MythTV  master
captureCardList.h
Go to the documentation of this file.
1 // Program Name: captureCardList.h
3 // Created : Sep. 21, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see COPYING for details
8 //
10 
11 #ifndef CAPTURECARDLIST_H_
12 #define CAPTURECARDLIST_H_
13 
14 #include <QString>
15 
16 #include "serviceexp.h"
17 #include "datacontracthelper.h"
18 
19 #include "captureCard.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC CaptureCardList : 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( "CaptureCards", "type=DTC::CaptureCard");
33 
34  Q_PROPERTY( QVariantList CaptureCards READ CaptureCards )
35 
36  PROPERTYIMP_RO_REF( QVariantList, CaptureCards );
37 
38  public:
39 
40  static inline void InitializeCustomTypes();
41 
42  Q_INVOKABLE CaptureCardList(QObject *parent = nullptr)
43  : QObject( parent )
44  {
45  }
46 
47  void Copy( const CaptureCardList *src )
48  {
49  CopyListContents< CaptureCard >( this, m_CaptureCards, src->m_CaptureCards );
50  }
51 
53  {
54  // We must make sure the object added to the QVariantList has
55  // a parent of 'this'
56 
57  auto *pObject = new CaptureCard( this );
58  m_CaptureCards.append( QVariant::fromValue<QObject *>( pObject ));
59 
60  return pObject;
61  }
62 
63  private:
64  Q_DISABLE_COPY(CaptureCardList);
65 };
66 
68 {
69  qRegisterMetaType< CaptureCardList* >();
71 }
72 
73 } // namespace DTC
74 
75 #endif
DTC::CaptureCardList::Copy
void Copy(const CaptureCardList *src)
Definition: captureCardList.h:47
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
DTC::CaptureCardList
Definition: captureCardList.h:24
DTC::CaptureCardList::CaptureCardList
Q_INVOKABLE CaptureCardList(QObject *parent=nullptr)
Definition: captureCardList.h:42
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:100
datacontracthelper.h
DTC::CaptureCardList::AddNewCaptureCard
CaptureCard * AddNewCaptureCard()
Definition: captureCardList.h:52
serviceexp.h
DTC::CaptureCardList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: captureCardList.h:67
captureCard.h
DTC
Definition: datacontracthelper.h:109
DTC::CaptureCard
Definition: captureCard.h:24
DTC::CaptureCard::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: captureCard.h:184