MythTV  master
recStatus.cpp
Go to the documentation of this file.
1 #include "recStatus.h"
2 #include "mythdate.h"
3 
5 {
6  if (recstatus == RecStatus::Recorded ||
7  recstatus == RecStatus::WillRecord ||
8  recstatus == RecStatus::Pending)
9  return "normal";
10 
11  if (recstatus == RecStatus::Recording ||
12  recstatus == RecStatus::Tuning)
13  return "running";
14 
15  if (recstatus == RecStatus::Conflict ||
16  recstatus == RecStatus::Offline ||
17  recstatus == RecStatus::TunerBusy ||
18  recstatus == RecStatus::Failed ||
19  recstatus == RecStatus::Aborted ||
20  recstatus == RecStatus::Missed ||
21  recstatus == RecStatus::Failing)
22  {
23  return "error";
24  }
25 
26  if (recstatus == RecStatus::Repeat ||
27  recstatus == RecStatus::NeverRecord ||
28  recstatus == RecStatus::DontRecord ||
29  (recstatus != RecStatus::DontRecord &&
30  recstatus <= RecStatus::EarlierShowing))
31  {
32  return "disabled";
33  }
34 
35  return "warning";
36 }
37 
40 {
41  return toString(recstatus, QString::number(id));
42 }
43 
45 QString RecStatus::toString(RecStatus::Type recstatus, const QString &name)
46 {
47  QString ret = "-";
48  switch (recstatus)
49  {
50  case RecStatus::Aborted:
51  ret = QObject::tr("A", "RecStatusChar RecStatus::Aborted");
52  break;
54  ret = QObject::tr("R", "RecStatusChar RecStatus::Recorded");
55  break;
57  ret = name;
58  break;
59  case RecStatus::Tuning:
60  ret = name;
61  break;
62  case RecStatus::Failing:
63  ret = name;
64  break;
66  ret = name;
67  break;
68  case RecStatus::Pending:
69  ret = name;
70  break;
72  ret = QObject::tr("X", "RecStatusChar RecStatus::DontRecord");
73  break;
75  ret = QObject::tr("P", "RecStatusChar RecStatus::PreviousRecording");
76  break;
78  ret = QObject::tr("R", "RecStatusChar RecStatus::CurrentRecording");
79  break;
81  ret = QObject::tr("E", "RecStatusChar RecStatus::EarlierShowing");
82  break;
84  ret = QObject::tr("T", "RecStatusChar RecStatus::TooManyRecordings");
85  break;
87  ret = QObject::tr("c", "RecStatusChar RecStatus::Cancelled");
88  break;
90  case RecStatus::Missed:
91  ret = QObject::tr("M", "RecStatusChar RecStatus::Missed");
92  break;
94  ret = QObject::tr("C", "RecStatusChar RecStatus::Conflict");
95  break;
97  ret = QObject::tr("L", "RecStatusChar RecStatus::LaterShowing");
98  break;
99  case RecStatus::Repeat:
100  ret = QObject::tr("r", "RecStatusChar RecStatus::Repeat");
101  break;
102  case RecStatus::Inactive:
103  ret = QObject::tr("x", "RecStatusChar RecStatus::Inactive");
104  break;
106  ret = QObject::tr("K", "RecStatusChar RecStatus::LowDiskSpace");
107  break;
109  ret = QObject::tr("B", "RecStatusChar RecStatus::TunerBusy");
110  break;
111  case RecStatus::Failed:
112  ret = QObject::tr("f", "RecStatusChar RecStatus::Failed");
113  break;
115  ret = QObject::tr("N", "RecStatusChar RecStatus::NotListed");
116  break;
118  ret = QObject::tr("V", "RecStatusChar RecStatus::NeverRecord");
119  break;
120  case RecStatus::Offline:
121  ret = QObject::tr("F", "RecStatusChar RecStatus::Offline");
122  break;
123  case RecStatus::Unknown:
124  break;
125  }
126 
127  return (ret.isEmpty()) ? QString("-") : ret;
128 }
129 
132 {
133  if (recstatus == RecStatus::Unknown && rectype == kNotRecording)
134  return QObject::tr("Not Recording");
135 
136  switch (recstatus)
137  {
138  case RecStatus::Aborted:
139  return QObject::tr("Aborted");
140  case RecStatus::Recorded:
141  return QObject::tr("Recorded");
143  return QObject::tr("Recording");
144  case RecStatus::Tuning:
145  return QObject::tr("Tuning");
146  case RecStatus::Failing:
147  return QObject::tr("Failing");
149  return QObject::tr("Will Record");
150  case RecStatus::Pending:
151  return QObject::tr("Pending");
153  return QObject::tr("Don't Record");
155  return QObject::tr("Previously Recorded");
157  return QObject::tr("Currently Recorded");
159  return QObject::tr("Earlier Showing");
161  return QObject::tr("Max Recordings");
163  return QObject::tr("Manual Cancel");
165  case RecStatus::Missed:
166  return QObject::tr("Missed");
167  case RecStatus::Conflict:
168  return QObject::tr("Conflicting");
170  return QObject::tr("Later Showing");
171  case RecStatus::Repeat:
172  return QObject::tr("Repeat");
173  case RecStatus::Inactive:
174  return QObject::tr("Inactive");
176  return QObject::tr("Low Disk Space");
178  return QObject::tr("Tuner Busy");
179  case RecStatus::Failed:
180  return QObject::tr("Recorder Failed");
182  return QObject::tr("Not Listed");
184  return QObject::tr("Never Record");
185  case RecStatus::Offline:
186  return QObject::tr("Recorder Off-Line");
187  case RecStatus::Unknown:
188  return QObject::tr("Unknown");
189  }
190 
191  return QObject::tr("Unknown");
192 }
193 
196  const QDateTime &recstartts)
197 {
198  if (recstatus == RecStatus::Unknown && rectype == kNotRecording)
199  return QObject::tr("This showing is not scheduled to record");
200 
201  QString message;
202  QDateTime now = MythDate::current();
203 
204  if (recstatus <= RecStatus::WillRecord)
205  {
206  switch (recstatus)
207  {
209  message = QObject::tr("This showing will be recorded.");
210  break;
211  case RecStatus::Pending:
212  message = QObject::tr("This showing is about to record.");
213  break;
215  message = QObject::tr("This showing is being recorded.");
216  break;
217  case RecStatus::Tuning:
218  message = QObject::tr("The showing is being tuned.");
219  break;
220  case RecStatus::Failing:
221  message = QObject::tr("The showing is failing to record "
222  "because of errors.");
223  break;
224  case RecStatus::Recorded:
225  message = QObject::tr("This showing was recorded.");
226  break;
227  case RecStatus::Aborted:
228  message = QObject::tr("This showing was recorded but was "
229  "aborted before completion.");
230  break;
231  case RecStatus::Missed:
233  message = QObject::tr("This showing was not recorded because "
234  "the master backend was not running.");
235  break;
237  message = QObject::tr("This showing was not recorded because "
238  "it was manually cancelled.");
239  break;
241  message = QObject::tr("This showing was not recorded because "
242  "there wasn't enough disk space.");
243  break;
245  message = QObject::tr("This showing was not recorded because "
246  "the recorder was already in use.");
247  break;
248  case RecStatus::Failed:
249  message = QObject::tr("This showing was not recorded because "
250  "the recorder failed.");
251  break;
252  default:
253  message = QObject::tr("The status of this showing is unknown.");
254  break;
255  }
256 
257  return message;
258  }
259 
260  if (recstartts > now)
261  message = QObject::tr("This showing will not be recorded because ");
262  else
263  message = QObject::tr("This showing was not recorded because ");
264 
265  switch (recstatus)
266  {
268  message += QObject::tr("it was manually set to not record.");
269  break;
271  message += QObject::tr("this episode was previously recorded "
272  "according to the duplicate policy chosen "
273  "for this title.");
274  break;
276  message += QObject::tr("this episode was previously recorded and "
277  "is still available in the list of "
278  "recordings.");
279  break;
281  message += QObject::tr("this episode will be recorded at an "
282  "earlier time instead.");
283  break;
285  message += QObject::tr("too many recordings of this program have "
286  "already been recorded.");
287  break;
288  case RecStatus::Conflict:
289  message += QObject::tr("another program with a higher priority "
290  "will be recorded.");
291  break;
293  message += QObject::tr("this episode will be recorded at a "
294  "later time instead.");
295  break;
296  case RecStatus::Repeat:
297  message += QObject::tr("this episode is a repeat.");
298  break;
299  case RecStatus::Inactive:
300  message += QObject::tr("this recording rule is inactive.");
301  break;
303  message += QObject::tr("this rule does not match any showings in "
304  "the current program listings.");
305  break;
307  message += QObject::tr("it was marked to never be recorded.");
308  break;
309  case RecStatus::Offline:
310  message += QObject::tr("the required recorder is off-line.");
311  break;
312  default:
313  if (recstartts > now)
314  message = QObject::tr("This showing will not be recorded.");
315  else
316  message = QObject::tr("This showing was not recorded.");
317  break;
318  }
319 
320  return message;
321 }
static QString toDescription(Type, RecordingType, const QDateTime &recstartts)
Converts "recstatus" into a long human readable description.
Definition: recStatus.cpp:195
unsigned int uint
Definition: compat.h:140
static QString toUIState(Type)
Definition: recStatus.cpp:4
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
static QString toString(Type, uint id)
Converts "recstatus" into a short (unreadable) string.
Definition: recStatus.cpp:39
const char * name
Definition: ParseText.cpp:328