MythTV  master
logMessageList.h
Go to the documentation of this file.
1 #ifndef LOGMESSAGELIST_H_
2 #define LOGMESSAGELIST_H_
3 
4 #include <QVariantList>
5 
6 #include "serviceexp.h"
7 #include "datacontracthelper.h"
8 
9 #include "labelValue.h"
10 #include "logMessage.h"
11 
12 namespace DTC
13 {
14 
15 class SERVICE_PUBLIC LogMessageList : 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( "HostNames", "type=DTC::LabelValue");
24  Q_CLASSINFO( "Applications", "type=DTC::LabelValue");
25  Q_CLASSINFO( "LogMessages", "type=DTC::LogMessage");
26 
27  Q_PROPERTY( QVariantList HostNames READ HostNames DESIGNABLE true )
28  Q_PROPERTY( QVariantList Applications READ Applications DESIGNABLE true )
29  Q_PROPERTY( QVariantList LogMessages READ LogMessages DESIGNABLE true )
30 
31  PROPERTYIMP_RO_REF( QVariantList, HostNames )
32  PROPERTYIMP_RO_REF( QVariantList, Applications )
33  PROPERTYIMP_RO_REF( QVariantList, LogMessages );
34 
35  public:
36 
37  static inline void InitializeCustomTypes();
38 
39  Q_INVOKABLE LogMessageList(QObject *parent = nullptr)
40  : QObject( parent )
41  {
42  }
43 
44  void Copy( const LogMessageList *src )
45  {
46  CopyListContents< LabelValue >( this, m_HostNames,
47  src->m_HostNames );
48  CopyListContents< LabelValue >( this, m_Applications,
49  src->m_Applications );
50  CopyListContents< LogMessage >( this, m_LogMessages,
51  src->m_LogMessages );
52  }
53 
55  {
56  // We must make sure the object added to the QVariantList has
57  // a parent of 'this'
58 
59  LabelValue *pObject = new LabelValue( this );
60  m_HostNames.append( QVariant::fromValue<QObject *>( pObject ));
61 
62  return pObject;
63  }
64 
66  {
67  // We must make sure the object added to the QVariantList has
68  // a parent of 'this'
69 
70  LabelValue *pObject = new LabelValue( this );
71  m_Applications.append( QVariant::fromValue<QObject *>( pObject ));
72 
73  return pObject;
74  }
75 
77  {
78  // We must make sure the object added to the QVariantList has
79  // a parent of 'this'
80 
81  LogMessage *pObject = new LogMessage( this );
82  m_LogMessages.append( QVariant::fromValue<QObject *>( pObject ));
83 
84  return pObject;
85  }
86 
87  private:
88  Q_DISABLE_COPY(LogMessageList);
89 };
90 
92 {
93  qRegisterMetaType< LogMessageList* >();
94 
96 }
97 
98 } // namespace DTC
99 
100 #endif
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
QList< QByteArray > LogMessage
void Copy(const LogMessageList *src)
static void InitializeCustomTypes()
Definition: logMessage.h:99
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
LabelValue * AddNewHostName()
#define PROPERTYIMP_RO_REF(type, name)
static void InitializeCustomTypes()
LabelValue * AddNewApplication()
LogMessage * AddNewLogMessage()