00001 #ifndef SR_ITEMS_H
00002 #define SR_ITEMS_H
00003 #include <qsqldatabase.h>
00004 #include "mythcontext.h"
00005 #include "mythdbcon.h"
00006 #include "managedlist.h"
00007 #include "scheduledrecording.h"
00008 #include "recordingprofile.h"
00009 #include "playgroup.h"
00010 #include "storagegroup.h"
00011
00012 class SimpleSRStorage : public SimpleDBStorage
00013 {
00014 protected:
00015 SimpleSRStorage(Setting *_setting, ScheduledRecording *_parent,
00016 QString name) :
00017 SimpleDBStorage(_setting, "record", name), parent(_parent)
00018 {
00019 parent->addChild(_setting);
00020 _setting->setName(name);
00021 }
00022
00023 virtual QString setClause(MSqlBindings& bindings)
00024 {
00025 QString recordidTag(":SETRECORDID");
00026 QString colTag(":SET" + getColumn().upper());
00027
00028 QString query("recordid = " + recordidTag + ", " +
00029 getColumn() + " = " + colTag);
00030
00031 bindings.insert(recordidTag, parent->getRecordID());
00032 bindings.insert(colTag, setting->getValue().utf8());
00033
00034 return query;
00035 }
00036
00037 virtual QString whereClause(MSqlBindings& bindings)
00038 {
00039 QString recordidTag(":WHERERECORDID");
00040 QString query("recordid = " + recordidTag);
00041
00042 bindings.insert(recordidTag, parent->getRecordID());
00043
00044 return query;
00045 }
00046
00047 ScheduledRecording *parent;
00048 };
00049
00050
00051 class SRSetting: public ManagedListSetting
00052 {
00053 protected:
00054 SRSetting(ScheduledRecording *_parent, QString name, ManagedList* _parentList=NULL)
00055 : ManagedListSetting("record", name, _parentList),
00056 parent(_parent)
00057 {
00058 parent->addChild(this);
00059 setName(name);
00060 }
00061
00062 virtual QString setClause(MSqlBindings& bindings)
00063 {
00064 QString recordidTag(":SETRECORDID");
00065 QString colTag(":SET" + getColumn().upper());
00066
00067 QString query("recordid = " + recordidTag + ", " +
00068 getColumn() + " = " + colTag);
00069
00070 bindings.insert(recordidTag, parent->getRecordID());
00071 bindings.insert(colTag, getValue().utf8());
00072
00073 return query;
00074 }
00075
00076 virtual QString whereClause(MSqlBindings& bindings)
00077 {
00078 QString recordidTag(":WHERERECORDID");
00079
00080 QString query("recordid = " + recordidTag);
00081
00082 bindings.insert(recordidTag, parent->getRecordID());
00083
00084 return query;
00085 }
00086
00087 ScheduledRecording *parent;
00088 };
00089
00090
00091
00092 class SRSelectSetting : public SelectManagedListSetting
00093 {
00094 protected:
00095 SRSelectSetting(ScheduledRecording *_parent, const QString& listName, const QString& listText,
00096 ManagedListGroup* _group, QString _column, ManagedList* _parentList=NULL)
00097 : SelectManagedListSetting(listName, listText, _group, "record", _column, _parentList),
00098 parent(_parent)
00099 {
00100 parent->addChild(this);
00101 setName(_column);
00102 }
00103
00104 virtual QString setClause(MSqlBindings& bindings)
00105 {
00106 QString recordidTag(":SETRECORDID");
00107 QString colTag(":SET" + getColumn().upper());
00108
00109 QString query("recordid = " + recordidTag + ", " +
00110 getColumn() + " = " + colTag);
00111
00112 bindings.insert(recordidTag, parent->getRecordID());
00113 bindings.insert(colTag, getValue().utf8());
00114
00115 return query;
00116 }
00117
00118 virtual QString whereClause(MSqlBindings& bindings)
00119 {
00120 QString recordidTag(":WHERERECORDID");
00121
00122 QString query("recordid = " + recordidTag);
00123
00124 bindings.insert(recordidTag, parent->getRecordID());
00125
00126 return query;
00127 }
00128
00129 ScheduledRecording *parent;
00130 };
00131
00132 class SRBoolSetting : public BoolManagedListSetting
00133 {
00134 public:
00135 SRBoolSetting(ScheduledRecording *_parent, const QString& trueText, const QString& falseText,
00136 const QString& ItemName, QString _column, ManagedListGroup* _group,
00137 ManagedList* _parentList=NULL)
00138 : BoolManagedListSetting(trueText, falseText, ItemName, "record", _column,
00139 _group, _parentList), parent(_parent)
00140 {
00141 parent->addChild(this);
00142 setName(_column);
00143 }
00144
00145 virtual QString setClause(MSqlBindings& bindings)
00146 {
00147 QString recordidTag(":SETRECORDID");
00148 QString colTag(":SET" + getColumn().upper());
00149
00150 QString query("recordid = " + recordidTag + ", " + getColumn()
00151 + " = " + colTag);
00152
00153 bindings.insert(recordidTag, parent->getRecordID());
00154 bindings.insert(colTag, getValue().utf8());
00155
00156 return query;
00157 }
00158
00159 virtual QString whereClause(MSqlBindings& bindings)
00160 {
00161 QString recordidTag(":WHERERECORDID");
00162
00163 QString query("recordid = " + recordidTag);
00164
00165 bindings.insert(recordidTag, parent->getRecordID());
00166
00167 return query;
00168 }
00169
00170 ScheduledRecording *parent;
00171 };
00172
00173
00174 class SRBoundedIntegerSetting : public BoundedIntegerManagedListSetting
00175 {
00176 public:
00177 SRBoundedIntegerSetting(int _min, int _max, int _bigStep, int _step, ScheduledRecording *_parent,
00178 const QString& ItemName, QString _column, ManagedListGroup* _group,
00179 ManagedList* _parentList=NULL, bool _invert = false)
00180 : BoundedIntegerManagedListSetting(_min, _max, _bigStep, _step, ItemName, "record",
00181 _column, _group, _parentList, _invert),
00182 parent(_parent)
00183
00184 {
00185 parent->addChild(this);
00186 setName(_column);
00187 }
00188
00189 virtual QString setClause(MSqlBindings& bindings)
00190 {
00191 QString recordidTag(":SETRECORDID");
00192 QString colTag(":SET" + getColumn().upper());
00193
00194 QString query("recordid = " + recordidTag + ", " +
00195 getColumn() + " = " + colTag);
00196
00197 bindings.insert(recordidTag, parent->getRecordID());
00198 bindings.insert(colTag, getValue().utf8());
00199
00200 return query;
00201 }
00202
00203 virtual QString whereClause(MSqlBindings& bindings)
00204 {
00205 QString recordidTag(":WHERERECORDID");
00206
00207 QString query("recordid = " + recordidTag);
00208
00209 bindings.insert(recordidTag, parent->getRecordID());
00210
00211 return query;
00212 }
00213
00214 ScheduledRecording *parent;
00215 };
00216
00217
00218 class SRRecordingType : public SRSelectSetting
00219 {
00220 public:
00221 SRRecordingType(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00222 : SRSelectSetting(_parent, "typeList", QString("[ %1 ]").arg(QObject::tr("Select Recording Schedule")),
00223 _group, "type", _list)
00224 {
00225 _parent->setRecTypeObj(this);
00226 }
00227
00228
00229 void addNormalSelections(bool haschannel, bool ismanual)
00230 {
00231 addSelection(QObject::tr("Do not record this program"), kNotRecording);
00232
00233 if (haschannel)
00234 addSelection(QObject::tr("Record only this showing"), kSingleRecord);
00235 if (!ismanual)
00236 addSelection(QObject::tr("Record one showing of this title"), kFindOneRecord);
00237
00238 if (haschannel)
00239 addSelection(QObject::tr("Record in this timeslot every week"), kWeekslotRecord);
00240 if (!ismanual)
00241 addSelection(QObject::tr("Record one showing of this title every week"), kFindWeeklyRecord);
00242
00243 if (haschannel)
00244 addSelection(QObject::tr("Record in this timeslot every day"), kTimeslotRecord);
00245 if (!ismanual)
00246 addSelection(QObject::tr("Record one showing of this title every day"), kFindDailyRecord);
00247
00248 if (haschannel && !ismanual)
00249 addSelection(QObject::tr("Record at any time on this channel"), kChannelRecord);
00250 if (!ismanual)
00251 addSelection(QObject::tr("Record at any time on any channel"), kAllRecord);
00252 }
00253
00254 void addOverrideSelections(void)
00255 {
00256 addSelection(QObject::tr("Record this showing with normal options"), kNotRecording);
00257 addSelection(QObject::tr("Record this showing with override options"), kOverrideRecord);
00258 addSelection(QObject::tr("Do not allow this showing to be recorded"), kDontRecord);
00259 }
00260
00261
00262
00263 };
00264
00265 class SRStartOffset : public SRBoundedIntegerSetting
00266 {
00267 public:
00268 SRStartOffset(ScheduledRecording *_parent, ManagedListGroup* _group, ManagedList* _list)
00269 : SRBoundedIntegerSetting( -480, 480, 10, 1, _parent, "startoffsetList", "startoffset",
00270 _group, _list, true)
00271 {
00272 setTemplates(QObject::tr("Start recording %1 minutes late"),
00273 QObject::tr("Start recording %1 minute late"),
00274 QObject::tr("Start recording on time"),
00275 QObject::tr("Start recording %1 minute early"),
00276 QObject::tr("Start recording %1 minutes early"));
00277
00278 _parent->setStartOffsetObj(this);
00279 }
00280 };
00281
00282
00283
00284 class SREndOffset : public SRBoundedIntegerSetting
00285 {
00286 public:
00287 SREndOffset(ScheduledRecording *_parent, ManagedListGroup* _group, ManagedList* _list)
00288 : SRBoundedIntegerSetting( -480, 480, 10, 1, _parent, "endoffsetList", "endoffset",
00289 _group, _list)
00290 {
00291 setTemplates(QObject::tr("End recording %1 minutes early"),
00292 QObject::tr("End recording %1 minute early"),
00293 QObject::tr("End recording on time"), QObject::tr("End recording %1 minute late"),
00294 QObject::tr("End recording %1 minutes late"));
00295
00296 _parent->setEndOffsetObj(this);
00297 }
00298 };
00299
00300
00301 class SRDupIn : public SRSelectSetting
00302 {
00303 public:
00304 SRDupIn(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00305 : SRSelectSetting(_parent, "dupInList", "[ Check for duplicates in ]", _group, "dupin", _list )
00306 {
00307 addSelection(QObject::tr("Look for duplicates in current and previous recordings"), kDupsInAll);
00308 addSelection(QObject::tr("Look for duplicates in current recordings only"), kDupsInRecorded);
00309 addSelection(QObject::tr("Look for duplicates in previous recordings only"), kDupsInOldRecorded);
00310 addSelection(QObject::tr("Exclude unidentified episodes"), kDupsExGeneric | kDupsInAll);
00311 if (gContext->GetNumSetting("HaveRepeats", 0))
00312 {
00313 addSelection(QObject::tr("Exclude old episodes"), kDupsExRepeats | kDupsInAll);
00314 addSelection(QObject::tr("Record new episodes only"), kDupsNewEpi | kDupsInAll);
00315 addSelection(QObject::tr("Record new episode first showings"), kDupsFirstNew | kDupsInAll);
00316 }
00317 setValue(kDupsInAll);
00318 _parent->setDupInObj(this);
00319 }
00320 };
00321
00322
00323 class SRDupMethod: public SRSelectSetting
00324 {
00325 public:
00326 SRDupMethod(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00327 : SRSelectSetting(_parent, "dupMethodList", QObject::tr("[ Match duplicates with ]"), _group,
00328 "dupmethod", _list)
00329 {
00330 addSelection(QObject::tr("Match duplicates using subtitle & description"), kDupCheckSubDesc);
00331 addSelection(QObject::tr("Match duplicates using subtitle then description"), kDupCheckSubThenDesc);
00332 addSelection(QObject::tr("Match duplicates using subtitle"), kDupCheckSub);
00333 addSelection(QObject::tr("Match duplicates using description"), kDupCheckDesc);
00334 addSelection(QObject::tr("Don't match duplicates"), kDupCheckNone);
00335 setValue(kDupCheckSubDesc);
00336 _parent->setDupMethodObj(this);
00337 }
00338 };
00339
00340
00341 class SRRecSearchType : public IntegerSetting, public SimpleSRStorage
00342 {
00343 public:
00344 SRRecSearchType(ScheduledRecording *parent) :
00345 IntegerSetting(this), SimpleSRStorage(this, parent, "search")
00346 {
00347 setVisible(false);
00348 }
00349 };
00350
00351
00352 class SRProfileSelector : public SRSelectSetting
00353 {
00354 public:
00355 SRProfileSelector(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00356 : SRSelectSetting(_parent, "profileList", QObject::tr("[ Select recording Profile ]"), _group,
00357 "profile", _list )
00358 {
00359 _parent->setProfileObj(this);
00360 }
00361
00362
00363 virtual void load() {
00364 fillSelections();
00365 SRSelectSetting::load();
00366 }
00367
00368 virtual void fillSelections() {
00369 clearSelections();
00370 RecordingProfile::fillSelections(selectItem, 0);
00371 }
00372 };
00373
00374 class SRSchedOptionsGroup : public ManagedListGroup
00375 {
00376 Q_OBJECT
00377
00378 public:
00379 SRSchedOptionsGroup(ScheduledRecording *_rec, ManagedList* _list, ManagedListGroup* _group,
00380 QObject* _parent);
00381
00382 void setEnabled(bool isScheduled, bool multiEpisode);
00383
00384 public slots:
00385 void itemChanged(ManagedListItem*);
00386
00387 protected:
00388
00389 friend class SRRootGroup;
00390 class SRRecPriority* recPriority;
00391 class SRStartOffset* startOffset;
00392 class SREndOffset* endOffset;
00393 class SRDupMethod* dupMethItem;
00394 class SRDupIn* dupLocItem;
00395 class SRInput* prefInput;
00396 class SRInactive* inactive;
00397
00398 ScheduledRecording *schedRec;
00399 };
00400
00401 class SRJobQueueGroup : public ManagedListGroup
00402 {
00403 Q_OBJECT
00404
00405 public:
00406 SRJobQueueGroup(ScheduledRecording *_rec, ManagedList* _list, ManagedListGroup* _group, QObject* _parent);
00407
00408 protected:
00409
00410 friend class SRRootGroup;
00411 class SRAutoTranscode* autoTranscode;
00412 class SRTranscoderSelector* transcoder;
00413 class SRAutoCommFlag* autoCommFlag;
00414 class SRAutoUserJob1* autoUserJob1;
00415 class SRAutoUserJob2* autoUserJob2;
00416 class SRAutoUserJob3* autoUserJob3;
00417 class SRAutoUserJob4* autoUserJob4;
00418
00419 ScheduledRecording *schedRec;
00420 };
00421
00422 class SRSchedInfoGroup : public ManagedListGroup
00423 {
00424 Q_OBJECT
00425
00426 public:
00427 SRSchedInfoGroup(ScheduledRecording *_rec, ManagedList* _list, ManagedListGroup* _group, QObject* _parent);
00428
00429 protected:
00430
00431 friend class SRRootGroup;
00432 ManagedListItem* detailsButton;
00433 ManagedListItem* previousButton;
00434 ManagedListItem* upcomingButton;
00435 ManagedListItem* upcomingRuleButton;
00436
00437 ScheduledRecording *schedRec;
00438 };
00439
00440
00441 class SRStorageOptionsGroup : public ManagedListGroup
00442 {
00443 Q_OBJECT
00444
00445 public:
00446 SRStorageOptionsGroup(ScheduledRecording *_rec, ManagedList* _list, ManagedListGroup* _group,
00447 QObject* _parent);
00448
00449 void setEnabled(bool isScheduled, bool multiEpisode);
00450
00451 public slots:
00452 void itemChanged(ManagedListItem*);
00453
00454 protected:
00455
00456 friend class RootSRGroup;
00457 class SRProfileSelector* profile;
00458 class SRRecGroup* recGroup;
00459 class SRStorageGroup* storageGroup;
00460 class SRPlayGroup* playGroup;
00461 class SRAutoExpire* autoExpire;
00462 class SRMaxEpisodes* maxEpisodes;
00463 class SRMaxNewest* maxNewest;
00464
00465 ScheduledRecording *schedRec;
00466 };
00467
00468
00469 class SRChannel : public ChannelSetting, public SimpleSRStorage
00470 {
00471 public:
00472 SRChannel(ScheduledRecording *parent) :
00473 ChannelSetting(this),
00474 SimpleSRStorage(this, parent, "chanid") { setVisible(false); }
00475 };
00476
00477 class SRStation : public LineEditSetting, public SimpleSRStorage
00478 {
00479 public:
00480 SRStation(ScheduledRecording *parent) :
00481 LineEditSetting(this),
00482 SimpleSRStorage(this, parent, "station") { setVisible(false); }
00483 };
00484
00485 class SRTitle : public LineEditSetting, public SimpleSRStorage
00486 {
00487 public:
00488 SRTitle(ScheduledRecording *parent) :
00489 LineEditSetting(this),
00490 SimpleSRStorage(this, parent, "title") { setVisible(false); }
00491 };
00492
00493 class SRSubtitle : public LineEditSetting, public SimpleSRStorage
00494 {
00495 public:
00496 SRSubtitle(ScheduledRecording *parent) :
00497 LineEditSetting(this),
00498 SimpleSRStorage(this, parent, "subtitle") { setVisible(false); }
00499 };
00500
00501 class SRDescription : public LineEditSetting, public SimpleSRStorage
00502 {
00503 public:
00504 SRDescription(ScheduledRecording *parent) :
00505 LineEditSetting(this),
00506 SimpleSRStorage(this, parent, "description") { setVisible(false); }
00507 };
00508
00509 class SRStartTime : public TimeSetting, public SimpleSRStorage
00510 {
00511 public:
00512 SRStartTime(ScheduledRecording *parent) :
00513 TimeSetting(this),
00514 SimpleSRStorage(this, parent, "starttime") { setVisible(false); }
00515 };
00516
00517 class SRStartDate : public DateSetting, public SimpleSRStorage
00518 {
00519 public:
00520 SRStartDate(ScheduledRecording *parent) :
00521 DateSetting(this),
00522 SimpleSRStorage(this, parent, "startdate") { setVisible(false); }
00523 };
00524
00525 class SREndTime : public TimeSetting, public SimpleSRStorage
00526 {
00527 public:
00528 SREndTime(ScheduledRecording *parent) :
00529 TimeSetting(this),
00530 SimpleSRStorage(this, parent, "endtime") { setVisible(false); }
00531 };
00532
00533 class SREndDate : public DateSetting, public SimpleSRStorage
00534 {
00535 public:
00536 SREndDate(ScheduledRecording *parent) :
00537 DateSetting(this),
00538 SimpleSRStorage(this, parent, "enddate") { setVisible(false); }
00539 };
00540
00541
00542 class SRCategory : public LineEditSetting, public SimpleSRStorage
00543 {
00544 public:
00545 SRCategory(ScheduledRecording *parent) :
00546 LineEditSetting(this),
00547 SimpleSRStorage(this, parent, "category") { setVisible(false); }
00548 };
00549
00550 class SRSeriesid : public LineEditSetting, public SimpleSRStorage
00551 {
00552 public:
00553 SRSeriesid(ScheduledRecording *parent) :
00554 LineEditSetting(this),
00555 SimpleSRStorage(this, parent, "seriesid") { setVisible(false); }
00556 };
00557
00558 class SRProgramid : public LineEditSetting, public SimpleSRStorage
00559 {
00560 public:
00561 SRProgramid(ScheduledRecording *parent) :
00562 LineEditSetting(this),
00563 SimpleSRStorage(this, parent, "programid") { setVisible(false); }
00564 };
00565
00566 class SRFindDay : public IntegerSetting, public SimpleSRStorage
00567 {
00568 public:
00569 SRFindDay(ScheduledRecording *parent) :
00570 IntegerSetting(this),
00571 SimpleSRStorage(this, parent, "findday") { setVisible(false); }
00572 };
00573
00574 class SRFindTime : public TimeSetting, public SimpleSRStorage
00575 {
00576 public:
00577 SRFindTime(ScheduledRecording *parent) :
00578 TimeSetting(this),
00579 SimpleSRStorage(this, parent, "findtime") { setVisible(false); }
00580 };
00581
00582 class SRFindId : public IntegerSetting, public SimpleSRStorage
00583 {
00584 public:
00585 SRFindId(ScheduledRecording *parent) :
00586 IntegerSetting(this),
00587 SimpleSRStorage(this, parent, "findid") { setVisible(false); }
00588 };
00589
00590 class SRParentId : public IntegerSetting, public SimpleSRStorage
00591 {
00592 public:
00593 SRParentId(ScheduledRecording *parent) :
00594 IntegerSetting(this),
00595 SimpleSRStorage(this, parent, "parentid") { setVisible(false); }
00596 };
00597
00598 class SRAutoTranscode: public SRSelectSetting
00599 {
00600 public:
00601 SRAutoTranscode(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00602 : SRSelectSetting(_parent, "autoTranscodeList", "[ Automatically Transcode ]", _group,
00603 "autotranscode", _list)
00604 {
00605 addSelection(QObject::tr("Transcode new recordings"), 1);
00606 addSelection(QObject::tr("Do not Transcode new recordings"), 0);
00607 setValue(0);
00608 _parent->setAutoTranscodeObj(this);
00609 }
00610 };
00611
00612 class SRTranscoderSelector: public SRSelectSetting {
00613 public:
00614 SRTranscoderSelector(ScheduledRecording *_parent, ManagedList* _list,
00615 ManagedListGroup* _group)
00616 : SRSelectSetting(_parent, "transcoderList",
00617 QObject::tr("[ Select transcoder ]"), _group,
00618 "transcoder", _list )
00619 {
00620 _parent->setTranscoderObj(this);
00621 }
00622
00623
00624 virtual void load() {
00625 fillSelections();
00626 SRSelectSetting::load();
00627 }
00628
00629 virtual void fillSelections() {
00630 clearSelections();
00631 RecordingProfile::fillSelections(selectItem,
00632 RecordingProfile::TranscoderGroup);
00633 }
00634 };
00635
00636 class SRAutoCommFlag: public SRSelectSetting
00637 {
00638 public:
00639 SRAutoCommFlag(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00640 : SRSelectSetting(_parent, "autoCommFlagList", "[ Automatically Commercial Flag ]", _group,
00641 "autocommflag", _list)
00642 {
00643 addSelection(QObject::tr("Commercial Flag new recordings"), 1);
00644 addSelection(QObject::tr("Do not Commercial Flag new recordings"), 0);
00645 setValue(1);
00646 _parent->setAutoCommFlagObj(this);
00647 }
00648 };
00649
00650 class SRAutoUserJob1: public SRSelectSetting
00651 {
00652 public:
00653 SRAutoUserJob1(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00654 : SRSelectSetting(_parent, "autoUserJob1List", "[ Automatically Run User Job #1 ]", _group,
00655 "autouserjob1", _list)
00656 {
00657 QString desc = gContext->GetSetting("UserJobDesc1");
00658 addSelection(QObject::tr("Run '%1'").arg(desc), 1);
00659 addSelection(QObject::tr("Do not run '%1' for new recordings").arg(desc), 0);
00660 setValue(0);
00661 _parent->setAutoUserJob1Obj(this);
00662 }
00663 };
00664
00665 class SRAutoUserJob2: public SRSelectSetting
00666 {
00667 public:
00668 SRAutoUserJob2(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00669 : SRSelectSetting(_parent, "autoUserJob2List", "[ Automatically Run User Job #2 ]", _group,
00670 "autouserjob2", _list)
00671 {
00672 QString desc = gContext->GetSetting("UserJobDesc2");
00673 addSelection(QObject::tr("Run '%1'").arg(desc), 1);
00674 addSelection(QObject::tr("Do not run '%1' for new recordings").arg(desc), 0);
00675 setValue(0);
00676 _parent->setAutoUserJob2Obj(this);
00677 }
00678 };
00679
00680 class SRAutoUserJob3: public SRSelectSetting
00681 {
00682 public:
00683 SRAutoUserJob3(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00684 : SRSelectSetting(_parent, "autoUserJob3List", "[ Automatically Run User Job #3 ]", _group,
00685 "autouserjob3", _list)
00686 {
00687 QString desc = gContext->GetSetting("UserJobDesc3");
00688 addSelection(QObject::tr("Run '%1'").arg(desc), 1);
00689 addSelection(QObject::tr("Do not run '%1' for new recordings").arg(desc), 0);
00690 setValue(0);
00691 _parent->setAutoUserJob3Obj(this);
00692 }
00693 };
00694
00695 class SRAutoUserJob4: public SRSelectSetting
00696 {
00697 public:
00698 SRAutoUserJob4(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00699 : SRSelectSetting(_parent, "autoUserJob4List", "[ Automatically Run User Job #4 ]", _group,
00700 "autouserjob4", _list)
00701 {
00702 QString desc = gContext->GetSetting("UserJobDesc4");
00703 addSelection(QObject::tr("Run '%1'").arg(desc), 1);
00704 addSelection(QObject::tr("Do not run '%1' for new recordings").arg(desc), 0);
00705 setValue(0);
00706 _parent->setAutoUserJob4Obj(this);
00707 }
00708 };
00709
00710 class SRAutoExpire: public SRBoolSetting
00711 {
00712 public:
00713 SRAutoExpire(ScheduledRecording *_parent, ManagedListGroup* _group, ManagedList* _list)
00714 : SRBoolSetting(_parent, QObject::tr("Allow auto expire"),
00715 QObject::tr("Don't allow auto expire"),
00716 "autoExpireItem", "autoexpire", _group, _list )
00717 {
00718 _parent->setAutoExpireObj(this);
00719 }
00720 };
00721
00722 class SRInactive: public SRBoolSetting
00723 {
00724 public:
00725 SRInactive(ScheduledRecording *_parent, ManagedListGroup* _group, ManagedList* _list)
00726 : SRBoolSetting(_parent, QObject::tr("This recording rule is inactive"),
00727 QObject::tr("This recording rule is active"),
00728 "inactiveItem", "inactive", _group, _list )
00729 {
00730 _parent->setInactiveObj(this);
00731 }
00732 };
00733
00734 class SRMaxNewest: public SRBoolSetting
00735 {
00736 public:
00737 SRMaxNewest(ScheduledRecording *_parent, ManagedListGroup* _group, ManagedList* _list)
00738 : SRBoolSetting(_parent, QObject::tr("Delete oldest if this would exceed the max episodes"),
00739 QObject::tr("Don't record if this would exceed the max episodes"),
00740 "maxnewestItem", "maxnewest", _group, _list )
00741 {
00742 setValue(false);
00743 _parent->setMaxNewestObj(this);
00744 }
00745 };
00746
00747
00748
00749
00750 class SRMaxEpisodes : public SRBoundedIntegerSetting
00751 {
00752 public:
00753 SRMaxEpisodes(ScheduledRecording *_parent, ManagedListGroup* _group, ManagedList* _list)
00754 : SRBoundedIntegerSetting( 0, 100, 5, 1, _parent, "maxepisodesList", "maxepisodes",
00755 _group, _list)
00756 {
00757 setTemplates("", "", QObject::tr("No episode limit"),
00758 QObject::tr("Keep only one episode."), QObject::tr("Keep at most %1 episodes"));
00759 _parent->setMaxEpisodesObj(this);
00760 }
00761 };
00762
00763
00764 class SRRecPriority: public SRBoundedIntegerSetting
00765 {
00766 public:
00767 SRRecPriority(ScheduledRecording *_parent, ManagedListGroup* _group, ManagedList* _list)
00768 : SRBoundedIntegerSetting( -99, 99, 5, 1, _parent, "recpriorityList", "recpriority",
00769 _group, _list)
00770 {
00771 setTemplates( QObject::tr("Reduce priority by %1"), QObject::tr("Reduce priority by %1"),
00772 QObject::tr("Normal recording priority"),
00773 QObject::tr("Raise priority by %1"), QObject::tr("Raise priority by %1") );
00774 setValue(0);
00775 _parent->setRecPriorityObj(this);
00776 }
00777 };
00778
00779
00780 class SRRecGroup: public SRSelectSetting
00781 {
00782 Q_OBJECT
00783
00784 public:
00785 SRRecGroup(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00786 : SRSelectSetting(_parent, "recgroupList", QString("[ %1 ]")
00787 .arg(QObject::tr("Select Recording Group")),
00788 _group, "recgroup", _list )
00789 {
00790 setValue("Default");
00791 _parent->setRecGroupObj(this);
00792 connect(selectItem, SIGNAL(goingBack()), this, SLOT(onGoingBack()));
00793 }
00794
00795
00796 virtual void load() {
00797 fillSelections();
00798 SRSelectSetting::load();
00799 }
00800
00801 virtual QString getValue(void) const {
00802 if (settingValue == "__NEW_GROUP__")
00803 return QString("Default");
00804 else
00805 return settingValue;
00806 }
00807
00808 virtual void fillSelections()
00809 {
00810 QStringList groups;
00811 QStringList::Iterator it;
00812 QString value, dispValue;
00813 bool foundDefault = false;
00814
00815 addButton(QString("[ %1 ]").arg(QObject::tr("Create a new recording group")), "__NEW_GROUP__");
00816 connect(selectItem, SIGNAL(buttonPressed(ManagedListItem*, ManagedListItem*)), this,
00817 SLOT(showNewRecGroup()));
00818
00819 MSqlQuery query(MSqlQuery::InitCon());
00820 query.prepare("SELECT DISTINCT recgroup FROM recorded");
00821
00822 if (query.exec() && query.isActive() && query.size() > 0)
00823 while (query.next())
00824 {
00825 value = QString::fromUtf8(query.value(0).toString());
00826 groups += value;
00827
00828 if (value == "Default")
00829 foundDefault = true;
00830 }
00831
00832
00833 query.prepare("SELECT DISTINCT recgroup FROM record");
00834
00835 if (query.exec() && query.isActive() && query.size() > 0)
00836 while (query.next())
00837 {
00838 value = QString::fromUtf8(query.value(0).toString());
00839 groups += value;
00840
00841 if (value == "Default")
00842 foundDefault = true;
00843 }
00844
00845 groups.sort();
00846 for (it = groups.begin(); it != groups.end(); ++it)
00847 {
00848 if (!foundDefault && *it > QObject::tr("Default"))
00849 {
00850 addSelection(QObject::tr(
00851 "Include in the \"%1\" recording group")
00852 .arg(QObject::tr("Default")), "Default");
00853 foundDefault = true;
00854 }
00855
00856 if (*it == "Default")
00857 dispValue = QObject::tr("Default");
00858 else
00859 dispValue = *it;
00860
00861 addSelection(QObject::tr("Include in the \"%1\" recording group")
00862 .arg(dispValue), *it);
00863 }
00864
00865 }
00866
00867
00868 public slots:
00869 void showNewRecGroup();
00870 void onGoingBack();
00871 };
00872
00873 class SRStorageGroup: public SRSelectSetting
00874 {
00875 Q_OBJECT
00876
00877 public:
00878 SRStorageGroup(ScheduledRecording *_parent, ManagedList* _list,
00879 ManagedListGroup* _group)
00880 : SRSelectSetting(_parent, "storagegroupList", QString("[ %1 ]")
00881 .arg(QObject::tr("Select Storage Group")),
00882 _group, "storagegroup", _list )
00883 {
00884 setValue("Default");
00885 _parent->setStorageGroupObj(this);
00886 }
00887
00888
00889 virtual void load() {
00890 fillSelections();
00891 SRSelectSetting::load();
00892 }
00893
00894 virtual QString getValue(void) const {
00895 return settingValue;
00896 }
00897
00898 virtual void fillSelections()
00899 {
00900 QStringList groups = StorageGroup::getRecordingsGroups();
00901 QStringList::Iterator it;
00902 QString value, dispValue;
00903 bool foundDefault = false;
00904
00905 for (it = groups.begin(); it != groups.end(); ++it)
00906 {
00907 if (*it == "Default")
00908 foundDefault = true;
00909 }
00910
00911 for (it = groups.begin(); it != groups.end(); ++it)
00912 {
00913 if (!foundDefault && *it > QObject::tr("Default"))
00914 {
00915 addSelection(QObject::tr(
00916 "Store in the \"%1\" storage group")
00917 .arg(QObject::tr("Default")), "Default");
00918 foundDefault = true;
00919 }
00920
00921 if (*it == "Default")
00922 dispValue = QObject::tr("Default");
00923 else if (*it == "LiveTV")
00924 dispValue = QObject::tr("LiveTV");
00925 else
00926 dispValue = *it;
00927
00928 addSelection(QObject::tr("Store in the \"%1\" storage group")
00929 .arg(dispValue), *it);
00930 }
00931
00932 }
00933 };
00934
00935 class SRPlayGroup: public SRSelectSetting
00936 {
00937 Q_OBJECT
00938
00939 public:
00940 SRPlayGroup(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00941 : SRSelectSetting(_parent, "playgroupList", QString("[ %1 ]")
00942 .arg(QObject::tr("Select Playback Group")),
00943 _group, "playgroup", _list )
00944 {
00945 setValue("Default");
00946 _parent->setPlayGroupObj(this);
00947 }
00948
00949 virtual void load() {
00950 fillSelections();
00951 SRSelectSetting::load();
00952 }
00953
00954 virtual QString getValue(void) const {
00955 return settingValue;
00956 }
00957
00958 virtual void fillSelections();
00959 };
00960
00961 class SRInput: public SRSelectSetting
00962 {
00963 Q_OBJECT
00964
00965 public:
00966 SRInput(ScheduledRecording *_parent, ManagedList* _list, ManagedListGroup* _group)
00967 : SRSelectSetting(_parent, "inputList", QString("[ %1 ]")
00968 .arg(QObject::tr("Select Preferred Input")),
00969 _group, "prefinput", _list )
00970 {
00971 setValue(0);
00972 _parent->setInputObj(this);
00973 }
00974
00975 virtual void load() {
00976 fillSelections();
00977 SRSelectSetting::load();
00978 }
00979
00980 virtual QString getValue(void) const {
00981 return settingValue;
00982 }
00983
00984 virtual void fillSelections();
00985 };
00986
00987 #endif
00988
00989