MythTV  master
recordingtypes.cpp
Go to the documentation of this file.
1 #include <QObject>
2 
3 #include "recordingtypes.h"
4 
8 {
9  switch (rectype)
10  {
11  case kNotRecording: return 0; break;
12  case kDontRecord: return 1; break;
13  case kOverrideRecord: return 2; break;
14  case kSingleRecord: return 3; break;
15  case kOneRecord: return 4; break;
16  case kWeeklyRecord: return 6; break;
17  case kDailyRecord: return 8; break;
18  case kAllRecord: return 9; break;
19  case kTemplateRecord: return 0; break;
20  default: return 11;
21  }
22 }
23 
25 QString toString(RecordingType rectype)
26 {
27  switch (rectype)
28  {
29  case kSingleRecord:
30  return QObject::tr("Single Record");
31  case kAllRecord:
32  return QObject::tr("Record All");
33  case kOneRecord:
34  return QObject::tr("Record One");
35  case kDailyRecord:
36  return QObject::tr("Record Daily");
37  case kWeeklyRecord:
38  return QObject::tr("Record Weekly");
39  case kOverrideRecord:
40  case kDontRecord:
41  return QObject::tr("Override Recording");
42  case kTemplateRecord:
43  return QObject::tr("Recording Template");
44  default:
45  return QObject::tr("Not Recording");
46  }
47 }
48 
50 QString toDescription(RecordingType rectype)
51 {
52  switch (rectype)
53  {
54  case kSingleRecord:
55  return QObject::tr("Record only this showing");
56  case kAllRecord:
57  return QObject::tr("Record all showings");
58  case kOneRecord:
59  return QObject::tr("Record only one showing");
60  case kDailyRecord:
61  return QObject::tr("Record one showing every day");
62  case kWeeklyRecord:
63  return QObject::tr("Record one showing every week");
64  case kOverrideRecord:
65  return QObject::tr("Record this showing with override options");
66  case kDontRecord:
67  return QObject::tr("Do not record this showing");
68  case kTemplateRecord:
69  return QObject::tr("Modify this recording rule template");
70  default:
71  return QObject::tr("Do not record this program");
72  }
73 }
74 
76 QString toRawString(RecordingType rectype)
77 {
78  switch (rectype)
79  {
80  case kSingleRecord:
81  return QString("Single Record");
82  case kAllRecord:
83  return QString("Record All");
84  case kOneRecord:
85  return QString("Record One");
86  case kDailyRecord:
87  return QString("Record Daily");
88  case kWeeklyRecord:
89  return QString("Record Weekly");
90  case kOverrideRecord:
91  return QString("Override Recording");
92  case kDontRecord:
93  return QString("Do not Record");
94  case kTemplateRecord:
95  return QString("Recording Template");
96  default:
97  return QString("Not Recording");
98  }
99 }
100 
102 {
103  if (type.toLower() == "not recording" || type.toLower() == "not")
104  return kNotRecording;
105  if (type.toLower() == "single record" || type.toLower() == "single")
106  return kSingleRecord;
107  if (type.toLower() == "record all" || type.toLower() == "all")
108  return kAllRecord;
109  if (type.toLower() == "record one" || type.toLower() == "one" ||
110  type.toLower() == "find one" || type.toLower() == "findone")
111  return kOneRecord;
112  if (type.toLower() == "record daily" || type.toLower() == "daily" ||
113  type.toLower() == "find daily" || type.toLower() == "finddaily")
114  return kDailyRecord;
115  if (type.toLower() == "record weekly" || type.toLower() == "weekly" ||
116  type.toLower() == "find weekly" || type.toLower() == "findweekly")
117  return kWeeklyRecord;
118  if (type.toLower() == "recording template" || type.toLower() == "template")
119  return kTemplateRecord;
120  if (type.toLower() == "override recording" || type.toLower() == "override")
121  return kOverrideRecord;
122  return kDontRecord;
123 }
124 
126 QChar toQChar(RecordingType rectype)
127 {
128  QString ret;
129  switch (rectype)
130  {
131  case kSingleRecord:
132  ret = QObject::tr("S", "RecTypeChar kSingleRecord"); break;
133  case kAllRecord:
134  ret = QObject::tr("A", "RecTypeChar kAllRecord"); break;
135  case kOneRecord:
136  ret = QObject::tr("1", "RecTypeChar kOneRecord"); break;
137  case kDailyRecord:
138  ret = QObject::tr("D", "RecTypeChar kDailyRecord"); break;
139  case kWeeklyRecord:
140  ret = QObject::tr("W", "RecTypeChar kWeeklyRecord"); break;
141  case kOverrideRecord:
142  case kDontRecord:
143  ret = QObject::tr("O", "RecTypeChar kOverrideRecord/kDontRecord");
144  break;
145  case kTemplateRecord:
146  ret = QObject::tr("T", "RecTypeChar kTemplateRecord"); break;
147  case kNotRecording:
148  default:
149  ret = " ";
150  }
151  return (ret.isEmpty()) ? QChar(' ') : ret[0];
152 }
153 
154 QString toString(RecordingDupInType recdupin)
155 {
156  switch (recdupin)
157  {
158  case kDupsInRecorded:
159  return QObject::tr("Current Recordings");
160  case kDupsInOldRecorded:
161  return QObject::tr("Previous Recordings");
162  case kDupsInAll:
163  return QObject::tr("All Recordings");
164  case kDupsNewEpi:
165  return QObject::tr("New Episodes Only");
166  default:
167  return QString();
168  }
169 }
170 
172 {
173  switch (recdupin)
174  {
175  case kDupsInRecorded:
176  return QObject::tr("Look for duplicates in current recordings only");
177  case kDupsInOldRecorded:
178  return QObject::tr("Look for duplicates in previous recordings only");
179  case kDupsInAll:
180  return QObject::tr("Look for duplicates in current and previous "
181  "recordings");
182  case kDupsNewEpi:
183  return QObject::tr("Record new episodes only");
184  default:
185  return QString();
186  }
187 }
188 
190 {
191  switch (recdupin)
192  {
193  case kDupsInRecorded:
194  return QString("Current Recordings");
195  case kDupsInOldRecorded:
196  return QString("Previous Recordings");
197  case kDupsInAll:
198  return QString("All Recordings");
199  case kDupsNewEpi:
200  return QString("New Episodes Only");
201  default:
202  return QString("Unknown");
203  }
204 }
205 
207 {
208  if (type.toLower() == "current recordings" || type.toLower() == "current")
209  return kDupsInRecorded;
210  if (type.toLower() == "previous recordings" || type.toLower() == "previous")
211  return kDupsInOldRecorded;
212  if (type.toLower() == "all recordings" || type.toLower() == "all")
213  return kDupsInAll;
214  if (type.toLower() == "new episodes only" || type.toLower() == "new")
215  return kDupsNewEpi;
216  return kDupsInAll;
217 }
218 
220 {
221  switch (duptype)
222  {
223  case kDupCheckNone:
224  return QObject::tr("None");
225  case kDupCheckSub:
226  return QObject::tr("Subtitle");
227  case kDupCheckDesc:
228  return QObject::tr("Description");
229  case kDupCheckSubDesc:
230  return QObject::tr("Subtitle and Description");
232  return QObject::tr("Subtitle then Description");
233  default:
234  return QString();
235  }
236 }
237 
239 {
240  switch (duptype)
241  {
242  case kDupCheckNone:
243  return QObject::tr("Don't match duplicates");
244  case kDupCheckSub:
245  return QObject::tr("Match duplicates using subtitle");
246  case kDupCheckDesc:
247  return QObject::tr("Match duplicates using description");
248  case kDupCheckSubDesc:
249  return QObject::tr("Match duplicates using subtitle & description");
251  return QObject::tr("Match duplicates using subtitle then description");
252  default:
253  return QString();
254  }
255 }
256 
258 {
259  switch (duptype)
260  {
261  case kDupCheckNone:
262  return QString("None");
263  case kDupCheckSub:
264  return QString("Subtitle");
265  case kDupCheckDesc:
266  return QString("Description");
267  case kDupCheckSubDesc:
268  return QString("Subtitle and Description");
270  return QString("Subtitle then Description");
271  default:
272  return QString("Unknown");
273  }
274 }
275 
277 {
278  if (type.toLower() == "none")
279  return kDupCheckNone;
280  if (type.toLower() == "subtitle")
281  return kDupCheckSub;
282  if (type.toLower() == "description")
283  return kDupCheckDesc;
284  if (type.toLower() == "subtitle and description" || type.toLower() == "subtitleanddescription")
285  return kDupCheckSubDesc;
286  if (type.toLower() == "subtitle then description" || type.toLower() == "subtitlethendescription")
287  return kDupCheckSubThenDesc;
288  return kDupCheckSubDesc;
289 }
290 
291 QString toRawString(RecSearchType searchtype)
292 {
293  switch (searchtype)
294  {
295  case kNoSearch:
296  return QString("None");
297  case kPowerSearch:
298  return QString("Power Search");
299  case kTitleSearch:
300  return QString("Title Search");
301  case kKeywordSearch:
302  return QString("Keyword Search");
303  case kPeopleSearch:
304  return QString("People Search");
305  case kManualSearch:
306  return QString("Manual Search");
307  default:
308  return QString("Unknown");
309  }
310 }
311 
313 {
314  if (type.toLower() == "none")
315  return kNoSearch;
316  if (type.toLower() == "power search" || type.toLower() == "power")
317  return kPowerSearch;
318  if (type.toLower() == "title search" || type.toLower() == "title")
319  return kTitleSearch;
320  if (type.toLower() == "keyword search" || type.toLower() == "keyword")
321  return kKeywordSearch;
322  if (type.toLower() == "people search" || type.toLower() == "people")
323  return kPeopleSearch;
324  if (type.toLower() == "manual search" || type.toLower() == "manual")
325  return kManualSearch;
326  return kNoSearch;
327 }
RecordingDupInType
QString toDescription(RecordingType rectype)
Converts "rectype" into a human readable description.
RecordingDupInType dupInFromString(const QString &type)
QChar toQChar(RecordingType rectype)
Converts "rectype" into a human readable character.
RecSearchType searchTypeFromString(const QString &type)
int RecTypePrecedence(RecordingType rectype)
Converts a RecordingType to a simple integer so it's specificity can be compared to another.
RecordingDupMethodType
RecSearchType
RecordingType recTypeFromString(const QString &type)
QString toString(RecordingType rectype)
Converts "rectype" into a human readable string.
RecordingDupMethodType dupMethodFromString(const QString &type)
QString toRawString(RecordingType rectype)
Converts "rectype" into an untranslated string.