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