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 )
28  Q_PROPERTY( QVariantList Applications READ Applications )
29  Q_PROPERTY( QVariantList LogMessages READ LogMessages )
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  auto *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  auto *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  auto *pObject = new LogMessage( this );
82  m_LogMessages.append( QVariant::fromValue<QObject *>( pObject ));
83 
84  return pObject;
85  }
86 
87  private:
89 };
90 
92 {
93  qRegisterMetaType< LogMessageList* >();
94 
97 }
98 
99 } // namespace DTC
100 
101 #endif
DTC::LogMessageList::Q_CLASSINFO
Q_CLASSINFO("HostNames", "type=DTC::LabelValue")
DTC::LogMessageList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: logMessageList.h:91
DTC::LogMessageList::Q_CLASSINFO
Q_CLASSINFO("Applications", "type=DTC::LabelValue")
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
DTC::LogMessageList::AddNewApplication
LabelValue * AddNewApplication()
Definition: logMessageList.h:65
DTC::LogMessageList::Q_CLASSINFO
Q_CLASSINFO("version", "1.0")
DTC::LogMessageList::Copy
void Copy(const LogMessageList *src)
Definition: logMessageList.h:44
DTC::LogMessageList::Q_CLASSINFO
Q_CLASSINFO("LogMessages", "type=DTC::LogMessage")
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:100
DTC::LogMessageList
Definition: logMessageList.h:16
DTC::LogMessage
Definition: logMessage.h:21
datacontracthelper.h
logMessage.h
serviceexp.h
DTC::LogMessage::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: logMessage.h:98
DTC::LogMessageList::AddNewLogMessage
LogMessage * AddNewLogMessage()
Definition: logMessageList.h:76
DTC::LabelValue::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: labelValue.h:68
labelValue.h
DTC::LogMessageList::AddNewHostName
LabelValue * AddNewHostName()
Definition: logMessageList.h:54
DTC
Definition: datacontracthelper.h:110
LogMessage
QList< QByteArray > LogMessage
Definition: loggingserver.h:127
DTC::LabelValue
Definition: labelValue.h:20
DTC::LogMessageList::Q_DISABLE_COPY
Q_DISABLE_COPY(LogMessageList)