MythTV  master
frontendStatus.h
Go to the documentation of this file.
1 #ifndef FRONTENDSTATUS_H
2 #define FRONTENDSTATUS_H
3 
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)
22  Q_PROPERTY(QVariantList ChapterTimes READ ChapterTimes)
23  Q_PROPERTY(QVariantMap SubtitleTracks READ SubtitleTracks)
24  Q_PROPERTY(QVariantMap AudioTracks READ AudioTracks)
25 
26  PROPERTYIMP_REF(QString, Name)
27  PROPERTYIMP_REF(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 QT_VERSION < QT_VERSION_CHECK(6,0,0)
56  auto type = static_cast<QMetaType::Type>(m_State["chaptertimes"].type());
57 #else
58  auto type = m_State["chaptertimes"].typeId();
59 #endif
60  if (type == QMetaType::QVariantList)
61  m_ChapterTimes = m_State["chaptertimes"].toList();
62  m_State.remove("chaptertimes");
63  }
64 
65  if (m_State.contains("subtitletracks"))
66  {
67 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
68  auto type = static_cast<QMetaType::Type>(m_State["subtitletracks"].type());
69 #else
70  auto type = m_State["subtitletracks"].typeId();
71 #endif
72  if (type == QMetaType::QVariantMap)
73  m_SubtitleTracks = m_State["subtitletracks"].toMap();
74  m_State.remove("subtitletracks");
75  }
76 
77  if (m_State.contains("audiotracks"))
78  {
79 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
80  auto type = static_cast<QMetaType::Type>(m_State["audiotracks"].type());
81 #else
82  auto type = m_State["audiotracks"].typeId();
83 #endif
84  if (type == QMetaType::QVariantMap)
85  m_AudioTracks = m_State["audiotracks"].toMap();
86  m_State.remove("audiotracks");
87  }
88  }
89 
90  private:
91  Q_DISABLE_COPY(FrontendStatus);
92  };
94 {
95  qRegisterMetaType<FrontendStatus*>();
96 }
97 
98 };
99 
100 #endif // FRONTENDSTATUS_H
DTC::FrontendStatus::Process
void Process(void)
Definition: frontendStatus.h:51
DTC::FrontendStatus::Copy
void Copy(const FrontendStatus *src)
Definition: frontendStatus.h:41
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
datacontracthelper.h
serviceexp.h
State
State
Definition: zmserver.h:68
DTC::FrontendStatus
Definition: frontendStatus.h:9
Name
Definition: channelsettings.cpp:47
DTC
Definition: datacontracthelper.h:123
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70
DTC::FrontendStatus::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: frontendStatus.h:93