MythTV  master
frontendStatus.h
Go to the documentation of this file.
1 #ifndef FRONTENDSTATUS_H
2 #define FRONTENDSTATUS_H
3 
4 #include "serviceexp.h"
5 #include "datacontracthelper.h"
6 
7 namespace DTC
8 {
9  class SERVICE_PUBLIC FrontendStatus : public QObject
10  {
11  Q_OBJECT
12  Q_CLASSINFO("version", "1.1");
13 
14  Q_CLASSINFO( "State", "type=QString");
15  Q_CLASSINFO( "ChapterTimes", "type=QString;name=Chapter");
16  Q_CLASSINFO( "SubtitleTracks", "type=QString;name=Track");
17  Q_CLASSINFO( "AudioTracks", "type=QString;name=Track");
18 
19  Q_PROPERTY(QString Name READ Name WRITE setName)
20  Q_PROPERTY(QString Version READ Version WRITE setVersion)
21  Q_PROPERTY(QVariantMap State READ State DESIGNABLE true)
22  Q_PROPERTY(QVariantList ChapterTimes READ ChapterTimes DESIGNABLE true)
23  Q_PROPERTY(QVariantMap SubtitleTracks READ SubtitleTracks DESIGNABLE true)
24  Q_PROPERTY(QVariantMap AudioTracks READ AudioTracks DESIGNABLE true)
25 
26  PROPERTYIMP(QString, Name)
27  PROPERTYIMP(QString, Version)
28  PROPERTYIMP_RO_REF(QVariantMap, State)
29  PROPERTYIMP_RO_REF(QVariantList, ChapterTimes)
30  PROPERTYIMP_RO_REF(QVariantMap, SubtitleTracks)
31  PROPERTYIMP_RO_REF(QVariantMap, AudioTracks)
32 
33  public:
34 
35  static inline void InitializeCustomTypes();
36 
37  Q_INVOKABLE explicit FrontendStatus(QObject *parent = nullptr) : QObject(parent)
38  {
39  }
40 
41  void Copy( const FrontendStatus *src)
42  {
43  m_Name = src->m_Name;
44  m_Version = src->m_Version;
45  m_State = src->m_State;
46  m_ChapterTimes = src->m_ChapterTimes;
47  m_SubtitleTracks = src->m_SubtitleTracks;
48  m_AudioTracks = src->m_AudioTracks;
49  }
50 
51  void Process(void)
52  {
53  if (m_State.contains("chaptertimes"))
54  {
55  if (m_State["chaptertimes"].type() == QVariant::List)
56  m_ChapterTimes = m_State["chaptertimes"].toList();
57  m_State.remove("chaptertimes");
58  }
59 
60  if (m_State.contains("subtitletracks"))
61  {
62  if (m_State["subtitletracks"].type() == QVariant::Map)
63  m_SubtitleTracks = m_State["subtitletracks"].toMap();
64  m_State.remove("subtitletracks");
65  }
66 
67  if (m_State.contains("audiotracks"))
68  {
69  if (m_State["audiotracks"].type() == QVariant::Map)
70  m_AudioTracks = m_State["audiotracks"].toMap();
71  m_State.remove("audiotracks");
72  }
73  }
74 
75  private:
76  Q_DISABLE_COPY(FrontendStatus);
77  };
79 {
80  qRegisterMetaType<FrontendStatus*>();
81 }
82 
83 };
84 
85 #endif // FRONTENDSTATUS_H
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
#define PROPERTYIMP(type, name)
State
Definition: zmserver.h:62
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
static void InitializeCustomTypes()
#define PROPERTYIMP_RO_REF(type, name)
void Copy(const FrontendStatus *src)