MythTV  master
channelInfoList.h
Go to the documentation of this file.
1 #ifndef CHANNELINFOLIST_H_
2 #define CHANNELINFOLIST_H_
3 
4 #include <QVariantList>
5 
6 #include "serviceexp.h"
7 #include "datacontracthelper.h"
8 
9 #include "programAndChannel.h"
10 
11 namespace DTC
12 {
13 
14 class SERVICE_PUBLIC ChannelInfoList : public QObject
15 {
16  Q_OBJECT
17  Q_CLASSINFO( "version", "1.0" );
18 
19  // Q_CLASSINFO Used to augment Metadata for properties.
20  // See datacontracthelper.h for details
21 
22  Q_CLASSINFO( "ChannelInfos", "type=DTC::ChannelInfo");
23  Q_CLASSINFO( "AsOf" , "transient=true" );
24 
25  Q_PROPERTY( int StartIndex READ StartIndex WRITE setStartIndex )
26  Q_PROPERTY( int Count READ Count WRITE setCount )
27  Q_PROPERTY( int CurrentPage READ CurrentPage WRITE setCurrentPage )
28  Q_PROPERTY( int TotalPages READ TotalPages WRITE setTotalPages )
29  Q_PROPERTY( int TotalAvailable READ TotalAvailable WRITE setTotalAvailable )
30  Q_PROPERTY( QDateTime AsOf READ AsOf WRITE setAsOf )
31  Q_PROPERTY( QString Version READ Version WRITE setVersion )
32  Q_PROPERTY( QString ProtoVer READ ProtoVer WRITE setProtoVer )
33 
34  Q_PROPERTY( QVariantList ChannelInfos READ ChannelInfos DESIGNABLE true )
35 
36  PROPERTYIMP ( int , StartIndex )
37  PROPERTYIMP ( int , Count )
38  PROPERTYIMP ( int , CurrentPage )
39  PROPERTYIMP ( int , TotalPages )
40  PROPERTYIMP ( int , TotalAvailable )
41  PROPERTYIMP ( QDateTime , AsOf )
42  PROPERTYIMP ( QString , Version )
43  PROPERTYIMP ( QString , ProtoVer )
44 
45  PROPERTYIMP_RO_REF( QVariantList, ChannelInfos );
46 
47  public:
48 
49  static void InitializeCustomTypes();
50 
51  Q_INVOKABLE ChannelInfoList(QObject *parent = nullptr)
52  : QObject( parent ),
53  m_StartIndex ( 0 ),
54  m_Count ( 0 ),
55  m_CurrentPage ( 0 ),
56  m_TotalPages ( 0 ),
57  m_TotalAvailable( 0 )
58  {
59  }
60 
61  void Copy( const ChannelInfoList *src )
62  {
63  m_StartIndex = src->m_StartIndex ;
64  m_Count = src->m_Count ;
65  m_TotalAvailable= src->m_TotalAvailable ;
66  m_AsOf = src->m_AsOf ;
67  m_Version = src->m_Version ;
68  m_ProtoVer = src->m_ProtoVer ;
69 
70  CopyListContents< ChannelInfo >( this, m_ChannelInfos, src->m_ChannelInfos );
71  }
72 
74  {
75  // We must make sure the object added to the QVariantList has
76  // a parent of 'this'
77 
78  ChannelInfo *pObject = new ChannelInfo( this );
79  m_ChannelInfos.append( QVariant::fromValue<QObject *>( pObject ));
80 
81  return pObject;
82  }
83 
84  private:
85  Q_DISABLE_COPY(ChannelInfoList);
86 };
87 
89 {
90  qRegisterMetaType< ChannelInfoList* >();
91 
93 }
94 
95 } // namespace DTC
96 
97 #endif
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)
static void InitializeCustomTypes()
void Copy(const ChannelInfoList *src)
ChannelInfo * AddNewChannelInfo()
static void InitializeCustomTypes()