MythTV master
programrecpriority.cpp
Go to the documentation of this file.
1// C/C++ headers
2#include <vector> // For std::vector
3
4// QT headers
5#include <QDateTime>
6
7// MythTV headers
21
22// MythFrontend
23#include "proglist.h"
24#include "programrecpriority.h"
25#include "scheduleeditor.h"
26
28 const ProgramRecPriorityInfo &other, bool ignore_non_serialized_data)
29{
30 RecordingInfo::clone(other, ignore_non_serialized_data);
31
32 if (!ignore_non_serialized_data)
33 {
34 m_recType = other.m_recType;
36 m_recCount = other.m_recCount;
39 m_profile = other.m_profile;
42 }
43}
44
46 const RecordingInfo &other, bool ignore_non_serialized_data)
47{
48 RecordingInfo::clone(other, ignore_non_serialized_data);
49
50 if (!ignore_non_serialized_data)
51 {
53 m_matchCount = 0;
54 m_recCount = 0;
55 m_last_record = QDateTime();
56 m_avg_delay = 0;
57 m_profile.clear();
58 m_storageGroup.clear();
59 m_recordingGroup.clear();
60 }
61}
62
64 const ProgramInfo &other, bool ignore_non_serialized_data)
65{
66 RecordingInfo::clone(other, ignore_non_serialized_data);
67
68 if (!ignore_non_serialized_data)
69 {
71 m_matchCount = 0;
72 m_recCount = 0;
73 m_last_record = QDateTime();
74 m_avg_delay = 0;
75 m_profile.clear();
76 m_storageGroup.clear();
77 m_recordingGroup.clear();
78 }
79}
80
82{
84
86 m_matchCount = 0;
87 m_recCount = 0;
88 m_last_record = QDateTime();
89 m_avg_delay = 0;
90 m_profile.clear();
91 m_storageGroup.clear();
92 m_recordingGroup.clear();
93}
94
96 bool showrerecord, uint star_range,
97 uint date_format) const
98{
99 RecordingInfo::ToMap(progMap, showrerecord, star_range, date_format);
100 progMap["title"] = (m_title == "Default (Template)") ?
101 QObject::tr("Default (Template)") : m_title;
102 progMap["category"] = (m_category == "Default") ?
103 QObject::tr("Default") : m_category;
104 progMap["storagegroup"] = (m_storageGroup == "Default") ?
105 QObject::tr("Default") : m_storageGroup;
106 progMap["recordinggroup"] = (m_recordingGroup == "Default") ?
107 QObject::tr("Default") : m_recordingGroup;
108}
109
111{
112 public:
113 explicit TitleSort(bool reverse) : m_reverse(reverse) {}
114
116 const ProgramRecPriorityInfo *b) const
117 {
119 if (cmp == 0)
121 // sort higher recording priority before
122 if (cmp == 0)
124 // sort lower RecordingTypePrecedence before
125 if (cmp == 0)
127 // sort lower RecordingRuleID before
128 if (cmp == 0)
130
131 return m_reverse ? cmp > 0 : cmp < 0;
132 }
133
134 private:
135 bool m_reverse {false};
136};
137
139{
140 public:
141 explicit ProgramRecPrioritySort(bool reverse) : m_reverse(reverse) {}
142
144 const ProgramRecPriorityInfo *b) const
145 {
146 // sort higher recording priority before
148 // sort lower RecTypePrecedence before
149 if (cmp == 0)
151 // sort lower RecordingRuleID before
152 if (cmp == 0)
154
155 return m_reverse ? cmp > 0 : cmp < 0;
156 }
157
158 private:
159 bool m_reverse {false};
160};
161
163{
164 public:
165 explicit ProgramRecTypeSort(bool reverse) : m_reverse(reverse) {}
166
168 const ProgramRecPriorityInfo *b) const
169 {
170 // sort lower RecTypePrecedence before
172 // sort higher recording priority before
173 if (cmp == 0)
175 // sort lower RecordingRuleID before
176 if (cmp == 0)
178
179 return m_reverse ? cmp > 0 : cmp < 0;
180 }
181
182 private:
183 bool m_reverse {false};
184};
185
187{
188 public:
189 explicit ProgramCountSort(bool reverse) : m_reverse(reverse) {}
190
192 const ProgramRecPriorityInfo *b) const
193 {
194 // sort higher match count before
195 int cmp = ternary_compare(b->m_matchCount, a->m_matchCount);
196 // sort higher recCount before
197 if (cmp == 0)
199 if (cmp == 0)
201 if (cmp == 0)
203
204 return m_reverse ? cmp > 0 : cmp < 0;
205 }
206
207 private:
208 bool m_reverse {false};
209};
210
212{
213 public:
214 explicit ProgramRecCountSort(bool reverse) : m_reverse(reverse) {}
215
217 const ProgramRecPriorityInfo *b) const
218 {
219 // sort higher recCount before
220 int cmp = ternary_compare(b->m_recCount, a->m_recCount);
221 // sort higher match count before
222 if (cmp == 0)
224 if (cmp == 0)
226 if (cmp == 0)
228
229 return m_reverse ? cmp > 0 : cmp < 0;
230 }
231
232 private:
233 bool m_reverse {false};
234};
235
237{
238 public:
239 explicit ProgramLastRecordSort(bool reverse) : m_reverse(reverse) {}
240
242 const ProgramRecPriorityInfo *b) const
243 {
244 // sort later date time before
246 if (cmp == 0)
248 if (cmp == 0)
250
251 return m_reverse ? cmp > 0 : cmp < 0;
252 }
253
254 private:
255 bool m_reverse {false};
256};
257
259{
260 public:
261 explicit ProgramAvgDelaySort(bool reverse) : m_reverse(reverse) {}
262
264 const ProgramRecPriorityInfo *b) const
265 {
266 int cmp = ternary_compare(a->m_avg_delay, b->m_avg_delay);
267 if (cmp == 0)
269 if (cmp == 0)
271
272 return m_reverse ? cmp > 0 : cmp < 0;
273 }
274
275 private:
276 bool m_reverse {false};
277};
278
280
282 const QString &name)
283 : ScheduleCommon(parent, name)
284{
285 m_sortType = (SortType)gCoreContext->GetNumSetting("ProgramRecPrioritySorting",
286 (int)byTitle);
287 m_reverseSort = gCoreContext->GetBoolSetting("ProgramRecPriorityReverse", false);
288}
289
291{
292 if (!LoadWindowFromXML("schedule-ui.xml", "managerecrules", this))
293 return false;
294
295 m_programList = dynamic_cast<MythUIButtonList *> (GetChild("programs"));
296
297 m_schedInfoText = dynamic_cast<MythUIText *> (GetChild("scheduleinfo"));
298 m_recPriorityText = dynamic_cast<MythUIText *> (GetChild("recpriority"));
299 m_recPriorityBText = dynamic_cast<MythUIText *> (GetChild("recpriorityB"));
300 m_finalPriorityText = dynamic_cast<MythUIText *> (GetChild("finalpriority"));
301 m_lastRecordedText = dynamic_cast<MythUIText *> (GetChild("lastrecorded"));
302 m_lastRecordedDateText = dynamic_cast<MythUIText *> (GetChild("lastrecordeddate"));
303 m_lastRecordedTimeText = dynamic_cast<MythUIText *> (GetChild("lastrecordedtime"));
304 m_chanNameText = dynamic_cast<MythUIText *> (GetChild("channel"));
305 m_chanNumText = dynamic_cast<MythUIText *> (GetChild("channum"));
306 m_callSignText = dynamic_cast<MythUIText *> (GetChild("callsign"));
307 m_recProfileText = dynamic_cast<MythUIText *> (GetChild("recordingprofile"));
308
309 if (!m_programList)
310 {
311 LOG(VB_GENERAL, LOG_ERR, "Theme is missing critical theme elements.");
312 return false;
313 }
314
319
320 m_programList->SetLCDTitles(tr("Schedule Priorities"),
321 "rec_type|titlesubtitle|progpriority");
322 m_programList->SetSearchFields("titlesubtitle");
323
326
327 return true;
328}
329
331{
332 FillList();
333}
334
336{
337 SortList();
338}
339
341{
342 if (GetFocusWidget()->keyPressEvent(event))
343 return true;
344
345 QStringList actions;
346 bool handled = GetMythMainWindow()->TranslateKeyPress("TV Frontend", event, actions);
347
348 for (int i = 0; i < actions.size() && !handled; i++)
349 {
350 const QString& action = actions[i];
351 handled = true;
352
353 if (action == "RANKINC")
355 else if (action == "RANKDEC")
357 else if (action == "ESCAPE")
358 {
360 gCoreContext->SaveSetting("ProgramRecPrioritySorting",
361 (int)m_sortType);
362 gCoreContext->SaveSetting("ProgramRecPriorityReverse",
363 (int)m_reverseSort);
364 Close();
365 }
366 else if (action == "1")
367 {
368 if (m_sortType != byTitle)
369 {
371 m_reverseSort = false;
372 }
373 else
374 {
376 }
377 SortList();
378 }
379 else if (action == "2")
380 {
382 {
384 m_reverseSort = false;
385 }
386 else
387 {
389 }
390 SortList();
391 }
392 else if (action == "4")
393 {
394 if (m_sortType != byRecType)
395 {
397 m_reverseSort = false;
398 }
399 else
400 {
402 }
403 SortList();
404 }
405 else if (action == "5")
406 {
407 if (m_sortType != byCount)
408 {
410 m_reverseSort = false;
411 }
412 else
413 {
415 }
416 SortList();
417 }
418 else if (action == "6")
419 {
420 if (m_sortType != byRecCount)
421 {
423 m_reverseSort = false;
424 }
425 else
426 {
428 }
429 SortList();
430 }
431 else if (action == "7")
432 {
434 {
436 m_reverseSort = false;
437 }
438 else
439 {
441 }
442 SortList();
443 }
444 else if (action == "8")
445 {
446 if (m_sortType != byAvgDelay)
447 {
449 m_reverseSort = false;
450 }
451 else
452 {
454 }
455 SortList();
456 }
457 else if (action == "PREVVIEW" || action == "NEXTVIEW")
458 {
459 m_reverseSort = false;
460 if (m_sortType == byTitle)
462 else if (m_sortType == byRecPriority)
464 else
466 SortList();
467 }
468 else if (action == "SELECT" || action == "EDIT")
469 {
472 }
473 else if (action == "MENU")
474 {
475 showMenu();
476 }
477 else if (action == "CUSTOMEDIT")
478 {
480 EditCustom();
481 }
482 else if (action == "DELETE")
483 {
485 remove();
486 }
487 else if (action == "UPCOMING")
488 {
490 ShowUpcoming();
491 }
492 else if (action == "INFO" || action == "DETAILS")
493 {
494 ShowDetails();
495 }
496 else
497 {
498 handled = false;
499 }
500 }
501
502 if (!handled && MythScreenType::keyPressEvent(event))
503 handled = true;
504
505 return handled;
506}
507
509{
510 QString label = tr("Options");
511
512 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
513 auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup");
514
515 if (menuPopup->Create())
516 {
517 menuPopup->SetReturnEvent(this, "menu");
518
519 menuPopup->AddButton(tr("Increase Priority"));
520 menuPopup->AddButton(tr("Decrease Priority"));
521 menuPopup->AddButton(tr("Sort"), nullptr, true);
522 menuPopup->AddButton(tr("Program Details"));
523 menuPopup->AddButton(tr("Upcoming"));
524 menuPopup->AddButton(tr("Custom Edit"));
525 menuPopup->AddButton(tr("Delete Rule"));
526 menuPopup->AddButton(tr("New Template"));
527
528 popupStack->AddScreen(menuPopup);
529 }
530 else
531 {
532 delete menuPopup;
533 }
534}
535
537{
538 QString label = tr("Sort Options");
539
540 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
541 auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup");
542
543 if (menuPopup->Create())
544 {
545 menuPopup->SetReturnEvent(this, "sortmenu");
546
547 menuPopup->AddButton(tr("Reverse Sort Order"));
548 menuPopup->AddButton(tr("Sort By Title"));
549 menuPopup->AddButton(tr("Sort By Priority"));
550 menuPopup->AddButton(tr("Sort By Type"));
551 menuPopup->AddButton(tr("Sort By Count"));
552 menuPopup->AddButton(tr("Sort By Record Count"));
553 menuPopup->AddButton(tr("Sort By Last Recorded"));
554 menuPopup->AddButton(tr("Sort By Average Delay"));
555
556 popupStack->AddScreen(menuPopup);
557 }
558 else
559 {
560 delete menuPopup;
561 }
562}
563
565{
566 if (event->type() == DialogCompletionEvent::kEventType)
567 {
568 auto *dce = (DialogCompletionEvent*)(event);
569
570 QString resultid = dce->GetId();
571 QString resulttext = dce->GetResultText();
572 int buttonnum = dce->GetResult();
573
574 if (resultid == "menu")
575 {
576 if (resulttext == tr("Increase Priority"))
577 {
579 }
580 else if (resulttext == tr("Decrease Priority"))
581 {
583 }
584 else if (resulttext == tr("Sort"))
585 {
586 showSortMenu();
587 }
588 else if (resulttext == tr("Program Details"))
589 {
590 ShowDetails();
591 }
592 else if (resulttext == tr("Upcoming"))
593 {
595 ShowUpcoming();
596 }
597 else if (resulttext == tr("Custom Edit"))
598 {
600 EditCustom();
601 }
602 else if (resulttext == tr("Delete Rule"))
603 {
605 remove();
606 }
607 else if (resulttext == tr("New Template"))
608 {
609 MythScreenStack *popupStack =
610 GetMythMainWindow()->GetStack("popup stack");
611 auto *textInput = new MythTextInputDialog(popupStack,
612 tr("Template Name"));
613 if (textInput->Create())
614 {
615 textInput->SetReturnEvent(this, "templatecat");
616 popupStack->AddScreen(textInput);
617 }
618 }
619 }
620 else if (resultid == "sortmenu")
621 {
622 if (resulttext == tr("Reverse Sort Order"))
623 {
625 SortList();
626 }
627 else if (resulttext == tr("Sort By Title"))
628 {
629 if (m_sortType != byTitle)
630 {
632 m_reverseSort = false;
633 }
634 else
635 {
637 }
638 SortList();
639 }
640 else if (resulttext == tr("Sort By Priority"))
641 {
643 {
645 m_reverseSort = false;
646 }
647 else
648 {
650 }
651 SortList();
652 }
653 else if (resulttext == tr("Sort By Type"))
654 {
655 if (m_sortType != byRecType)
656 {
658 m_reverseSort = false;
659 }
660 else
661 {
663 }
664 SortList();
665 }
666 else if (resulttext == tr("Sort By Count"))
667 {
668 if (m_sortType != byCount)
669 {
671 m_reverseSort = false;
672 }
673 else
674 {
676 }
677 SortList();
678 }
679 else if (resulttext == tr("Sort By Record Count"))
680 {
681 if (m_sortType != byRecCount)
682 {
684 m_reverseSort = false;
685 }
686 else
687 {
689 }
690 SortList();
691 }
692 else if (resulttext == tr("Sort By Last Recorded"))
693 {
695 {
697 m_reverseSort = false;
698 }
699 else
700 {
702 }
703 SortList();
704 }
705 else if (resulttext == tr("Sort By Average Delay"))
706 {
707 if (m_sortType != byAvgDelay)
708 {
710 m_reverseSort = false;
711 }
712 else
713 {
715 }
716 SortList();
717 }
718 }
719 else if (resultid == "deleterule")
720 {
721 auto *record = dce->GetData().value<RecordingRule *>();
722 if (record)
723 {
724 if (buttonnum > 0)
725 {
728
729 if (record->Delete() && item)
730 RemoveItemFromList(item);
731 else
732 LOG(VB_GENERAL, LOG_ERR,
733 "Failed to delete recording rule");
734 }
735 delete record;
736 }
737 }
738 else if (resultid == "templatecat")
739 {
740 newTemplate(resulttext);
741 }
742 else
743 {
745 }
746 }
747}
748
750{
751 if (!item)
752 return;
753
754 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
755 if (!pgRecInfo)
756 return;
757
758 auto *record = new RecordingRule();
759 record->m_recordID = pgRecInfo->GetRecordingRuleID();
760 if (record->m_searchType == kNoSearch)
761 record->LoadByProgram(pgRecInfo);
762
764 auto *schededit = new ScheduleEditor(mainStack, record);
765 if (schededit->Create())
766 {
767 mainStack->AddScreen(schededit);
770 }
771 else
772 {
773 delete schededit;
774 }
775}
776
778{
779 category = category.trimmed();
780 if (category.isEmpty())
781 return;
782
783 // Try to find an existing template and use it.
784 QMap<int, ProgramRecPriorityInfo>::Iterator it;
785 for (it = m_programData.begin(); it != m_programData.end(); ++it)
786 {
787 ProgramRecPriorityInfo *progInfo = &(*it);
788 if (progInfo->GetRecordingRuleType() == kTemplateRecord &&
789 category.compare(progInfo->GetCategory(),
790 Qt::CaseInsensitive) == 0)
791 {
792 m_programList->SetValueByData(QVariant::fromValue(progInfo));
794 return;
795 }
796 }
797
798 auto *record = new RecordingRule();
799 if (!record)
800 return;
801 record->MakeTemplate(category);
802
804 auto *schededit = new ScheduleEditor(mainStack, record);
805 if (schededit->Create())
806 {
807 mainStack->AddScreen(schededit);
810 }
811 else
812 {
813 delete schededit;
814 }
815}
816
818{
819 // Assumes that the current item didn't change, which isn't guaranteed
821 ProgramRecPriorityInfo *pgRecInfo = nullptr;
822 if (item)
823 pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
824
825 // If the recording id doesn't match, the user created a new
826 // template.
827 if (!pgRecInfo || recid != pgRecInfo->getRecordID())
828 {
829 RecordingRule record;
830 record.m_recordID = recid;
831 if (!record.Load() || record.m_type == kNotRecording)
832 return;
833
834 ProgramRecPriorityInfo progInfo;
835 progInfo.SetRecordingRuleID(record.m_recordID);
836 progInfo.SetRecordingRuleType(record.m_type);
837 progInfo.SetTitle(record.m_title, record.m_sortTitle);
838 progInfo.SetSubtitle(record.m_subtitle, record.m_sortSubtitle);
839 progInfo.SetCategory(record.m_category);
840 progInfo.SetRecordingPriority(record.m_recPriority);
841 progInfo.m_recType = record.m_type;
842 progInfo.m_recStatus = record.m_isInactive ?
844 progInfo.m_profile = record.m_recProfile;
845 progInfo.m_last_record = record.m_lastRecorded;
846 progInfo.m_storageGroup = record.m_storageGroup;
848
849 m_programData[recid] = progInfo;
851 record.m_recPriority;
852 SortList(&m_programData[recid]);
853
854 return;
855 }
856
857 // We need to refetch the recording priority values since the Advanced
858 // Recording Options page could've been used to change them
859
861 query.prepare("SELECT recpriority, type, inactive "
862 "FROM record "
863 "WHERE recordid = :RECORDID");
864 query.bindValue(":RECORDID", recid);
865 if (!query.exec())
866 {
867 MythDB::DBError("Get new recording priority query", query);
868 }
869 else if (query.next())
870 {
871 int recPriority = query.value(0).toInt();
872 int rectype = query.value(1).toInt();
873 int inactive = query.value(2).toInt();
874
875 // set the recording priorities of that program
876 pgRecInfo->SetRecordingPriority(recPriority);
877 pgRecInfo->m_recType = (RecordingType)rectype;
878 // also set the m_origRecPriorityData with new recording
879 // priority so we don't save to db again when we exit
881 pgRecInfo->GetRecordingPriority();
882 // also set the active/inactive state
883 pgRecInfo->m_recStatus = inactive ? RecStatus::Inactive : RecStatus::Unknown;
884
885 SortList();
886 }
887 else
888 {
889 RemoveItemFromList(item);
890 }
891
892 countMatches();
893}
894
896{
898 if (!item)
899 return;
900
901 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
902 if (!pgRecInfo ||
903 (pgRecInfo->m_recType == kTemplateRecord &&
904 pgRecInfo->GetCategory()
905 .compare("Default", Qt::CaseInsensitive) == 0))
906 {
907 return;
908 }
909
910 auto *record = new RecordingRule();
911 record->m_recordID = pgRecInfo->GetRecordingRuleID();
912 if (!record->Load())
913 {
914 delete record;
915 return;
916 }
917
918 QString message = tr("Delete '%1' %2 rule?")
919 .arg(record->m_title, toString(pgRecInfo->GetRecordingRuleType()));
920
921 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
922
923 auto *okPopup = new MythConfirmationDialog(popupStack, message, true);
924 okPopup->SetReturnEvent(this, "deleterule");
925 okPopup->SetData(QVariant::fromValue(record));
926
927 if (okPopup->Create())
928 popupStack->AddScreen(okPopup);
929 else
930 delete okPopup;
931}
932
934{
936 if (!item)
937 return;
938
939 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
940 if (pgRecInfo)
941 {
943
944 query.prepare("SELECT inactive "
945 "FROM record "
946 "WHERE recordid = :RECID");
947 query.bindValue(":RECID", pgRecInfo->GetRecordingRuleID());
948
949
950 if (!query.exec())
951 {
952 MythDB::DBError("ProgramRecPriority::deactivate()", query);
953 }
954 else if (query.next())
955 {
956 int inactive = query.value(0).toInt();
957 if (inactive)
958 inactive = 0;
959 else
960 inactive = 1;
961
962 query.prepare("UPDATE record "
963 "SET inactive = :INACTIVE "
964 "WHERE recordid = :RECID");
965 query.bindValue(":INACTIVE", inactive);
966 query.bindValue(":RECID", pgRecInfo->GetRecordingRuleID());
967
968 if (!query.exec())
969 {
971 "Update recording schedule inactive query", query);
972 }
973 else
974 {
976 QString("DeactivateRule %1 %2")
977 .arg(pgRecInfo->GetRecordingRuleID())
978 .arg(pgRecInfo->GetTitle()));
979 pgRecInfo->m_recStatus = inactive ? RecStatus::Inactive : RecStatus::Unknown;
980 item->DisplayState("disabled", "status");
981 }
982 }
983 }
984}
985
987{
989 if (!item)
990 return;
991
992 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
993 if (!pgRecInfo)
994 return;
995
996 // inc/dec recording priority
997 int tempRecPriority = pgRecInfo->GetRecordingPriority() + howMuch;
998 if (tempRecPriority > -100 && tempRecPriority < 100)
999 {
1000 pgRecInfo->m_recPriority = tempRecPriority;
1001
1002 // order may change if sorting by recording priority, so resort
1004 SortList();
1005 else
1006 {
1007 // No need to re-fill the entire list, just update this entry
1008 int progRecPriority = pgRecInfo->GetRecordingPriority();
1009
1010 item->SetText(QString::number(progRecPriority), "progpriority");
1011 item->SetText(QString::number(progRecPriority), "recpriority");
1013 m_recPriorityText->SetText(QString::number(progRecPriority));
1014
1015 item->SetText(QString::number(progRecPriority), "recpriorityB");
1017 m_recPriorityBText->SetText(QString::number(progRecPriority));
1018
1019 item->SetText(QString::number(progRecPriority), "finalpriority");
1021 m_finalPriorityText->SetText(QString::number(progRecPriority));
1022 }
1023 }
1024}
1025
1027{
1028 QMap<int, ProgramRecPriorityInfo>::Iterator it;
1029
1030 for (it = m_programData.begin(); it != m_programData.end(); ++it)
1031 {
1032 ProgramRecPriorityInfo *progInfo = &(*it);
1033 int key = progInfo->GetRecordingRuleID();
1034
1035 // if this program's recording priority changed from when we entered
1036 // save new value out to db
1037 if (progInfo->GetRecordingPriority() != m_origRecPriorityData[key])
1039 progInfo->GetRecordingPriority());
1040 }
1041}
1042
1044{
1045 std::vector<ProgramInfo *> recordinglist;
1046
1047 m_programData.clear();
1048
1049 RemoteGetAllScheduledRecordings(recordinglist);
1050
1051 for (auto & pgiter : recordinglist)
1052 {
1053 ProgramInfo *progInfo = pgiter;
1054 m_programData[pgiter->GetRecordingRuleID()] =
1055 (*progInfo);
1056
1057 // save recording priority value in map so we don't have to
1058 // save all program's recording priority values when we exit
1059 m_origRecPriorityData[pgiter->GetRecordingRuleID()] =
1060 pgiter->GetRecordingPriority();
1061
1062 delete pgiter;
1063 }
1064
1065 // get recording types associated with each program from db
1066 // (hope this is ok to do here, it's so much lighter doing
1067 // it all at once than once per program)
1068
1069 MSqlQuery result(MSqlQuery::InitCon());
1070 result.prepare("SELECT recordid, title, chanid, starttime, startdate, "
1071 "type, inactive, last_record, avg_delay, profile, "
1072 "recgroup, storagegroup "
1073 "FROM record;");
1074
1075 if (!result.exec())
1076 {
1077 MythDB::DBError("Get program recording priorities query", result);
1078 }
1079
1080 countMatches();
1081 while (result.next()) {
1082 uint recordid = result.value(0).toUInt();
1083// QString title = result.value(1).toString();
1084// QString chanid = result.value(2).toString();
1085// QString tempTime = result.value(3).toString();
1086// QString tempDate = result.value(4).toString();
1087 RecordingType recType = (RecordingType)result.value(5).toInt();
1088 int inactive = result.value(6).toInt();
1089 QDateTime lastrec = MythDate::as_utc(result.value(7).toDateTime());
1090 int avgd = result.value(8).toInt();
1091 QString profile = result.value(9).toString();
1092 QString recordingGroup = result.value(10).toString();
1093 QString storageGroup = result.value(11).toString();
1094
1095 // find matching program in m_programData and set
1096 // recType
1097 QMap<int, ProgramRecPriorityInfo>::Iterator it;
1098 it = m_programData.find(recordid);
1099 if (it != m_programData.end())
1100 {
1101 ProgramRecPriorityInfo *progInfo = &(*it);
1102
1103 progInfo->m_recType = recType;
1104 progInfo->m_matchCount =
1105 m_listMatch[progInfo->GetRecordingRuleID()];
1106 progInfo->m_recCount =
1107 m_recMatch[progInfo->GetRecordingRuleID()];
1108 progInfo->m_last_record = lastrec;
1109 progInfo->m_avg_delay = avgd;
1110 progInfo->m_profile = profile;
1111 progInfo->m_recordingGroup = recordingGroup;
1112 progInfo->m_storageGroup = storageGroup;
1113
1114 if (inactive)
1115 progInfo->m_recStatus = RecStatus::Inactive;
1116 else if (m_conMatch[progInfo->GetRecordingRuleID()] > 0)
1117 progInfo->m_recStatus = RecStatus::Conflict;
1118 else if (m_nowMatch[progInfo->GetRecordingRuleID()] > 0)
1120 else if (m_recMatch[progInfo->GetRecordingRuleID()] > 0)
1122 else
1123 progInfo->m_recStatus = RecStatus::Unknown;
1124 }
1125 }
1126}
1127
1129{
1130 m_listMatch.clear();
1131 m_conMatch.clear();
1132 m_nowMatch.clear();
1133 m_recMatch.clear();
1134 ProgramList schedList;
1135 LoadFromScheduler(schedList);
1136 QDateTime now = MythDate::current();
1137
1138 for (auto *program : schedList)
1139 {
1140 const RecStatus::Type recstatus = (*program).GetRecordingStatus();
1141 const uint recordid = (*program).GetRecordingRuleID();
1142 if ((*program).GetRecordingEndTime() > now && recstatus != RecStatus::NotListed)
1143 {
1144 m_listMatch[recordid]++;
1145 if (recstatus == RecStatus::Conflict || recstatus == RecStatus::Offline)
1146 m_conMatch[recordid]++;
1147 else if (recstatus == RecStatus::WillRecord)
1148 m_recMatch[recordid]++;
1149 else if (recstatus == RecStatus::Recording)
1150 {
1151 m_nowMatch[recordid]++;
1152 m_recMatch[recordid]++;
1153 }
1154 }
1155 }
1156}
1157
1159{
1160 if (newCurrentItem)
1161 m_currentItem = newCurrentItem;
1162 else
1163 {
1165 if (item)
1167 item->GetData().value<ProgramRecPriorityInfo*>();
1168 }
1169
1170 QMap<int, ProgramRecPriorityInfo>::Iterator pit;
1171
1172 // copy m_programData into m_sortedProgram
1173 m_sortedProgram.clear();
1174 for (pit = m_programData.begin(); pit != m_programData.end(); ++pit)
1175 {
1176 ProgramRecPriorityInfo *progInfo = &(*pit);
1177 m_sortedProgram.push_back(progInfo);
1178 }
1179
1180 // sort m_sortedProgram
1181 switch (m_sortType)
1182 {
1183 case byTitle :
1184 sort(m_sortedProgram.begin(), m_sortedProgram.end(),
1186 break;
1187 case byRecPriority :
1188 sort(m_sortedProgram.begin(), m_sortedProgram.end(),
1190 break;
1191 case byRecType :
1192 sort(m_sortedProgram.begin(), m_sortedProgram.end(),
1194 break;
1195 case byCount :
1196 sort(m_sortedProgram.begin(), m_sortedProgram.end(),
1198 break;
1199 case byRecCount :
1200 sort(m_sortedProgram.begin(), m_sortedProgram.end(),
1202 break;
1203 case byLastRecord :
1204 sort(m_sortedProgram.begin(), m_sortedProgram.end(),
1206 break;
1207 case byAvgDelay :
1208 sort(m_sortedProgram.begin(), m_sortedProgram.end(),
1210 break;
1211 }
1212
1213 UpdateList();
1214}
1215
1217{
1220 .value<ProgramRecPriorityInfo*>();
1221
1223
1224 std::vector<ProgramRecPriorityInfo*>::iterator it;
1225 for (it = m_sortedProgram.begin(); it != m_sortedProgram.end(); ++it)
1226 {
1227 ProgramRecPriorityInfo *progInfo = *it;
1228
1229 auto *item = new MythUIButtonListItem(m_programList, "",
1230 QVariant::fromValue(progInfo));
1231
1232 int progRecPriority = progInfo->GetRecordingPriority();
1233
1234 if ((progInfo->m_recType == kSingleRecord ||
1235 progInfo->m_recType == kOverrideRecord ||
1236 progInfo->m_recType == kDontRecord) &&
1237 !(progInfo->GetSubtitle()).trimmed().isEmpty())
1238 {
1239 QString rating = QString::number(progInfo->GetStars(10));
1240
1241 item->DisplayState(rating, "ratingstate");
1242 }
1243 else
1244 {
1245 progInfo->m_subtitle.clear();
1246 }
1247
1248 QString state;
1249 if (progInfo->m_recType == kDontRecord ||
1250 (progInfo->m_recType != kTemplateRecord &&
1251 progInfo->m_recStatus == RecStatus::Inactive))
1252 state = "disabled";
1253 else if (m_conMatch[progInfo->GetRecordingRuleID()] > 0)
1254 state = "error";
1255 else if (m_recMatch[progInfo->GetRecordingRuleID()] > 0 ||
1256 progInfo->m_recType == kTemplateRecord)
1257 state = "normal";
1258 else if (m_nowMatch[progInfo->GetRecordingRuleID()] > 0)
1259 state = "running";
1260 else
1261 state = "warning";
1262
1263 InfoMap infoMap;
1264 progInfo->ToMap(infoMap);
1265 item->SetTextFromMap(infoMap, state);
1266
1267 QString subtitle;
1268 if (progInfo->m_subtitle != "(null)" &&
1269 (progInfo->m_recType == kSingleRecord ||
1270 progInfo->m_recType == kOverrideRecord ||
1271 progInfo->m_recType == kDontRecord))
1272 {
1273 subtitle = progInfo->m_subtitle;
1274 }
1275
1276 QString matchInfo;
1277 if (progInfo->GetRecordingStatus() == RecStatus::Inactive)
1278 {
1279 matchInfo = QString("%1 %2")
1280 .arg(m_listMatch[progInfo->GetRecordingRuleID()])
1281 .arg(RecStatus::toString(progInfo->GetRecordingStatus(),
1282 progInfo->GetRecordingRuleType()));
1283 }
1284 else
1285 {
1286 matchInfo = tr("Recording %1 of %2")
1287 .arg(m_recMatch[progInfo->GetRecordingRuleID()])
1288 .arg(m_listMatch[progInfo->GetRecordingRuleID()]);
1289 }
1290
1291 subtitle = QString("(%1) %2").arg(matchInfo, subtitle);
1292 item->SetText(subtitle, "scheduleinfo", state);
1293
1294 item->SetText(QString::number(progRecPriority), "progpriority", state);
1295 item->SetText(QString::number(progRecPriority), "finalpriority", state);
1296
1297 item->SetText(QString::number(progRecPriority), "recpriority", state);
1298 item->SetText(QString::number(progRecPriority), "recpriorityB", state);
1299
1300 QString tempDateTime = MythDate::toString(progInfo->m_last_record,
1303 item->SetText(tempDateTime, "lastrecorded", state);
1304 QString tempDate = MythDate::toString(progInfo->m_last_record,
1307 item->SetText(tempDate, "lastrecordeddate", state);
1308 QString tempTime = MythDate::toString(
1309 progInfo->m_last_record, MythDate::kTime);
1310 item->SetText(tempTime, "lastrecordedtime", state);
1311
1312 QString channame = progInfo->m_chanName;
1313 QString channum = progInfo->m_chanStr;
1314 QString callsign = progInfo->m_chanSign;
1315 if (progInfo->m_recType != kSingleRecord &&
1316 progInfo->m_recType != kOverrideRecord &&
1317 progInfo->m_recType != kDontRecord &&
1318 !(progInfo->GetRecordingRule()->m_filter & 1024) &&
1320 {
1321 channame = tr("Any");
1322 channum = tr("Any");
1323 callsign = tr("Any");
1324 }
1325 item->SetText(channame, "channel", state);
1326 item->SetText(channum, "channum", state);
1327 item->SetText(callsign, "callsign", state);
1328
1329 QString profile = progInfo->m_profile;
1330 if ((profile == "Default") || (profile == "Live TV") ||
1331 (profile == "High Quality") || (profile == "Low Quality"))
1332 profile = tr(profile.toUtf8().constData());
1333 item->SetText(profile, "recordingprofile", state);
1334 item->SetText(progInfo->m_recordingGroup, "recordinggroup", state);
1335 item->SetText(progInfo->m_storageGroup, "storagegroup", state);
1336 item->DisplayState(state, "status");
1337
1338 if (m_currentItem == progInfo)
1340 }
1341
1342 m_currentItem = nullptr;
1343
1344 MythUIText *norecordingText = dynamic_cast<MythUIText*>
1345 (GetChild("norecordings_info"));
1346
1347 if (norecordingText)
1348 norecordingText->SetVisible(m_programData.isEmpty());
1349}
1350
1351// Called whenever a new recording is selected from the list of
1352// recordings. This function updates the screen with the information
1353// on the newly selected recording.
1355{
1356 if (!item)
1357 return;
1358
1359 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo *>();
1360
1361 if (!pgRecInfo)
1362 return;
1363
1364 int progRecPriority = pgRecInfo->GetRecordingPriority();
1365
1366 QString subtitle;
1367 if (pgRecInfo->m_subtitle != "(null)" &&
1368 (pgRecInfo->m_recType == kSingleRecord ||
1369 pgRecInfo->m_recType == kOverrideRecord ||
1370 pgRecInfo->m_recType == kDontRecord))
1371 {
1372 subtitle = pgRecInfo->m_subtitle;
1373 }
1374
1375 QString matchInfo;
1376 if (pgRecInfo->GetRecordingStatus() == RecStatus::Inactive)
1377 {
1378 matchInfo = QString("%1 %2")
1379 .arg(m_listMatch[pgRecInfo->GetRecordingRuleID()])
1380 .arg(RecStatus::toString(pgRecInfo->GetRecordingStatus(),
1381 pgRecInfo->GetRecordingRuleType()));
1382 }
1383 else
1384 {
1385 matchInfo = tr("Recording %1 of %2")
1386 .arg(m_recMatch[pgRecInfo->GetRecordingRuleID()])
1387 .arg(m_listMatch[pgRecInfo->GetRecordingRuleID()]);
1388 }
1389
1390 subtitle = QString("(%1) %2").arg(matchInfo, subtitle);
1391
1392 InfoMap infoMap;
1393 pgRecInfo->ToMap(infoMap);
1394 SetTextFromMap(infoMap);
1395
1396 if (m_schedInfoText)
1397 m_schedInfoText->SetText(subtitle);
1398
1400 m_recPriorityText->SetText(QString::number(progRecPriority));
1401
1403 m_recPriorityBText->SetText(QString::number(progRecPriority));
1404
1406 m_finalPriorityText->SetText(QString::number(progRecPriority));
1407
1409 {
1410 QString tempDateTime = MythDate::toString(pgRecInfo->m_last_record,
1413 m_lastRecordedText->SetText(tempDateTime);
1414 }
1415
1417 {
1418 QString tempDate = MythDate::toString(pgRecInfo->m_last_record,
1422 }
1423
1425 {
1426 QString tempTime = MythDate::toString(
1427 pgRecInfo->m_last_record, MythDate::kTime);
1429 }
1430
1432 {
1433 QString channame = pgRecInfo->m_chanName;
1434 QString channum = pgRecInfo->m_chanStr;
1435 QString callsign = pgRecInfo->m_chanSign;
1436 if (pgRecInfo->m_recType != kSingleRecord &&
1437 pgRecInfo->m_recType != kOverrideRecord &&
1438 pgRecInfo->m_recType != kDontRecord &&
1439 !(pgRecInfo->GetRecordingRule()->m_filter & 1024) &&
1440 pgRecInfo->GetRecordingRule()->m_searchType != kManualSearch)
1441 {
1442 channame = tr("Any");
1443 channum = tr("Any");
1444 callsign = tr("Any");
1445 }
1446 if (m_chanNameText)
1447 m_chanNameText->SetText(channame);
1448 if (m_chanNumText)
1449 m_chanNumText->SetText(channum);
1450 if (m_callSignText)
1451 m_callSignText->SetText(callsign);
1452 }
1453
1454 if (m_recProfileText)
1455 {
1456 QString profile = pgRecInfo->m_profile;
1457 if ((profile == "Default") || (profile == "Live TV") ||
1458 (profile == "High Quality") || (profile == "Low Quality"))
1459 profile = tr(profile.toUtf8().constData());
1461 }
1462}
1463
1465{
1466 if (!item)
1467 return;
1468
1469 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo *>();
1470
1471 if (!pgRecInfo)
1472 return;
1473
1474 QMap<int, ProgramRecPriorityInfo>::iterator it;
1475 it = m_programData.find(pgRecInfo->GetRecordingRuleID());
1476 if (it != m_programData.end())
1477 m_programData.erase(it);
1478
1480}
1481
1483{
1485 return item ? item->GetData().value<ProgramRecPriorityInfo*>() : nullptr;
1486}
1487
1488/* vim: set expandtab tabstop=4 shiftwidth=4: */
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:41
static const Type kEventType
Definition: mythdialogbox.h:56
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:128
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:837
QVariant value(int i) const
Definition: mythdbcon.h:204
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:618
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:888
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:812
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:550
Dialog asking for user confirmation.
void SaveSetting(const QString &key, int newValue)
int GetNumSetting(const QString &key, int defaultval=0)
bool GetBoolSetting(const QString &key, bool defaultval=false)
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:226
Basic menu dialog, message and a list of options.
MythScreenStack * GetMainStack()
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void LoadInBackground(const QString &message="")
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
virtual void Close()
Dialog prompting the user to enter a text string.
void DisplayState(const QString &state, const QString &name)
void SetText(const QString &text, const QString &name="", const QString &state="")
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
void SetLCDTitles(const QString &title, const QString &columnList="")
MythUIButtonListItem * GetItemCurrent() const
void SetItemCurrent(MythUIButtonListItem *item)
void RemoveItem(MythUIButtonListItem *item)
void Reset() override
Reset the widget to it's original state, should not reset changes made by the theme.
void SetSearchFields(const QString &fields)
void itemClicked(MythUIButtonListItem *item)
void SetValueByData(const QVariant &data)
void itemSelected(MythUIButtonListItem *item)
virtual void SetTextFromMap(const InfoMap &infoMap)
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:115
virtual void SetVisible(bool visible)
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:138
ProgramAvgDelaySort(bool reverse)
bool operator()(const ProgramRecPriorityInfo *a, const ProgramRecPriorityInfo *b) const
ProgramCountSort(bool reverse)
bool operator()(const ProgramRecPriorityInfo *a, const ProgramRecPriorityInfo *b) const
Holds information on recordings and videos.
Definition: programinfo.h:70
float GetStars(void) const
Definition: programinfo.h:448
uint GetRecordingRuleID(void) const
Definition: programinfo.h:455
void SetTitle(const QString &t, const QString &st=nullptr)
QString m_category
Definition: programinfo.h:779
void SetRecordingRuleType(RecordingType type)
Definition: programinfo.h:588
QString GetSortSubtitle(void) const
Definition: programinfo.h:367
void SetCategory(const QString &cat)
Definition: programinfo.h:541
QString m_title
Definition: programinfo.h:770
void SetRecordingRuleID(uint id)
Definition: programinfo.h:545
QString GetSortTitle(void) const
Definition: programinfo.h:365
QString m_chanStr
Definition: programinfo.h:785
int GetRecordingPriority(void) const
Definition: programinfo.h:446
virtual void ToMap(InfoMap &progMap, bool showrerecord=false, uint star_range=10, uint date_format=0) const
Converts ProgramInfo into QString QHash containing each field in ProgramInfo converted into localized...
QString m_chanSign
Definition: programinfo.h:786
QString m_chanName
Definition: programinfo.h:787
void SetRecordingPriority(int priority)
Definition: programinfo.h:543
QString m_subtitle
Definition: programinfo.h:772
RecStatus::Type GetRecordingStatus(void) const
Definition: programinfo.h:453
int8_t m_recStatus
Definition: programinfo.h:833
QString GetSubtitle(void) const
Definition: programinfo.h:366
QString GetCategory(void) const
Definition: programinfo.h:372
void SetSubtitle(const QString &st, const QString &sst=nullptr)
RecordingType GetRecordingRuleType(void) const
Definition: programinfo.h:457
ProgramLastRecordSort(bool reverse)
bool operator()(const ProgramRecPriorityInfo *a, const ProgramRecPriorityInfo *b) const
bool operator()(const ProgramRecPriorityInfo *a, const ProgramRecPriorityInfo *b) const
ProgramRecCountSort(bool reverse)
void clear(void) override
virtual void clone(const ProgramRecPriorityInfo &other, bool ignore_non_serialized_data=false)
void ToMap(InfoMap &progMap, bool showrerecord=false, uint star_range=10, uint date_format=0) const override
Converts ProgramInfo into QString QHash containing each field in ProgramInfo converted into localized...
bool operator()(const ProgramRecPriorityInfo *a, const ProgramRecPriorityInfo *b) const
ProgramRecPrioritySort(bool reverse)
MythUIText * m_schedInfoText
ProgramInfo * GetCurrentProgram(void) const override
MythUIText * m_chanNameText
QMap< int, int > m_origRecPriorityData
void updateInfo(MythUIButtonListItem *item)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void edit(MythUIButtonListItem *item) const
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
MythUIText * m_lastRecordedTimeText
std::vector< ProgramRecPriorityInfo * > m_sortedProgram
void changeRecPriority(int howMuch)
ProgramRecPriority(MythScreenStack *parent, const QString &name)
QMap< int, int > m_nowMatch
MythUIText * m_callSignText
MythUIText * m_recPriorityBText
MythUIButtonList * m_programList
QMap< int, int > m_conMatch
QMap< int, int > m_listMatch
MythUIText * m_finalPriorityText
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
void newTemplate(QString category)
void customEvent(QEvent *event) override
MythUIText * m_lastRecordedDateText
MythUIText * m_chanNumText
MythUIText * m_lastRecordedText
void scheduleChanged(int recid)
MythUIText * m_recPriorityText
QMap< int, ProgramRecPriorityInfo > m_programData
bool Create(void) override
QMap< int, int > m_recMatch
ProgramRecPriorityInfo * m_currentItem
void RemoveItemFromList(MythUIButtonListItem *item)
void SortList(ProgramRecPriorityInfo *newCurrentItem=nullptr)
MythUIText * m_recProfileText
bool operator()(const ProgramRecPriorityInfo *a, const ProgramRecPriorityInfo *b) const
ProgramRecTypeSort(bool reverse)
static QString toString(RecStatus::Type recstatus, uint id)
Converts "recstatus" into a short (unreadable) string.
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:36
static QString GetRecgroupString(uint recGroupID)
Temporary helper during transition from string to ID.
void clear(void) override
RecordingRule * GetRecordingRule(void)
Returns the "record" field, creating it if necessary.
int getRecordID(void)
Returns a record id, creating "record" it if necessary.
void ApplyRecordRecPriorityChange(int newrecpriority)
Sets recording priority of "record", creating "record" if it does not exist.
virtual void clone(const RecordingInfo &other, bool ignore_non_serialized_data=false)
Copies important fields from other RecordingInfo.
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:30
RecordingType m_type
QString m_sortSubtitle
Definition: recordingrule.h:81
QString m_category
Definition: recordingrule.h:83
RecSearchType m_searchType
unsigned m_filter
QString m_storageGroup
int m_recordID
Unique Recording Rule ID.
Definition: recordingrule.h:71
QString m_title
Definition: recordingrule.h:78
QString m_recProfile
bool m_isInactive
Recording rule is enabled?
Definition: recordingrule.h:75
QString m_subtitle
Definition: recordingrule.h:80
bool Load(bool asTemplate=false)
Load a single rule from the recorded table.
QDateTime m_lastRecorded
QString m_sortTitle
Definition: recordingrule.h:79
virtual void ShowDetails(void) const
Show the Program Details screen.
void customEvent(QEvent *event) override
virtual void EditCustom(void)
Creates a dialog for creating a custom recording rule.
virtual void ShowUpcoming(void) const
Show the upcoming recordings for this title.
Construct a recording schedule.
void ruleSaved(int ruleId)
void ruleDeleted(int ruleId)
static void ReschedulePlace(const QString &why)
TitleSort(bool reverse)
bool operator()(const ProgramRecPriorityInfo *a, const ProgramRecPriorityInfo *b) const
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
unsigned int uint
Definition: compat.h:68
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
int ternary_compare(const QDateTime &a, const QDateTime &b)
balanced ternary (three way) comparison This is equivalent to C++20's operator <=>.
Definition: mythdate.h:76
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythMainWindow * GetMythMainWindow(void)
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
Definition: mythdate.cpp:28
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:93
@ kDateTimeFull
Default local time.
Definition: mythdate.h:23
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
Definition: mythdate.h:26
@ kDateFull
Default local time.
Definition: mythdate.h:19
@ kTime
Default local time.
Definition: mythdate.h:22
@ kAddYear
Add year to string if not included.
Definition: mythdate.h:25
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:15
MBASE_PUBLIC int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
This method chops the input a and b into pieces of digits and non-digits (a1.05 becomes a | 1 | .
Definition: stringutil.cpp:160
def rating(profile, smoonURL, gate)
Definition: scan.py:36
bool LoadFromScheduler(AutoDeleteDeque< TYPE * > &destination, bool &hasConflicts, const QString &altTable="", int recordid=-1)
Definition: programinfo.h:939
void RemoteGetAllScheduledRecordings(std::vector< ProgramInfo * > &scheduledlist)
int RecTypePrecedence(RecordingType rectype)
Converts a RecordingType to a simple integer so it's specificity can be compared to another.
@ kManualSearch
@ kNoSearch
RecordingType
@ kNotRecording
@ kOverrideRecord
@ kSingleRecord
@ kTemplateRecord
@ kDontRecord