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 COPYING for details
8 //
10 
11 #ifndef CUTLIST_H_
12 #define CUTLIST_H_
13 
14 #include <QString>
15 #include <QVariantList>
16 
17 #include "serviceexp.h"
18 #include "datacontracthelper.h"
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 DESIGNABLE true )
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  Cutting *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
Q_INVOKABLE CutList(QObject *parent=nullptr)
Definition: cutList.h:43
Cutting * AddNewCutting()
Definition: cutList.h:53
static void InitializeCustomTypes()
Definition: cutting.h:53
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
void Copy(const CutList *src)
Definition: cutList.h:48
static void InitializeCustomTypes()
Definition: cutList.h:68
#define PROPERTYIMP_RO_REF(type, name)