MythTV  master
titleInfoList.h
Go to the documentation of this file.
1 // Program Name: titleInfoList.h
3 // Created : June 14, 2013
4 //
5 // Copyright (c) 2013 Chris Pinkham <cpinkham@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see LICENSE for details
8 //
10 
11 #ifndef TITLEINFOLIST_H_
12 #define TITLEINFOLIST_H_
13 
14 #include <QVariantList>
15 
18 
19 #include "titleInfo.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC TitleInfoList : public QObject
25 {
26  Q_OBJECT
27  Q_CLASSINFO( "version", "1.0" );
28 
29  // Q_CLASSINFO Used to augment Metadata for properties.
30  // See datacontracthelper.h for details
31 
32  Q_CLASSINFO( "TitleInfos", "type=DTC::TitleInfo");
33 
34  Q_PROPERTY( QVariantList TitleInfos READ TitleInfos )
35 
36  PROPERTYIMP_RO_REF( QVariantList, TitleInfos );
37 
38  public:
39 
40  static inline void InitializeCustomTypes();
41 
42  Q_INVOKABLE TitleInfoList(QObject *parent = nullptr)
43  : QObject( parent )
44  {
45  }
46 
47  void Copy( const TitleInfoList *src )
48  {
49  CopyListContents< TitleInfo >( this, m_TitleInfos, src->m_TitleInfos );
50  }
51 
53  {
54  // We must make sure the object added to the QVariantList has
55  // a parent of 'this'
56 
57  auto *pObject = new TitleInfo( this );
58  m_TitleInfos.append( QVariant::fromValue<QObject *>( pObject ));
59 
60  return pObject;
61  }
62 
63  private:
64  Q_DISABLE_COPY(TitleInfoList);
65 };
66 
68 {
69  qRegisterMetaType< TitleInfoList* >();
70 
72 }
73 
74 } // namespace DTC
75 
76 #endif
DTC::TitleInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: titleInfo.h:58
DTC::TitleInfoList::Copy
void Copy(const TitleInfoList *src)
Definition: titleInfoList.h:47
DTC::TitleInfoList
Definition: titleInfoList.h:24
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
titleInfo.h
DTC::TitleInfoList::TitleInfoList
Q_INVOKABLE TitleInfoList(QObject *parent=nullptr)
Definition: titleInfoList.h:42
datacontracthelper.h
serviceexp.h
DTC::TitleInfoList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: titleInfoList.h:67
DTC::TitleInfo
Definition: titleInfo.h:24
DTC
Definition: datacontracthelper.h:123
DTC::TitleInfoList::AddNewTitleInfo
TitleInfo * AddNewTitleInfo()
Definition: titleInfoList.h:52