MythTV  master
encoderList.h
Go to the documentation of this file.
1 // Program Name: encoderList.h
3 // Created : Jan. 15, 2010
4 //
5 // Copyright (c) 2010 David Blain <dblain@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see LICENSE for details
8 //
10 
11 #ifndef ENCODERLIST_H_
12 #define ENCODERLIST_H_
13 
14 #include <QVariantList>
15 
16 #include "serviceexp.h"
17 #include "datacontracthelper.h"
18 
19 #include "encoder.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC EncoderList : 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( "Encoders", "type=DTC::Encoder");
33 
34  Q_PROPERTY( QVariantList Encoders READ Encoders )
35 
36  PROPERTYIMP_RO_REF( QVariantList, Encoders );
37 
38  public:
39 
40  static inline void InitializeCustomTypes();
41 
42  Q_INVOKABLE EncoderList(QObject *parent = nullptr)
43  : QObject( parent )
44  {
45  }
46 
47  void Copy( const EncoderList *src )
48  {
49  CopyListContents< Encoder >( this, m_Encoders, src->m_Encoders );
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 Encoder( this );
58  m_Encoders.append( QVariant::fromValue<QObject *>( pObject ));
59 
60  return pObject;
61  }
62 
63  private:
64  Q_DISABLE_COPY(EncoderList);
65 };
66 
68 {
69  qRegisterMetaType< EncoderList* >();
70 
72 }
73 
74 } // namespace DTC
75 
76 #endif
DTC::Encoder::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:105
DTC::EncoderList::AddNewEncoder
Encoder * AddNewEncoder()
Definition: encoderList.h:52
DTC::EncoderList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: encoderList.h:67
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
datacontracthelper.h
serviceexp.h
encoder.h
DTC::EncoderList::EncoderList
Q_INVOKABLE EncoderList(QObject *parent=nullptr)
Definition: encoderList.h:42
DTC
Definition: datacontracthelper.h:123
DTC::EncoderList::Copy
void Copy(const EncoderList *src)
Definition: encoderList.h:47
DTC::Encoder
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:27
DTC::EncoderList
Definition: encoderList.h:24
Encoders
std::vector< uint32_t > Encoders
Definition: mythdrmconnector.h:9