00001 /* 00002 MythWeather 00003 Version 0.8 00004 January 8th, 2003 00005 00006 By John Danner & Dustin Doris 00007 00008 Note: Portions of this code taken from MythMusic 00009 00010 */ 00011 00012 #ifndef WEATHER_H_ 00013 #define WEATHER_H_ 00014 00015 #include <mythtv/mythdialogs.h> 00016 00017 #include "defs.h" 00018 00019 class SourceManager; 00020 class WeatherScreen; 00021 00022 struct weatherTypes 00023 { 00024 int typeNum; 00025 QString typeName; 00026 QString typeIcon; 00027 }; 00028 00029 class Weather : public MythDialog 00030 { 00031 Q_OBJECT 00032 00033 public: 00034 Weather(MythMainWindow *parent, SourceManager *srcMan, 00035 const char *name = 0); 00036 ~Weather(); 00037 00038 bool UpdateData(); 00039 void processEvents(); 00040 QPixmap *getBackground() { return &realBackground; } 00041 00042 signals: 00043 void clock_tick(); 00044 00045 private slots: 00046 void update_timeout() {} 00047 void showtime_timeout(); 00048 void nextpage_timeout(); 00049 void weatherTimeout() {} 00050 void cursorLeft(); 00051 void cursorRight(); 00052 void holdPage(); 00053 void setupPage(); 00054 void screenReady(WeatherScreen *ws); 00055 00056 protected: 00057 void paintEvent(QPaintEvent *e); 00058 void keyPressEvent(QKeyEvent *e); 00059 00060 private: 00061 void setupScreens(QDomElement &xml); 00062 WeatherScreen *nextScreen(); 00063 WeatherScreen *prevScreen(); 00064 void updateBackground(); 00065 void updatePage(QPainter *e); 00066 void showLayout(WeatherScreen *ws); 00067 00068 private: 00069 int timeoutCounter; 00070 int wantAnimated; 00071 bool stopProcessing; 00072 // QString parseData(QString data, QString beg, QString end); 00073 // void LoadWindow(QDomElement &); 00074 XMLParse *theme; 00075 QDomElement xmldata; 00076 00077 units_t m_units; 00078 bool firstRun; 00079 int updateInterval; 00080 int nextpageInterval; 00081 int nextpageIntArrow; 00082 QTimer *showtime_Timer; 00083 QTimer *nextpage_Timer; 00084 00085 // QString findAccidbyName(QString); 00086 // QString findNamebyAccid(QString); 00087 // void loadCityData(int); 00088 // void fillList(); 00089 // void loadAccidBreaks(); 00090 // bool GetWeatherData(); 00091 // bool GetAnimatedRadarMap(); 00092 // bool GetStaticRadarMap(); 00093 bool gotDataHook; 00094 // void setWeatherTypeIcon(QString[]); 00095 // void setWeatherIcon(QString); 00096 //void backupCity(int); 00097 // void setSetting(QString, QString, bool); 00098 00099 // QString GetString(QString); 00100 // int GetInt(QString); 00101 // float GetFloat(QString); 00102 00103 // void loadWeatherTypes(); 00104 00105 QRect newlocRect; 00106 QRect fullRect; 00107 00108 QPixmap realBackground; 00109 bool allowkeys; 00110 SourceManager *m_srcMan; 00111 QPtrList<WeatherScreen> screens; //screens in correct display order 00112 /* 00113 * May not be necessary, but we will keep instances around, they may be 00114 * helpful when doing configuration. though if I split out config to 00115 * different classes then these may not be necessary 00116 * 00117 * Maybe I'll do something like I did with sources, having instance 00118 * indpendent info that I load when parsing xml, then creating objects as 00119 * necessary. 00120 * UPDATE: Things are currently between two places, either having only one 00121 * possible instance of a screen, or else having multiple instances, which 00122 * would require somehow creating multiple LaySet objects, probably possibly 00123 * by keeping a map of QDomElement's instead of Screens, and parsing them 00124 * for each screen required. 00125 */ 00126 QMap<QString, WeatherScreen *> all_screens; //screens parsed from xml 00127 WeatherScreen *currScreen; 00128 WeatherScreen *m_startup; 00129 bool paused; 00130 }; 00131 00132 #endif
1.5.5