MythTV  master
inputList.h
Go to the documentation of this file.
1 // Program Name: inputList.h
3 // Created : Nov. 20, 2013
4 //
5 // Copyright (c) 2013 Stuart Morgan <smorgan@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see COPYING for details
8 //
10 
11 #ifndef INPUTLIST_H_
12 #define INPUTLIST_H_
13 
14 #include <QVariantList>
15 
16 #include "serviceexp.h"
17 #include "datacontracthelper.h"
18 
19 #include "input.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC InputList : 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( "Inputs", "type=DTC::Input");
33 
34  Q_PROPERTY( QVariantList Inputs READ Inputs )
35 
36  PROPERTYIMP_RO_REF( QVariantList, Inputs );
37 
38  public:
39 
40  static inline void InitializeCustomTypes();
41 
42  Q_INVOKABLE InputList(QObject *parent = nullptr)
43  : QObject( parent )
44  {
45  }
46 
47  void Copy( const InputList *src )
48  {
49  CopyListContents< Input >( this, m_Inputs, src->m_Inputs );
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 Input( this );
58  m_Inputs.append( QVariant::fromValue<QObject *>( pObject ));
59 
60  return pObject;
61  }
62 
63  private:
65 };
66 
68 {
69  qRegisterMetaType< InputList* >();
70 
72 }
73 
74 } // namespace DTC
75 
76 #endif
DTC::InputList::Copy
void Copy(const InputList *src)
Definition: inputList.h:47
DTC::InputList::AddNewInput
Input * AddNewInput()
Definition: inputList.h:52
DTC::InputList::Q_DISABLE_COPY
Q_DISABLE_COPY(InputList)
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
DTC::InputList::Q_CLASSINFO
Q_CLASSINFO("Inputs", "type=DTC::Input")
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:100
DTC::InputList::Q_CLASSINFO
Q_CLASSINFO("version", "1.0")
DTC::Input
Definition: input.h:25
datacontracthelper.h
serviceexp.h
DTC::Input::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: input.h:85
DTC::InputList
Definition: inputList.h:25
DTC::InputList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: inputList.h:67
DTC
Definition: datacontracthelper.h:110
input.h