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 
46 QString RecStatus::toString(RecStatus::Type recstatus, const QString &name)
47 {
48  QString ret = "-";
49  switch (recstatus)
50  {
51  case RecStatus::Aborted:
52  ret = QObject::tr("A", "RecStatusChar RecStatus::Aborted");
53  break;
55  ret = QObject::tr("R", "RecStatusChar RecStatus::Recorded");
56  break;
58  case RecStatus::Tuning:
59  case RecStatus::Failing:
61  case RecStatus::Pending:
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;
83  case RecStatus::Missed:
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;
92  case RecStatus::Repeat:
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;
104  case RecStatus::Failed:
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;
113  case RecStatus::Offline:
114  ret = QObject::tr("F", "RecStatusChar RecStatus::Offline");
115  break;
116  case RecStatus::Unknown:
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  {
131  case RecStatus::Aborted:
132  return QObject::tr("Aborted");
133  case RecStatus::Recorded:
134  return QObject::tr("Recorded");
136  return QObject::tr("Recording");
137  case RecStatus::Tuning:
138  return QObject::tr("Tuning");
139  case RecStatus::Failing:
140  return QObject::tr("Failing");
142  return QObject::tr("Will Record");
143  case RecStatus::Pending:
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");
158  case RecStatus::Missed:
159  return QObject::tr("Missed");
160  case RecStatus::Conflict:
161  return QObject::tr("Conflicting");
163  return QObject::tr("Later Showing");
164  case RecStatus::Repeat:
165  return QObject::tr("Repeat");
166  case RecStatus::Inactive:
167  return QObject::tr("Inactive");
169  return QObject::tr("Low Disk Space");
171  return QObject::tr("Tuner Busy");
172  case RecStatus::Failed:
173  return QObject::tr("Recorder Failed");
175  return QObject::tr("Not Listed");
177  return QObject::tr("Never Record");
178  case RecStatus::Offline:
179  return QObject::tr("Recorder Off-Line");
180  case RecStatus::Unknown:
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;
204  case RecStatus::Pending:
205  message = QObject::tr("This showing is about to record.");
206  break;
208  message = QObject::tr("This showing is being recorded.");
209  break;
210  case RecStatus::Tuning:
211  message = QObject::tr("The showing is being tuned.");
212  break;
213  case RecStatus::Failing:
214  message = QObject::tr("The showing is failing to record "
215  "because of errors.");
216  break;
217  case RecStatus::Recorded:
218  message = QObject::tr("This showing was recorded.");
219  break;
220  case RecStatus::Aborted:
221  message = QObject::tr("This showing was recorded but was "
222  "aborted before completion.");
223  break;
224  case RecStatus::Missed:
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;
241  case RecStatus::Failed:
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;
281  case RecStatus::Conflict:
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;
289  case RecStatus::Repeat:
290  message += QObject::tr("this episode is a repeat.");
291  break;
292  case RecStatus::Inactive:
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;
302  case RecStatus::Offline:
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 }
RecStatus::Type
Type
Definition: recordingstatus.h:16
RecStatus::toUIState
static QString toUIState(RecStatus::Type recstatus)
Definition: recordingstatus.cpp:5
RecStatus::LaterShowing
@ LaterShowing
Definition: recordingstatus.h:40
RecStatus::NeverRecord
@ NeverRecord
Definition: recordingstatus.h:43
RecStatus::Tuning
@ Tuning
Definition: recordingstatus.h:22
RecStatus::Cancelled
@ Cancelled
Definition: recordingstatus.h:26
recordingstatus.h
RecStatus::TunerBusy
@ TunerBusy
Definition: recordingstatus.h:24
RecStatus::Unknown
@ Unknown
Definition: recordingstatus.h:32
RecStatus::Recorded
@ Recorded
Definition: recordingstatus.h:29
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
RecStatus::toString
static QString toString(RecStatus::Type recstatus, uint id)
Converts "recstatus" into a short (unreadable) string.
Definition: recordingstatus.cpp:40
RecStatus::WillRecord
@ WillRecord
Definition: recordingstatus.h:31
mythdate.h
RecStatus::TooManyRecordings
@ TooManyRecordings
Definition: recordingstatus.h:37
RecStatus::PreviousRecording
@ PreviousRecording
Definition: recordingstatus.h:34
RecStatus::toDescription
static QString toDescription(Type recstatus, RecordingType rectype, const QDateTime &recstartts)
Converts "recstatus" into a long human readable description.
Definition: recordingstatus.cpp:188
RecStatus::Failing
@ Failing
Definition: recordingstatus.h:18
RecStatus::Aborted
@ Aborted
Definition: recordingstatus.h:28
RecStatus::Conflict
@ Conflict
Definition: recordingstatus.h:39
RecStatus::Failed
@ Failed
Definition: recordingstatus.h:23
RecStatus::Missed
@ Missed
Definition: recordingstatus.h:27
uint
unsigned int uint
Definition: compat.h:79
RecStatus::Offline
@ Offline
Definition: recordingstatus.h:44
RecStatus::Pending
@ Pending
Definition: recordingstatus.h:17
RecStatus::Recording
@ Recording
Definition: recordingstatus.h:30
RecStatus::DontRecord
@ DontRecord
Definition: recordingstatus.h:33
RecStatus::Inactive
@ Inactive
Definition: recordingstatus.h:42
kNotRecording
@ kNotRecording
Definition: recordingtypes.h:22
RecStatus::EarlierShowing
@ EarlierShowing
Definition: recordingstatus.h:36
RecStatus::CurrentRecording
@ CurrentRecording
Definition: recordingstatus.h:35
RecStatus::NotListed
@ NotListed
Definition: recordingstatus.h:38
RecStatus::Repeat
@ Repeat
Definition: recordingstatus.h:41
RecStatus::MissedFuture
@ MissedFuture
Definition: recordingstatus.h:21
RecStatus::LowDiskSpace
@ LowDiskSpace
Definition: recordingstatus.h:25
RecordingType
RecordingType
Definition: recordingtypes.h:20