MythTV  master
lineup.h
Go to the documentation of this file.
1 // Program Name: lineup.h
3 // Created : Sep. 18, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see COPYING for details
8 //
10 
11 #ifndef LINEUP_H_
12 #define LINEUP_H_
13 
14 #include <QString>
15 
16 #include "serviceexp.h"
17 #include "datacontracthelper.h"
18 
19 namespace DTC
20 {
21 
23 
24 class SERVICE_PUBLIC Lineup : public QObject
25 {
26  Q_OBJECT
27  Q_CLASSINFO( "version" , "1.0" );
28 
29  Q_PROPERTY( QString LineupId READ LineupId WRITE setLineupId )
30  Q_PROPERTY( QString Name READ Name WRITE setName )
31  Q_PROPERTY( QString DisplayName READ DisplayName WRITE setDisplayName )
32  Q_PROPERTY( QString Type READ Type WRITE setType )
33  Q_PROPERTY( QString Postal READ Postal WRITE setPostal )
34  Q_PROPERTY( QString Device READ Device WRITE setDevice )
35 
36  PROPERTYIMP ( QString , LineupId )
37  PROPERTYIMP ( QString , Name )
38  PROPERTYIMP ( QString , DisplayName )
39  PROPERTYIMP ( QString , Type )
40  PROPERTYIMP ( QString , Postal )
41  PROPERTYIMP ( QString , Device )
42 
43  public:
44 
45  static inline void InitializeCustomTypes();
46 
47  Q_INVOKABLE Lineup(QObject *parent = nullptr)
48  : QObject ( parent )
49  {
50  }
51 
52  void Copy( const Lineup *src )
53  {
54  m_LineupId = src->m_LineupId ;
55  m_Name = src->m_Name ;
56  m_DisplayName = src->m_DisplayName ;
57  m_Type = src->m_Type ;
58  m_Postal = src->m_Postal ;
59  m_Device = src->m_Device ;
60  }
61 
62  private:
63  Q_DISABLE_COPY(Lineup);
64 };
65 
66 class SERVICE_PUBLIC LineupList : public QObject
67 {
68  Q_OBJECT
69  Q_CLASSINFO( "version", "1.0" );
70 
71  // Q_CLASSINFO Used to augment Metadata for properties.
72  // See datacontracthelper.h for details
73 
74  Q_CLASSINFO( "Lineups", "type=DTC::Lineup");
75 
76  Q_PROPERTY( QVariantList Lineups READ Lineups DESIGNABLE true )
77 
78  PROPERTYIMP_RO_REF( QVariantList, Lineups );
79 
80  public:
81 
82  static inline void InitializeCustomTypes();
83 
84  Q_INVOKABLE LineupList(QObject *parent = nullptr)
85  : QObject( parent )
86  {
87  }
88 
89  void Copy( const LineupList *src )
90  {
91  CopyListContents< Lineup >( this, m_Lineups, src->m_Lineups );
92  }
93 
95  {
96  // We must make sure the object added to the QVariantList has
97  // a parent of 'this'
98 
99  Lineup *pObject = new Lineup( this );
100  m_Lineups.append( QVariant::fromValue<QObject *>( pObject ));
101 
102  return pObject;
103  }
104 
105 };
106 
108 {
109  qRegisterMetaType< Lineup* >();
110 }
111 
113 {
114  qRegisterMetaType< LineupList* >();
115 
117 }
118 
119 } // namespace DTC
120 
121 #endif
static void InitializeCustomTypes()
Definition: lineup.h:107
#define PROPERTYIMP(type, name)
Q_INVOKABLE LineupList(QObject *parent=nullptr)
Definition: lineup.h:84
void Copy(const LineupList *src)
Definition: lineup.h:89
A device containing images (ie. USB stick, CD, storage group etc)
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
#define PROPERTYIMP_RO_REF(type, name)
void Copy(const Lineup *src)
Definition: lineup.h:52
static void InitializeCustomTypes()
Definition: lineup.h:112
Lineup * AddNewLineup()
Definition: lineup.h:94