00001 #ifndef _WEATHER_SETUP_H_
00002 #define _WEATHER_SETUP_H_
00003
00004
00005 #include <QList>
00006
00007
00008 #include <mythcontext.h>
00009 #include <mythscreentype.h>
00010 #include <mythuibuttonlist.h>
00011 #include <mythuibutton.h>
00012 #include <mythuitext.h>
00013 #include <mythuitextedit.h>
00014 #include <mythuispinbox.h>
00015 #include <mythuicheckbox.h>
00016 #include <mythmainwindow.h>
00017 #include <mythdialogbox.h>
00018
00019
00020 #include "weatherUtils.h"
00021
00022 class SourceManager;
00023
00024 struct SourceListInfo
00025 {
00026 QString name;
00027 QString author;
00028 QString email;
00029 QString version;
00030 uint update_timeout;
00031 uint retrieve_timeout;
00032 uint id;
00033 };
00034
00035 Q_DECLARE_METATYPE(SourceListInfo *)
00036
00037
00040 class GlobalSetup : public MythScreenType
00041 {
00042 Q_OBJECT
00043
00044 public:
00045 GlobalSetup(MythScreenStack *parent, const QString &name);
00046 ~GlobalSetup();
00047
00048 bool Create(void);
00049
00050 protected slots:
00051 void saveData(void);
00052
00053 private:
00054 void loadData(void);
00055
00056 private:
00057 MythUICheckBox *m_backgroundCheckbox;
00058 MythUISpinBox *m_timeoutSpinbox;
00059 int m_timeout;
00060 int m_hold_timeout;
00061 MythUIButton *m_finishButton;
00062 };
00063
00064 class ScreenSetup : public MythScreenType
00065 {
00066 Q_OBJECT
00067
00068 public:
00069 ScreenSetup(MythScreenStack *parent, const QString &name, SourceManager *srcman);
00070 ~ScreenSetup();
00071
00072 bool Create(void);
00073 bool keyPressEvent(QKeyEvent *);
00074 void customEvent(QEvent*);
00075
00076 protected slots:
00077 void updateHelpText(void);
00078 void saveData(void);
00079 void doListSelect(MythUIButtonListItem *selected);
00080
00081 private:
00082 void loadData(void);
00083
00084 void showUnitsPopup(const QString &name, ScreenListInfo *si);
00085 void doLocationDialog(ScreenListInfo *si);
00086
00087 void deleteScreen(void);
00088
00089 private:
00090 SourceManager *m_sourceManager;
00091 bool m_createdSrcMan;
00092 MythUIText *m_helpText;
00093 MythUIButtonList *m_activeList;
00094 MythUIButtonList *m_inactiveList;
00095 MythUIButton *m_finishButton;
00096 };
00097
00098 class SourceSetup : public MythScreenType
00099 {
00100 Q_OBJECT
00101
00102 public:
00103 SourceSetup(MythScreenStack *parent, const QString &name);
00104 ~SourceSetup();
00105
00106 bool Create(void);
00107
00108 bool loadData(void);
00109
00110 protected slots:
00111 void sourceListItemSelected(MythUIButtonListItem *itm = 0);
00112 void updateSpinboxUpdate(void);
00113 void retrieveSpinboxUpdate(void);
00114 void saveData(void);
00115
00116 private:
00117 MythUISpinBox *m_updateSpinbox;
00118 MythUISpinBox *m_retrieveSpinbox;
00119 MythUIButtonList *m_sourceList;
00120 MythUIButton *m_finishButton;
00121 MythUIText *m_sourceText;
00122 };
00123
00124 struct ResultListInfo
00125 {
00126 QString idstr;
00127 ScriptInfo *src;
00128 };
00129
00130 Q_DECLARE_METATYPE(ResultListInfo *)
00131
00132 typedef QMultiHash<QString, QList<ScriptInfo*> > CacheMap;
00133
00134 class LocationDialog : public MythScreenType
00135 {
00136 Q_OBJECT
00137
00138 public:
00139 LocationDialog(MythScreenStack *parent, const QString &name,
00140 MythScreenType *retScreen,
00141 ScreenListInfo *si, SourceManager *srcman);
00142 ~LocationDialog();
00143
00144 bool Create(void);
00145
00146 protected slots:
00147 void doSearch(void);
00148 void itemSelected(MythUIButtonListItem *item);
00149 void itemClicked(MythUIButtonListItem *item);
00150
00151 private:
00152 void clearResults();
00153
00154 private:
00155 CacheMap m_cache;
00156 QStringList m_types;
00157 ScreenListInfo *m_screenListInfo;
00158 SourceManager *m_sourceManager;
00159
00160 MythScreenType *m_retScreen;
00161
00162 MythUIButtonList *m_locationList;
00163 MythUITextEdit *m_locationEdit;
00164 MythUIButton *m_searchButton;
00165 MythUIText *m_resultsText;
00166 MythUIText *m_sourceText;
00167 };
00168
00169 #endif