/
genreList.h
89 lines (64 loc) · 1.87 KB
/
genreList.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//////////////////////////////////////////////////////////////////////////////
// Program Name: genreList.h
// Created : Mar. 08, 2017
//
// Copyright (c) 2017 Paul Harrison <pharrison@mythtv.org>
//
// Licensed under the GPL v2 or later, see COPYING for details
//
//////////////////////////////////////////////////////////////////////////////
#ifndef GENRELIST_H_
#define GENRELIST_H_
#include <QString>
#include <QVariantList>
#include "serviceexp.h"
#include "datacontracthelper.h"
#include "genre.h"
namespace DTC
{
class SERVICE_PUBLIC GenreList : public QObject
{
Q_OBJECT
Q_CLASSINFO( "version", "1.0" );
// Q_CLASSINFO Used to augment Metadata for properties.
// See datacontracthelper.h for details
Q_CLASSINFO( "GenreList", "type=DTC::Genre");
Q_PROPERTY( QVariantList Genres READ Genres DESIGNABLE true )
PROPERTYIMP_RO_REF( QVariantList, Genres )
public:
static inline void InitializeCustomTypes();
public:
GenreList(QObject *parent = 0)
: QObject ( parent )
{
}
GenreList( const GenreList &src )
{
Copy( src );
}
void Copy( const GenreList &src )
{
CopyListContents< Genre >( this, m_Genres, src.m_Genres );
}
Genre *AddNewGenre()
{
// We must make sure the object added to the QVariantList has
// a parent of 'this'
Genre *pObject = new Genre( this );
m_Genres.append( QVariant::fromValue<QObject *>( pObject ));
return pObject;
}
};
} // namespace DTC
Q_DECLARE_METATYPE( DTC::GenreList )
Q_DECLARE_METATYPE( DTC::GenreList* )
namespace DTC
{
inline void GenreList::InitializeCustomTypes()
{
qRegisterMetaType< GenreList >();
qRegisterMetaType< GenreList* >();
Genre::InitializeCustomTypes();
}
}
#endif