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  case RecStatus::Tuning:
58  case RecStatus::Failing:
60  case RecStatus::Pending:
61  ret = name;
62  break;
64  ret = QObject::tr("X", "RecStatusChar RecStatus::DontRecord");
65  break;
67  ret = QObject::tr("P", "RecStatusChar RecStatus::PreviousRecording");
68  break;
70  ret = QObject::tr("R", "RecStatusChar RecStatus::CurrentRecording");
71  break;
73  ret = QObject::tr("E", "RecStatusChar RecStatus::EarlierShowing");
74  break;
76  ret = QObject::tr("T", "RecStatusChar RecStatus::TooManyRecordings");
77  break;
79  ret = QObject::tr("c", "RecStatusChar RecStatus::Cancelled");
80  break;
82  case RecStatus::Missed:
83  ret = QObject::tr("M", "RecStatusChar RecStatus::Missed");
84  break;
86  ret = QObject::tr("C", "RecStatusChar RecStatus::Conflict");
87  break;
89  ret = QObject::tr("L", "RecStatusChar RecStatus::LaterShowing");
90  break;
91  case RecStatus::Repeat:
92  ret = QObject::tr("r", "RecStatusChar RecStatus::Repeat");
93  break;
95  ret = QObject::tr("x", "RecStatusChar RecStatus::Inactive");
96  break;
98  ret = QObject::tr("K", "RecStatusChar RecStatus::LowDiskSpace");
99  break;
101  ret = QObject::tr("B", "RecStatusChar RecStatus::TunerBusy");
102  break;
103  case RecStatus::Failed:
104  ret = QObject::tr("f", "RecStatusChar RecStatus::Failed");
105  break;
107  ret = QObject::tr("N", "RecStatusChar RecStatus::NotListed");
108  break;
110  ret = QObject::tr("V", "RecStatusChar RecStatus::NeverRecord");
111  break;
112  case RecStatus::Offline:
113  ret = QObject::tr("F", "RecStatusChar RecStatus::Offline");
114  break;
115  case RecStatus::Unknown:
116  break;
117  }
118 
119  return (ret.isEmpty()) ? QString("-") : ret;
120 }
121 
124 {
125  if (recstatus == RecStatus::Unknown && rectype == kNotRecording)
126  return QObject::tr("Not Recording");
127 
128  switch (recstatus)
129  {
130  case RecStatus::Aborted:
131  return QObject::tr("Aborted");
132  case RecStatus::Recorded:
133  return QObject::tr("Recorded");
135  return QObject::tr("Recording");
136  case RecStatus::Tuning:
137  return QObject::tr("Tuning");
138  case RecStatus::Failing:
139  return QObject::tr("Failing");
141  return QObject::tr("Will Record");
142  case RecStatus::Pending:
143  return QObject::tr("Pending");
145  return QObject::tr("Don't Record");
147  return QObject::tr("Previously Recorded");
149  return QObject::tr("Currently Recorded");
151  return QObject::tr("Earlier Showing");
153  return QObject::tr("Max Recordings");
155  return QObject::tr("Manual Cancel");
157  case RecStatus::Missed:
158  return QObject::tr("Missed");
159  case RecStatus::Conflict:
160  return QObject::tr("Conflicting");
162  return QObject::tr("Later Showing");
163  case RecStatus::Repeat:
164  return QObject::tr("Repeat");
165  case RecStatus::Inactive:
166  return QObject::tr("Inactive");
168  return QObject::tr("Low Disk Space");
170  return QObject::tr("Tuner Busy");
171  case RecStatus::Failed:
172  return QObject::tr("Recorder Failed");
174  return QObject::tr("Not Listed");
176  return QObject::tr("Never Record");
177  case RecStatus::Offline:
178  return QObject::tr("Recorder Off-Line");
179  case RecStatus::Unknown:
180  return QObject::tr("Unknown");
181  }
182 
183  return QObject::tr("Unknown");
184 }
185 
188  const QDateTime &recstartts)
189 {
190  if (recstatus == RecStatus::Unknown && rectype == kNotRecording)
191  return QObject::tr("This showing is not scheduled to record");
192 
193  QString message;
194  QDateTime now = MythDate::current();
195 
196  if (recstatus <= RecStatus::WillRecord)
197  {
198  switch (recstatus)
199  {
201  message = QObject::tr("This showing will be recorded.");
202  break;
203  case RecStatus::Pending:
204  message = QObject::tr("This showing is about to record.");
205  break;
207  message = QObject::tr("This showing is being recorded.");
208  break;
209  case RecStatus::Tuning:
210  message = QObject::tr("The showing is being tuned.");
211  break;
212  case RecStatus::Failing:
213  message = QObject::tr("The showing is failing to record "
214  "because of errors.");
215  break;
216  case RecStatus::Recorded:
217  message = QObject::tr("This showing was recorded.");
218  break;
219  case RecStatus::Aborted:
220  message = QObject::tr("This showing was recorded but was "
221  "aborted before completion.");
222  break;
223  case RecStatus::Missed:
225  message = QObject::tr("This showing was not recorded because "
226  "the master backend was not running.");
227  break;
229  message = QObject::tr("This showing was not recorded because "
230  "it was manually cancelled.");
231  break;
233  message = QObject::tr("This showing was not recorded because "
234  "there wasn't enough disk space.");
235  break;
237  message = QObject::tr("This showing was not recorded because "
238  "the recorder was already in use.");
239  break;
240  case RecStatus::Failed:
241  message = QObject::tr("This showing was not recorded because "
242  "the recorder failed.");
243  break;
244  default:
245  message = QObject::tr("The status of this showing is unknown.");
246  break;
247  }
248 
249  return message;
250  }
251 
252  if (recstartts > now)
253  message = QObject::tr("This showing will not be recorded because ");
254  else
255  message = QObject::tr("This showing was not recorded because ");
256 
257  switch (recstatus)
258  {
260  message += QObject::tr("it was manually set to not record.");
261  break;
263  message += QObject::tr("this episode was previously recorded "
264  "according to the duplicate policy chosen "
265  "for this title.");
266  break;
268  message += QObject::tr("this episode was previously recorded and "
269  "is still available in the list of "
270  "recordings.");
271  break;
273  message += QObject::tr("this episode will be recorded at an "
274  "earlier time instead.");
275  break;
277  message += QObject::tr("too many recordings of this program have "
278  "already been recorded.");
279  break;
280  case RecStatus::Conflict:
281  message += QObject::tr("another program with a higher priority "
282  "will be recorded.");
283  break;
285  message += QObject::tr("this episode will be recorded at a "
286  "later time instead.");
287  break;
288  case RecStatus::Repeat:
289  message += QObject::tr("this episode is a repeat.");
290  break;
291  case RecStatus::Inactive:
292  message += QObject::tr("this recording rule is inactive.");
293  break;
295  message += QObject::tr("this rule does not match any showings in "
296  "the current program listings.");
297  break;
299  message += QObject::tr("it was marked to never be recorded.");
300  break;
301  case RecStatus::Offline:
302  message += QObject::tr("the required recorder is off-line.");
303  break;
304  default:
305  if (recstartts > now)
306  message = QObject::tr("This showing will not be recorded.");
307  else
308  message = QObject::tr("This showing was not recorded.");
309  break;
310  }
311 
312  return message;
313 }
static QString toDescription(Type, RecordingType, const QDateTime &recstartts)
Converts "recstatus" into a long human readable description.
Definition: recStatus.cpp:187
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
unsigned int uint
Definition: compat.h:140