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