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