MythTV  master
weatherScreen.h
Go to the documentation of this file.
1 #ifndef WEATHERSCREEN_H
2 #define WEATHERSCREEN_H
3 
4 // QT headers
5 #include <QStringList>
6 #include <QMap>
7 
8 // MythTV headers
9 #include <mythscreentype.h>
10 #include <mythuitext.h>
11 #include <mythuiimage.h>
12 
13 // MythWeather headers
14 #include "weatherUtils.h"
15 
16 class Weather;
17 
18 enum DaysOfWeek {
21 };
22 
27 {
28  Q_OBJECT
29 
30  public:
31  WeatherScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id);
32  ~WeatherScreen() override = default;
33 
34  bool Create(void) override; // MythScreenType
35  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
36 
38  ScreenListInfo *screenDefn, int id);
39 
40  void setValue(const QString &key, const QString &value);
41  QString getValue(const QString &key) { return m_dataValueMap[key]; }
42  bool containsKey(const QString &key) { return m_dataValueMap.contains(key); }
43  virtual bool canShowScreen();
44  void setUnits(units_t units) { m_units = units; }
45  units_t getUnits() const { return m_units; }
46  virtual bool usingKeys() { return false; }
47  bool inUse() const { return m_inuse; }
48  void setInUse(bool inuse) { m_inuse = inuse; }
49  int getId() const { return m_id; }
50 
51  signals:
53 
54  public slots:
55  virtual void newData(const QString& /*loc*/, units_t /*units*/, DataMap data);
56 
57  protected:
60  QString m_name;
61 
62  protected:
63  virtual QString prepareDataItem(const QString &key, const QString &value);
64  virtual void prepareWidget(MythUIType *widget);
65  virtual bool prepareScreen(bool checkOnly = false);
66  virtual QString getTemperatureUnit();
67  QString formatDataItem(const QString &key, const QString &value);
68 
69  private:
70  QMap<QString, QString> m_dataValueMap;
71 
72  bool m_inuse {false};
73  bool m_prepared {false};
74  int m_id;
75 };
76 
77 #endif // WEATHERSCREEN_H
WeatherScreen::m_inuse
bool m_inuse
Definition: weatherScreen.h:72
mythuitext.h
slots
std::array< unsigned int, 4 > slots
Definition: element.cpp:38
WeatherScreen::inUse
bool inUse() const
Definition: weatherScreen.h:47
DAY_TUESDAY
@ DAY_TUESDAY
Definition: weatherScreen.h:19
WeatherScreen::loadScreen
static WeatherScreen * loadScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id)
Definition: weatherScreen.cpp:12
WeatherScreen::setValue
void setValue(const QString &key, const QString &value)
Definition: weatherScreen.cpp:67
MythScreenStack
Definition: mythscreenstack.h:16
DAY_WENDESDAY
@ DAY_WENDESDAY
Definition: weatherScreen.h:19
WeatherScreen::~WeatherScreen
~WeatherScreen() override=default
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
WeatherScreen::setUnits
void setUnits(units_t units)
Definition: weatherScreen.h:44
mythuiimage.h
DAY_SUNDAY
@ DAY_SUNDAY
Definition: weatherScreen.h:19
WeatherScreen::newData
virtual void newData(const QString &, units_t, DataMap data)
Definition: weatherScreen.cpp:73
DAY_FRIDAY
@ DAY_FRIDAY
Definition: weatherScreen.h:20
DAY_THURSDAY
@ DAY_THURSDAY
Definition: weatherScreen.h:19
DataMap
QMap< QString, QString > DataMap
Definition: weatherUtils.h:25
SI_UNITS
#define SI_UNITS
Definition: weatherUtils.h:17
WeatherScreen::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: weatherScreen.cpp:237
WeatherScreen::m_units
units_t m_units
Definition: weatherScreen.h:58
WeatherScreen::WeatherScreen
WeatherScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id)
Definition: weatherScreen.cpp:18
ScreenListInfo
Definition: weatherUtils.h:48
Weather
Definition: weather.h:21
WeatherScreen
Weather screen.
Definition: weatherScreen.h:27
WeatherScreen::prepareScreen
virtual bool prepareScreen(bool checkOnly=false)
Definition: weatherScreen.cpp:97
DaysOfWeek
DaysOfWeek
Definition: weatherScreen.h:18
WeatherScreen::m_id
int m_id
Definition: weatherScreen.h:74
units_t
unsigned char units_t
Definition: weatherUtils.h:24
WeatherScreen::canShowScreen
virtual bool canShowScreen()
Definition: weatherScreen.cpp:47
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:66
WeatherScreen::getUnits
units_t getUnits() const
Definition: weatherScreen.h:45
WeatherScreen::containsKey
bool containsKey(const QString &key)
Definition: weatherScreen.h:42
WeatherScreen::setInUse
void setInUse(bool inuse)
Definition: weatherScreen.h:48
WeatherScreen::getValue
QString getValue(const QString &key)
Definition: weatherScreen.h:41
WeatherScreen::prepareDataItem
virtual QString prepareDataItem(const QString &key, const QString &value)
Definition: weatherScreen.cpp:232
WeatherScreen::m_prepared
bool m_prepared
Definition: weatherScreen.h:73
WeatherScreen::getTemperatureUnit
virtual QString getTemperatureUnit()
Definition: weatherScreen.cpp:90
WeatherScreen::m_name
QString m_name
Definition: weatherScreen.h:60
WeatherScreen::m_screenDefn
ScreenListInfo * m_screenDefn
Definition: weatherScreen.h:59
WeatherScreen::screenReady
void screenReady(WeatherScreen *)
WeatherScreen::getId
int getId() const
Definition: weatherScreen.h:49
WeatherScreen::Create
bool Create(void) override
Definition: weatherScreen.cpp:34
WeatherScreen::formatDataItem
QString formatDataItem(const QString &key, const QString &value)
Definition: weatherScreen.cpp:162
WeatherScreen::m_dataValueMap
QMap< QString, QString > m_dataValueMap
Definition: weatherScreen.h:70
DAY_SATURDAY
@ DAY_SATURDAY
Definition: weatherScreen.h:20
mythscreentype.h
DAY_MONDAY
@ DAY_MONDAY
Definition: weatherScreen.h:19
WeatherScreen::usingKeys
virtual bool usingKeys()
Definition: weatherScreen.h:46
weatherUtils.h
WeatherScreen::prepareWidget
virtual void prepareWidget(MythUIType *widget)
Definition: weatherScreen.cpp:149