MythTV  master
programrecpriority.h
Go to the documentation of this file.
1 #ifndef PROGRAMRECPROIRITY_H_
2 #define PROGRAMRECPROIRITY_H_
3 
4 // C++
5 #include <vector>
6 
7 // MythTV headers
10 
11 // MythFrontend
12 #include "schedulecommon.h"
13 
14 class QDateTime;
15 
16 class MythUIButtonList;
18 class MythUIText;
19 class MythUIStateType;
20 class ProgramRecPriority;
21 
22 class RecordingRule;
23 
24 // overloaded version of RecordingInfo with additional recording priority
25 // values so we can keep everything together and don't
26 // have to hit the db mulitiple times
28 {
29  friend class ProgramRecPriority;
30 
31  public:
32  ProgramRecPriorityInfo() = default;
33  ProgramRecPriorityInfo(const ProgramRecPriorityInfo &/*other*/) = default;
35  { if (this != &other) clone(other); return *this; }
37  { if (this != &other) clone(other); return *this; }
39  { if (this != &other) clone(other); return *this; }
40  virtual void clone(const ProgramRecPriorityInfo &other,
41  bool ignore_non_serialized_data = false);
42  void clone(const RecordingInfo &other,
43  bool ignore_non_serialized_data = false) override; // RecordingInfo
44  void clone(const ProgramInfo &other,
45  bool ignore_non_serialized_data = false) override; // RecordingInfo
46 
47  void clear(void) override; // RecordingInfo
48 
49  void ToMap(InfoMap &progMap,
50  bool showrerecord = false,
51  uint star_range = 10,
52  uint date_format = 0) const override; // ProgramInfo
53 
55  int m_matchCount {0};
56  int m_recCount {0};
57  QDateTime m_last_record;
58  int m_avg_delay {0};
59  QString m_profile;
61  QString m_storageGroup;
62 };
63 
65 {
66  Q_OBJECT
67  public:
68  ProgramRecPriority(MythScreenStack *parent, const QString &name);
69  ~ProgramRecPriority() override = default;
70 
71  bool Create(void) override; // MythScreenType
72  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
73  void customEvent(QEvent *event) override; // ScheduleCommon
74 
75  enum SortType
76  {
84  };
85 
86  protected slots:
87  void updateInfo(MythUIButtonListItem *item);
88  void edit(MythUIButtonListItem *item) const;
89  void scheduleChanged(int recid);
90 
91  private:
92  void Load(void) override; // MythScreenType
93  void Init(void) override; // MythScreenType
94 
95  void FillList(void);
96  void SortList(ProgramRecPriorityInfo *newCurrentItem = nullptr);
97  void UpdateList();
99 
100  void changeRecPriority(int howMuch);
101  void saveRecPriority(void);
102  void newTemplate(QString category);
103  void remove();
104  void deactivate();
105 
106  void showMenu(void);
107  void showSortMenu(void);
108 
109  ProgramInfo *GetCurrentProgram(void) const override; // ScheduleCommon
110 
111  QMap<int, ProgramRecPriorityInfo> m_programData;
112  std::vector<ProgramRecPriorityInfo*> m_sortedProgram;
113  QMap<int, int> m_origRecPriorityData;
114 
115  void countMatches(void);
116  QMap<int, int> m_conMatch;
117  QMap<int, int> m_nowMatch;
118  QMap<int, int> m_recMatch;
119  QMap<int, int> m_listMatch;
120 
122 
134 
136 
137  bool m_reverseSort {false};
138 
140 };
141 
143 
144 #endif
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(GrabberScript *)
ProgramRecPriorityInfo::ProgramRecPriorityInfo
ProgramRecPriorityInfo()=default
ProgramRecPriority::m_recPriorityBText
MythUIText * m_recPriorityBText
Definition: programrecpriority.h:125
ProgramRecPriority::m_sortType
SortType m_sortType
Definition: programrecpriority.h:139
ProgramRecPriority::m_chanNumText
MythUIText * m_chanNumText
Definition: programrecpriority.h:131
ProgramRecPriority::m_finalPriorityText
MythUIText * m_finalPriorityText
Definition: programrecpriority.h:126
ProgramRecPriorityInfo::clear
void clear(void) override
Definition: programrecpriority.cpp:80
ProgramRecPriority::Create
bool Create(void) override
Definition: programrecpriority.cpp:289
ProgramRecPriorityInfo::m_matchCount
int m_matchCount
Definition: programrecpriority.h:55
ProgramRecPriority::updateInfo
void updateInfo(MythUIButtonListItem *item)
Definition: programrecpriority.cpp:1319
ProgramRecPriority::UpdateList
void UpdateList()
Definition: programrecpriority.cpp:1183
ProgramRecPriority::m_currentItem
ProgramRecPriorityInfo * m_currentItem
Definition: programrecpriority.h:135
ProgramRecPriority::GetCurrentProgram
ProgramInfo * GetCurrentProgram(void) const override
Definition: programrecpriority.cpp:1447
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:35
ProgramRecPriorityInfo::operator=
ProgramRecPriorityInfo & operator=(const ProgramInfo &other)
Definition: programrecpriority.h:38
ProgramRecPriority
Definition: programrecpriority.h:64
ProgramRecPriority::m_reverseSort
bool m_reverseSort
Definition: programrecpriority.h:137
ProgramRecPriority::saveRecPriority
void saveRecPriority(void)
Definition: programrecpriority.cpp:991
ProgramRecPriority::byRecType
@ byRecType
Definition: programrecpriority.h:79
ProgramRecPriority::m_recProfileText
MythUIText * m_recProfileText
Definition: programrecpriority.h:133
MythScreenStack
Definition: mythscreenstack.h:16
RecordingRule
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:28
ProgramRecPriority::Load
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Definition: programrecpriority.cpp:329
ProgramRecPriority::changeRecPriority
void changeRecPriority(int howMuch)
Definition: programrecpriority.cpp:951
ProgramRecPriority::showSortMenu
void showSortMenu(void)
Definition: programrecpriority.cpp:519
ProgramRecPriority::deactivate
void deactivate()
Definition: programrecpriority.cpp:898
ProgramRecPriority::showMenu
void showMenu(void)
Definition: programrecpriority.cpp:491
ProgramRecPriority::m_recPriorityText
MythUIText * m_recPriorityText
Definition: programrecpriority.h:124
schedulecommon.h
ProgramRecPriority::m_lastRecordedTimeText
MythUIText * m_lastRecordedTimeText
Definition: programrecpriority.h:129
ProgramRecPriority::~ProgramRecPriority
~ProgramRecPriority() override=default
ProgramRecPriority::SortType
SortType
Definition: programrecpriority.h:75
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
ProgramRecPriority::m_lastRecordedText
MythUIText * m_lastRecordedText
Definition: programrecpriority.h:127
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
ProgramRecPriority::newTemplate
void newTemplate(QString category)
Definition: programrecpriority.cpp:744
ProgramRecPriorityInfo
Definition: programrecpriority.h:27
ProgramRecPriority::ProgramRecPriority
ProgramRecPriority(MythScreenStack *parent, const QString &name)
Definition: programrecpriority.cpp:280
ProgramRecPriority::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: programrecpriority.cpp:339
ProgramRecPriority::byRecPriority
@ byRecPriority
Definition: programrecpriority.h:78
ProgramRecPriority::byCount
@ byCount
Definition: programrecpriority.h:80
ProgramRecPriorityInfo::operator=
ProgramRecPriorityInfo & operator=(const ProgramRecPriorityInfo &other)
Definition: programrecpriority.h:34
ProgramRecPriority::m_listMatch
QMap< int, int > m_listMatch
Definition: programrecpriority.h:119
ProgramRecPriority::m_origRecPriorityData
QMap< int, int > m_origRecPriorityData
Definition: programrecpriority.h:113
ProgramRecPriority::m_chanNameText
MythUIText * m_chanNameText
Definition: programrecpriority.h:130
ProgramRecPriorityInfo::ToMap
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...
Definition: programrecpriority.cpp:94
ProgramRecPriorityInfo::m_recType
RecordingType m_recType
Definition: programrecpriority.h:54
ProgramRecPriority::m_recMatch
QMap< int, int > m_recMatch
Definition: programrecpriority.h:118
ScheduleCommon
Definition: schedulecommon.h:15
ProgramRecPriority::m_programData
QMap< int, ProgramRecPriorityInfo > m_programData
Definition: programrecpriority.h:111
ProgramRecPriority::m_callSignText
MythUIText * m_callSignText
Definition: programrecpriority.h:132
ProgramRecPriority::FillList
void FillList(void)
Definition: programrecpriority.cpp:1008
uint
unsigned int uint
Definition: compat.h:79
ProgramRecPriority::customEvent
void customEvent(QEvent *event) override
Definition: programrecpriority.cpp:547
ProgramRecPriorityInfo::m_avg_delay
int m_avg_delay
Definition: programrecpriority.h:58
ProgramRecPriority::m_schedInfoText
MythUIText * m_schedInfoText
Definition: programrecpriority.h:123
ProgramRecPriority::m_programList
MythUIButtonList * m_programList
Definition: programrecpriority.h:121
ProgramRecPriority::countMatches
void countMatches(void)
Definition: programrecpriority.cpp:1095
ProgramRecPriority::m_sortedProgram
std::vector< ProgramRecPriorityInfo * > m_sortedProgram
Definition: programrecpriority.h:112
ProgramRecPriority::RemoveItemFromList
void RemoveItemFromList(MythUIButtonListItem *item)
Definition: programrecpriority.cpp:1429
ProgramRecPriority::scheduleChanged
void scheduleChanged(int recid)
Definition: programrecpriority.cpp:782
ProgramRecPriority::byTitle
@ byTitle
Definition: programrecpriority.h:77
ProgramRecPriority::byRecCount
@ byRecCount
Definition: programrecpriority.h:81
ProgramRecPriority::byLastRecord
@ byLastRecord
Definition: programrecpriority.h:82
recordinginfo.h
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
ProgramRecPriority::SortList
void SortList(ProgramRecPriorityInfo *newCurrentItem=nullptr)
Definition: programrecpriority.cpp:1125
ProgramRecPriorityInfo::m_recordingGroup
QString m_recordingGroup
Definition: programrecpriority.h:60
kNotRecording
@ kNotRecording
Definition: recordingtypes.h:22
ProgramRecPriorityInfo::m_last_record
QDateTime m_last_record
Definition: programrecpriority.h:57
ProgramRecPriorityInfo::operator=
ProgramRecPriorityInfo & operator=(const RecordingInfo &other)
Definition: programrecpriority.h:36
ProgramRecPriority::m_conMatch
QMap< int, int > m_conMatch
Definition: programrecpriority.h:116
ProgramRecPriorityInfo::m_profile
QString m_profile
Definition: programrecpriority.h:59
ProgramRecPriority::byAvgDelay
@ byAvgDelay
Definition: programrecpriority.h:83
ProgramRecPriorityInfo::m_recCount
int m_recCount
Definition: programrecpriority.h:56
ProgramRecPriority::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: programrecpriority.cpp:334
ProgramRecPriority::edit
void edit(MythUIButtonListItem *item) const
Definition: programrecpriority.cpp:718
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
ProgramRecPriority::m_lastRecordedDateText
MythUIText * m_lastRecordedDateText
Definition: programrecpriority.h:128
RecordingType
RecordingType
Definition: recordingtypes.h:20
ProgramRecPriorityInfo::clone
virtual void clone(const ProgramRecPriorityInfo &other, bool ignore_non_serialized_data=false)
Definition: programrecpriority.cpp:26
ProgramRecPriority::remove
void remove()
Definition: programrecpriority.cpp:860
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
mythscreentype.h
ProgramRecPriority::m_nowMatch
QMap< int, int > m_nowMatch
Definition: programrecpriority.h:117
ProgramRecPriorityInfo::m_storageGroup
QString m_storageGroup
Definition: programrecpriority.h:61