MythTV  master
imageMetadataInfoList.h
Go to the documentation of this file.
1 #ifndef IMAGEMETADATAINFOLIST_H
2 #define IMAGEMETADATAINFOLIST_H
3 
4 #include <QVariantList>
5 
6 #include "serviceexp.h"
7 #include "datacontracthelper.h"
8 #include "imageMetadataInfo.h"
9 
10 
11 
12 namespace DTC
13 {
14 
15 class SERVICE_PUBLIC ImageMetadataInfoList : public QObject
16 {
17  Q_OBJECT
18  Q_CLASSINFO( "version", "1.0" )
19 
20  // Q_CLASSINFO Used to augment Metadata for properties.
21  // See datacontracthelper.h for details
22 
23  Q_CLASSINFO( "ImageMetadataInfos", "type=DTC::ImageMetadataInfo")
24 
25  Q_PROPERTY( int Count READ Count WRITE setCount )
26  Q_PROPERTY( QString File READ File WRITE setFile )
27  Q_PROPERTY( QString Path READ Path WRITE setPath )
28  Q_PROPERTY( int Size READ Size WRITE setSize )
29  Q_PROPERTY( QString Extension READ Extension WRITE setExtension )
30  Q_PROPERTY( QVariantList ImageMetadataInfos READ ImageMetadataInfos DESIGNABLE true )
31 
32  PROPERTYIMP ( int , Count )
33  PROPERTYIMP ( QString , File )
34  PROPERTYIMP ( QString , Path )
35  PROPERTYIMP ( int , Size )
36  PROPERTYIMP ( QString , Extension )
37  PROPERTYIMP_RO_REF( QVariantList, ImageMetadataInfos )
38 
39  public:
40 
41  static inline void InitializeCustomTypes();
42 
43  Q_INVOKABLE ImageMetadataInfoList(QObject *parent = nullptr)
44  : QObject( parent ),
45  m_Count ( 0 ),
46  m_Size ( 0 )
47  {
48  }
49 
50  void Copy( const ImageMetadataInfoList *src )
51  {
52  m_Count = src->m_Count;
53  m_File = src->m_File;
54  m_Path = src->m_Path;
55  m_Size = src->m_Size;
56  m_Extension = src->m_Extension;
57 
58  CopyListContents< ImageMetadataInfo >( this, m_ImageMetadataInfos, src->m_ImageMetadataInfos );
59  }
60 
62  {
63  // We must make sure the object added to the
64  // QVariantList has a parent of 'this'
65  ImageMetadataInfo *pObject = new ImageMetadataInfo( this );
66  m_ImageMetadataInfos.append( QVariant::fromValue<QObject *>( pObject ));
67 
68  return pObject;
69  }
70 
71  private:
72  Q_DISABLE_COPY(ImageMetadataInfoList);
73 };
74 
76 {
77  qRegisterMetaType< ImageMetadataInfoList* >();
78 
80 }
81 
82 } // namespace DTC
83 
84 #endif // IMAGEMETADATAINFOLIST_H
static void InitializeCustomTypes()
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
#define PROPERTYIMP(type, name)
ImageMetadataInfo * AddNewImageMetadataInfo()
void Copy(const ImageMetadataInfoList *src)
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
#define PROPERTYIMP_RO_REF(type, name)