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