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