-
Notifications
You must be signed in to change notification settings - Fork 1
/
qhtspdvrentry.h
144 lines (122 loc) · 3.93 KB
/
qhtspdvrentry.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* Copyright (C) 2012 Robert Meijers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QHTSPDVRENTRY_H
#define QHTSPDVRENTRY_H
#include <QDateTime>
#include <QExplicitlySharedDataPointer>
#include <QObject>
#include <QSharedData>
#include <QString>
#include "qhtspchannel.h"
#include "qhtspmessage.h"
class QHtsp;
class QHtspDvrEntryData : public QObject, public QSharedData
{
Q_OBJECT
public:
explicit QHtspDvrEntryData(QHtsp *htsp);
QHtspDvrEntryData(const QHtspDvrEntryData &other);
~QHtspDvrEntryData() { }
qint64 channelId;
QString description;
QString error;
QHtsp *htsp;
qint64 id;
quint16 state;
QDateTime start;
QDateTime stop;
QString title;
void setChannelId(qint64 channelId);
void setDescription(QString description);
void setError(QString error);
void setId(qint64 id);
void setState(quint16 state);
void setStart(QDateTime start);
void setStop(QDateTime stop);
void setTitle(QString title);
QHtspChannel *channel();
void parseMessage(QHtspMessage &message);
signals:
void channelChanged();
void descriptionChanged();
void errorChanged();
void idChanged();
void stateChanged();
void startChanged();
void stopChanged();
void titleChanged();
private:
QHtspChannel *m_channel;
};
class QHtspDvrEntry : public QObject
{
Q_OBJECT
Q_ENUMS(State)
Q_PROPERTY(QHtspChannel *channel READ channel NOTIFY channelChanged)
Q_PROPERTY(qint64 channelId READ channelId WRITE setChannelId NOTIFY channelChanged)
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
Q_PROPERTY(QString error READ error WRITE setError NOTIFY errorChanged)
Q_PROPERTY(qint64 id READ id WRITE setId NOTIFY idChanged)
Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(QDateTime start READ start WRITE setStart NOTIFY startChanged)
Q_PROPERTY(QDateTime stop READ stop WRITE setStop NOTIFY stopChanged)
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
public:
enum State {
Completed = 2,
Invalid = 3,
Missed = 4,
Recording = 1,
Scheduled = 0
};
explicit QHtspDvrEntry(QHtsp *htsp, QObject *parent = 0);
QHtspDvrEntry(QHtspMessage &message, QHtsp *htsp, QObject *parent = 0);
QHtspDvrEntry(const QHtspDvrEntry &dvrEntry, QObject *parent = 0);
QHtspChannel *channel();
qint64 channelId();
QString description();
QString error();
qint64 id();
State state();
QDateTime start();
QDateTime stop();
QString title();
void setChannelId(qint64 channelId);
void setDescription(QString description);
void setError(QString error);
void setId(qint64 id);
void setState(State state);
void setStart(QDateTime start);
void setStop(QDateTime stop);
void setTitle(QString title);
Q_INVOKABLE void cancel();
Q_INVOKABLE void remove();
void update(QHtspMessage &message);
signals:
void channelChanged();
void descriptionChanged();
void errorChanged();
void idChanged();
void stateChanged();
void startChanged();
void stopChanged();
void titleChanged();
private:
QExplicitlySharedDataPointer<QHtspDvrEntryData> d;
void _connectSignals();
};
#endif // QHTSPDVRENTRY_H