MythTV  master
videoSourceList.h
Go to the documentation of this file.
1 #ifndef VIDEOSOURCELIST_H_
2 #define VIDEOSOURCELIST_H_
3 
4 #include <QVariantList>
5 #include <QDateTime>
6 
7 #include "serviceexp.h"
8 #include "datacontracthelper.h"
9 
10 #include "videoSource.h"
11 
12 namespace DTC
13 {
14 
15 class SERVICE_PUBLIC VideoSourceList : public QObject
16 {
17  Q_OBJECT
18  Q_CLASSINFO( "version", "1.0" );
19 
20  // Q_CLASSINFO Used to augment Metadata for properties.
21  // See datacontracthelper.h for details
22 
23  Q_CLASSINFO( "VideoSources", "type=DTC::VideoSource");
24  Q_CLASSINFO( "AsOf" , "transient=true" );
25 
26  Q_PROPERTY( QDateTime AsOf READ AsOf WRITE setAsOf )
27  Q_PROPERTY( QString Version READ Version WRITE setVersion )
28  Q_PROPERTY( QString ProtoVer READ ProtoVer WRITE setProtoVer )
29 
30  Q_PROPERTY( QVariantList VideoSources READ VideoSources )
31 
32  PROPERTYIMP_REF ( QDateTime , AsOf )
33  PROPERTYIMP_REF ( QString , Version )
34  PROPERTYIMP_REF ( QString , ProtoVer )
35 
36  PROPERTYIMP_RO_REF( QVariantList, VideoSources )
37 
38  public:
39 
40  static inline void InitializeCustomTypes();
41 
42  Q_INVOKABLE VideoSourceList(QObject *parent = nullptr)
43  : QObject( parent )
44  {
45  }
46 
47  void Copy( const VideoSourceList *src )
48  {
49  m_AsOf = src->m_AsOf ;
50  m_Version = src->m_Version ;
51  m_ProtoVer = src->m_ProtoVer ;
52 
53  CopyListContents< VideoSource >( this, m_VideoSources, src->m_VideoSources );
54  }
55 
57  {
58  // We must make sure the object added to the QVariantList has
59  // a parent of 'this'
60 
61  auto *pObject = new VideoSource( this );
62  m_VideoSources.append( QVariant::fromValue<QObject *>( pObject ));
63 
64  return pObject;
65  }
66 
67  private:
68  Q_DISABLE_COPY(VideoSourceList);
69 };
70 
72 {
73  qRegisterMetaType< VideoSourceList* >();
74 
76 }
77 
78 } // namespace DTC
79 
80 #endif
videoSource.h
DTC::VideoSourceList
Definition: videoSourceList.h:15
DTC::VideoSourceList::AddNewVideoSource
VideoSource * AddNewVideoSource()
Definition: videoSourceList.h:56
DTC::VideoSource::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoSource.h:85
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
DTC::VideoSource
Definition: videoSource.h:14
datacontracthelper.h
serviceexp.h
DTC::VideoSourceList::Copy
void Copy(const VideoSourceList *src)
Definition: videoSourceList.h:47
DTC
Definition: datacontracthelper.h:123
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70
DTC::VideoSourceList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoSourceList.h:71