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 DESIGNABLE true )
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  Frontend *pObject = new Frontend( this );
58  m_Frontends.append( QVariant::fromValue<QObject *>( pObject ));
59 
60  return pObject;
61  }
62 
63  private:
64  Q_DISABLE_COPY(FrontendList);
65 };
66 
68 {
69  qRegisterMetaType< FrontendList* >();
70 
72 }
73 
74 } // namespace DTC
75 
76 #endif
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
Q_INVOKABLE FrontendList(QObject *parent=nullptr)
Definition: frontendList.h:42
#define PROPERTYIMP_RO_REF(type, name)
Frontend * AddNewFrontend()
Definition: frontendList.h:52
static void InitializeCustomTypes()
Definition: frontendList.h:67
void Copy(const FrontendList *src)
Definition: frontendList.h:47