MythTV  master
videoMetadataInfoList.h
Go to the documentation of this file.
1 // Program Name: videoMetadataInfoList.h
3 // Created : Apr. 21, 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 VIDEOMETADATAINFOLIST_H_
12 #define VIDEOMETADATAINFOLIST_H_
13 
14 #include <QVariantList>
15 
18 
19 #include "videoMetadataInfo.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC VideoMetadataInfoList : public QObject
25 {
26  Q_OBJECT
27  Q_CLASSINFO( "version", "1.02" );
28 
29  // Q_CLASSINFO Used to augment Metadata for properties.
30  // See datacontracthelper.h for details
31 
32  Q_CLASSINFO( "VideoMetadataInfos", "type=DTC::VideoMetadataInfo");
33  Q_CLASSINFO( "AsOf" , "transient=true" );
34 
35  Q_PROPERTY( int StartIndex READ StartIndex WRITE setStartIndex )
36  Q_PROPERTY( int Count READ Count WRITE setCount )
37  Q_PROPERTY( int CurrentPage READ CurrentPage WRITE setCurrentPage )
38  Q_PROPERTY( int TotalPages READ TotalPages WRITE setTotalPages )
39  Q_PROPERTY( int TotalAvailable READ TotalAvailable WRITE setTotalAvailable )
40  Q_PROPERTY( QDateTime AsOf READ AsOf WRITE setAsOf )
41  Q_PROPERTY( QString Version READ Version WRITE setVersion )
42  Q_PROPERTY( QString ProtoVer READ ProtoVer WRITE setProtoVer )
43 
44  Q_PROPERTY( QVariantList VideoMetadataInfos READ VideoMetadataInfos )
45 
46  PROPERTYIMP ( int , StartIndex )
47  PROPERTYIMP ( int , Count )
48  PROPERTYIMP ( int , CurrentPage )
49  PROPERTYIMP ( int , TotalPages )
50  PROPERTYIMP ( int , TotalAvailable )
51  PROPERTYIMP_REF ( QDateTime , AsOf )
52  PROPERTYIMP_REF ( QString , Version )
53  PROPERTYIMP_REF ( QString , ProtoVer )
54 
55  PROPERTYIMP_RO_REF( QVariantList, VideoMetadataInfos );
56 
57  public:
58 
59  static inline void InitializeCustomTypes();
60 
61  Q_INVOKABLE VideoMetadataInfoList(QObject *parent = nullptr)
62  : QObject( parent ),
63  m_StartIndex ( 0 ),
64  m_Count ( 0 ),
65  m_CurrentPage ( 0 ),
66  m_TotalPages ( 0 ),
67  m_TotalAvailable( 0 )
68  {
69  }
70 
71  void Copy( const VideoMetadataInfoList *src )
72  {
73  m_StartIndex = src->m_StartIndex ;
74  m_Count = src->m_Count ;
75  m_TotalAvailable= src->m_TotalAvailable ;
76  m_AsOf = src->m_AsOf ;
77  m_Version = src->m_Version ;
78  m_ProtoVer = src->m_ProtoVer ;
79 
80  CopyListContents< VideoMetadataInfo >( this, m_VideoMetadataInfos, src->m_VideoMetadataInfos );
81  }
82 
84  {
85  // We must make sure the object added to the QVariantList has
86  // a parent of 'this'
87 
88  auto *pObject = new VideoMetadataInfo( this );
89  m_VideoMetadataInfos.append( QVariant::fromValue<QObject *>( pObject ));
90 
91  return pObject;
92  }
93 
94  private:
95  Q_DISABLE_COPY(VideoMetadataInfoList);
96 };
97 
99 {
100  qRegisterMetaType< VideoMetadataInfoList* >();
101 
103 }
104 
105 } // namespace DTC
106 
107 #endif
DTC::VideoMetadataInfoList::Copy
void Copy(const VideoMetadataInfoList *src)
Definition: videoMetadataInfoList.h:71
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
DTC::VideoMetadataInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoMetadataInfo.h:161
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
datacontracthelper.h
serviceexp.h
DTC::VideoMetadataInfoList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoMetadataInfoList.h:98
PROPERTYIMP
#define PROPERTYIMP(type, name)
Definition: datacontracthelper.h:56
DTC
Definition: datacontracthelper.h:123
DTC::VideoMetadataInfo
Definition: videoMetadataInfo.h:29
videoMetadataInfo.h
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70
DTC::VideoMetadataInfoList::AddNewVideoMetadataInfo
VideoMetadataInfo * AddNewVideoMetadataInfo()
Definition: videoMetadataInfoList.h:83
DTC::VideoMetadataInfoList
Definition: videoMetadataInfoList.h:24