-
Notifications
You must be signed in to change notification settings - Fork 1
/
qhtspevent.cpp
166 lines (138 loc) · 3.56 KB
/
qhtspevent.cpp
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
156
157
158
159
160
161
162
163
164
165
166
/*
* 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/>.
*/
#include "qhtspevent.h"
#include "qhtsp.h"
#include "qhtspchannel.h"
QHtspEvent::QHtspEvent(QHtsp *htsp, qint64 id, QObject *parent) :
QObject(parent)
{
d = new QHtspEventData(htsp, id);
_connectSignals();
}
QHtspEvent::QHtspEvent(QHtspMessage &message, QHtsp *htsp, QObject *parent) :
QObject(parent)
{
d = new QHtspEventData(htsp, -1);
d->parseMessage(message);
_connectSignals();
}
QHtspEvent::QHtspEvent(const QHtspEvent &event, QObject *parent) :
QObject(parent)
{
d = event.d;
_connectSignals();
}
qint64 QHtspEvent::id()
{
return d->id;
}
QHtspChannel *QHtspEvent::channel()
{
return d->channel();
}
qint64 QHtspEvent::channelId()
{
return d->channelId;
}
QString QHtspEvent::description()
{
return d->description;
}
QString QHtspEvent::longDescription()
{
return d->longDescription;
}
QHtspEvent *QHtspEvent::nextEvent()
{
return d->nextEvent();
}
qint64 QHtspEvent::nextEventId()
{
return d->nextEventId;
}
QHtspEvent *QHtspEvent::previousEvent()
{
return d->previousEvent();
}
QDateTime QHtspEvent::start()
{
return d->start;
}
QDateTime QHtspEvent::stop()
{
return d->stop;
}
QString QHtspEvent::title()
{
return d->title;
}
void QHtspEvent::setId(qint64 id)
{
d->setId(id);
}
void QHtspEvent::setChannelId(qint64 channelId)
{
d->setChannelId(channelId);
}
void QHtspEvent::setDescription(QString description)
{
d->setDescription(description);
}
void QHtspEvent::setLongDescription(QString description)
{
d->setLongDescription(description);
}
void QHtspEvent::setNextEventId(qint64 nextEventId)
{
d->setNextEventId(nextEventId);
}
void QHtspEvent::setStart(QDateTime start)
{
d->setStart(start);
}
void QHtspEvent::setStop(QDateTime stop)
{
d->setStop(stop);
}
void QHtspEvent::setTitle(QString title)
{
d->setTitle(title);
}
bool QHtspEvent::record()
{
if(!d->htsp)
return false;
d->htsp->addDvrEntry(id());
return true;
}
void QHtspEvent::update(QHtspMessage &message)
{
d->parseMessage(message);
}
void QHtspEvent::_connectSignals()
{
connect(d.data(), SIGNAL(channelIdChanged()), this, SIGNAL(channelIdChanged()));
connect(d.data(), SIGNAL(descriptionChanged()), this, SIGNAL(descriptionChanged()));
connect(d.data(), SIGNAL(idChanged()), this, SIGNAL(idChanged()));
connect(d.data(), SIGNAL(loaded()), this, SIGNAL(loaded()));
connect(d.data(), SIGNAL(longDescriptionChanged()), this, SIGNAL(longDescriptionChanged()));
connect(d.data(), SIGNAL(nextEventIdChanged()), this, SIGNAL(nextEventIdChanged()));
connect(d.data(), SIGNAL(previousEventChanged()), this, SIGNAL(previousEventChanged()));
connect(d.data(), SIGNAL(startChanged()), this, SIGNAL(startChanged()));
connect(d.data(), SIGNAL(stopChanged()), this, SIGNAL(stopChanged()));
connect(d.data(), SIGNAL(titleChanged()), this, SIGNAL(titleChanged()));
}