MythTV  master
videoStreamInfoList.h
Go to the documentation of this file.
1 // Program Name: videoStreamInfoList.h
3 // Created : May. 30, 2020
4 //
5 // Copyright (c) 2011 Peter Bennett <pbennett@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see COPYING for details
8 //
10 
11 #ifndef VIDEOSTREAMINFOLIST_H_
12 #define VIDEOSTREAMINFOLIST_H_
13 
14 #include <QVariantList>
15 
16 #include "serviceexp.h"
17 #include "datacontracthelper.h"
18 
19 #include "videoStreamInfo.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC VideoStreamInfoList : public QObject
25 {
26  Q_OBJECT
27  Q_CLASSINFO( "version", "1.00" );
28 
29  // Q_CLASSINFO Used to augment Metadata for properties.
30  // See datacontracthelper.h for details
31 
32  Q_CLASSINFO( "VideoStreamInfos", "type=DTC::VideoStreamInfo");
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  Q_PROPERTY( int ErrorCode READ ErrorCode WRITE setErrorCode )
40  Q_PROPERTY( QString ErrorMsg READ ErrorMsg WRITE setErrorMsg )
41 
42  Q_PROPERTY( QVariantList VideoStreamInfos READ VideoStreamInfos )
43 
44  PROPERTYIMP ( int , Count )
45  PROPERTYIMP_REF ( QDateTime , AsOf )
46  PROPERTYIMP_REF ( QString , Version )
47  PROPERTYIMP_REF ( QString , ProtoVer )
48  PROPERTYIMP ( int , ErrorCode )
49  PROPERTYIMP_REF ( QString , ErrorMsg )
50 
51  PROPERTYIMP_RO_REF( QVariantList, VideoStreamInfos );
52 
53  public:
54 
55  static inline void InitializeCustomTypes();
56 
57  Q_INVOKABLE VideoStreamInfoList(QObject *parent = nullptr)
58  : QObject( parent ),
59  m_Count ( 0 )
60  {
61  }
62 
63  void Copy( const VideoStreamInfoList *src )
64  {
65  m_Count = src->m_Count ;
66  m_AsOf = src->m_AsOf ;
67  m_Version = src->m_Version ;
68  m_ProtoVer = src->m_ProtoVer ;
69  m_ErrorCode = src->m_ErrorCode ;
70  m_ErrorMsg = src->m_ErrorMsg ;
71 
72  CopyListContents< VideoStreamInfo >( this, m_VideoStreamInfos, src->m_VideoStreamInfos );
73  }
74 
76  {
77  // We must make sure the object added to the QVariantList has
78  // a parent of 'this'
79 
80  auto *pObject = new VideoStreamInfo( this );
81  m_VideoStreamInfos.append( QVariant::fromValue<QObject *>( pObject ));
82 
83  return pObject;
84  }
85 
86  private:
87  Q_DISABLE_COPY(VideoStreamInfoList);
88 };
89 
91 {
92  qRegisterMetaType< VideoStreamInfoList* >();
93 
95 }
96 
97 } // namespace DTC
98 
99 #endif
DTC::VideoStreamInfoList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoStreamInfoList.h:90
DTC::VideoStreamInfo
Definition: videoStreamInfo.h:25
videoStreamInfo.h
DTC::VideoStreamInfoList
Definition: videoStreamInfoList.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::VideoStreamInfoList::Copy
void Copy(const VideoStreamInfoList *src)
Definition: videoStreamInfoList.h:63
PROPERTYIMP
#define PROPERTYIMP(type, name)
Definition: datacontracthelper.h:56
DTC
Definition: datacontracthelper.h:123
DTC::VideoStreamInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: videoStreamInfo.h:86
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70
DTC::VideoStreamInfoList::AddNewVideoStreamInfo
VideoStreamInfo * AddNewVideoStreamInfo()
Definition: videoStreamInfoList.h:75