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 <QChar> // Fix Qt6 GCC SFINAE warning
15#include <QDateTime>
16#include <QString>
17#include <QVariantList>
18
20
21
22class V2ShowStats : public QObject
23{
24 Q_OBJECT
25 Q_CLASSINFO( "Version", "1.0" );
26 SERVICE_PROPERTY2(QString, Title)
27 SERVICE_PROPERTY2(int, Count)
28 SERVICE_PROPERTY2(QDateTime, LastRecDate)
29 public:
30 Q_INVOKABLE V2ShowStats(QObject *parent = nullptr)
31 : QObject( parent )
32 {
33 }
34 private:
36};
38
39
40class V2RecStats : public QObject
41{
42 Q_OBJECT
43 Q_CLASSINFO( "Version", "1.0" );
44
45 Q_CLASSINFO( "Shows", "type=V2ShowStats")
46 Q_CLASSINFO( "Channels", "type=V2ShowStats")
47
48 SERVICE_PROPERTY2(int, ShowCount)
49 SERVICE_PROPERTY2(int, EpisodeCount)
50 SERVICE_PROPERTY2(QDateTime, FirstRecDate)
51 SERVICE_PROPERTY2(QDateTime, LastRecDate)
52 SERVICE_PROPERTY2(long long, RunTimeSecs)
53 SERVICE_PROPERTY2(long long, RecTimeSecs)
54 SERVICE_PROPERTY2( QVariantList, Shows )
55 SERVICE_PROPERTY2( QVariantList, Channels )
56
57 public:
58 Q_INVOKABLE V2RecStats(QObject *parent = nullptr)
59 : QObject(parent)
60 {
61 }
62 // These are here so that a routine in serviceutil
63 // can fill the QVariantlist. Unfortunately the standard
64 // call [e.g. GetShows()] generated by the macros returns a
65 // const QVariantlist.
66 QVariantList& GetShows() {return m_Shows;}
67 QVariantList& GetChannels() {return m_Channels;}
68
70 {
71 // We must make sure the object added to the QVariantList has
72 // a parent of 'this'
73 auto *pObject = new V2ShowStats( this );
74 m_Shows.append( QVariant::fromValue<QObject *>( pObject ));
75 return pObject;
76 }
77
79 {
80 // We must make sure the object added to the QVariantList has
81 // a parent of 'this'
82 auto *pObject = new V2ShowStats( this );
83 m_Channels.append( QVariant::fromValue<QObject *>( pObject ));
84 return pObject;
85 }
86
87 private:
89};
91
92#endif // V2RECSTATS_H_
V2ShowStats * AddNewShow()
Definition: v2recStats.h:69
Q_CLASSINFO("Version", "1.0")
QVariantList & GetChannels()
Definition: v2recStats.h:67
Q_DISABLE_COPY(V2RecStats)
QVariantList & GetShows()
Definition: v2recStats.h:66
V2ShowStats * AddNewChannel()
Definition: v2recStats.h:78
Q_CLASSINFO("Version", "1.0")
Q_INVOKABLE V2ShowStats(QObject *parent=nullptr)
Definition: v2recStats.h:30
Q_DISABLE_COPY(V2ShowStats)
Q_DECLARE_METATYPE(std::chrono::seconds)
#define SERVICE_PROPERTY2(Type, Name)