MythTV  master
markupList.h
Go to the documentation of this file.
1 // Program Name: markupList.h
3 // Created : Apr. 4, 2021
4 //
5 // Copyright (c) 2021 team MythTV
6 //
7 // Licensed under the GPL v2 or later, see LICENSE for details
8 //
10 
11 #ifndef MARKUPLIST_H_
12 #define MARKUPLIST_H_
13 
14 #include <QString>
15 #include <QVariantList>
16 
19 
20 #include "markup.h"
21 
22 namespace DTC
23 {
24 
25 class SERVICE_PUBLIC MarkupList : 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( "Markups", "type=DTC::Markup");
34 
35  Q_PROPERTY( QVariantList Mark READ Mark )
36  Q_PROPERTY( QVariantList Seek READ Seek )
37 
38  PROPERTYIMP_RO_REF( QVariantList, Mark );
39  PROPERTYIMP_RO_REF( QVariantList, Seek );
40 
41  public:
42 
43  static inline void InitializeCustomTypes();
44 
45  Q_INVOKABLE MarkupList(QObject *parent = nullptr)
46  : QObject ( parent )
47  {
48  }
49 
50  void Copy( const MarkupList *src )
51  {
52  CopyListContents< Markup >( this, m_Mark, src->m_Mark );
53  CopyListContents< Markup >( this, m_Seek, src->m_Seek );
54  }
55 
57  {
58  // We must make sure the object added to the QVariantList has
59  // a parent of 'this'
60 
61  auto *pObject = new Markup( this );
62  m_Mark.append( QVariant::fromValue<QObject *>( pObject ));
63 
64  return pObject;
65  }
66 
68  {
69  // We must make sure the object added to the QVariantList has
70  // a parent of 'this'
71 
72  auto *pObject = new Markup( this );
73  m_Seek.append( QVariant::fromValue<QObject *>( pObject ));
74 
75  return pObject;
76  }
77 
78  private:
79  Q_DISABLE_COPY(MarkupList);
80 };
81 
83 {
84  qRegisterMetaType< MarkupList* >();
85 
87 }
88 
89 } // namespace DTC
90 
91 #endif
markup.h
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
DTC::MarkupList::AddNewMarkup
Markup * AddNewMarkup()
Definition: markupList.h:56
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
DTC::Markup::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: markup.h:59
DTC::Markup
Definition: markup.h:26
datacontracthelper.h
serviceexp.h
DTC::MarkupList::AddNewSeek
Markup * AddNewSeek()
Definition: markupList.h:67
DTC
Definition: datacontracthelper.h:123
DTC::MarkupList::Copy
void Copy(const MarkupList *src)
Definition: markupList.h:50
DTC::MarkupList
Definition: markupList.h:25
DTC::MarkupList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: markupList.h:82