MythTV  master
videoLookupInfoList.h
Go to the documentation of this file.
1 // Program Name: videoLookupInfoList.h
3 // Created : Jul. 19, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see LICENSE for details
8 //
10 
11 #ifndef VIDEOLOOKUPINFOLIST_H_
12 #define VIDEOLOOKUPINFOLIST_H_
13 
14 #include <QVariantList>
15 
18 
19 #include "videoLookupInfo.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC VideoLookupList : public QObject
25 {
26  Q_OBJECT
27  Q_CLASSINFO( "version", "1.0" );
28 
29  // Q_CLASSINFO Used to augment Metadata for properties.
30  // See datacontracthelper.h for details
31 
32  Q_CLASSINFO( "VideoLookups", "type=DTC::VideoLookup");
33  Q_CLASSINFO( "AsOf" , "transient=true" );
34 
35  Q_PROPERTY( int Count READ Count WRITE setCount )
36  Q_PROPERTY( QDateTime AsOf READ AsOf WRITE setAsOf )
37  Q_PROPERTY( QString Version READ Version WRITE setVersion )
38  Q_PROPERTY( QString ProtoVer READ ProtoVer WRITE setProtoVer )
39 
40  Q_PROPERTY( QVariantList VideoLookups READ VideoLookups )
41 
42  PROPERTYIMP ( int , Count )
43  PROPERTYIMP_REF ( QDateTime , AsOf )
44  PROPERTYIMP_REF ( QString , Version )
45  PROPERTYIMP_REF ( QString , ProtoVer )
46 
47  PROPERTYIMP_RO_REF( QVariantList, VideoLookups );
48 
49  public:
50 
51  static inline void InitializeCustomTypes();
52 
53  Q_INVOKABLE VideoLookupList(QObject *parent = nullptr)
54  : QObject( parent ),
55  m_Count ( 0 )
56  {
57  }
58 
59  void Copy( const VideoLookupList *src )
60  {
61  m_Count = src->m_Count ;
62  m_AsOf = src->m_AsOf ;
63  m_Version = src->m_Version ;
64  m_ProtoVer = src->m_ProtoVer ;
65 
66  CopyListContents< VideoLookup >( this, m_VideoLookups, src->m_VideoLookups );
67  }
68 
70  {
71  // We must make sure the object added to the QVariantList has
72  // a parent of 'this'
73 
74  auto *pObject = new VideoLookup( this );
75  m_VideoLookups.append( QVariant::fromValue<QObject *>( pObject ));
76 
77  return pObject;
78  }
79 
80  private:
81  Q_DISABLE_COPY(VideoLookupList);
82 };
83 
85 {
86  qRegisterMetaType< VideoLookupList* >();
87 
89 }
90 
91 } // namespace DTC
92 
93 #endif
DTC::VideoLookup
Definition: videoLookupInfo.h:68
DTC::VideoLookupList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoLookupInfoList.h:84
DTC::VideoLookupList
Definition: videoLookupInfoList.h:24
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
DTC::VideoLookup::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoLookupInfo.h:180
DTC::VideoLookupList::AddNewVideoLookup
VideoLookup * AddNewVideoLookup()
Definition: videoLookupInfoList.h:69
DTC::VideoLookupList::Copy
void Copy(const VideoLookupList *src)
Definition: videoLookupInfoList.h:59
PROPERTYIMP
#define PROPERTYIMP(type, name)
Definition: datacontracthelper.h:56
DTC
Definition: datacontracthelper.h:123
videoLookupInfo.h
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70