MythTV  master
cutList.h
Go to the documentation of this file.
1 // Program Name: cutList.h
3 // Created : Mar. 09, 2014
4 //
5 // Copyright (c) 2014 team MythTV
6 //
7 // Licensed under the GPL v2 or later, see LICENSE for details
8 //
10 
11 #ifndef CUTLIST_H_
12 #define CUTLIST_H_
13 
14 #include <QString>
15 #include <QVariantList>
16 
19 
20 #include "cutting.h"
21 
22 namespace DTC
23 {
24 
25 class SERVICE_PUBLIC CutList : public QObject
26 {
27  Q_OBJECT
28  Q_CLASSINFO( "version", "1.0" );
29 
30  // Q_CLASSINFO Used to augment Metadata for properties.
31  // See datacontracthelper.h for details
32 
33  Q_CLASSINFO( "Cuttings", "type=DTC::Cutting");
34 
35  Q_PROPERTY( QVariantList Cuttings READ Cuttings )
36 
37  PROPERTYIMP_RO_REF( QVariantList, Cuttings );
38 
39  public:
40 
41  static inline void InitializeCustomTypes();
42 
43  Q_INVOKABLE CutList(QObject *parent = nullptr)
44  : QObject ( parent )
45  {
46  }
47 
48  void Copy( const CutList *src )
49  {
50  CopyListContents< Cutting >( this, m_Cuttings, src->m_Cuttings );
51  }
52 
54  {
55  // We must make sure the object added to the QVariantList has
56  // a parent of 'this'
57 
58  auto *pObject = new Cutting( this );
59  m_Cuttings.append( QVariant::fromValue<QObject *>( pObject ));
60 
61  return pObject;
62  }
63 
64  private:
65  Q_DISABLE_COPY(CutList);
66 };
67 
69 {
70  qRegisterMetaType< CutList* >();
71 
73 }
74 
75 } // namespace DTC
76 
77 #endif
DTC::CutList::Copy
void Copy(const CutList *src)
Definition: cutList.h:48
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
DTC::CutList::CutList
Q_INVOKABLE CutList(QObject *parent=nullptr)
Definition: cutList.h:43
DTC::CutList::AddNewCutting
Cutting * AddNewCutting()
Definition: cutList.h:53
DTC::Cutting
Definition: cutting.h:23
DTC::CutList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: cutList.h:68
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
DTC::Cutting::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: cutting.h:53
datacontracthelper.h
serviceexp.h
cutting.h
DTC
Definition: datacontracthelper.h:123
DTC::CutList
Definition: cutList.h:25