MythTV master
v2programList.h
Go to the documentation of this file.
1
2// Program Name: programs.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 V2PROGRAMLIST_H_
12#define V2PROGRAMLIST_H_
13
14#include <QChar> // Fix Qt6 GCC SFINAE warning
15#include <QDateTime>
16#include <QString>
17#include <QVariantList>
18
20
21#include "v2programAndChannel.h"
22
23class V2ProgramList : public QObject
24{
25 Q_OBJECT
26 Q_CLASSINFO( "Version", "1.0" );
27
28 Q_CLASSINFO( "Programs", "type=V2Program");
29 Q_CLASSINFO( "AsOf" , "transient=true" );
30
31 SERVICE_PROPERTY2( int , StartIndex )
32 SERVICE_PROPERTY2( int , Count )
33 SERVICE_PROPERTY2( int , TotalAvailable )
34 SERVICE_PROPERTY2( QDateTime , AsOf )
35 SERVICE_PROPERTY2( QString , Version )
36 SERVICE_PROPERTY2( QString , ProtoVer )
37 SERVICE_PROPERTY2( QVariantList, Programs );
38
39 public:
40
41 Q_INVOKABLE V2ProgramList(QObject *parent = nullptr)
42 : QObject( parent )
43 {
44 }
45
46 void Copy( const V2ProgramList *src )
47 {
48 m_StartIndex = src->m_StartIndex ;
49 m_Count = src->m_Count ;
50 m_TotalAvailable= src->m_TotalAvailable ;
51 m_AsOf = src->m_AsOf ;
52 m_Version = src->m_Version ;
53 m_ProtoVer = src->m_ProtoVer ;
54
55 CopyListContents< V2Program >( this, m_Programs, src->m_Programs );
56 }
57
58 // This is here so that a routine in serviceutil (FillUpcomingList)
59 // can fill the QVariantlist of programs. Unfortunately the standard
60 // call Programs() generated by the macros returns a const QVariantlist.
61 QVariantList& GetPrograms() {return m_Programs;}
62
64 {
65 // We must make sure the object added to the QVariantList has
66 // a parent of 'this'
67
68 auto *pObject = new V2Program( this );
69 m_Programs.append( QVariant::fromValue<QObject *>( pObject ));
70
71 return pObject;
72 }
73
74 private:
76};
77
79
80#endif
Q_CLASSINFO("AsOf", "transient=true")
V2Program * AddNewProgram()
Definition: v2programList.h:63
Q_CLASSINFO("Programs", "type=V2Program")
Q_DISABLE_COPY(V2ProgramList)
QVariantList & GetPrograms()
Definition: v2programList.h:61
SERVICE_PROPERTY2(QVariantList, Programs)
void Copy(const V2ProgramList *src)
Definition: v2programList.h:46
Q_CLASSINFO("Version", "1.0")
Q_DECLARE_METATYPE(std::chrono::seconds)