7 #include <QCoreApplication>
43 #define ENUM_TO_QVARIANT(a) qVariantFromValue(static_cast<int>(a))
47 static QString
fs0(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"New episode"));
48 static QString
fs1(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"Identifiable episode"));
49 static QString
fs2(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"First showing"));
50 static QString
fs3(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"Prime time"));
51 static QString
fs4(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"Commercial free"));
52 static QString
fs5(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"High definition"));
53 static QString
fs6(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"This episode"));
54 static QString
fs7(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"This series"));
55 static QString
fs8(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"This time"));
56 static QString
fs9(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"This day and time"));
57 static QString
fs10(QT_TRANSLATE_NOOP(
"SchedFilterEditor",
"This channel"));
66 static_cast<TV*>(player));
69 mainStack->
AddScreen(se, (player == NULL));
86 m_recInfo(new
RecordingInfo(*recInfo)), m_recordingRule(NULL),
88 m_saveButton(NULL), m_cancelButton(NULL), m_rulesList(NULL),
89 m_schedOptButton(NULL), m_storeOptButton(NULL),
90 m_postProcButton(NULL), m_schedInfoButton(NULL),
91 m_previewButton(NULL), m_metadataButton(NULL),
92 m_filtersButton(NULL),
93 m_player(player), m_loaded(
false), m_view(kMainView), m_child(NULL)
108 m_recInfo(NULL), m_recordingRule(recRule),
110 m_saveButton(NULL), m_cancelButton(NULL), m_rulesList(NULL),
111 m_schedOptButton(NULL), m_storeOptButton(NULL),
112 m_postProcButton(NULL), m_schedInfoButton(NULL),
113 m_previewButton(NULL), m_metadataButton(NULL),
114 m_filtersButton(NULL),
115 m_player(player), m_loaded(
false), m_view(kMainView), m_child(NULL)
126 QString message = QString(
"VIEWSCHEDULED_EXITING");
157 LOG(VB_GENERAL, LOG_ERR,
"ScheduleEditor, theme is missing "
158 "required elements");
213 LOG(VB_GENERAL, LOG_ERR,
214 "ScheduleEditor::Create() - Failed to load recording rule");
254 .compare(
"Default", Qt::CaseInsensitive) != 0)
257 tr(
"Delete this recording rule template"),
261 tr(
"Modify this recording rule template"),
267 tr(
"Record this showing with normal options"),
270 tr(
"Record this showing with override options"),
273 tr(
"Do not record this showing"),
282 tr(
"Do not record this program"),
286 tr(
"Record only this showing"),
290 tr(
"Record only one showing"),
292 if (!hasChannel || isManual)
294 tr(
"Record one showing every week"),
296 if (!hasChannel || isManual)
298 tr(
"Record one showing every day"),
302 tr(
"Record all showings"),
420 if (!schedoptedit->
Create())
445 if (!storeoptedit->
Create())
486 QString label = tr(
"Schedule Information");
496 menuPopup->
AddButton(tr(
"Program Details"));
497 menuPopup->
AddButton(tr(
"Upcoming Episodes"));
498 menuPopup->
AddButton(tr(
"Upcoming Recordings"));
499 menuPopup->
AddButton(tr(
"Previously Scheduled"));
512 bool handled =
false;
515 TranslateKeyPress(
"TV Frontend", event, actions);
517 for (
int i = 0; i < actions.size() && !handled; i++)
519 QString
action = actions[i];
522 if (action ==
"MENU")
524 else if (action ==
"INFO")
526 else if (action ==
"UPCOMING")
528 else if (action ==
"PREVVIEW")
530 else if (action ==
"NEXTVIEW")
548 QString resultid = dce->
GetId();
551 if (resultid ==
"menu")
553 if (resulttext == tr(
"Main Options"))
555 if (resulttext == tr(
"Schedule Options"))
557 else if (resulttext == tr(
"Filter Options"))
559 else if (resulttext == tr(
"Storage Options"))
561 else if (resulttext == tr(
"Post Processing"))
563 else if (resulttext == tr(
"Metadata Options"))
565 else if (resulttext == tr(
"Use Template"))
567 else if (resulttext == tr(
"Schedule Info"))
569 else if (resulttext == tr(
"Preview Changes"))
572 else if (resultid ==
"templatemenu")
576 else if (resultid ==
"schedinfo")
578 if (resulttext == tr(
"Program Details"))
580 else if (resulttext == tr(
"Upcoming Episodes"))
582 else if (resulttext == tr(
"Upcoming Recordings"))
584 else if (resulttext == tr(
"Previously Scheduled"))
587 else if (resultid ==
"newrecgroup")
647 title.remove(QRegExp(
" \\(.*\\)$"));
672 QString ttable =
"record_tmp";
723 if (!schedfilteredit->
Create())
725 delete schedfilteredit;
793 QString label = tr(
"Options");
806 menuPopup->
AddButton(tr(
"Main Options"));
808 menuPopup->
AddButton(tr(
"Schedule Options"));
810 menuPopup->
AddButton(tr(
"Filter Options"));
812 menuPopup->
AddButton(tr(
"Storage Options"));
814 menuPopup->
AddButton(tr(
"Post Processing"));
817 menuPopup->
AddButton(tr(
"Metadata Options"));
819 menuPopup->
AddButton(tr(
"Schedule Info"));
821 menuPopup->
AddButton(tr(
"Preview Changes"));
822 menuPopup->
AddButton(tr(
"Use Template"));
834 if (templates.empty())
840 QString label = tr(
"Template Options");
848 while (!templates.empty())
850 QString
name = templates.front();
851 if (name ==
"Default")
855 templates.pop_front();
875 m_editor(&editor), m_recordingRule(&rule), m_recInfo(recInfo),
876 m_backButton(NULL), m_saveButton(NULL), m_previewButton(NULL)
889 bool handled =
false;
892 TranslateKeyPress(
"TV Frontend", event, actions);
894 for (
int i = 0; i < actions.size() && !handled; i++)
896 QString
action = actions[i];
899 if (action ==
"MENU")
901 else if (action ==
"INFO")
903 else if (action ==
"UPCOMING")
905 if (action ==
"ESCAPE")
907 else if (action ==
"PREVVIEW")
909 else if (action ==
"NEXTVIEW")
922 const QString xmlfile,
const QString winname,
bool isTemplate)
932 connect(
m_editor, SIGNAL(templateLoaded()), SLOT(
Load()));
978 :
SchedEditChild(parent,
"ScheduleOptionsEditor", editor, rule, recInfo),
990 "schedule-ui.xml",
"scheduleoptionseditor",
1004 LOG(VB_GENERAL, LOG_ERR,
"SchedOptEditor, theme is missing "
1005 "required elements");
1049 :
SchedEditChild(parent,
"ScheduleFilterEditor", editor, rule, recInfo),
1050 m_filtersList(NULL), m_loaded(
false)
1061 "schedule-ui.xml",
"schedulefiltereditor",
1073 LOG(VB_GENERAL, LOG_ERR,
"SchedFilterEditor, theme is missing "
1074 "required elements");
1095 query.
prepare(
"SELECT filterid, description, newruledefault "
1096 "FROM recordfilter ORDER BY filterid");
1100 while (query.
next())
1102 filterid = query.
value(0).toInt();
1104 .toUtf8().constData());
1108 button->setCheckable(
true);
1114 for (idx = 0; idx < end; ++idx)
1117 int filterid = qVariantValue<int>(button->
GetData());
1139 uint32_t filter_mask = 0;
1143 for (idx = 0; idx < end; ++idx)
1147 filter_mask |= (1 << qVariantValue<uint32_t>(button->
GetData()));
1163 :
SchedEditChild(parent,
"StorageOptionsEditor", editor, rule, recInfo),
1175 "schedule-ui.xml",
"storageoptionseditor",
1187 LOG(VB_GENERAL, LOG_ERR,
"StoreOptEditor, theme is missing "
1188 "required elements");
1226 QString resultid = dce->
GetId();
1229 if (resultid ==
"newrecgroup")
1252 :
SchedEditChild(parent,
"PostProcOptionsEditor", editor, rule, recInfo),
1264 "schedule-ui.xml",
"postproceditor",
1276 LOG(VB_GENERAL, LOG_ERR,
"PostProcEditor, theme is missing "
1277 "required elements");
1317 :
SchedEditChild(parent,
"MetadataOptions", editor, rule, recInfo),
1319 m_busyPopup(NULL), m_fanart(NULL), m_coverart(NULL),
1320 m_banner(NULL), m_inetrefEdit(NULL), m_seasonSpin(NULL),
1321 m_episodeSpin(NULL), m_queryButton(NULL), m_localFanartButton(NULL),
1322 m_localCoverartButton(NULL), m_localBannerButton(NULL),
1323 m_onlineFanartButton(NULL), m_onlineCoverartButton(NULL),
1324 m_onlineBannerButton(NULL)
1356 "schedule-ui.xml",
"metadataoptions",
1380 LOG(VB_GENERAL, LOG_ERR,
"MetadataOptions, theme is missing "
1381 "required elements");
1447 QString message = title;
1461 "recording online..."));
1492 QString msg = tr(
"Downloading selected artwork...");
1502 downloads.insert(type, info);
1594 lookup->
toMap(metadataMap);
1599 const QString &prefixAlt,
1601 const QString &returnEvent)
1605 if (prefix.startsWith(
"myth://"))
1608 fp = prefix.isEmpty() ? prefixAlt :
prefix;
1628 QList<QByteArray> exts = QImageReader::supportedImageFormats();
1629 for (QList<QByteArray>::iterator
p = exts.begin();
p != exts.end(); ++
p)
1631 ret.append(QString(
"*.").append(*
p));
1642 "on this rule to set artwork. For items "
1643 "without a metadata source, you can set "
1644 "any unique value."));
1658 QString msg = tr(
"Searching for available artwork...");
1697 if (list.count() == 0)
1706 if (resultsdialog->
Create())
1720 for (DownloadMap::const_iterator i = map.begin(); i != map.end(); ++i)
1780 if (list.count() > 1)
1784 for (
int p = 0;
p != list.size(); ++
p)
1796 (list[
p])->GetYear() != 0 &&
1801 LOG(VB_GENERAL, LOG_INFO,
"Multiple results matched on year. No definite "
1802 "match could be found based on year alone.");
1805 else if (yearindex == -1)
1807 LOG(VB_GENERAL, LOG_INFO,
"Matched based on year. ");
1821 LOG(VB_GENERAL, LOG_INFO,
"Falling through to selection dialog.");
1827 Qt::QueuedConnection);
1829 if (resultsdialog->
Create())
1871 QString title = tr(
"No match found for this recording. You can "
1872 "try entering a TVDB/TMDB number, season, and "
1873 "episode manually.");
1896 if (lul.count() >= 1)
1917 QString title = tr(
"This number, season, and episode combination "
1918 "does not appear to be valid (or the site may "
1919 "be down). Check your information and try "
1971 const QString resultid = dce->
GetId();
1975 if (resultid ==
"coverart")
1979 else if (resultid ==
"fanart")
1983 else if (resultid ==
"banner")
2005 : m_prioritySpin(NULL), m_startoffsetSpin(NULL), m_endoffsetSpin(NULL),
2006 m_dupmethodList(NULL), m_dupscopeList(NULL), m_inputList(NULL),
2007 m_ruleactiveCheck(NULL), m_newrepeatList(NULL),
2008 m_screen(&screen), m_rule(rule), m_other(other), m_loaded(
false),
2009 m_haveRepeats(
gCoreContext->GetNumSetting(
"HaveRepeats", 0))
2093 QObject::tr(
"Match duplicates using subtitle & description"),
2096 QObject::tr(
"Match duplicates using subtitle then description"),
2099 QObject::tr(
"Match duplicates using subtitle"),
2102 QObject::tr(
"Match duplicates using description"),
2105 QObject::tr(
"Don't match duplicates"),
2119 QObject::tr(
"Look for duplicates in current and previous "
2120 "recordings"), ENUM_TO_QVARIANT(
kDupsInAll));
2122 QObject::tr(
"Look for duplicates in current recordings only"),
2125 QObject::tr(
"Look for duplicates in previous recordings only"),
2131 QObject::tr(
"Record new episodes only"),
2144 QObject::tr(
"Use any available input"),
2145 qVariantFromValue(0));
2148 for (
uint i = 0; i < inputids.size(); ++i)
2151 QObject::tr(
"Prefer input %1")
2170 QObject::tr(
"Record new and repeat "
2171 "episodes"), ENUM_TO_QVARIANT(0));
2173 QObject::tr(
"Record new episodes only"),
2269 : m_recprofileList(NULL), m_recgroupList(NULL), m_storagegroupList(NULL),
2270 m_playgroupList(NULL), m_maxepSpin(NULL), m_maxbehaviourList(NULL),
2271 m_autoexpireCheck(NULL),
2272 m_screen(&screen), m_rule(rule), m_other(other), m_loaded(
false)
2324 QStringList::Iterator it;
2332 label = QObject::tr(
"Record using the %1 profile");
2334 QMap<int, QString>::iterator pit;
2335 for (pit = profiles.begin(); pit != profiles.end(); ++pit)
2338 label.arg(pit.value()),
2339 qVariantFromValue(pit.value()));
2350 label = QObject::tr(
"Include in the \"%1\" recording group");
2352 QObject::tr(
"Create a new recording group"),
2353 qVariantFromValue(QString(
"__NEW_GROUP__")));
2355 label.arg(QObject::tr(
"Default")),
2356 qVariantFromValue(QString(
"Default")));
2362 query.
prepare(
"SELECT DISTINCT recgroup FROM recorded "
2363 "WHERE recgroup <> 'Default' AND "
2364 " recgroup <> 'Deleted'");
2367 while (query.
next())
2368 groups += query.
value(0).toString();
2370 query.
prepare(
"SELECT DISTINCT recgroup FROM record "
2371 "WHERE recgroup <> 'Default'");
2374 while (query.
next())
2375 groups += query.
value(0).toString();
2379 groups.removeDuplicates();
2380 for (it = groups.begin(); it != groups.end(); ++it)
2383 qVariantFromValue(*it));
2394 label = QObject::tr(
"Store in the \"%1\" storage group");
2396 label.arg(QObject::tr(
"Default")),
2397 qVariantFromValue(QString(
"Default")));
2400 for (it = groups.begin(); it != groups.end(); ++it)
2402 if ((*it).compare(
"Default", Qt::CaseInsensitive) != 0)
2404 label.arg(*it), qVariantFromValue(*it));
2415 label = QObject::tr(
"Use \"%1\" playback group settings");
2417 label.arg(QObject::tr(
"Default")),
2418 qVariantFromValue(QString(
"Default")));
2421 for (it = groups.begin(); it != groups.end(); ++it)
2424 qVariantFromValue(*it));
2448 QObject::tr(
"Don't record if this would exceed the max "
2449 "episodes"), qVariantFromValue(
false));
2451 QObject::tr(
"Delete oldest if this would exceed the max "
2452 "episodes"), qVariantFromValue(
true));
2550 QObject::tr(
"Create New Recording Group. Enter group name: ");
2558 if (textDialog->
Create())
2559 popupStack->
AddScreen(textDialog,
false);
2569 recgroup = recgroup.trimmed();
2570 if (recgroup.isEmpty())
2573 QString label = QObject::tr(
"Include in the \"%1\" recording group");
2576 qVariantFromValue(recgroup));
2582 label.arg(recgroup), qVariantFromValue(recgroup));
2597 : m_commflagCheck(NULL), m_transcodeCheck(NULL),
2598 m_transcodeprofileList(NULL), m_userjob1Check(NULL),
2599 m_userjob2Check(NULL), m_userjob3Check(NULL), m_userjob4Check(NULL),
2600 m_metadataLookupCheck(NULL),
2601 m_screen(&screen), m_rule(rule), m_other(other), m_loaded(
false)
2670 QMap<int, QString> profiles =
2672 QMap<int, QString>::iterator it;
2673 for (it = profiles.begin(); it != profiles.end(); ++it)
2676 qVariantFromValue(it.key()));
2690 userjob1Text->
SetText(QObject::tr(
"Run '%1'")
2704 userjob2Text->
SetText(QObject::tr(
"Run '%1'")
2718 userjob3Text->
SetText(QObject::tr(
"Run '%1'")
2732 userjob4Text->
SetText(QObject::tr(
"Run '%1'")