MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
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.0");
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(QVariantMap State READ State DESIGNABLE true)
20  Q_PROPERTY(QVariantList ChapterTimes READ ChapterTimes DESIGNABLE true)
21  Q_PROPERTY(QVariantMap SubtitleTracks READ SubtitleTracks DESIGNABLE true)
22  Q_PROPERTY(QVariantMap AudioTracks READ AudioTracks DESIGNABLE true)
23 
24  PROPERTYIMP_RO_REF(QVariantMap, State)
25  PROPERTYIMP_RO_REF(QVariantList, ChapterTimes)
26  PROPERTYIMP_RO_REF(QVariantMap, SubtitleTracks)
27  PROPERTYIMP_RO_REF(QVariantMap, AudioTracks)
28 
29  public:
30  static inline void InitializeCustomTypes();
31 
32  public:
33  FrontendStatus(QObject *parent = 0) : QObject(parent)
34  {
35  }
36 
38  {
39  Copy(src);
40  }
41 
42  void Copy(const FrontendStatus &src)
43  {
44  m_State = src.m_State;
45  m_ChapterTimes = src.m_ChapterTimes;
46  m_SubtitleTracks = src.m_SubtitleTracks;
47  m_AudioTracks = src.m_AudioTracks;
48  }
49 
50  void Process(void)
51  {
52  if (m_State.contains("chaptertimes"))
53  {
54  if (m_State["chaptertimes"].type() == QVariant::List)
55  m_ChapterTimes = m_State["chaptertimes"].toList();
56  m_State.remove("chaptertimes");
57  }
58 
59  if (m_State.contains("subtitletracks"))
60  {
61  if (m_State["subtitletracks"].type() == QVariant::Map)
62  m_SubtitleTracks = m_State["subtitletracks"].toMap();
63  m_State.remove("subtitletracks");
64  }
65 
66  if (m_State.contains("audiotracks"))
67  {
68  if (m_State["audiotracks"].type() == QVariant::Map)
69  m_AudioTracks = m_State["audiotracks"].toMap();
70  m_State.remove("audiotracks");
71  }
72  }
73  };
74 };
75 
77 Q_DECLARE_METATYPE(DTC::FrontendStatus*)
78 
79 namespace DTC
80 {
81 inline void FrontendStatus::InitializeCustomTypes()
82 {
83  qRegisterMetaType<FrontendStatus>();
84  qRegisterMetaType<FrontendStatus*>();
85 }
86 }
87 
88 #endif // FRONTENDSTATUS_H