MythTV  master
musicMetadataInfoList.h
Go to the documentation of this file.
1 // Program Name: musicMetadataInfoList.h
3 // Created : July 20, 2017
4 //
5 // Copyright (c) 2017 Paul Harrison <pharrison@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see COPYING for details
8 //
10 
11 #ifndef MUSICMETADATAINFOLIST_H_
12 #define MUSICMETADATAINFOLIST_H_
13 
14 #include <QVariantList>
15 
16 #include "serviceexp.h"
17 #include "datacontracthelper.h"
18 
19 #include "musicMetadataInfo.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC MusicMetadataInfoList : public QObject
25 {
26  Q_OBJECT
27  Q_CLASSINFO( "version", "1.00" );
28 
29  // Q_CLASSINFO Used to augment Metadata for properties.
30  // See datacontracthelper.h for details
31 
32  Q_CLASSINFO( "MusicMetadataInfos", "type=DTC::MusicMetadataInfo");
33  Q_CLASSINFO( "AsOf" , "transient=true" );
34 
35  Q_PROPERTY( int StartIndex READ StartIndex WRITE setStartIndex )
36  Q_PROPERTY( int Count READ Count WRITE setCount )
37  Q_PROPERTY( int CurrentPage READ CurrentPage WRITE setCurrentPage )
38  Q_PROPERTY( int TotalPages READ TotalPages WRITE setTotalPages )
39  Q_PROPERTY( int TotalAvailable READ TotalAvailable WRITE setTotalAvailable )
40  Q_PROPERTY( QDateTime AsOf READ AsOf WRITE setAsOf )
41  Q_PROPERTY( QString Version READ Version WRITE setVersion )
42  Q_PROPERTY( QString ProtoVer READ ProtoVer WRITE setProtoVer )
43 
44  Q_PROPERTY( QVariantList MusicMetadataInfos READ MusicMetadataInfos DESIGNABLE true )
45 
46  PROPERTYIMP ( int , StartIndex )
47  PROPERTYIMP ( int , Count )
48  PROPERTYIMP ( int , CurrentPage )
49  PROPERTYIMP ( int , TotalPages )
50  PROPERTYIMP ( int , TotalAvailable )
51  PROPERTYIMP ( QDateTime , AsOf )
52  PROPERTYIMP ( QString , Version )
53  PROPERTYIMP ( QString , ProtoVer )
54 
55  PROPERTYIMP_RO_REF( QVariantList, MusicMetadataInfos )
56 
57  public:
58 
59  static inline void InitializeCustomTypes();
60 
61  Q_INVOKABLE MusicMetadataInfoList(QObject *parent = nullptr)
62  : QObject( parent ),
63  m_StartIndex ( 0 ),
64  m_Count ( 0 ),
65  m_CurrentPage ( 0 ),
66  m_TotalPages ( 0 ),
67  m_TotalAvailable( 0 )
68  {
69  }
70 
71  void Copy( const MusicMetadataInfoList *src )
72  {
73  m_StartIndex = src->m_StartIndex ;
74  m_Count = src->m_Count ;
75  m_TotalAvailable= src->m_TotalAvailable ;
76  m_AsOf = src->m_AsOf ;
77  m_Version = src->m_Version ;
78  m_ProtoVer = src->m_ProtoVer ;
79 
80  CopyListContents< MusicMetadataInfo >( this, m_MusicMetadataInfos, src->m_MusicMetadataInfos );
81  }
82 
84  {
85  // We must make sure the object added to the QVariantList has
86  // a parent of 'this'
87 
88  MusicMetadataInfo *pObject = new MusicMetadataInfo( this );
89  m_MusicMetadataInfos.append( QVariant::fromValue<QObject *>( pObject ));
90 
91  return pObject;
92  }
93 
94 };
95 
97 {
98  qRegisterMetaType< MusicMetadataInfoList* >();
99 
101 }
102 
103 } // namespace DTC
104 
105 #endif
static void InitializeCustomTypes()
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
void Copy(const MusicMetadataInfoList *src)
#define PROPERTYIMP(type, name)
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
#define PROPERTYIMP_RO_REF(type, name)
MusicMetadataInfo * AddNewMusicMetadataInfo()