MythTV master
programrecpriority.cpp
Go to the documentation of this file.
1// C/C++ headers
2#include <algorithm>
3#include <compare>
4#include <vector> // For std::vector
5
6// QT headers
7#include <QDateTime>
8
9// MythTV headers
10#include "libmythbase/mythdb.h"
22
23// MythFrontend
24#include "proglist.h"
25#include "programrecpriority.h"
26#include "scheduleeditor.h"
27
29 const ProgramRecPriorityInfo &other, bool ignore_non_serialized_data)
30{
31 RecordingInfo::clone(other, ignore_non_serialized_data);
32
33 if (!ignore_non_serialized_data)
34 {
35 m_recType = other.m_recType;
37 m_recCount = other.m_recCount;
40 m_profile = other.m_profile;
43 }
44}
45
47 const RecordingInfo &other, bool ignore_non_serialized_data)
48{
49 RecordingInfo::clone(other, ignore_non_serialized_data);
50
51 if (!ignore_non_serialized_data)
52 {
54 m_matchCount = 0;
55 m_recCount = 0;
56 m_last_record = QDateTime();
57 m_avg_delay = 0;
58 m_profile.clear();
59 m_storageGroup.clear();
60 m_recordingGroup.clear();
61 }
62}
63
65 const ProgramInfo &other, bool ignore_non_serialized_data)
66{
67 RecordingInfo::clone(other, ignore_non_serialized_data);
68
69 if (!ignore_non_serialized_data)
70 {
72 m_matchCount = 0;
73 m_recCount = 0;
74 m_last_record = QDateTime();
75 m_avg_delay = 0;
76 m_profile.clear();
77 m_storageGroup.clear();
78 m_recordingGroup.clear();
79 }
80}
81
83{
85
87 m_matchCount = 0;
88 m_recCount = 0;
89 m_last_record = QDateTime();
90 m_avg_delay = 0;
91 m_profile.clear();
92 m_storageGroup.clear();
93 m_recordingGroup.clear();
94}
95
97 bool showrerecord, uint star_range,
98 uint date_format) const
99{
100 RecordingInfo::ToMap(progMap, showrerecord, star_range, date_format);
101 progMap["title"] = (m_title == "Default (Template)") ?
102 QObject::tr("Default (Template)") : m_title;
103 progMap["category"] = (m_category == "Default") ?
104 QObject::tr("Default") : m_category;
105 progMap["storagegroup"] = (m_storageGroup == "Default") ?
106 QObject::tr("Default") : m_storageGroup;
107 progMap["recordinggroup"] = (m_recordingGroup == "Default") ?
108 QObject::tr("Default") : m_recordingGroup;
109}
110
111// For the spaceship operator, the c++ standard library explicitly
112// requires '0' and not nullptr. NOLINTBEGIN(modernize-use-nullptr)
114{
115 public:
116 explicit TitleSort(bool reverse) : m_reverse(reverse) {}
117
119 const ProgramRecPriorityInfo *b) const
120 {
122 if (cmp == 0)
124 // sort higher recording priority before
125 if (cmp == 0)
126 cmp = b->GetRecordingPriority() <=> a->GetRecordingPriority();
127 // sort lower RecordingTypePrecedence before
128 if (cmp == 0)
130 // sort lower RecordingRuleID before
131 if (cmp == 0)
132 cmp = a->GetRecordingRuleID() <=> b->GetRecordingRuleID();
133
134 return m_reverse ? cmp > 0 : cmp < 0;
135 }
136
137 private:
138 bool m_reverse {false};
139};
140
142{
143 public:
144 explicit ProgramRecPrioritySort(bool reverse) : m_reverse(reverse) {}
145
147 const ProgramRecPriorityInfo *b) const
148 {
149 // sort higher recording priority before
150 auto cmp = b->GetRecordingPriority() <=> a->GetRecordingPriority();
151 // sort lower RecTypePrecedence before
152 if (cmp == 0)
154 // sort lower RecordingRuleID before
155 if (cmp == 0)
156 cmp = a->GetRecordingRuleID() <=> b->GetRecordingRuleID();
157
158 return m_reverse ? cmp > 0 : cmp < 0;
159 }
160
161 private:
162 bool m_reverse {false};
163};
164
166{
167 public:
168 explicit ProgramRecTypeSort(bool reverse) : m_reverse(reverse) {}
169
171 const ProgramRecPriorityInfo *b) const
172 {
173 // sort lower RecTypePrecedence before
175 // sort higher recording priority before
176 if (cmp == 0)
177 cmp = b->GetRecordingPriority() <=> a->GetRecordingPriority();
178 // sort lower RecordingRuleID before
179 if (cmp == 0)
180 cmp = a->GetRecordingRuleID() <=> b->GetRecordingRuleID();
181
182 return m_reverse ? cmp > 0 : cmp < 0;
183 }
184
185 private:
186 bool m_reverse {false};
187};
188
190{
191 public:
192 explicit ProgramCountSort(bool reverse) : m_reverse(reverse) {}
193
195 const ProgramRecPriorityInfo *b) const
196 {
197 // sort higher match count before
198 auto cmp = b->m_matchCount <=> a->m_matchCount;
199 // sort higher recCount before
200 if (cmp == 0)
201 cmp = b->m_recCount <=> a->m_recCount;
202 if (cmp == 0)
204 if (cmp == 0)
206
207 return m_reverse ? cmp > 0 : cmp < 0;
208 }
209
210 private:
211 bool m_reverse {false};
212};
213
215{
216 public:
217 explicit ProgramRecCountSort(bool reverse) : m_reverse(reverse) {}
218
220 const ProgramRecPriorityInfo *b) const
221 {
222 // sort higher recCount before
223 auto cmp = b->m_recCount <=> a->m_recCount;
224 // sort higher match count before
225 if (cmp == 0)
226 cmp = b->m_matchCount <=> a->m_matchCount;
227 if (cmp == 0)
229 if (cmp == 0)
231
232 return m_reverse ? cmp > 0 : cmp < 0;
233 }
234
235 private:
236 bool m_reverse {false};
237};
238
240{
241 public:
242 explicit ProgramLastRecordSort(bool reverse) : m_reverse(reverse) {}
243
245 const ProgramRecPriorityInfo *b) const
246 {
247 // sort later date time before
248 auto cmp = b->m_last_record.toMSecsSinceEpoch() <=> a->m_last_record.toMSecsSinceEpoch();
249 if (cmp == 0)
251 if (cmp == 0)
253
254 return m_reverse ? cmp > 0 : cmp < 0;
255 }
256
257 private:
258 bool m_reverse {false};
259};
260
262{
263 public:
264 explicit ProgramAvgDelaySort(bool reverse) : m_reverse(reverse) {}
265
267 const ProgramRecPriorityInfo *b) const
268 {
269 auto cmp = a->m_avg_delay <=> b->m_avg_delay;
270 if (cmp == 0)
272 if (cmp == 0)
274
275 return m_reverse ? cmp > 0 : cmp < 0;
276 }
277
278 private:
279 bool m_reverse {false};
280};
281// NOLINTEND(modernize-use-nullptr)
282
284
286 const QString &name)
287 : ScheduleCommon(parent, name)
288{
289 m_sortType = (SortType)gCoreContext->GetNumSetting("ProgramRecPrioritySorting",
290 (int)byTitle);
291 m_reverseSort = gCoreContext->GetBoolSetting("ProgramRecPriorityReverse", false);
292}
293
295{
296 if (!LoadWindowFromXML("schedule-ui.xml", "managerecrules", this))
297 return false;
298
299 m_programList = dynamic_cast<MythUIButtonList *> (GetChild("programs"));
300
301 m_schedInfoText = dynamic_cast<MythUIText *> (GetChild("scheduleinfo"));
302 m_recPriorityText = dynamic_cast<MythUIText *> (GetChild("recpriority"));
303 m_recPriorityBText = dynamic_cast<MythUIText *> (GetChild("recpriorityB"));
304 m_finalPriorityText = dynamic_cast<MythUIText *> (GetChild("finalpriority"));
305 m_lastRecordedText = dynamic_cast<MythUIText *> (GetChild("lastrecorded"));
306 m_lastRecordedDateText = dynamic_cast<MythUIText *> (GetChild("lastrecordeddate"));
307 m_lastRecordedTimeText = dynamic_cast<MythUIText *> (GetChild("lastrecordedtime"));
308 m_chanNameText = dynamic_cast<MythUIText *> (GetChild("channel"));
309 m_chanNumText = dynamic_cast<MythUIText *> (GetChild("channum"));
310 m_callSignText = dynamic_cast<MythUIText *> (GetChild("callsign"));
311 m_recProfileText = dynamic_cast<MythUIText *> (GetChild("recordingprofile"));
312
313 if (!m_programList)
314 {
315 LOG(VB_GENERAL, LOG_ERR, "Theme is missing critical theme elements.");
316 return false;
317 }
318
323
324 m_programList->SetLCDTitles(tr("Schedule Priorities"),
325 "rec_type|titlesubtitle|progpriority");
326 m_programList->SetSearchFields("titlesubtitle");
327
330
331 return true;
332}
333
335{
336 FillList();
337}
338
340{
341 SortList();
342}
343
345{
346 if (GetFocusWidget()->keyPressEvent(event))
347 return true;
348
349 QStringList actions;
350 bool handled = GetMythMainWindow()->TranslateKeyPress("TV Frontend", event, actions);
351
352 for (int i = 0; i < actions.size() && !handled; i++)
353 {
354 const QString& action = actions[i];
355 handled = true;
356
357 if (action == "RANKINC")
358 {
360 }
361 else if (action == "RANKDEC")
362 {
364 }
365 else if (action == "ESCAPE")
366 {
368 gCoreContext->SaveSetting("ProgramRecPrioritySorting",
369 (int)m_sortType);
370 gCoreContext->SaveSetting("ProgramRecPriorityReverse",
371 (int)m_reverseSort);
372 Close();
373 }
374 else if (action == "1")
375 {
376 if (m_sortType != byTitle)
377 {
379 m_reverseSort = false;
380 }
381 else
382 {
384 }
385 SortList();
386 }
387 else if (action == "2")
388 {
390 {
392 m_reverseSort = false;
393 }
394 else
395 {
397 }
398 SortList();
399 }
400 else if (action == "4")
401 {
402 if (m_sortType != byRecType)
403 {
405 m_reverseSort = false;
406 }
407 else
408 {
410 }
411 SortList();
412 }
413 else if (action == "5")
414 {
415 if (m_sortType != byCount)
416 {
418 m_reverseSort = false;
419 }
420 else
421 {
423 }
424 SortList();
425 }
426 else if (action == "6")
427 {
428 if (m_sortType != byRecCount)
429 {
431 m_reverseSort = false;
432 }
433 else
434 {
436 }
437 SortList();
438 }
439 else if (action == "7")
440 {
442 {
444 m_reverseSort = false;
445 }
446 else
447 {
449 }
450 SortList();
451 }
452 else if (action == "8")
453 {
454 if (m_sortType != byAvgDelay)
455 {
457 m_reverseSort = false;
458 }
459 else
460 {
462 }
463 SortList();
464 }
465 else if (action == "PREVVIEW" || action == "NEXTVIEW")
466 {
467 m_reverseSort = false;
468 if (m_sortType == byTitle)
470 else if (m_sortType == byRecPriority)
472 else
474 SortList();
475 }
476 else if (action == "SELECT" || action == "EDIT")
477 {
480 }
481 else if (action == "MENU")
482 {
483 showMenu();
484 }
485 else if (action == "CUSTOMEDIT")
486 {
488 EditCustom();
489 }
490 else if (action == "DELETE")
491 {
493 remove();
494 }
495 else if (action == "UPCOMING")
496 {
498 ShowUpcoming();
499 }
500 else if (action == "INFO" || action == "DETAILS")
501 {
502 ShowDetails();
503 }
504 else
505 {
506 handled = false;
507 }
508 }
509
510 if (!handled && MythScreenType::keyPressEvent(event))
511 handled = true;
512
513 return handled;
514}
515
517{
518 QString label = tr("Options");
519
520 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
521 auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup");
522
523 if (menuPopup->Create())
524 {
525 menuPopup->SetReturnEvent(this, "menu");
526
527 menuPopup->AddButton(tr("Increase Priority"));
528 menuPopup->AddButton(tr("Decrease Priority"));
529 menuPopup->AddButton(tr("Sort"), nullptr, true);
530 menuPopup->AddButton(tr("Program Details"));
531 menuPopup->AddButton(tr("Upcoming"));
532 menuPopup->AddButton(tr("Custom Edit"));
533 menuPopup->AddButton(tr("Delete Rule"));
534 menuPopup->AddButton(tr("New Template"));
535
536 popupStack->AddScreen(menuPopup);
537 }
538 else
539 {
540 delete menuPopup;
541 }
542}
543
545{
546 QString label = tr("Sort Options");
547
548 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
549 auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup");
550
551 if (menuPopup->Create())
552 {
553 menuPopup->SetReturnEvent(this, "sortmenu");
554
555 menuPopup->AddButton(tr("Reverse Sort Order"));
556 menuPopup->AddButton(tr("Sort By Title"));
557 menuPopup->AddButton(tr("Sort By Priority"));
558 menuPopup->AddButton(tr("Sort By Type"));
559 menuPopup->AddButton(tr("Sort By Count"));
560 menuPopup->AddButton(tr("Sort By Record Count"));
561 menuPopup->AddButton(tr("Sort By Last Recorded"));
562 menuPopup->AddButton(tr("Sort By Average Delay"));
563
564 popupStack->AddScreen(menuPopup);
565 }
566 else
567 {
568 delete menuPopup;
569 }
570}
571
573{
574 if (event->type() == DialogCompletionEvent::kEventType)
575 {
576 auto *dce = (DialogCompletionEvent*)event;
577
578 QString resultid = dce->GetId();
579 QString resulttext = dce->GetResultText();
580 int buttonnum = dce->GetResult();
581
582 if (resultid == "menu")
583 {
584 if (resulttext == tr("Increase Priority"))
585 {
587 }
588 else if (resulttext == tr("Decrease Priority"))
589 {
591 }
592 else if (resulttext == tr("Sort"))
593 {
594 showSortMenu();
595 }
596 else if (resulttext == tr("Program Details"))
597 {
598 ShowDetails();
599 }
600 else if (resulttext == tr("Upcoming"))
601 {
603 ShowUpcoming();
604 }
605 else if (resulttext == tr("Custom Edit"))
606 {
608 EditCustom();
609 }
610 else if (resulttext == tr("Delete Rule"))
611 {
613 remove();
614 }
615 else if (resulttext == tr("New Template"))
616 {
617 MythScreenStack *popupStack =
618 GetMythMainWindow()->GetStack("popup stack");
619 auto *textInput = new MythTextInputDialog(popupStack,
620 tr("Template Name"));
621 if (textInput->Create())
622 {
623 textInput->SetReturnEvent(this, "templatecat");
624 popupStack->AddScreen(textInput);
625 }
626 }
627 }
628 else if (resultid == "sortmenu")
629 {
630 if (resulttext == tr("Reverse Sort Order"))
631 {
633 SortList();
634 }
635 else if (resulttext == tr("Sort By Title"))
636 {
637 if (m_sortType != byTitle)
638 {
640 m_reverseSort = false;
641 }
642 else
643 {
645 }
646 SortList();
647 }
648 else if (resulttext == tr("Sort By Priority"))
649 {
651 {
653 m_reverseSort = false;
654 }
655 else
656 {
658 }
659 SortList();
660 }
661 else if (resulttext == tr("Sort By Type"))
662 {
663 if (m_sortType != byRecType)
664 {
666 m_reverseSort = false;
667 }
668 else
669 {
671 }
672 SortList();
673 }
674 else if (resulttext == tr("Sort By Count"))
675 {
676 if (m_sortType != byCount)
677 {
679 m_reverseSort = false;
680 }
681 else
682 {
684 }
685 SortList();
686 }
687 else if (resulttext == tr("Sort By Record Count"))
688 {
689 if (m_sortType != byRecCount)
690 {
692 m_reverseSort = false;
693 }
694 else
695 {
697 }
698 SortList();
699 }
700 else if (resulttext == tr("Sort By Last Recorded"))
701 {
703 {
705 m_reverseSort = false;
706 }
707 else
708 {
710 }
711 SortList();
712 }
713 else if (resulttext == tr("Sort By Average Delay"))
714 {
715 if (m_sortType != byAvgDelay)
716 {
718 m_reverseSort = false;
719 }
720 else
721 {
723 }
724 SortList();
725 }
726 }
727 else if (resultid == "deleterule")
728 {
729 auto *record = dce->GetData().value<RecordingRule *>();
730 if (record)
731 {
732 if (buttonnum > 0)
733 {
736
737 if (record->Delete() && item)
738 RemoveItemFromList(item);
739 else
740 LOG(VB_GENERAL, LOG_ERR,
741 "Failed to delete recording rule");
742 }
743 delete record;
744 }
745 }
746 else if (resultid == "templatecat")
747 {
748 newTemplate(resulttext);
749 }
750 else
751 {
753 }
754 }
755}
756
758{
759 if (!item)
760 return;
761
762 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
763 if (!pgRecInfo)
764 return;
765
766 auto *record = new RecordingRule();
767 record->m_recordID = pgRecInfo->GetRecordingRuleID();
768 if (record->m_searchType == kNoSearch)
769 record->LoadByProgram(pgRecInfo);
770
772 auto *schededit = new ScheduleEditor(mainStack, record);
773 if (schededit->Create())
774 {
775 mainStack->AddScreen(schededit);
778 }
779 else
780 {
781 delete schededit;
782 }
783}
784
786{
787 category = category.trimmed();
788 if (category.isEmpty())
789 return;
790
791 // Try to find an existing template and use it.
792 QMap<int, ProgramRecPriorityInfo>::Iterator it;
793 for (it = m_programData.begin(); it != m_programData.end(); ++it)
794 {
795 ProgramRecPriorityInfo *progInfo = &(*it);
796 if (progInfo->GetRecordingRuleType() == kTemplateRecord &&
797 category.compare(progInfo->GetCategory(),
798 Qt::CaseInsensitive) == 0)
799 {
800 m_programList->SetValueByData(QVariant::fromValue(progInfo));
802 return;
803 }
804 }
805
806 auto *record = new RecordingRule();
807 if (!record)
808 return;
809 record->MakeTemplate(category);
810
812 auto *schededit = new ScheduleEditor(mainStack, record);
813 if (schededit->Create())
814 {
815 mainStack->AddScreen(schededit);
818 }
819 else
820 {
821 delete schededit;
822 }
823}
824
826{
827 // Assumes that the current item didn't change, which isn't guaranteed
829 ProgramRecPriorityInfo *pgRecInfo = nullptr;
830 if (item)
831 pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
832
833 // If the recording id doesn't match, the user created a new
834 // template.
835 if (!pgRecInfo || recid != pgRecInfo->getRecordID())
836 {
837 RecordingRule record;
838 record.m_recordID = recid;
839 if (!record.Load() || record.m_type == kNotRecording)
840 return;
841
842 ProgramRecPriorityInfo progInfo;
843 progInfo.SetRecordingRuleID(record.m_recordID);
844 progInfo.SetRecordingRuleType(record.m_type);
845 progInfo.SetTitle(record.m_title, record.m_sortTitle);
846 progInfo.SetSubtitle(record.m_subtitle, record.m_sortSubtitle);
847 progInfo.SetCategory(record.m_category);
848 progInfo.SetRecordingPriority(record.m_recPriority);
849 progInfo.m_recType = record.m_type;
850 progInfo.m_recStatus = record.m_isInactive ?
852 progInfo.m_profile = record.m_recProfile;
853 progInfo.m_last_record = record.m_lastRecorded;
854 progInfo.m_storageGroup = record.m_storageGroup;
856
857 m_programData[recid] = progInfo;
859 record.m_recPriority;
860 SortList(&m_programData[recid]);
861
862 return;
863 }
864
865 // We need to refetch the recording priority values since the Advanced
866 // Recording Options page could've been used to change them
867
869 query.prepare("SELECT recpriority, type, inactive "
870 "FROM record "
871 "WHERE recordid = :RECORDID");
872 query.bindValue(":RECORDID", recid);
873 if (!query.exec())
874 {
875 MythDB::DBError("Get new recording priority query", query);
876 }
877 else if (query.next())
878 {
879 int recPriority = query.value(0).toInt();
880 int rectype = query.value(1).toInt();
881 int inactive = query.value(2).toInt();
882
883 // set the recording priorities of that program
884 pgRecInfo->SetRecordingPriority(recPriority);
885 pgRecInfo->m_recType = (RecordingType)rectype;
886 // also set the m_origRecPriorityData with new recording
887 // priority so we don't save to db again when we exit
889 pgRecInfo->GetRecordingPriority();
890 // also set the active/inactive state
891 pgRecInfo->m_recStatus = inactive ? RecStatus::Inactive : RecStatus::Unknown;
892
893 SortList();
894 }
895 else
896 {
897 RemoveItemFromList(item);
898 }
899
900 countMatches();
901}
902
904{
906 if (!item)
907 return;
908
909 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
910 if (!pgRecInfo ||
911 (pgRecInfo->m_recType == kTemplateRecord &&
912 pgRecInfo->GetCategory()
913 .compare("Default", Qt::CaseInsensitive) == 0))
914 {
915 return;
916 }
917
918 auto *record = new RecordingRule();
919 record->m_recordID = pgRecInfo->GetRecordingRuleID();
920 if (!record->Load())
921 {
922 delete record;
923 return;
924 }
925
926 QString message = tr("Delete '%1' %2 rule?")
927 .arg(record->m_title, toString(pgRecInfo->GetRecordingRuleType()));
928
929 MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
930
931 auto *okPopup = new MythConfirmationDialog(popupStack, message, true);
932 okPopup->SetReturnEvent(this, "deleterule");
933 okPopup->SetData(QVariant::fromValue(record));
934
935 if (okPopup->Create())
936 popupStack->AddScreen(okPopup);
937 else
938 delete okPopup;
939}
940
942{
944 if (!item)
945 return;
946
947 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
948 if (pgRecInfo)
949 {
951
952 query.prepare("SELECT inactive "
953 "FROM record "
954 "WHERE recordid = :RECID");
955 query.bindValue(":RECID", pgRecInfo->GetRecordingRuleID());
956
957
958 if (!query.exec())
959 {
960 MythDB::DBError("ProgramRecPriority::deactivate()", query);
961 }
962 else if (query.next())
963 {
964 int inactive = query.value(0).toInt();
965 if (inactive)
966 inactive = 0;
967 else
968 inactive = 1;
969
970 query.prepare("UPDATE record "
971 "SET inactive = :INACTIVE "
972 "WHERE recordid = :RECID");
973 query.bindValue(":INACTIVE", inactive);
974 query.bindValue(":RECID", pgRecInfo->GetRecordingRuleID());
975
976 if (!query.exec())
977 {
979 "Update recording schedule inactive query", query);
980 }
981 else
982 {
984 QString("DeactivateRule %1 %2")
985 .arg(pgRecInfo->GetRecordingRuleID())
986 .arg(pgRecInfo->GetTitle()));
987 pgRecInfo->m_recStatus = inactive ? RecStatus::Inactive : RecStatus::Unknown;
988 item->DisplayState("disabled", "status");
989 }
990 }
991 }
992}
993
995{
997 if (!item)
998 return;
999
1000 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>();
1001 if (!pgRecInfo)
1002 return;
1003
1004 // inc/dec recording priority
1005 int tempRecPriority = pgRecInfo->GetRecordingPriority() + howMuch;
1006 if (tempRecPriority > -100 && tempRecPriority < 100)
1007 {
1008 pgRecInfo->m_recPriority = tempRecPriority;
1009
1010 // order may change if sorting by recording priority, so resort
1012 {
1013 SortList();
1014 }
1015 else
1016 {
1017 // No need to re-fill the entire list, just update this entry
1018 int progRecPriority = pgRecInfo->GetRecordingPriority();
1019
1020 item->SetText(QString::number(progRecPriority), "progpriority");
1021 item->SetText(QString::number(progRecPriority), "recpriority");
1023 m_recPriorityText->SetText(QString::number(progRecPriority));
1024
1025 item->SetText(QString::number(progRecPriority), "recpriorityB");
1027 m_recPriorityBText->SetText(QString::number(progRecPriority));
1028
1029 item->SetText(QString::number(progRecPriority), "finalpriority");
1031 m_finalPriorityText->SetText(QString::number(progRecPriority));
1032 }
1033 }
1034}
1035
1037{
1038 QMap<int, ProgramRecPriorityInfo>::Iterator it;
1039
1040 for (it = m_programData.begin(); it != m_programData.end(); ++it)
1041 {
1042 ProgramRecPriorityInfo *progInfo = &(*it);
1043 int key = progInfo->GetRecordingRuleID();
1044
1045 // if this program's recording priority changed from when we entered
1046 // save new value out to db
1047 if (progInfo->GetRecordingPriority() != m_origRecPriorityData[key])
1049 progInfo->GetRecordingPriority());
1050 }
1051}
1052
1054{
1055 std::vector<ProgramInfo *> recordinglist;
1056
1057 m_programData.clear();
1058
1059 RemoteGetAllScheduledRecordings(recordinglist);
1060
1061 for (auto & pgiter : recordinglist)
1062 {
1063 ProgramInfo *progInfo = pgiter;
1064 m_programData[pgiter->GetRecordingRuleID()] =
1065 (*progInfo);
1066
1067 // save recording priority value in map so we don't have to
1068 // save all program's recording priority values when we exit
1069 m_origRecPriorityData[pgiter->GetRecordingRuleID()] =
1070 pgiter->GetRecordingPriority();
1071
1072 delete pgiter;
1073 }
1074
1075 // get recording types associated with each program from db
1076 // (hope this is ok to do here, it's so much lighter doing
1077 // it all at once than once per program)
1078
1079 MSqlQuery result(MSqlQuery::InitCon());
1080 result.prepare("SELECT recordid, title, chanid, starttime, startdate, "
1081 "type, inactive, last_record, avg_delay, profile, "
1082 "recgroup, storagegroup "
1083 "FROM record;");
1084
1085 if (!result.exec())
1086 {
1087 MythDB::DBError("Get program recording priorities query", result);
1088 }
1089
1090 countMatches();
1091 while (result.next()) {
1092 uint recordid = result.value(0).toUInt();
1093// QString title = result.value(1).toString();
1094// QString chanid = result.value(2).toString();
1095// QString tempTime = result.value(3).toString();
1096// QString tempDate = result.value(4).toString();
1097 RecordingType recType = (RecordingType)result.value(5).toInt();
1098 int inactive = result.value(6).toInt();
1099 QDateTime lastrec = MythDate::as_utc(result.value(7).toDateTime());
1100 int avgd = result.value(8).toInt();
1101 QString profile = result.value(9).toString();
1102 QString recordingGroup = result.value(10).toString();
1103 QString storageGroup = result.value(11).toString();
1104
1105 // find matching program in m_programData and set
1106 // recType
1107 QMap<int, ProgramRecPriorityInfo>::Iterator it;
1108 it = m_programData.find(recordid);
1109 if (it != m_programData.end())
1110 {
1111 ProgramRecPriorityInfo *progInfo = &(*it);
1112
1113 progInfo->m_recType = recType;
1114 progInfo->m_matchCount =
1115 m_listMatch[progInfo->GetRecordingRuleID()];
1116 progInfo->m_recCount =
1117 m_recMatch[progInfo->GetRecordingRuleID()];
1118 progInfo->m_last_record = lastrec;
1119 progInfo->m_avg_delay = avgd;
1120 progInfo->m_profile = profile;
1121 progInfo->m_recordingGroup = recordingGroup;
1122 progInfo->m_storageGroup = storageGroup;
1123
1124 if (inactive)
1125 progInfo->m_recStatus = RecStatus::Inactive;
1126 else if (m_conMatch[progInfo->GetRecordingRuleID()] > 0)
1127 progInfo->m_recStatus = RecStatus::Conflict;
1128 else if (m_nowMatch[progInfo->GetRecordingRuleID()] > 0)
1130 else if (m_recMatch[progInfo->GetRecordingRuleID()] > 0)
1132 else
1133 progInfo->m_recStatus = RecStatus::Unknown;
1134 }
1135 }
1136}
1137
1139{
1140 m_listMatch.clear();
1141 m_conMatch.clear();
1142 m_nowMatch.clear();
1143 m_recMatch.clear();
1144 ProgramList schedList;
1145 LoadFromScheduler(schedList);
1146 QDateTime now = MythDate::current();
1147
1148 for (auto *program : schedList)
1149 {
1150 const RecStatus::Type recstatus = (*program).GetRecordingStatus();
1151 const uint recordid = (*program).GetRecordingRuleID();
1152 if ((*program).GetRecordingEndTime() > now && recstatus != RecStatus::NotListed)
1153 {
1154 m_listMatch[recordid]++;
1155 if (recstatus == RecStatus::Conflict || recstatus == RecStatus::Offline)
1156 {
1157 m_conMatch[recordid]++;
1158 }
1159 else if (recstatus == RecStatus::WillRecord)
1160 {
1161 m_recMatch[recordid]++;
1162 }
1163 else if (recstatus == RecStatus::Recording)
1164 {
1165 m_nowMatch[recordid]++;
1166 m_recMatch[recordid]++;
1167 }
1168 }
1169 }
1170}
1171
1173{
1174 if (newCurrentItem)
1175 {
1176 m_currentItem = newCurrentItem;
1177 }
1178 else
1179 {
1181 if (item)
1183 item->GetData().value<ProgramRecPriorityInfo*>();
1184 }
1185
1186 QMap<int, ProgramRecPriorityInfo>::Iterator pit;
1187
1188 // copy m_programData into m_sortedProgram
1189 m_sortedProgram.clear();
1190 for (pit = m_programData.begin(); pit != m_programData.end(); ++pit)
1191 {
1192 ProgramRecPriorityInfo *progInfo = &(*pit);
1193 m_sortedProgram.push_back(progInfo);
1194 }
1195
1196 // sort m_sortedProgram
1197 switch (m_sortType)
1198 {
1199 case byTitle :
1200 std::ranges::sort(m_sortedProgram,
1202 break;
1203 case byRecPriority :
1204 std::ranges::sort(m_sortedProgram,
1206 break;
1207 case byRecType :
1208 std::ranges::sort(m_sortedProgram,
1210 break;
1211 case byCount :
1212 std::ranges::sort(m_sortedProgram,
1214 break;
1215 case byRecCount :
1216 std::ranges::sort(m_sortedProgram,
1218 break;
1219 case byLastRecord :
1220 std::ranges::sort(m_sortedProgram,
1222 break;
1223 case byAvgDelay :
1224 std::ranges::sort(m_sortedProgram,
1226 break;
1227 }
1228
1229 UpdateList();
1230}
1231
1233{
1236 .value<ProgramRecPriorityInfo*>();
1237
1239
1240 std::vector<ProgramRecPriorityInfo*>::iterator it;
1241 for (it = m_sortedProgram.begin(); it != m_sortedProgram.end(); ++it)
1242 {
1243 ProgramRecPriorityInfo *progInfo = *it;
1244
1245 auto *item = new MythUIButtonListItem(m_programList, "",
1246 QVariant::fromValue(progInfo));
1247
1248 int progRecPriority = progInfo->GetRecordingPriority();
1249
1250 if ((progInfo->m_recType == kSingleRecord ||
1251 progInfo->m_recType == kOverrideRecord ||
1252 progInfo->m_recType == kDontRecord) &&
1253 !(progInfo->GetSubtitle()).trimmed().isEmpty())
1254 {
1255 QString rating = QString::number(progInfo->GetStars(10));
1256
1257 item->DisplayState(rating, "ratingstate");
1258 }
1259 else
1260 {
1261 progInfo->m_subtitle.clear();
1262 }
1263
1264 QString state;
1265 if (progInfo->m_recType == kDontRecord ||
1266 (progInfo->m_recType != kTemplateRecord &&
1267 progInfo->m_recStatus == RecStatus::Inactive))
1268 state = "disabled";
1269 else if (m_conMatch[progInfo->GetRecordingRuleID()] > 0)
1270 state = "error";
1271 else if (m_recMatch[progInfo->GetRecordingRuleID()] > 0 ||
1272 progInfo->m_recType == kTemplateRecord)
1273 state = "normal";
1274 else if (m_nowMatch[progInfo->GetRecordingRuleID()] > 0)
1275 state = "running";
1276 else
1277 state = "warning";
1278
1279 InfoMap infoMap;
1280 progInfo->ToMap(infoMap);
1281 item->SetTextFromMap(infoMap, state);
1282
1283 QString subtitle;
1284 if (progInfo->m_subtitle != "(null)" &&
1285 (progInfo->m_recType == kSingleRecord ||
1286 progInfo->m_recType == kOverrideRecord ||
1287 progInfo->m_recType == kDontRecord))
1288 {
1289 subtitle = progInfo->m_subtitle;
1290 }
1291
1292 QString matchInfo;
1293 if (progInfo->GetRecordingStatus() == RecStatus::Inactive)
1294 {
1295 matchInfo = QString("%1 %2")
1296 .arg(m_listMatch[progInfo->GetRecordingRuleID()])
1297 .arg(RecStatus::toString(progInfo->GetRecordingStatus(),
1298 progInfo->GetRecordingRuleType()));
1299 }
1300 else
1301 {
1302 matchInfo = tr("Recording %1 of %2")
1303 .arg(m_recMatch[progInfo->GetRecordingRuleID()])
1304 .arg(m_listMatch[progInfo->GetRecordingRuleID()]);
1305 }
1306
1307 subtitle = QString("(%1) %2").arg(matchInfo, subtitle);
1308 item->SetText(subtitle, "scheduleinfo", state);
1309
1310 item->SetText(QString::number(progRecPriority), "progpriority", state);
1311 item->SetText(QString::number(progRecPriority), "finalpriority", state);
1312
1313 item->SetText(QString::number(progRecPriority), "recpriority", state);
1314 item->SetText(QString::number(progRecPriority), "recpriorityB", state);
1315
1316 QString tempDateTime = MythDate::toString(progInfo->m_last_record,
1319 item->SetText(tempDateTime, "lastrecorded", state);
1320 QString tempDate = MythDate::toString(progInfo->m_last_record,
1323 item->SetText(tempDate, "lastrecordeddate", state);
1324 QString tempTime = MythDate::toString(
1325 progInfo->m_last_record, MythDate::kTime);
1326 item->SetText(tempTime, "lastrecordedtime", state);
1327
1328 QString channame = progInfo->m_chanName;
1329 QString channum = progInfo->m_chanStr;
1330 QString callsign = progInfo->m_chanSign;
1331 if (progInfo->m_recType != kSingleRecord &&
1332 progInfo->m_recType != kOverrideRecord &&
1333 progInfo->m_recType != kDontRecord &&
1334 !(progInfo->GetRecordingRule()->m_filter & 1024) &&
1336 {
1337 channame = tr("Any");
1338 channum = tr("Any");
1339 callsign = tr("Any");
1340 }
1341 item->SetText(channame, "channel", state);
1342 item->SetText(channum, "channum", state);
1343 item->SetText(callsign, "callsign", state);
1344
1345 QString profile = progInfo->m_profile;
1346 if ((profile == "Default") || (profile == "Live TV") ||
1347 (profile == "High Quality") || (profile == "Low Quality"))
1348 profile = tr(profile.toUtf8().constData());
1349 item->SetText(profile, "recordingprofile", state);
1350 item->SetText(progInfo->m_recordingGroup, "recordinggroup", state);
1351 item->SetText(progInfo->m_storageGroup, "storagegroup", state);
1352 item->DisplayState(state, "status");
1353
1354 if (m_currentItem == progInfo)
1356 }
1357
1358 m_currentItem = nullptr;
1359
1360 MythUIText *norecordingText = dynamic_cast<MythUIText*>
1361 (GetChild("norecordings_info"));
1362
1363 if (norecordingText)
1364 norecordingText->SetVisible(m_programData.isEmpty());
1365}
1366
1367// Called whenever a new recording is selected from the list of
1368// recordings. This function updates the screen with the information
1369// on the newly selected recording.
1371{
1372 if (!item)
1373 return;
1374
1375 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo *>();
1376
1377 if (!pgRecInfo)
1378 return;
1379
1380 int progRecPriority = pgRecInfo->GetRecordingPriority();
1381
1382 QString subtitle;
1383 if (pgRecInfo->m_subtitle != "(null)" &&
1384 (pgRecInfo->m_recType == kSingleRecord ||
1385 pgRecInfo->m_recType == kOverrideRecord ||
1386 pgRecInfo->m_recType == kDontRecord))
1387 {
1388 subtitle = pgRecInfo->m_subtitle;
1389 }
1390
1391 QString matchInfo;
1392 if (pgRecInfo->GetRecordingStatus() == RecStatus::Inactive)
1393 {
1394 matchInfo = QString("%1 %2")
1395 .arg(m_listMatch[pgRecInfo->GetRecordingRuleID()])
1396 .arg(RecStatus::toString(pgRecInfo->GetRecordingStatus(),
1397 pgRecInfo->GetRecordingRuleType()));
1398 }
1399 else
1400 {
1401 matchInfo = tr("Recording %1 of %2")
1402 .arg(m_recMatch[pgRecInfo->GetRecordingRuleID()])
1403 .arg(m_listMatch[pgRecInfo->GetRecordingRuleID()]);
1404 }
1405
1406 subtitle = QString("(%1) %2").arg(matchInfo, subtitle);
1407
1408 InfoMap infoMap;
1409 pgRecInfo->ToMap(infoMap);
1410 SetTextFromMap(infoMap);
1411
1412 if (m_schedInfoText)
1413 m_schedInfoText->SetText(subtitle);
1414
1416 m_recPriorityText->SetText(QString::number(progRecPriority));
1417
1419 m_recPriorityBText->SetText(QString::number(progRecPriority));
1420
1422 m_finalPriorityText->SetText(QString::number(progRecPriority));
1423
1425 {
1426 QString tempDateTime = MythDate::toString(pgRecInfo->m_last_record,
1429 m_lastRecordedText->SetText(tempDateTime);
1430 }
1431
1433 {
1434 QString tempDate = MythDate::toString(pgRecInfo->m_last_record,
1438 }
1439
1441 {
1442 QString tempTime = MythDate::toString(
1443 pgRecInfo->m_last_record, MythDate::kTime);
1445 }
1446
1448 {
1449 QString channame = pgRecInfo->m_chanName;
1450 QString channum = pgRecInfo->m_chanStr;
1451 QString callsign = pgRecInfo->m_chanSign;
1452 if (pgRecInfo->m_recType != kSingleRecord &&
1453 pgRecInfo->m_recType != kOverrideRecord &&
1454 pgRecInfo->m_recType != kDontRecord &&
1455 !(pgRecInfo->GetRecordingRule()->m_filter & 1024) &&
1456 pgRecInfo->GetRecordingRule()->m_searchType != kManualSearch)
1457 {
1458 channame = tr("Any");
1459 channum = tr("Any");
1460 callsign = tr("Any");
1461 }
1462 if (m_chanNameText)
1463 m_chanNameText->SetText(channame);
1464 if (m_chanNumText)
1465 m_chanNumText->SetText(channum);
1466 if (m_callSignText)
1467 m_callSignText->SetText(callsign);
1468 }
1469
1470 if (m_recProfileText)
1471 {
1472 QString profile = pgRecInfo->m_profile;
1473 if ((profile == "Default") || (profile == "Live TV") ||
1474 (profile == "High Quality") || (profile == "Low Quality"))
1475 profile = tr(profile.toUtf8().constData());
1477 }
1478}
1479
1481{
1482 if (!item)
1483 return;
1484
1485 auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo *>();
1486
1487 if (!pgRecInfo)
1488 return;
1489
1490 QMap<int, ProgramRecPriorityInfo>::iterator it;
1491 it = m_programData.find(pgRecInfo->GetRecordingRuleID());
1492 if (it != m_programData.end())
1493 m_programData.erase(it);
1494
1496}
1497
1499{
1501 return item ? item->GetData().value<ProgramRecPriorityInfo*>() : nullptr;
1502}
1503
1504/* 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:40
static const Type kEventType
Definition: mythdialogbox.h:55
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:838
QVariant value(int i) const
Definition: mythdbcon.h:204
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:619
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:889
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:813
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:551
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:225
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:130
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:74
float GetStars(void) const
Definition: programinfo.h:453
uint GetRecordingRuleID(void) const
Definition: programinfo.h:460
void SetTitle(const QString &t, const QString &st=nullptr)
QString m_category
Definition: programinfo.h:785
void SetRecordingRuleType(RecordingType type)
Definition: programinfo.h:593
QString GetSortSubtitle(void) const
Definition: programinfo.h:371
void SetCategory(const QString &cat)
Definition: programinfo.h:546
QString m_title
Definition: programinfo.h:776
void SetRecordingRuleID(uint id)
Definition: programinfo.h:550
QString GetSortTitle(void) const
Definition: programinfo.h:369
QString m_chanStr
Definition: programinfo.h:791
int GetRecordingPriority(void) const
Definition: programinfo.h:451
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:792
QString m_chanName
Definition: programinfo.h:793
void SetRecordingPriority(int priority)
Definition: programinfo.h:548
QString m_subtitle
Definition: programinfo.h:778
RecStatus::Type GetRecordingStatus(void) const
Definition: programinfo.h:458
int8_t m_recStatus
Definition: programinfo.h:839
QString GetSubtitle(void) const
Definition: programinfo.h:370
QString GetCategory(void) const
Definition: programinfo.h:377
void SetSubtitle(const QString &st, const QString &sst=nullptr)
RecordingType GetRecordingRuleType(void) const
Definition: programinfo.h:462
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:60
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#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 std::strong_ordering 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:122
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:945
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