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
11 #include <libmythui/mythuibutton.h>
15 #include <libmythui/mythuitext.h>
17 
18 // MythWeather headers
19 #include "weatherUtils.h"
20 
21 class SourceManager;
22 
24 {
25  QString name;
26  QString author;
27  QString email;
28  QString version;
29  std::chrono::minutes update_timeout {DEFAULT_UPDATE_TIMEOUT};
30  std::chrono::seconds retrieve_timeout {0s};
31  uint id {};
32 };
33 
35 
40 {
41  Q_OBJECT
42 
43  public:
44  GlobalSetup(MythScreenStack *parent, const QString &name)
45  : MythScreenType(parent, name) {}
46  ~GlobalSetup() override = default;
47 
48  bool Create(void) override; // MythScreenType
49 
50  protected slots:
51  void saveData(void);
52 
53  private:
54  void loadData(void);
55 
56  private:
59  int m_timeout {0};
61 };
62 
64 {
65  Q_OBJECT
66 
67  public:
68  ScreenSetup(MythScreenStack *parent, const QString &name, SourceManager *srcman);
69  ~ScreenSetup() override;
70 
71  bool Create(void) override; // MythScreenType
72  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
73  void customEvent(QEvent *event) override; // MythUIType
74 
75  protected slots:
76  void updateHelpText(void);
77  void saveData(void);
78  void doListSelect(MythUIButtonListItem *selected);
79 
80  private:
81  void loadData(void);
82 
83  void showUnitsPopup(const QString &name, ScreenListInfo *si);
85 
86  void deleteScreen(void);
87 
88  private:
90  bool m_createdSrcMan { false };
91  MythUIText *m_helpText { nullptr };
95 };
96 
98 {
99  Q_OBJECT
100 
101  public:
102  SourceSetup(MythScreenStack *parent, const QString &name)
103  : MythScreenType(parent, name) {};
104  ~SourceSetup() override;
105 
106  bool Create(void) override; // MythScreenType
107 
108  bool loadData(void);
109 
110  protected slots:
112 #if 0
114 #endif
115  void updateSpinboxUpdate(void);
116  void retrieveSpinboxUpdate(void);
117  void saveData(void);
118 
119  private:
124  MythUIText *m_sourceText { nullptr };
125 };
126 
128 {
129  QString idstr;
130  ScriptInfo *src { nullptr };
131 };
132 
134 
135 using CacheMap = QMultiHash<QString, QList<ScriptInfo*> >;
136 
138 {
139  Q_OBJECT
140 
141  public:
142  LocationDialog(MythScreenStack *parent, const QString &name,
143  MythScreenType *retScreen,
144  ScreenListInfo *si, SourceManager *srcman);
145  ~LocationDialog() override;
146 
147  bool Create(void) override; // MythScreenType
148 
149  protected slots:
150  void doSearch(void);
151  void itemSelected(MythUIButtonListItem *item);
152  void itemClicked(MythUIButtonListItem *item);
153 
154  private:
155  void clearResults();
156 
157  private:
159  QStringList m_types;
160  ScreenListInfo *m_screenListInfo { nullptr };
161  SourceManager *m_sourceManager { nullptr };
162 
163  MythScreenType *m_retScreen { nullptr };
164 
165  MythUIButtonList *m_locationList { nullptr };
166  MythUITextEdit *m_locationEdit { nullptr };
167  MythUIButton *m_searchButton { nullptr };
168  MythUIText *m_resultsText { nullptr };
169  MythUIText *m_sourceText { nullptr };
170 };
171 
172 #endif /* WEATHER_SETUP_H */
SourceSetup::m_sourceList
MythUIButtonList * m_sourceList
Definition: weatherSetup.h:122
CacheMap
QMultiHash< QString, QList< ScriptInfo * > > CacheMap
Definition: weatherSetup.h:135
SourceListInfo::update_timeout
std::chrono::minutes update_timeout
Definition: weatherSetup.h:29
ScreenSetup::m_activeList
MythUIButtonList * m_activeList
Definition: weatherSetup.h:92
ScreenSetup::m_finishButton
MythUIButton * m_finishButton
Definition: weatherSetup.h:94
mythuitext.h
GlobalSetup::loadData
void loadData(void)
Definition: weatherSetup.cpp:46
ScreenSetup::doListSelect
void doListSelect(MythUIButtonListItem *selected)
Definition: weatherSetup.cpp:445
SourceSetup::sourceListItemSelected
void sourceListItemSelected(MythUIButtonListItem *item)
Definition: weatherSetup.cpp:819
SourceSetup::m_finishButton
MythUIButton * m_finishButton
Definition: weatherSetup.h:123
GlobalSetup::saveData
void saveData(void)
Definition: weatherSetup.cpp:57
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(SourceListInfo *)
ScreenSetup::saveData
void saveData(void)
Definition: weatherSetup.cpp:350
ScreenSetup::updateHelpText
void updateHelpText(void)
Definition: weatherSetup.cpp:183
DEFAULT_UPDATE_TIMEOUT
static constexpr std::chrono::minutes DEFAULT_UPDATE_TIMEOUT
Definition: weatherUtils.h:20
ScreenSetup::~ScreenSetup
~ScreenSetup() override
Definition: weatherSetup.cpp:81
ResultListInfo
Definition: weatherSetup.h:127
ScreenSetup::Create
bool Create(void) override
Definition: weatherSetup.cpp:104
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
ScreenSetup::customEvent
void customEvent(QEvent *event) override
Definition: weatherSetup.cpp:575
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:531
SourceListInfo::author
QString author
Definition: weatherSetup.h:26
ScreenSetup::loadData
void loadData(void)
Definition: weatherSetup.cpp:247
ResultListInfo::idstr
QString idstr
Definition: weatherSetup.h:129
ResultListInfo::src
ScriptInfo * src
Definition: weatherSetup.h:130
mythuibuttonlist.h
ScreenSetup::m_sourceManager
SourceManager * m_sourceManager
Definition: weatherSetup.h:89
GlobalSetup::m_finishButton
MythUIButton * m_finishButton
Definition: weatherSetup.h:60
SourceListInfo::name
QString name
Definition: weatherSetup.h:25
SourceSetup::updateSpinboxUpdate
void updateSpinboxUpdate(void)
Definition: weatherSetup.cpp:801
GlobalSetup::m_backgroundCheckbox
MythUICheckBox * m_backgroundCheckbox
Definition: weatherSetup.h:57
ScreenSetup
Definition: weatherSetup.h:63
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
SourceSetup::m_retrieveSpinbox
MythUISpinBox * m_retrieveSpinbox
Definition: weatherSetup.h:121
GlobalSetup::m_timeout
int m_timeout
Definition: weatherSetup.h:59
GlobalSetup::~GlobalSetup
~GlobalSetup() override=default
LocationDialog
Definition: weatherSetup.h:137
SourceSetup::m_updateSpinbox
MythUISpinBox * m_updateSpinbox
Definition: weatherSetup.h:120
SourceSetup::Create
bool Create(void) override
Definition: weatherSetup.cpp:681
SourceListInfo::retrieve_timeout
std::chrono::seconds retrieve_timeout
Definition: weatherSetup.h:30
GlobalSetup::Create
bool Create(void) override
Definition: weatherSetup.cpp:18
GlobalSetup
Screen for mythweather global settings.
Definition: weatherSetup.h:39
ScreenSetup::doLocationDialog
void doLocationDialog(ScreenListInfo *si)
Definition: weatherSetup.cpp:517
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
LocationDialog::m_types
QStringList m_types
Definition: weatherSetup.h:159
SourceSetup::loadData
bool loadData(void)
Definition: weatherSetup.cpp:729
ScreenSetup::ScreenSetup
ScreenSetup(MythScreenStack *parent, const QString &name, SourceManager *srcman)
Definition: weatherSetup.cpp:71
SourceSetup::SourceSetup
SourceSetup(MythScreenStack *parent, const QString &name)
Definition: weatherSetup.h:102
ScreenSetup::m_helpText
MythUIText * m_helpText
Definition: weatherSetup.h:91
ScreenListInfo
Definition: weatherUtils.h:48
SourceListInfo::version
QString version
Definition: weatherSetup.h:28
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:97
SourceListInfo
Definition: weatherSetup.h:23
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:44
SourceSetup::retrieveSpinboxUpdate
void retrieveSpinboxUpdate(void)
Definition: weatherSetup.cpp:810
mythuitextedit.h
ScreenSetup::m_createdSrcMan
bool m_createdSrcMan
Definition: weatherSetup.h:90
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:124
SourceSetup::saveData
void saveData(void)
Definition: weatherSetup.cpp:767
mythuibutton.h
ScreenSetup::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: weatherSetup.cpp:153
ScreenSetup::m_inactiveList
MythUIButtonList * m_inactiveList
Definition: weatherSetup.h:93
ScreenSetup::deleteScreen
void deleteScreen(void)
Definition: weatherSetup.cpp:557
mythuicheckbox.h
ScriptInfo
Definition: serverSideScripting.h:36
GlobalSetup::m_timeoutSpinbox
MythUISpinBox * m_timeoutSpinbox
Definition: weatherSetup.h:58
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:671
mythmainwindow.h
LocationDialog::m_cache
CacheMap m_cache
Definition: weatherSetup.h:158
SourceListInfo::email
QString email
Definition: weatherSetup.h:27
mythscreentype.h
SourceManager
Definition: sourceManager.h:18
uint
unsigned int uint
Definition: freesurround.h:24
weatherUtils.h