MythTV  master
mythtv/libs/libmythservicecontracts/datacontracts/encoder.h
Go to the documentation of this file.
1 // Program Name: encoder.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 ENCODER_H_
12 #define ENCODER_H_
13 
14 #include <QString>
15 
18 
19 #include "input.h"
20 #include "programAndChannel.h"
21 
22 namespace DTC
23 {
24 
26 
27 class SERVICE_PUBLIC Encoder : public QObject
28 {
29  Q_OBJECT
30  Q_CLASSINFO( "version" , "1.0" );
31 
32  Q_CLASSINFO( "Inputs", "type=DTC::Input");
33 
34  Q_PROPERTY( int Id READ Id WRITE setId )
35  Q_PROPERTY( QString HostName READ HostName WRITE setHostName )
36  Q_PROPERTY( bool Local READ Local WRITE setLocal )
37  Q_PROPERTY( bool Connected READ Connected WRITE setConnected )
38  Q_PROPERTY( int State READ State WRITE setState )
39  Q_PROPERTY( int SleepStatus READ SleepStatus WRITE setSleepStatus )
40  Q_PROPERTY( bool LowOnFreeSpace READ LowOnFreeSpace WRITE setLowOnFreeSpace )
41 
42  Q_PROPERTY( QVariantList Inputs READ Inputs )
43  Q_PROPERTY( QObject* Recording READ Recording )
44 
45  PROPERTYIMP ( int , Id )
46  PROPERTYIMP_REF( QString , HostName )
47  PROPERTYIMP ( bool , Local )
48  PROPERTYIMP ( bool , Connected )
49  PROPERTYIMP ( int , State )
50  PROPERTYIMP ( int , SleepStatus )
51  PROPERTYIMP ( bool , LowOnFreeSpace )
52 
54 
55  PROPERTYIMP_RO_REF( QVariantList, Inputs );
56 
57  public:
58 
59  static inline void InitializeCustomTypes();
60 
61  Q_INVOKABLE Encoder(QObject *parent = nullptr)
62  : QObject ( parent ),
63  m_Id ( 0 ),
64  m_Local ( true ),
65  m_Connected ( false ),
66  m_State ( 0 ),
67  m_SleepStatus ( 0 ),
68  m_LowOnFreeSpace( false ),
69  m_Recording ( nullptr )
70  {
71  }
72 
73  void Copy( const Encoder *src )
74  {
75  m_Id = src->m_Id ;
76  m_HostName = src->m_HostName ;
77  m_Local = src->m_Local ;
78  m_Connected = src->m_Connected ;
79  m_State = src->m_State ;
80  m_SleepStatus = src->m_SleepStatus ;
81  m_LowOnFreeSpace= src->m_LowOnFreeSpace;
82  m_Recording = nullptr ;
83 
84  if ( src->m_Recording != nullptr)
85  Recording()->Copy( src->m_Recording );
86 
87  CopyListContents< Input >( this, m_Inputs, src->m_Inputs );
88  }
89 
91  {
92  // We must make sure the object added to the QVariantList has
93  // a parent of 'this'
94 
95  auto *pObject = new Input( this );
96  Inputs().append( QVariant::fromValue<QObject *>( pObject ));
97 
98  return pObject;
99  }
100 
101  private:
102  Q_DISABLE_COPY(Encoder);
103 };
104 
106 {
107  qRegisterMetaType< Encoder* >();
108 
110 }
111 
112 } // namespace DTC
113 
114 #endif
DTC::Encoder::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:105
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:89
DTC::Program
Definition: programAndChannel.h:145
SleepStatus
SleepStatus
SleepStatus is an enumeration of the awake/sleep status of a slave.
Definition: tv.h:97
DTC::Encoder::AddNewInput
Input * AddNewInput()
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:90
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:95
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
DTC::Input
Definition: input.h:24
datacontracthelper.h
serviceexp.h
State
State
Definition: zmserver.h:68
DTC::Encoder::Copy
void Copy(const Encoder *src)
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:73
PROPERTYIMP_PTR
#define PROPERTYIMP_PTR(type, name)
Definition: datacontracthelper.h:102
Recording
static bool Recording(const RecordingInfo *p)
Definition: scheduler.cpp:221
programAndChannel.h
PROPERTYIMP
#define PROPERTYIMP(type, name)
Definition: datacontracthelper.h:56
DTC
Definition: datacontracthelper.h:123
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70
DTC::Program::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: programAndChannel.h:335
DTC::Encoder
Definition: mythtv/libs/libmythservicecontracts/datacontracts/encoder.h:27
input.h