MythTV  master
programAndChannel.h
Go to the documentation of this file.
1 // Program Name: program.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 COPYING for details
8 //
10 
11 #ifndef PROGRAM_H_
12 #define PROGRAM_H_
13 
14 #include <QDateTime>
15 #include <QString>
16 
17 #include "serviceexp.h"
18 #include "datacontracthelper.h"
19 
20 #include "recording.h"
21 #include "artworkInfoList.h"
22 #include "castMemberList.h"
23 
24 namespace DTC
25 {
26 
27 class Program;
28 
29 
30 class SERVICE_PUBLIC ChannelInfo : public QObject
31 {
32  Q_OBJECT
33  Q_CLASSINFO( "version", "2.2" );
34 
35  // Q_CLASSINFO Used to augment Metadata for properties.
36  // See datacontracthelper.h for details
37 
38  Q_CLASSINFO( "Programs", "type=DTC::Program");
39 
40  Q_PROPERTY( uint ChanId READ ChanId WRITE setChanId )
41  Q_PROPERTY( QString ChanNum READ ChanNum WRITE setChanNum )
42  Q_PROPERTY( QString CallSign READ CallSign WRITE setCallSign )
43  Q_PROPERTY( QString IconURL READ IconURL WRITE setIconURL )
44  Q_PROPERTY( QString ChannelName READ ChannelName WRITE setChannelName )
45 
46  Q_PROPERTY( uint MplexId READ MplexId WRITE setMplexId )
47  Q_PROPERTY( uint ServiceId READ ServiceId WRITE setServiceId )
48  Q_PROPERTY( uint ATSCMajorChan READ ATSCMajorChan WRITE setATSCMajorChan )
49  Q_PROPERTY( uint ATSCMinorChan READ ATSCMinorChan WRITE setATSCMinorChan )
50  Q_PROPERTY( QString Format READ Format WRITE setFormat )
51  Q_PROPERTY( QString FrequencyId READ FrequencyId WRITE setFrequencyId )
52  Q_PROPERTY( int FineTune READ FineTune WRITE setFineTune )
53  Q_PROPERTY( QString ChanFilters READ ChanFilters WRITE setChanFilters )
54  Q_PROPERTY( int SourceId READ SourceId WRITE setSourceId )
55  Q_PROPERTY( int InputId READ InputId WRITE setInputId )
56  Q_PROPERTY( bool CommFree READ CommFree WRITE setCommFree )
57  Q_PROPERTY( bool UseEIT READ UseEIT WRITE setUseEIT )
58  Q_PROPERTY( bool Visible READ Visible WRITE setVisible )
59  Q_PROPERTY( QString ExtendedVisible READ ExtendedVisible WRITE setExtendedVisible )
60  Q_PROPERTY( QString XMLTVID READ XMLTVID WRITE setXMLTVID )
61  Q_PROPERTY( QString DefaultAuth READ DefaultAuth WRITE setDefaultAuth )
62  Q_PROPERTY( QString ChannelGroups READ ChannelGroups WRITE setChannelGroups )
63  Q_PROPERTY( QString Inputs READ Inputs WRITE setInputs )
64  Q_PROPERTY( uint ServiceType READ ServiceType WRITE setServiceType )
65 
66  Q_PROPERTY( QVariantList Programs READ Programs )
67 
68  PROPERTYIMP ( uint , ChanId )
69  PROPERTYIMP_REF ( QString , ChanNum )
70  PROPERTYIMP_REF ( QString , CallSign )
71  PROPERTYIMP_REF ( QString , IconURL )
72  PROPERTYIMP_REF ( QString , ChannelName )
73  PROPERTYIMP ( uint , MplexId )
74  PROPERTYIMP ( uint , ServiceId )
75  PROPERTYIMP ( uint , ATSCMajorChan )
76  PROPERTYIMP ( uint , ATSCMinorChan )
77  PROPERTYIMP_REF ( QString , Format )
78  PROPERTYIMP_REF ( QString , FrequencyId )
79  PROPERTYIMP ( int , FineTune )
80  PROPERTYIMP_REF ( QString , ChanFilters )
81  PROPERTYIMP ( int , SourceId )
82  PROPERTYIMP ( int , InputId )
83  PROPERTYIMP ( bool , CommFree )
84  PROPERTYIMP ( bool , UseEIT )
85  PROPERTYIMP ( bool , Visible )
86  PROPERTYIMP_REF ( QString , ExtendedVisible )
87  PROPERTYIMP_REF ( QString , XMLTVID )
88  PROPERTYIMP_REF ( QString , DefaultAuth )
89  PROPERTYIMP_REF ( QString , ChannelGroups )
90  PROPERTYIMP_REF ( QString , Inputs )
91  PROPERTYIMP ( uint , ServiceType )
92 
93  PROPERTYIMP_RO_REF( QVariantList, Programs )
94 
95  // Used only by Serializer
96  PROPERTYIMP( bool, SerializeDetails )
97 
98  public:
99 
100  static void InitializeCustomTypes();
101 
102  Q_INVOKABLE explicit ChannelInfo(QObject *parent = nullptr)
103  : QObject ( parent ),
104  m_ChanId ( 0 ),
105  m_MplexId ( 0 ),
106  m_ServiceId ( 0 ),
107  m_ATSCMajorChan ( 0 ),
108  m_ATSCMinorChan ( 0 ),
109  m_FineTune ( 0 ),
110  m_SourceId ( 0 ),
111  m_InputId ( 0 ),
112  m_CommFree ( false ),
113  m_UseEIT ( false ),
114  m_Visible ( true ),
115  m_ServiceType ( 0 ),
116  m_SerializeDetails( true )
117  {
118  }
119 
120  void Copy( const ChannelInfo *src )
121  {
122  m_ChanId = src->m_ChanId ;
123  m_ChanNum = src->m_ChanNum ;
124  m_CallSign = src->m_CallSign ;
125  m_IconURL = src->m_IconURL ;
126  m_ChannelName = src->m_ChannelName ;
127  m_ChanFilters = src->m_ChanFilters ;
128  m_SourceId = src->m_SourceId ;
129  m_InputId = src->m_InputId ;
130  m_CommFree = src->m_CommFree ;
131  m_UseEIT = src->m_UseEIT ;
132  m_Visible = src->m_Visible ;
133  m_ChannelGroups = src->m_ChannelGroups;
134  m_Inputs = src->m_Inputs;
135 
136  CopyListContents< Program >( this, m_Programs, src->m_Programs );
137  }
138 
139  Program *AddNewProgram();
140 
141  private:
143 };
144 
145 class SERVICE_PUBLIC Program : public QObject
146 {
147  Q_OBJECT
148  Q_CLASSINFO( "version" , "1.11" );
149  Q_CLASSINFO( "defaultProp", "Description" );
150  Q_CLASSINFO( "deprecated" , "FileSize,FileName,HostName");
151 
152  Q_PROPERTY( QDateTime StartTime READ StartTime WRITE setStartTime )
153  Q_PROPERTY( QDateTime EndTime READ EndTime WRITE setEndTime )
154  Q_PROPERTY( QString Title READ Title WRITE setTitle )
155  Q_PROPERTY( QString SubTitle READ SubTitle WRITE setSubTitle )
156  Q_PROPERTY( QString Category READ Category WRITE setCategory )
157  Q_PROPERTY( QString CatType READ CatType WRITE setCatType )
158  Q_PROPERTY( bool Repeat READ Repeat WRITE setRepeat )
159  Q_PROPERTY( int VideoProps READ VideoProps WRITE setVideoProps)
160  Q_PROPERTY( int AudioProps READ AudioProps WRITE setAudioProps)
161  Q_PROPERTY( int SubProps READ SubProps WRITE setSubProps )
162 
163  Q_PROPERTY( QString SeriesId READ SeriesId WRITE setSeriesId )
164  Q_PROPERTY( QString ProgramId READ ProgramId WRITE setProgramId )
165  Q_PROPERTY( double Stars READ Stars WRITE setStars )
166  Q_PROPERTY( QDateTime LastModified READ LastModified WRITE setLastModified )
167  Q_PROPERTY( int ProgramFlags READ ProgramFlags WRITE setProgramFlags )
168  Q_PROPERTY( QDate Airdate READ Airdate WRITE setAirdate )
169  Q_PROPERTY( QString Description READ Description WRITE setDescription )
170  Q_PROPERTY( QString Inetref READ Inetref WRITE setInetref )
171  Q_PROPERTY( int Season READ Season WRITE setSeason )
172  Q_PROPERTY( int Episode READ Episode WRITE setEpisode )
173  Q_PROPERTY( int TotalEpisodes READ TotalEpisodes WRITE setTotalEpisodes )
174 
175  // ----
176  // DEPRECATED
177  // These don't belong here, they are Recording only metadata
178  Q_PROPERTY( qlonglong FileSize READ FileSize WRITE setFileSize )
179  Q_PROPERTY( QString FileName READ FileName WRITE setFileName )
180  Q_PROPERTY( QString HostName READ HostName WRITE setHostName )
181  // ----
182 
183  Q_PROPERTY( QObject* Channel READ Channel )
184  Q_PROPERTY( QObject* Recording READ Recording )
185  Q_PROPERTY( QObject* Artwork READ Artwork )
186  Q_PROPERTY( QObject* Cast READ Cast )
187 
188  PROPERTYIMP_REF( QDateTime , StartTime )
189  PROPERTYIMP_REF( QDateTime , EndTime )
190  PROPERTYIMP_REF( QString , Title )
191  PROPERTYIMP_REF( QString , SubTitle )
192  PROPERTYIMP_REF( QString , Category )
193  PROPERTYIMP_REF( QString , CatType )
194  PROPERTYIMP ( bool , Repeat )
195 
196  PROPERTYIMP_REF( QString , SeriesId )
197  PROPERTYIMP_REF( QString , ProgramId )
198  PROPERTYIMP ( double , Stars )
199  PROPERTYIMP_REF( QDateTime , LastModified )
200  PROPERTYIMP ( int , ProgramFlags )
201  PROPERTYIMP ( int , VideoProps )
202  PROPERTYIMP ( int , AudioProps )
203  PROPERTYIMP ( int , SubProps )
204  PROPERTYIMP ( QDate , Airdate )
205  PROPERTYIMP_REF( QString , Description )
206  PROPERTYIMP_REF( QString , Inetref )
207  PROPERTYIMP ( int , Season )
208  PROPERTYIMP ( int , Episode )
209  PROPERTYIMP ( int , TotalEpisodes)
210 
211  // ----
212  // DEPRECATED
213  // These don't belong here, they are Recording only metadata
214  PROPERTYIMP ( qlonglong , FileSize )
215  PROPERTYIMP_REF( QString , FileName )
216  PROPERTYIMP_REF( QString , HostName )
217  // ----
218 
221  PROPERTYIMP_PTR( ArtworkInfoList, Artwork )
223 
224  // Used only by Serializer
225  PROPERTYIMP( bool, SerializeDetails )
226  PROPERTYIMP( bool, SerializeChannel )
227  PROPERTYIMP( bool, SerializeRecording )
228  PROPERTYIMP( bool, SerializeArtwork )
229  PROPERTYIMP( bool, SerializeCast );
230 
231  public:
232 
233  static inline void InitializeCustomTypes();
234 
235  Q_INVOKABLE explicit Program(QObject *parent = nullptr)
236  : QObject ( parent ),
237  m_Repeat ( false ),
238  m_Stars ( 0 ),
239  m_ProgramFlags ( 0 ),
240  m_VideoProps ( 0 ),
241  m_AudioProps ( 0 ),
242  m_SubProps ( 0 ),
243  m_Season ( 0 ),
244  m_Episode ( 0 ),
245  m_TotalEpisodes ( 0 ),
246  m_FileSize ( 0 ), // DEPRECATED
247  m_Channel ( nullptr ),
248  m_Recording ( nullptr ),
249  m_Artwork ( nullptr ),
250  m_Cast ( nullptr ),
251  m_SerializeDetails ( true ),
252  m_SerializeChannel ( true ),
253  m_SerializeRecording ( true ),
254  m_SerializeArtwork ( true ),
255  m_SerializeCast ( true )
256  {
257  }
258 
259  void Copy( const Program *src )
260  {
261  m_StartTime = src->m_StartTime;
262  m_EndTime = src->m_EndTime;
263  m_Title = src->m_Title;
264  m_SubTitle = src->m_SubTitle;
265  m_Category = src->m_Category;
266  m_CatType = src->m_CatType;
267  m_Repeat = src->m_Repeat;
268  m_SeriesId = src->m_SeriesId;
269  m_ProgramId = src->m_ProgramId;
270  m_Stars = src->m_Stars;
271  m_LastModified = src->m_LastModified;
272  m_ProgramFlags = src->m_ProgramFlags;
273  m_VideoProps = src->m_VideoProps;
274  m_AudioProps = src->m_AudioProps;
275  m_SubProps = src->m_SubProps;
276  m_Airdate = src->m_Airdate;
277  m_Description = src->m_Description;
278  m_Inetref = src->m_Inetref;
279  m_Season = src->m_Season;
280  m_Episode = src->m_Episode;
281  m_TotalEpisodes = src->m_TotalEpisodes;
282  // DEPRECATED
283  m_FileSize = src->m_FileSize;
284  m_FileName = src->m_FileName;
285  m_HostName = src->m_HostName;
286  // ----
287  m_SerializeDetails = src->m_SerializeDetails;
288  m_SerializeChannel = src->m_SerializeChannel;
289  m_SerializeRecording= src->m_SerializeRecording;
290  m_SerializeArtwork = src->m_SerializeArtwork;
291  m_SerializeCast = src->m_SerializeCast;
292 
293  if ( src->m_Channel != nullptr)
294  Channel()->Copy( src->m_Channel );
295 
296  if ( src->m_Recording != nullptr)
297  Recording()->Copy( src->m_Recording );
298 
299  if ( src->m_Artwork != nullptr)
300  Artwork()->Copy( src->m_Artwork );
301 
302  if (src->m_Cast != nullptr)
303  Cast()->Copy( src->m_Cast );
304  }
305 
306 };
307 
309 {
310  // We must make sure the object added to the QVariantList has
311  // a parent of 'this'
312 
313  auto *pObject = new Program( this );
314  m_Programs.append( QVariant::fromValue<QObject *>( pObject ));
315 
316  return pObject;
317 }
318 
320 {
321  qRegisterMetaType< ChannelInfo* >();
322 
323  if (QMetaType::type( "DTC::Program*" ) == 0)
325 }
326 
328 {
329  qRegisterMetaType< Program* >();
330 
331  if (QMetaType::type( "DTC::ChannelInfo*" ) == 0)
333 
334  if (QMetaType::type( "DTC::RecordingInfo*" ) == 0)
336 
337  if (QMetaType::type( "DTC::ArtworkInfoList*" ) == 0)
339 
340  if (QMetaType::type( "DTC::CastMemberList*" ) == 0)
342 }
343 
344 } // namespace DTC
345 
346 #endif
DTC::ChannelInfo::AddNewProgram
Program * AddNewProgram()
Definition: programAndChannel.h:308
Channel
Definition: channel.h:34
DTC::ArtworkInfoList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: artworkInfoList.h:68
recording.h
DTC::ChannelInfo::Copy
void Copy(const ChannelInfo *src)
Definition: programAndChannel.h:120
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
DTC::Program
Definition: programAndChannel.h:146
UseEIT
Definition: videosource.cpp:557
DTC::ChannelInfo::ChannelInfo
Q_INVOKABLE ChannelInfo(QObject *parent=nullptr)
Definition: programAndChannel.h:102
DTC::CastMemberList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: castMemberList.h:59
VideoProps
VideoProps
if VideoProps changes, the videoprop column in program and recordedprogram has to changed accordingly
Definition: programtypes.h:184
MythDate::Format
Format
Definition: mythdate.h:13
Stars
#define Stars
Definition: synaesthesia.h:21
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
Visible
Definition: channelsettings.cpp:392
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
DTC::CastMemberList
Definition: castMemberList.h:17
datacontracthelper.h
serviceexp.h
DTC::RecordingInfo
Definition: recording.h:26
uint
unsigned int uint
Definition: compat.h:141
DTC::ChannelInfo::Q_DISABLE_COPY
Q_DISABLE_COPY(ChannelInfo)
PROPERTYIMP_PTR
#define PROPERTYIMP_PTR(type, name)
Definition: datacontracthelper.h:102
DTC::RecordingInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: recording.h:124
Recording
static bool Recording(const RecordingInfo *p)
Definition: scheduler.cpp:216
DTC::ChannelInfo::Q_CLASSINFO
Q_CLASSINFO("version", "2.2")
AudioProps
AudioProps
if AudioProps changes, the audioprop column in program and recordedprogram has to changed accordingly
Definition: programtypes.h:169
PROPERTYIMP
#define PROPERTYIMP(type, name)
Definition: datacontracthelper.h:56
DTC
Definition: datacontracthelper.h:124
DTC::ChannelInfo::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: programAndChannel.h:319
DTC::Program::Copy
void Copy(const Program *src)
Definition: programAndChannel.h:259
DTC::Program::Q_CLASSINFO
Q_CLASSINFO("defaultProp", "Description")
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70
DTC::ChannelInfo
Definition: programAndChannel.h:31
DTC::Program::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: programAndChannel.h:327
artworkInfoList.h
DTC::Program::Q_CLASSINFO
Q_CLASSINFO("version", "1.11")
DTC::ArtworkInfoList
Definition: artworkInfoList.h:26
castMemberList.h