MythTV master
v2recStats.h
Go to the documentation of this file.
1
2// Program Name: v2resStats.h
3// Created : Oct. 18, 2021
4//
5// Copyright (c) 2026 Peter Bennett <pbennett@mythtv.org>
6//
7// Licensed under the GPL v2 or later, see COPYING for details
8//
10
11#ifndef V2RECSTATS_H_
12#define V2RECSTATS_H_
13
14#include <QDateTime>
15#include <QString>
16#include <QVariantList>
17
19
20
21class V2ShowStats : public QObject
22{
23 Q_OBJECT
24 Q_CLASSINFO( "Version", "1.0" );
25 SERVICE_PROPERTY2(QString, Title)
26 SERVICE_PROPERTY2(int, Count)
27 SERVICE_PROPERTY2(QDateTime, LastRecDate)
28 public:
29 Q_INVOKABLE V2ShowStats(QObject *parent = nullptr)
30 : QObject( parent )
31 {
32 }
33 private:
35};
37
38
39class V2RecStats : public QObject
40{
41 Q_OBJECT
42 Q_CLASSINFO( "Version", "1.0" );
43
44 Q_CLASSINFO( "Shows", "type=V2ShowStats")
45 Q_CLASSINFO( "Channels", "type=V2ShowStats")
46
47 SERVICE_PROPERTY2(int, ShowCount)
48 SERVICE_PROPERTY2(int, EpisodeCount)
49 SERVICE_PROPERTY2(QDateTime, FirstRecDate)
50 SERVICE_PROPERTY2(QDateTime, LastRecDate)
51 SERVICE_PROPERTY2(long long, RunTimeSecs)
52 SERVICE_PROPERTY2(long long, RecTimeSecs)
53 SERVICE_PROPERTY2( QVariantList, Shows )
54 SERVICE_PROPERTY2( QVariantList, Channels )
55
56 public:
57 Q_INVOKABLE V2RecStats(QObject *parent = nullptr)
58 : QObject(parent)
59 {
60 }
61 // These are here so that a routine in serviceutil
62 // can fill the QVariantlist. Unfortunately the standard
63 // call [e.g. GetShows()] generated by the macros returns a
64 // const QVariantlist.
65 QVariantList& GetShows() {return m_Shows;}
66 QVariantList& GetChannels() {return m_Channels;}
67
69 {
70 // We must make sure the object added to the QVariantList has
71 // a parent of 'this'
72 auto *pObject = new V2ShowStats( this );
73 m_Shows.append( QVariant::fromValue<QObject *>( pObject ));
74 return pObject;
75 }
76
78 {
79 // We must make sure the object added to the QVariantList has
80 // a parent of 'this'
81 auto *pObject = new V2ShowStats( this );
82 m_Channels.append( QVariant::fromValue<QObject *>( pObject ));
83 return pObject;
84 }
85
86 private:
88};
90
91#endif // V2RECSTATS_H_
V2ShowStats * AddNewShow()
Definition: v2recStats.h:68
Q_CLASSINFO("Version", "1.0")
QVariantList & GetChannels()
Definition: v2recStats.h:66
Q_DISABLE_COPY(V2RecStats)
QVariantList & GetShows()
Definition: v2recStats.h:65
V2ShowStats * AddNewChannel()
Definition: v2recStats.h:77
Q_CLASSINFO("Version", "1.0")
Q_INVOKABLE V2ShowStats(QObject *parent=nullptr)
Definition: v2recStats.h:29
Q_DISABLE_COPY(V2ShowStats)
Q_DECLARE_METATYPE(std::chrono::seconds)
#define SERVICE_PROPERTY2(Type, Name)