MythTV  master
weatherSetup.h
Go to the documentation of this file.
1 #ifndef WEATHER_SETUP_H
2 #define WEATHER_SETUP_H
3 
4 // QT headers
5 #include <QList>
6 
7 // MythTV headers
8 #include <libmyth/mythcontext.h>
12 #include <libmythui/mythuibutton.h>
16 #include <libmythui/mythuitext.h>
18 
19 // MythWeather headers
20 #include "weatherUtils.h"
21 
22 class SourceManager;
23 
25 {
26  QString name;
27  QString author;
28  QString email;
29  QString version;
30  std::chrono::minutes update_timeout {DEFAULT_UPDATE_TIMEOUT};
31  std::chrono::seconds retrieve_timeout {0s};
32  uint id {};
33 };
34 
36 
41 {
42  Q_OBJECT
43 
44  public:
45  GlobalSetup(MythScreenStack *parent, const QString &name)
46  : MythScreenType(parent, name) {}
47  ~GlobalSetup() override = default;
48 
49  bool Create(void) override; // MythScreenType
50 
51  protected slots:
52  void saveData(void);
53 
54  private:
55  void loadData(void);
56 
57  private:
60  int m_timeout {0};
62 };
63 
65 {
66  Q_OBJECT
67 
68  public:
69  ScreenSetup(MythScreenStack *parent, const QString &name, SourceManager *srcman);
70  ~ScreenSetup() override;
71 
72  bool Create(void) override; // MythScreenType
73  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
74  void customEvent(QEvent *event) override; // MythUIType
75 
76  protected slots:
77  void updateHelpText(void);
78  void saveData(void);
79  void doListSelect(MythUIButtonListItem *selected);
80 
81  private:
82  void loadData(void);
83 
84  void showUnitsPopup(const QString &name, ScreenListInfo *si);
86 
87  void deleteScreen(void);
88 
89  private:
91  bool m_createdSrcMan { false };
92  MythUIText *m_helpText { nullptr };
96 };
97 
99 {
100  Q_OBJECT
101 
102  public:
103  SourceSetup(MythScreenStack *parent, const QString &name)
104  : MythScreenType(parent, name) {};
105  ~SourceSetup() override;
106 
107  bool Create(void) override; // MythScreenType
108 
109  bool loadData(void);
110 
111  protected slots:
113 #if 0
115 #endif
116  void updateSpinboxUpdate(void);
117  void retrieveSpinboxUpdate(void);
118  void saveData(void);
119 
120  private:
125  MythUIText *m_sourceText { nullptr };
126 };
127 
129 {
130  QString idstr;
131  ScriptInfo *src { nullptr };
132 };
133 
135 
136 using CacheMap = QMultiHash<QString, QList<ScriptInfo*> >;
137 
139 {
140  Q_OBJECT
141 
142  public:
143  LocationDialog(MythScreenStack *parent, const QString &name,
144  MythScreenType *retScreen,
145  ScreenListInfo *si, SourceManager *srcman);
146  ~LocationDialog() override;
147 
148  bool Create(void) override; // MythScreenType
149 
150  protected slots:
151  void doSearch(void);
152  void itemSelected(MythUIButtonListItem *item);
153  void itemClicked(MythUIButtonListItem *item);
154 
155  private:
156  void clearResults();
157 
158  private:
160  QStringList m_types;
161  ScreenListInfo *m_screenListInfo { nullptr };
162  SourceManager *m_sourceManager { nullptr };
163 
164  MythScreenType *m_retScreen { nullptr };
165 
166  MythUIButtonList *m_locationList { nullptr };
167  MythUITextEdit *m_locationEdit { nullptr };
168  MythUIButton *m_searchButton { nullptr };
169  MythUIText *m_resultsText { nullptr };
170  MythUIText *m_sourceText { nullptr };
171 };
172 
173 #endif /* WEATHER_SETUP_H */
SourceSetup::m_sourceList
MythUIButtonList * m_sourceList
Definition: weatherSetup.h:123
CacheMap
QMultiHash< QString, QList< ScriptInfo * > > CacheMap
Definition: weatherSetup.h:136
SourceListInfo::update_timeout
std::chrono::minutes update_timeout
Definition: weatherSetup.h:30
ScreenSetup::m_activeList
MythUIButtonList * m_activeList
Definition: weatherSetup.h:93
ScreenSetup::m_finishButton
MythUIButton * m_finishButton
Definition: weatherSetup.h:95
mythuitext.h
GlobalSetup::loadData
void loadData(void)
Definition: weatherSetup.cpp:44
ScreenSetup::doListSelect
void doListSelect(MythUIButtonListItem *selected)
Definition: weatherSetup.cpp:441
SourceSetup::sourceListItemSelected
void sourceListItemSelected(MythUIButtonListItem *item)
Definition: weatherSetup.cpp:813
SourceSetup::m_finishButton
MythUIButton * m_finishButton
Definition: weatherSetup.h:124
GlobalSetup::saveData
void saveData(void)
Definition: weatherSetup.cpp:55
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(SourceListInfo *)
ScreenSetup::saveData
void saveData(void)
Definition: weatherSetup.cpp:346
ScreenSetup::updateHelpText
void updateHelpText(void)
Definition: weatherSetup.cpp:179
DEFAULT_UPDATE_TIMEOUT
static constexpr std::chrono::minutes DEFAULT_UPDATE_TIMEOUT
Definition: weatherUtils.h:20
ScreenSetup::~ScreenSetup
~ScreenSetup() override
Definition: weatherSetup.cpp:79
ResultListInfo
Definition: weatherSetup.h:128
ScreenSetup::Create
bool Create(void) override
Definition: weatherSetup.cpp:102
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
ScreenSetup::customEvent
void customEvent(QEvent *event) override
Definition: weatherSetup.cpp:569
MythUITextEdit
A text entry and edit widget.
Definition: mythuitextedit.h:34
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
ScreenSetup::showUnitsPopup
void showUnitsPopup(const QString &name, ScreenListInfo *si)
Definition: weatherSetup.cpp:525
SourceListInfo::author
QString author
Definition: weatherSetup.h:27
ScreenSetup::loadData
void loadData(void)
Definition: weatherSetup.cpp:243
ResultListInfo::idstr
QString idstr
Definition: weatherSetup.h:130
ResultListInfo::src
ScriptInfo * src
Definition: weatherSetup.h:131
mythuibuttonlist.h
ScreenSetup::m_sourceManager
SourceManager * m_sourceManager
Definition: weatherSetup.h:90
GlobalSetup::m_finishButton
MythUIButton * m_finishButton
Definition: weatherSetup.h:61
SourceListInfo::name
QString name
Definition: weatherSetup.h:26
SourceSetup::updateSpinboxUpdate
void updateSpinboxUpdate(void)
Definition: weatherSetup.cpp:795
GlobalSetup::m_backgroundCheckbox
MythUICheckBox * m_backgroundCheckbox
Definition: weatherSetup.h:58
ScreenSetup
Definition: weatherSetup.h:64
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
SourceSetup::m_retrieveSpinbox
MythUISpinBox * m_retrieveSpinbox
Definition: weatherSetup.h:122
GlobalSetup::m_timeout
int m_timeout
Definition: weatherSetup.h:60
GlobalSetup::~GlobalSetup
~GlobalSetup() override=default
LocationDialog
Definition: weatherSetup.h:138
SourceSetup::m_updateSpinbox
MythUISpinBox * m_updateSpinbox
Definition: weatherSetup.h:121
SourceSetup::Create
bool Create(void) override
Definition: weatherSetup.cpp:675
SourceListInfo::retrieve_timeout
std::chrono::seconds retrieve_timeout
Definition: weatherSetup.h:31
GlobalSetup::Create
bool Create(void) override
Definition: weatherSetup.cpp:16
GlobalSetup
Screen for mythweather global settings.
Definition: weatherSetup.h:40
ScreenSetup::doLocationDialog
void doLocationDialog(ScreenListInfo *si)
Definition: weatherSetup.cpp:511
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
LocationDialog::m_types
QStringList m_types
Definition: weatherSetup.h:160
SourceSetup::loadData
bool loadData(void)
Definition: weatherSetup.cpp:723
ScreenSetup::ScreenSetup
ScreenSetup(MythScreenStack *parent, const QString &name, SourceManager *srcman)
Definition: weatherSetup.cpp:69
SourceSetup::SourceSetup
SourceSetup(MythScreenStack *parent, const QString &name)
Definition: weatherSetup.h:103
ScreenSetup::m_helpText
MythUIText * m_helpText
Definition: weatherSetup.h:92
ScreenListInfo
Definition: weatherUtils.h:48
uint
unsigned int uint
Definition: compat.h:81
SourceListInfo::version
QString version
Definition: weatherSetup.h:29
MythUICheckBox
A checkbox widget supporting three check states - on,off,half and two conditions - selected and unsel...
Definition: mythuicheckbox.h:15
SourceSetup
Definition: weatherSetup.h:98
SourceListInfo
Definition: weatherSetup.h:24
mythuispinbox.h
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
GlobalSetup::GlobalSetup
GlobalSetup(MythScreenStack *parent, const QString &name)
Definition: weatherSetup.h:45
SourceSetup::retrieveSpinboxUpdate
void retrieveSpinboxUpdate(void)
Definition: weatherSetup.cpp:804
mythuitextedit.h
ScreenSetup::m_createdSrcMan
bool m_createdSrcMan
Definition: weatherSetup.h:91
mythcontext.h
MythUISpinBox
A widget for offering a range of numerical values where only the the bounding values and interval are...
Definition: mythuispinbox.h:16
SourceSetup::m_sourceText
MythUIText * m_sourceText
Definition: weatherSetup.h:125
SourceSetup::saveData
void saveData(void)
Definition: weatherSetup.cpp:761
mythuibutton.h
ScreenSetup::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: weatherSetup.cpp:151
ScreenSetup::m_inactiveList
MythUIButtonList * m_inactiveList
Definition: weatherSetup.h:94
ScreenSetup::deleteScreen
void deleteScreen(void)
Definition: weatherSetup.cpp:551
mythuicheckbox.h
ScriptInfo
Definition: serverSideScripting.h:36
GlobalSetup::m_timeoutSpinbox
MythUISpinBox * m_timeoutSpinbox
Definition: weatherSetup.h:59
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
SourceSetup::~SourceSetup
~SourceSetup() override
Definition: weatherSetup.cpp:665
mythmainwindow.h
LocationDialog::m_cache
CacheMap m_cache
Definition: weatherSetup.h:159
SourceListInfo::email
QString email
Definition: weatherSetup.h:28
mythscreentype.h
SourceManager
Definition: sourceManager.h:18
weatherUtils.h