MythTV  master
programList.h
Go to the documentation of this file.
1 // Program Name: programs.h
3 // Created : Jan. 15, 2010
4 //
5 // Copyright (c) 2010 David Blain <dblain@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see COPYING for details
8 //
10 
11 #ifndef PROGRAMS_H_
12 #define PROGRAMS_H_
13 
14 #include <QDateTime>
15 #include <QString>
16 #include <QVariantList>
17 
18 #include "serviceexp.h"
19 #include "datacontracthelper.h"
20 
21 #include "programAndChannel.h"
22 
23 namespace DTC
24 {
25 
26 class SERVICE_PUBLIC ProgramList : public QObject
27 {
28  Q_OBJECT
29  Q_CLASSINFO( "version", "1.0" );
30 
31  // Q_CLASSINFO Used to augment Metadata for properties.
32  // See datacontracthelper.h for details
33 
34  Q_CLASSINFO( "Programs", "type=DTC::Program");
35  Q_CLASSINFO( "AsOf" , "transient=true" );
36 
37  Q_PROPERTY( int StartIndex READ StartIndex WRITE setStartIndex )
38  Q_PROPERTY( int Count READ Count WRITE setCount )
39  Q_PROPERTY( int TotalAvailable READ TotalAvailable WRITE setTotalAvailable )
40  Q_PROPERTY( QDateTime AsOf READ AsOf WRITE setAsOf )
41  Q_PROPERTY( QString Version READ Version WRITE setVersion )
42  Q_PROPERTY( QString ProtoVer READ ProtoVer WRITE setProtoVer )
43 
44  Q_PROPERTY( QVariantList Programs READ Programs DESIGNABLE true )
45 
46  PROPERTYIMP ( int , StartIndex )
47  PROPERTYIMP ( int , Count )
48  PROPERTYIMP ( int , TotalAvailable )
49  PROPERTYIMP ( QDateTime , AsOf )
50  PROPERTYIMP ( QString , Version )
51  PROPERTYIMP ( QString , ProtoVer )
52 
53  PROPERTYIMP_RO_REF( QVariantList, Programs );
54 
55  public:
56 
57  static inline void InitializeCustomTypes();
58 
59  Q_INVOKABLE ProgramList(QObject *parent = nullptr)
60  : QObject ( parent ),
61  m_StartIndex ( 0 ),
62  m_Count ( 0 ),
63  m_TotalAvailable( 0 )
64  {
65  }
66 
67  void Copy( const ProgramList *src )
68  {
69  m_StartIndex = src->m_StartIndex ;
70  m_Count = src->m_Count ;
71  m_TotalAvailable= src->m_TotalAvailable ;
72  m_AsOf = src->m_AsOf ;
73  m_Version = src->m_Version ;
74  m_ProtoVer = src->m_ProtoVer ;
75 
76  CopyListContents< Program >( this, m_Programs, src->m_Programs );
77  }
78 
80  {
81  // We must make sure the object added to the QVariantList has
82  // a parent of 'this'
83 
84  Program *pObject = new Program( this );
85  m_Programs.append( QVariant::fromValue<QObject *>( pObject ));
86 
87  return pObject;
88  }
89 
90  private:
91  Q_DISABLE_COPY(ProgramList);
92 };
93 
95 {
96  qRegisterMetaType< ProgramList* >();
97 
99 }
100 
101 } // namespace DTC
102 
103 #endif
Program * AddNewProgram()
Definition: programList.h:79
static void InitializeCustomTypes()
Definition: programList.h:94
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
#define PROPERTYIMP(type, name)
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
#define PROPERTYIMP_RO_REF(type, name)
void Copy(const ProgramList *src)
Definition: programList.h:67
static void InitializeCustomTypes()