MythTV  master
weatherUtils.h
Go to the documentation of this file.
1 #ifndef _WEATHERUTILS_H_
2 #define _WEATHERUTILS_H_
3 
4 // QT headers
5 #include <QMap>
6 #include <QMultiHash>
7 #include <QString>
8 #include <QDomElement>
9 #include <QFile>
10 #include <QMetaType>
11 
12 // MythTV headers
13 #include <mythcontext.h>
14 
15 #define SI_UNITS 0
16 #define ENG_UNITS 1
17 #define DEFAULT_UPDATE_TIMEOUT (5*60*1000)
18 #define DEFAULT_SCRIPT_TIMEOUT (60)
19 
20 class ScriptInfo;
21 
22 typedef unsigned char units_t;
23 typedef QMap<QString, QString> DataMap;
24 
26 {
27  public:
28 
30  : m_name(info.m_name), m_location(info.m_location), m_src(info.m_src) {}
31  explicit TypeListInfo(const QString &_name)
32  : m_name(_name) {}
33  TypeListInfo(const QString &_name, const QString &_location)
34  : m_name(_name), m_location(_location) {}
35  TypeListInfo(const QString &_name, const QString &_location,
36  ScriptInfo *_src)
37  : m_name(_name), m_location(_location), m_src(_src) {}
38 
39  public:
40  QString m_name;
41  QString m_location;
42  ScriptInfo *m_src {nullptr};
43 };
44 typedef QMultiHash<QString, TypeListInfo> TypeListMap;
45 
47 {
48  public:
49  ScreenListInfo() = default;
51  m_name(info.m_name),
52  m_title(info.m_title),
53  m_types(info.m_types),
55  m_helptxt(info.m_helptxt),
56  m_sources(info.m_sources),
57  m_units(info.m_units),
58  m_hasUnits(info.m_hasUnits),
59  m_multiLoc(info.m_multiLoc),
60  m_updating(info.m_updating) {}
61 
62  TypeListInfo GetCurrentTypeList(void) const;
63 
64  public:
65  QString m_name;
66  QString m_title;
68  QStringList m_dataTypes;
69  QString m_helptxt;
70  QStringList m_sources;
72  bool m_hasUnits {false};
73  bool m_multiLoc {false};
74  bool m_updating {false};
75 };
76 
78 
79 typedef QMap<QString, ScreenListInfo> ScreenListMap;
80 
82 QStringList loadScreen(const QDomElement& ScreenListInfo);
83 bool doLoadScreens(const QString &filename, ScreenListMap &screens);
84 
85 #endif
QMultiHash< QString, TypeListInfo > TypeListMap
Definition: weatherUtils.h:44
QStringList m_sources
Definition: weatherUtils.h:70
TypeListMap m_types
Definition: weatherUtils.h:67
QString m_name
Definition: weatherUtils.h:40
Q_DECLARE_METATYPE(ScreenListInfo *)
ScreenListInfo(const ScreenListInfo &info)
Definition: weatherUtils.h:50
ScreenListMap loadScreens()
QMap< QString, ScreenListInfo > ScreenListMap
Definition: weatherUtils.h:79
TypeListInfo GetCurrentTypeList(void) const
QString m_name
Definition: weatherUtils.h:65
TypeListInfo(const QString &_name, const QString &_location)
Definition: weatherUtils.h:33
QString m_helptxt
Definition: weatherUtils.h:69
ScreenListInfo()=default
units_t m_units
Definition: weatherUtils.h:71
TypeListInfo(const QString &_name)
Definition: weatherUtils.h:31
QStringList m_dataTypes
Definition: weatherUtils.h:68
unsigned char units_t
Definition: weatherUtils.h:20
bool doLoadScreens(const QString &filename, ScreenListMap &screens)
TypeListInfo(const QString &_name, const QString &_location, ScriptInfo *_src)
Definition: weatherUtils.h:35
TypeListInfo(const TypeListInfo &info)
Definition: weatherUtils.h:29
QMap< QString, QString > DataMap
Definition: weatherUtils.h:23
QStringList loadScreen(const QDomElement &ScreenListInfo)
QString m_location
Definition: weatherUtils.h:41
QString m_title
Definition: weatherUtils.h:66
#define SI_UNITS
Definition: weatherUtils.h:15
ScriptInfo * m_src
Definition: weatherUtils.h:42