00001 #include "scheduledrecording.h"
00002 #include "sr_items.h"
00003 #include <qlayout.h>
00004 #include "mythdialogs.h"
00005
00006
00007
00008 SRSchedOptionsGroup::SRSchedOptionsGroup(ScheduledRecording *_rec, ManagedList* _parentList,
00009 ManagedListGroup* _group, QObject* _parent)
00010 : ManagedListGroup( QObject::tr("Scheduling Options"), _group, _parentList,
00011 _parent, "schedOpts"),
00012 schedRec(_rec)
00013 {
00014 recPriority = new SRRecPriority(_rec, this, _parentList);
00015 addItem(recPriority->getItem(), -1);
00016
00017 prefInput = new SRInput(_rec, _parentList, this);
00018 addItem(prefInput->getItem(), -1);
00019
00020 startOffset = new SRStartOffset(_rec, this, _parentList);
00021 addItem(startOffset->getItem());
00022
00023 endOffset = new SREndOffset(_rec, this, _parentList);
00024 addItem(endOffset->getItem());
00025
00026 dupMethItem = new SRDupMethod(_rec, _parentList, this);
00027 addItem(dupMethItem->getItem(), -1);
00028 connect(dupMethItem->getItem(), SIGNAL(changed(ManagedListItem*)), this, SLOT(itemChanged(ManagedListItem*)));
00029
00030 dupLocItem = new SRDupIn(_rec, _parentList, this);
00031 addItem(dupLocItem->getItem(), -1);
00032 connect(dupMethItem->getItem(), SIGNAL(changed(ManagedListItem*)), this, SLOT(itemChanged(ManagedListItem*)));
00033
00034 inactive = new SRInactive(_rec, this, _parentList);
00035 addItem(inactive->getItem(), -1);
00036 }
00037
00038
00039 void SRSchedOptionsGroup::itemChanged(ManagedListItem*)
00040 {
00041
00042 if (dupMethItem->getItem()->getEnabled())
00043 {
00044 if (dupMethItem->getItem()->getValue().toInt() != kDupCheckNone)
00045 dupLocItem->getItem()->setEnabled(true);
00046 else
00047 dupLocItem->getItem()->setEnabled(false);
00048 }
00049 }
00050
00051 void SRSchedOptionsGroup::setEnabled(bool isScheduled, bool multiEpisode)
00052 {
00053 ManagedListGroup::setEnabled(isScheduled);
00054
00055 dupMethItem->getItem()->setEnabled(isScheduled & multiEpisode);
00056
00057 if (dupMethItem->getItem()->getEnabled())
00058 {
00059 if (dupMethItem->getItem()->getValue().toInt() != kDupCheckNone)
00060 dupLocItem->getItem()->setEnabled(true);
00061 else
00062 dupLocItem->getItem()->setEnabled(false);
00063
00064 }
00065 else
00066 {
00067 dupLocItem->getItem()->setEnabled(false);
00068 }
00069 }
00070
00071
00072 SRJobQueueGroup::SRJobQueueGroup(ScheduledRecording *_rec, ManagedList* _parentList, ManagedListGroup* _group,
00073 QObject* _parent)
00074 : ManagedListGroup(QObject::tr("Post Recording Processing"), _group, _parentList,
00075 _parent, "postProcessing"),
00076 schedRec(_rec)
00077 {
00078 autoCommFlag = new SRAutoCommFlag(_rec, _parentList, this);
00079 addItem(autoCommFlag->getItem(), -1);
00080
00081 autoTranscode = new SRAutoTranscode(_rec, _parentList, this);
00082 addItem(autoTranscode->getItem(), -1);
00083
00084 transcoder = new SRTranscoderSelector(_rec, _parentList, this);
00085 addItem(transcoder->getItem(), -1);
00086
00087 autoUserJob1 = new SRAutoUserJob1(_rec, _parentList, this);
00088 addItem(autoUserJob1->getItem(), -1);
00089
00090 autoUserJob2 = new SRAutoUserJob2(_rec, _parentList, this);
00091 addItem(autoUserJob2->getItem(), -1);
00092
00093 autoUserJob3 = new SRAutoUserJob3(_rec, _parentList, this);
00094 addItem(autoUserJob3->getItem(), -1);
00095
00096 autoUserJob4 = new SRAutoUserJob4(_rec, _parentList, this);
00097 addItem(autoUserJob4->getItem(), -1);
00098 }
00099
00100 SRStorageOptionsGroup::SRStorageOptionsGroup(ScheduledRecording *_rec, ManagedList* _parentList,
00101 ManagedListGroup* _group, QObject* _parent)
00102 : ManagedListGroup(QObject::tr("Storage Options"), _group, _parentList,
00103 _parent, "storageOpts"),
00104 schedRec(_rec)
00105 {
00106 profile = new SRProfileSelector(_rec, _parentList, this);
00107 addItem(profile->getItem(), -1);
00108
00109 recGroup = new SRRecGroup(_rec, _parentList, this);
00110 addItem(recGroup->getItem(), -1);
00111
00112 storageGroup = new SRStorageGroup(_rec, _parentList, this);
00113 addItem(storageGroup->getItem(), -1);
00114
00115 playGroup = new SRPlayGroup(_rec, _parentList, this);
00116 addItem(playGroup->getItem(), -1);
00117
00118 autoExpire = new SRAutoExpire(_rec, this, parentList);
00119 addItem(autoExpire->getItem(), -1);
00120
00121 maxEpisodes = new SRMaxEpisodes(_rec, this, _parentList);
00122 addItem(maxEpisodes->getItem(), -1);
00123
00124 connect(maxEpisodes->getItem(), SIGNAL(changed(ManagedListItem*)), this, SLOT(itemChanged(ManagedListItem*)));
00125
00126 maxNewest = new SRMaxNewest(_rec, this, _parentList);
00127 addItem(maxNewest->getItem(), -1);
00128 }
00129
00130 SRSchedInfoGroup::SRSchedInfoGroup(ScheduledRecording *_rec, ManagedList* _parentList,
00131 ManagedListGroup* _group, QObject* _parent)
00132 : ManagedListGroup(QObject::tr("Schedule Information"), _group, _parentList,
00133 _parent, "schedInfo"),
00134 schedRec(_rec)
00135 {
00136 detailsButton = new ManagedListItem(QObject::tr("Program details"),
00137 _parentList, this, "showDetails");
00138 addItem(detailsButton, -1);
00139 connect(detailsButton, SIGNAL(selected(ManagedListItem*)), _rec,
00140 SLOT(runShowDetails()));
00141
00142 upcomingButton =
00143 new ManagedListItem(QObject::tr("Upcoming episodes for this title"),
00144 _parentList, this, "listUpcoming");
00145 addItem(upcomingButton, -1);
00146 connect(upcomingButton, SIGNAL(selected(ManagedListItem*)), _rec,
00147 SLOT(runTitleList()));
00148
00149 upcomingRuleButton =
00150 new ManagedListItem(QObject::tr("Upcoming episodes for this rule"),
00151 _parentList, this, "listRule");
00152 addItem(upcomingRuleButton, -1);
00153 connect(upcomingRuleButton, SIGNAL(selected(ManagedListItem*)), _rec,
00154 SLOT(runRuleList()));
00155
00156 previousButton =
00157 new ManagedListItem(QObject::tr("Previously scheduled episodes"),
00158 _parentList, this, "listPrevious");
00159 addItem(previousButton, -1);
00160 connect(previousButton, SIGNAL(selected(ManagedListItem*)), _rec,
00161 SLOT(runPrevList()));
00162
00163 }
00164
00165 void SRStorageOptionsGroup::itemChanged(ManagedListItem*)
00166 {
00167 maxNewest->getItem()->setEnabled(maxEpisodes->getValue().toInt() !=0);
00168 }
00169
00170 void SRStorageOptionsGroup::setEnabled(bool isScheduled, bool)
00171 {
00172 ManagedListGroup::setEnabled(isScheduled);
00173 }
00174
00175 void SRRecGroup::onGoingBack()
00176 {
00177 if (selectItem->getCurItemValue() == "__NEW_GROUP__" )
00178 {
00179 selectItem->selectValue("Default");
00180 }
00181 }
00182
00183
00184 void SRRecGroup::showNewRecGroup()
00185 {
00186 QString newGroup;
00187
00188 bool ok = MythPopupBox::showGetTextPopup(gContext->GetMainWindow(),
00189 QObject::tr("Create New Recording Group"),
00190 QObject::tr("Enter group name or press SELECT to "
00191 "enter text via the On Screen Keyboard"),
00192 newGroup);
00193 if (ok)
00194 {
00195 addSelection(QObject::tr("Include in the \"%1\" recording group")
00196 .arg(newGroup), newGroup);
00197 selectItem->selectValue(newGroup);
00198 }
00199 }
00200
00201 void SRPlayGroup::fillSelections()
00202 {
00203 addSelection(QString(QObject::tr("Use \"%1\" playback group settings"))
00204 .arg(QObject::tr("Default")), "Default");
00205
00206 QStringList names = PlayGroup::GetNames();
00207
00208 if (names.isEmpty())
00209 getItem()->setEnabled(false);
00210
00211 while (!names.isEmpty())
00212 {
00213 addSelection(QObject::tr("Use \"%1\" playback group settings")
00214 .arg(names.front()), names.front());
00215 names.pop_front();
00216 }
00217 }
00218
00219 void SRInput::fillSelections()
00220 {
00221 addSelection(QString(QObject::tr("Use any available input")), 0);
00222
00223 MSqlQuery query(MSqlQuery::InitCon());
00224 query.prepare("SELECT cardinputid,cardid,inputname,displayname "
00225 "FROM cardinput ORDER BY cardinputid");
00226
00227 if (query.exec() && query.isActive() && query.size() > 0)
00228 {
00229 while (query.next())
00230 {
00231 QString input_name = query.value(3).toString();
00232 if (input_name == "")
00233 input_name = QString("%1: %2")
00234 .arg(query.value(1).toInt())
00235 .arg(query.value(2).toString());
00236 addSelection(QObject::tr("Prefer input %1")
00237 .arg(input_name), query.value(0).toInt());
00238 }
00239 }
00240 }