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 <QMap>
6#include <QStringList>
7
8// MythTV headers
12
13// MythWeather headers
14#include "weatherUtils.h"
15
16class Weather;
17
18enum DaysOfWeek : std::uint8_t {
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
Screen in which all other widgets are contained and rendered.
The base class on which all widgets and screens are based.
Definition: mythuitype.h:86
Weather screen.
Definition: weatherScreen.h:27
void setInUse(bool inuse)
Definition: weatherScreen.h:48
virtual void prepareWidget(MythUIType *widget)
QString getValue(const QString &key)
Definition: weatherScreen.h:41
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool inUse() const
Definition: weatherScreen.h:47
int getId() const
Definition: weatherScreen.h:49
~WeatherScreen() override=default
ScreenListInfo * m_screenDefn
Definition: weatherScreen.h:59
QMap< QString, QString > m_dataValueMap
Definition: weatherScreen.h:70
units_t getUnits() const
Definition: weatherScreen.h:45
units_t m_units
Definition: weatherScreen.h:58
void setValue(const QString &key, const QString &value)
virtual bool usingKeys()
Definition: weatherScreen.h:46
WeatherScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id)
virtual QString getTemperatureUnit()
virtual bool canShowScreen()
static WeatherScreen * loadScreen(MythScreenStack *parent, ScreenListInfo *screenDefn, int id)
QString formatDataItem(const QString &key, const QString &value)
void setUnits(units_t units)
Definition: weatherScreen.h:44
virtual bool prepareScreen(bool checkOnly=false)
virtual QString prepareDataItem(const QString &key, const QString &value)
QString m_name
Definition: weatherScreen.h:60
void screenReady(WeatherScreen *)
bool Create(void) override
bool containsKey(const QString &key)
Definition: weatherScreen.h:42
virtual void newData(const QString &, units_t, DataMap data)
DaysOfWeek
Definition: weatherScreen.h:18
@ DAY_FRIDAY
Definition: weatherScreen.h:20
@ DAY_WENDESDAY
Definition: weatherScreen.h:19
@ DAY_SATURDAY
Definition: weatherScreen.h:20
@ DAY_THURSDAY
Definition: weatherScreen.h:19
@ DAY_MONDAY
Definition: weatherScreen.h:19
@ DAY_SUNDAY
Definition: weatherScreen.h:19
@ DAY_TUESDAY
Definition: weatherScreen.h:19
static constexpr uint8_t SI_UNITS
Definition: weatherUtils.h:18
QMap< QString, QString > DataMap
Definition: weatherUtils.h:26
unsigned char units_t
Definition: weatherUtils.h:25