MythTV  master
v2programList.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 V2PROGRAMLIST_H_
12 #define V2PROGRAMLIST_H_
13 
14 #include <QDateTime>
15 #include <QString>
16 #include <QVariantList>
17 
19 
20 #include "v2programAndChannel.h"
21 
22 class V2ProgramList : public QObject
23 {
24  Q_OBJECT
25  Q_CLASSINFO( "Version", "1.0" );
26 
27  Q_CLASSINFO( "Programs", "type=V2Program");
28  Q_CLASSINFO( "AsOf" , "transient=true" );
29 
30  SERVICE_PROPERTY2( int , StartIndex )
31  SERVICE_PROPERTY2( int , Count )
32  SERVICE_PROPERTY2( int , TotalAvailable )
33  SERVICE_PROPERTY2( QDateTime , AsOf )
34  SERVICE_PROPERTY2( QString , Version )
35  SERVICE_PROPERTY2( QString , ProtoVer )
36  SERVICE_PROPERTY2( QVariantList, Programs );
37 
38  public:
39 
40  Q_INVOKABLE V2ProgramList(QObject *parent = nullptr)
41  : QObject( parent )
42  {
43  }
44 
45  void Copy( const V2ProgramList *src )
46  {
47  m_StartIndex = src->m_StartIndex ;
48  m_Count = src->m_Count ;
49  m_TotalAvailable= src->m_TotalAvailable ;
50  m_AsOf = src->m_AsOf ;
51  m_Version = src->m_Version ;
52  m_ProtoVer = src->m_ProtoVer ;
53 
54  CopyListContents< V2Program >( this, m_Programs, src->m_Programs );
55  }
56 
57  // This is here so that a routine in serviceutil (FillUpcomingList)
58  // can fill the QVariantlist of programs. Unfortunately the standard
59  // call Programs() generated by the macros returns a const QVariantlist.
60  QVariantList& GetPrograms() {return m_Programs;}
61 
63  {
64  // We must make sure the object added to the QVariantList has
65  // a parent of 'this'
66 
67  auto *pObject = new V2Program( this );
68  m_Programs.append( QVariant::fromValue<QObject *>( pObject ));
69 
70  return pObject;
71  }
72 
73  private:
75 };
76 
78 
79 #endif
V2ProgramList::SERVICE_PROPERTY2
SERVICE_PROPERTY2(QVariantList, Programs)
V2ProgramList::Q_CLASSINFO
Q_CLASSINFO("Version", "1.0")
v2programAndChannel.h
V2ProgramList::Copy
void Copy(const V2ProgramList *src)
Definition: v2programList.h:45
V2ProgramList
Definition: v2programList.h:22
V2ProgramList::V2ProgramList
Q_INVOKABLE V2ProgramList(QObject *parent=nullptr)
Definition: v2programList.h:40
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(StandardSetting *)
mythhttpservice.h
V2Program
Definition: v2programAndChannel.h:107
V2ProgramList::Q_DISABLE_COPY
Q_DISABLE_COPY(V2ProgramList)
V2ProgramList::GetPrograms
QVariantList & GetPrograms()
Definition: v2programList.h:60
V2ProgramList::AddNewProgram
V2Program * AddNewProgram()
Definition: v2programList.h:62