MythTV master
recordingstatus.cpp
Go to the documentation of this file.
1#include "recordingstatus.h"
2
3#include "mythdate.h"
4
6{
7 if (recstatus == RecStatus::Recorded ||
8 recstatus == RecStatus::WillRecord ||
9 recstatus == RecStatus::Pending)
10 return "normal";
11
12 if (recstatus == RecStatus::Recording ||
13 recstatus == RecStatus::Tuning)
14 return "running";
15
16 if (recstatus == RecStatus::Conflict ||
17 recstatus == RecStatus::Offline ||
18 recstatus == RecStatus::TunerBusy ||
19 recstatus == RecStatus::Failed ||
20 recstatus == RecStatus::Aborted ||
21 recstatus == RecStatus::Missed ||
22 recstatus == RecStatus::Failing)
23 {
24 return "error";
25 }
26
27 if (recstatus == RecStatus::Repeat ||
28 recstatus == RecStatus::NeverRecord ||
29 recstatus == RecStatus::DontRecord ||
30 (recstatus != RecStatus::DontRecord &&
31 recstatus <= RecStatus::EarlierShowing))
32 {
33 return "disabled";
34 }
35
36 return "warning";
37}
38
41{
42 return toString(recstatus, QString::number(id));
43}
44
46QString RecStatus::toString(RecStatus::Type recstatus, const QString &name)
47{
48 QString ret = "-";
49 switch (recstatus)
50 {
52 ret = QObject::tr("A", "RecStatusChar RecStatus::Aborted");
53 break;
55 ret = QObject::tr("R", "RecStatusChar RecStatus::Recorded");
56 break;
62 ret = name;
63 break;
65 ret = QObject::tr("X", "RecStatusChar RecStatus::DontRecord");
66 break;
68 ret = QObject::tr("P", "RecStatusChar RecStatus::PreviousRecording");
69 break;
71 ret = QObject::tr("R", "RecStatusChar RecStatus::CurrentRecording");
72 break;
74 ret = QObject::tr("E", "RecStatusChar RecStatus::EarlierShowing");
75 break;
77 ret = QObject::tr("T", "RecStatusChar RecStatus::TooManyRecordings");
78 break;
80 ret = QObject::tr("c", "RecStatusChar RecStatus::Cancelled");
81 break;
84 ret = QObject::tr("M", "RecStatusChar RecStatus::Missed");
85 break;
87 ret = QObject::tr("C", "RecStatusChar RecStatus::Conflict");
88 break;
90 ret = QObject::tr("L", "RecStatusChar RecStatus::LaterShowing");
91 break;
93 ret = QObject::tr("r", "RecStatusChar RecStatus::Repeat");
94 break;
96 ret = QObject::tr("x", "RecStatusChar RecStatus::Inactive");
97 break;
99 ret = QObject::tr("K", "RecStatusChar RecStatus::LowDiskSpace");
100 break;
102 ret = QObject::tr("B", "RecStatusChar RecStatus::TunerBusy");
103 break;
105 ret = QObject::tr("f", "RecStatusChar RecStatus::Failed");
106 break;
108 ret = QObject::tr("N", "RecStatusChar RecStatus::NotListed");
109 break;
111 ret = QObject::tr("V", "RecStatusChar RecStatus::NeverRecord");
112 break;
114 ret = QObject::tr("F", "RecStatusChar RecStatus::Offline");
115 break;
117 break;
118 }
119
120 return (ret.isEmpty()) ? QString("-") : ret;
121}
122
125{
126 if (recstatus == RecStatus::Unknown && rectype == kNotRecording)
127 return QObject::tr("Not Recording");
128
129 switch (recstatus)
130 {
132 return QObject::tr("Aborted");
134 return QObject::tr("Recorded");
136 return QObject::tr("Recording");
138 return QObject::tr("Tuning");
140 return QObject::tr("Failing");
142 return QObject::tr("Will Record");
144 return QObject::tr("Pending");
146 return QObject::tr("Don't Record");
148 return QObject::tr("Previously Recorded");
150 return QObject::tr("Currently Recorded");
152 return QObject::tr("Earlier Showing");
154 return QObject::tr("Max Recordings");
156 return QObject::tr("Manual Cancel");
159 return QObject::tr("Missed");
161 return QObject::tr("Conflicting");
163 return QObject::tr("Later Showing");
165 return QObject::tr("Repeat");
167 return QObject::tr("Inactive");
169 return QObject::tr("Low Disk Space");
171 return QObject::tr("Tuner Busy");
173 return QObject::tr("Recorder Failed");
175 return QObject::tr("Not Listed");
177 return QObject::tr("Never Record");
179 return QObject::tr("Recorder Off-Line");
181 return QObject::tr("Unknown");
182 }
183
184 return QObject::tr("Unknown");
185}
186
189 const QDateTime &recstartts)
190{
191 if (recstatus == RecStatus::Unknown && rectype == kNotRecording)
192 return QObject::tr("This showing is not scheduled to record");
193
194 QString message;
195 QDateTime now = MythDate::current();
196
197 if (recstatus <= RecStatus::WillRecord)
198 {
199 switch (recstatus)
200 {
202 message = QObject::tr("This showing will be recorded.");
203 break;
205 message = QObject::tr("This showing is about to record.");
206 break;
208 message = QObject::tr("This showing is being recorded.");
209 break;
211 message = QObject::tr("The showing is being tuned.");
212 break;
214 message = QObject::tr("The showing is failing to record "
215 "because of errors.");
216 break;
218 message = QObject::tr("This showing was recorded.");
219 break;
221 message = QObject::tr("This showing was recorded but was "
222 "aborted before completion.");
223 break;
226 message = QObject::tr("This showing was not recorded because "
227 "the master backend was not running.");
228 break;
230 message = QObject::tr("This showing was not recorded because "
231 "it was manually cancelled.");
232 break;
234 message = QObject::tr("This showing was not recorded because "
235 "there wasn't enough disk space.");
236 break;
238 message = QObject::tr("This showing was not recorded because "
239 "the recorder was already in use.");
240 break;
242 message = QObject::tr("This showing was not recorded because "
243 "the recorder failed.");
244 break;
245 default:
246 message = QObject::tr("The status of this showing is unknown.");
247 break;
248 }
249
250 return message;
251 }
252
253 if (recstartts > now)
254 message = QObject::tr("This showing will not be recorded because ");
255 else
256 message = QObject::tr("This showing was not recorded because ");
257
258 switch (recstatus)
259 {
261 message += QObject::tr("it was manually set to not record.");
262 break;
264 message += QObject::tr("this episode was previously recorded "
265 "according to the duplicate policy chosen "
266 "for this title.");
267 break;
269 message += QObject::tr("this episode was previously recorded and "
270 "is still available in the list of "
271 "recordings.");
272 break;
274 message += QObject::tr("this episode will be recorded at an "
275 "earlier time instead.");
276 break;
278 message += QObject::tr("too many recordings of this program have "
279 "already been recorded.");
280 break;
282 message += QObject::tr("another program with a higher priority "
283 "will be recorded.");
284 break;
286 message += QObject::tr("this episode will be recorded at a "
287 "later time instead.");
288 break;
290 message += QObject::tr("this episode is a repeat.");
291 break;
293 message += QObject::tr("this recording rule is inactive.");
294 break;
296 message += QObject::tr("this rule does not match any showings in "
297 "the current program listings.");
298 break;
300 message += QObject::tr("it was marked to never be recorded.");
301 break;
303 message += QObject::tr("the required recorder is off-line.");
304 break;
305 default:
306 if (recstartts > now)
307 message = QObject::tr("This showing will not be recorded.");
308 else
309 message = QObject::tr("This showing was not recorded.");
310 break;
311 }
312
313 return message;
314}
static QString toDescription(Type recstatus, RecordingType rectype, const QDateTime &recstartts)
Converts "recstatus" into a long human readable description.
static QString toString(RecStatus::Type recstatus, uint id)
Converts "recstatus" into a short (unreadable) string.
static QString toUIState(RecStatus::Type recstatus)
unsigned int uint
Definition: freesurround.h:24
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:15
RecordingType
@ kNotRecording