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