-
Notifications
You must be signed in to change notification settings - Fork 1
/
qhtspevent.h
155 lines (131 loc) · 4.46 KB
/
qhtspevent.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
145
146
147
148
149
150
151
152
153
154
155
/*
* 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 QHTSPEVENT_H
#define QHTSPEVENT_H
#include <QDateTime>
#include <QExplicitlySharedDataPointer>
#include <QMetaType>
#include <QObject>
#include <QSharedData>
#include <QString>
#include "qhtspmessage.h"
class QHtsp;
class QHtspChannel;
class QHtspEvent;
class QHtspEventData : public QObject, public QSharedData
{
Q_OBJECT
public:
QHtspEventData(QHtsp *htsp, int id = -1);
QHtspEventData(const QHtspEventData &other);
~QHtspEventData() { }
qint64 id;
qint64 channelId;
QString description;
QHtsp *htsp;
QString longDescription;
qint64 nextEventId;
QDateTime start;
QDateTime stop;
QString title;
void setId(qint64 id);
void setChannelId(qint64 channelId);
void setDescription(QString description);
void setLongDescription(QString description);
void setNextEventId(qint64 nextEventId);
void setStart(QDateTime start);
void setStop(QDateTime stop);
void setTitle(QString title);
QHtspChannel *channel();
QHtspEvent *nextEvent();
QHtspEvent *previousEvent();
void parseMessage(QHtspMessage &message);
signals:
void idChanged();
void channelIdChanged();
void descriptionChanged();
void longDescriptionChanged();
void nextEventIdChanged();
void previousEventChanged();
void startChanged();
void stopChanged();
void titleChanged();
void loaded();
private:
QHtspChannel *m_channel;
bool m_loaded;
QHtspEvent *m_nextEvent;
QHtspEvent *m_previousEvent;
bool m_previousEventSearched;
private slots:
void _previousEventDestroyed();
};
class QHtspEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(qint64 id READ id WRITE setId NOTIFY idChanged)
Q_PROPERTY(QHtspChannel *channel READ channel)
Q_PROPERTY(qint64 channelId READ channelId WRITE setChannelId NOTIFY channelIdChanged)
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
Q_PROPERTY(QString longDescription READ longDescription WRITE setLongDescription NOTIFY longDescriptionChanged)
Q_PROPERTY(QHtspEvent *nextEvent READ nextEvent NOTIFY nextEventIdChanged)
Q_PROPERTY(qint64 nextEventId READ nextEventId WRITE setNextEventId NOTIFY nextEventIdChanged)
Q_PROPERTY(QHtspEvent *previousEvent READ previousEvent NOTIFY previousEventChanged)
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:
QHtspEvent(QHtsp *htsp, qint64 id = -1, QObject *parent = 0);
QHtspEvent(QHtspMessage &message, QHtsp *htsp, QObject *parent = 0);
QHtspEvent(const QHtspEvent &event, QObject *parent = 0);
qint64 id();
QHtspChannel *channel();
qint64 channelId();
QString description();
QString longDescription();
QHtspEvent *nextEvent();
qint64 nextEventId();
QHtspEvent *previousEvent();
QDateTime start();
QDateTime stop();
QString title();
void setId(qint64 id);
void setChannelId(qint64 channelId);
void setDescription(QString description);
void setLongDescription(QString description);
void setNextEventId(qint64 nextEventId);
void setStart(QDateTime start);
void setStop(QDateTime stop);
void setTitle(QString title);
Q_INVOKABLE bool record();
void update(QHtspMessage &message);
signals:
void idChanged();
void channelIdChanged();
void descriptionChanged();
void longDescriptionChanged();
void nextEventIdChanged();
void previousEventChanged();
void startChanged();
void stopChanged();
void titleChanged();
void loaded();
private:
QExplicitlySharedDataPointer<QHtspEventData> d;
void _connectSignals();
};
#endif // QHTSPEVENT_H