MythTV  master
programrecpriority.h
Go to the documentation of this file.
1 #ifndef PROGRAMRECPROIRITY_H_
2 #define PROGRAMRECPROIRITY_H_
3 
4 #include <vector>
5 
6 #include "recordinginfo.h"
7 #include "mythscreentype.h"
8 
9 // mythfrontend
10 #include "schedulecommon.h"
11 
12 class QDateTime;
13 
14 class MythUIButtonList;
16 class MythUIText;
17 class MythUIStateType;
18 class ProgramRecPriority;
19 
20 class RecordingRule;
21 
22 // overloaded version of RecordingInfo with additional recording priority
23 // values so we can keep everything together and don't
24 // have to hit the db mulitiple times
26 {
27  friend class ProgramRecPriority;
28 
29  public:
31  ProgramRecPriorityInfo(const ProgramRecPriorityInfo &/*other*/) = default;
33  { if (this != &other) clone(other); return *this; }
35  { if (this != &other) clone(other); return *this; }
37  { if (this != &other) clone(other); return *this; }
38  virtual void clone(const ProgramRecPriorityInfo &other,
39  bool ignore_non_serialized_data = false);
40  void clone(const RecordingInfo &other,
41  bool ignore_non_serialized_data = false) override; // RecordingInfo
42  void clone(const ProgramInfo &other,
43  bool ignore_non_serialized_data = false) override; // RecordingInfo
44 
45  void clear(void) override; // RecordingInfo
46 
47  void ToMap(InfoMap &progMap,
48  bool showrerecord = false,
49  uint star_range = 10) const override; // ProgramInfo
50 
52  int m_matchCount {0};
53  int m_recCount {0};
54  QDateTime m_last_record;
55  int m_avg_delay {0};
56  QString m_profile;
57 };
58 
60 {
61  Q_OBJECT
62  public:
63  ProgramRecPriority(MythScreenStack *parent, const QString &name);
64  ~ProgramRecPriority() override = default;
65 
66  bool Create(void) override; // MythScreenType
67  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
68  void customEvent(QEvent *event) override; // ScheduleCommon
69 
70  enum SortType
71  {
79  };
80 
81  protected slots:
82  void updateInfo(MythUIButtonListItem *item);
83  void edit(MythUIButtonListItem *item) const;
84  void scheduleChanged(int recid);
85 
86  private:
87  void Load(void) override; // MythScreenType
88  void Init(void) override; // MythScreenType
89 
90  void FillList(void);
91  void SortList(ProgramRecPriorityInfo *newCurrentItem = nullptr);
92  void UpdateList();
94 
95  void changeRecPriority(int howMuch);
96  void saveRecPriority(void);
97  void newTemplate(QString category);
98  void remove();
99  void deactivate();
100 
101  void showMenu(void);
102  void showSortMenu(void);
103 
104  ProgramInfo *GetCurrentProgram(void) const override; // ScheduleCommon
105 
106  QMap<int, ProgramRecPriorityInfo> m_programData;
107  std::vector<ProgramRecPriorityInfo*> m_sortedProgram;
108  QMap<int, int> m_origRecPriorityData;
109 
110  void countMatches(void);
111  QMap<int, int> m_conMatch;
112  QMap<int, int> m_nowMatch;
113  QMap<int, int> m_recMatch;
114  QMap<int, int> m_listMatch;
115 
117 
129 
131 
132  bool m_reverseSort {false};
133 
135 };
136 
138 
139 #endif
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(GrabberScript *)
ProgramRecPriorityInfo::ProgramRecPriorityInfo
ProgramRecPriorityInfo()=default
ProgramRecPriority::m_recPriorityBText
MythUIText * m_recPriorityBText
Definition: programrecpriority.h:120
ProgramRecPriority::m_sortType
SortType m_sortType
Definition: programrecpriority.h:134
ProgramRecPriority::m_chanNumText
MythUIText * m_chanNumText
Definition: programrecpriority.h:126
ProgramRecPriority::m_finalPriorityText
MythUIText * m_finalPriorityText
Definition: programrecpriority.h:121
ProgramRecPriorityInfo::clear
void clear(void) override
Definition: programrecpriority.cpp:81
ProgramRecPriority::Create
bool Create(void) override
Definition: programrecpriority.cpp:395
ProgramRecPriorityInfo::m_matchCount
int m_matchCount
Definition: programrecpriority.h:52
ProgramRecPriority::updateInfo
void updateInfo(MythUIButtonListItem *item)
Definition: programrecpriority.cpp:1413
ProgramRecPriority::UpdateList
void UpdateList()
Definition: programrecpriority.cpp:1282
ProgramRecPriority::m_currentItem
ProgramRecPriorityInfo * m_currentItem
Definition: programrecpriority.h:130
ProgramRecPriority::GetCurrentProgram
ProgramInfo * GetCurrentProgram(void) const override
Definition: programrecpriority.cpp:1542
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:36
ProgramRecPriority
Definition: programrecpriority.h:60
ProgramRecPriority::m_reverseSort
bool m_reverseSort
Definition: programrecpriority.h:132
ProgramRecPriority::saveRecPriority
void saveRecPriority(void)
Definition: programrecpriority.cpp:1095
ProgramRecPriority::byRecType
@ byRecType
Definition: programrecpriority.h:74
ProgramRecPriority::m_recProfileText
MythUIText * m_recProfileText
Definition: programrecpriority.h:128
MythScreenStack
Definition: mythscreenstack.h:16
RecordingRule
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:33
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:435
category
QString category
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1422
ProgramRecPriority::changeRecPriority
void changeRecPriority(int howMuch)
Definition: programrecpriority.cpp:1055
ProgramRecPriority::showSortMenu
void showSortMenu(void)
Definition: programrecpriority.cpp:625
ProgramRecPriority::deactivate
void deactivate()
Definition: programrecpriority.cpp:1002
ProgramRecPriority::showMenu
void showMenu(void)
Definition: programrecpriority.cpp:597
ProgramRecPriority::m_recPriorityText
MythUIText * m_recPriorityText
Definition: programrecpriority.h:119
schedulecommon.h
ProgramRecPriority::m_lastRecordedTimeText
MythUIText * m_lastRecordedTimeText
Definition: programrecpriority.h:124
ProgramRecPriority::~ProgramRecPriority
~ProgramRecPriority() override=default
ProgramRecPriority::SortType
SortType
Definition: programrecpriority.h:71
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
ProgramRecPriority::m_lastRecordedText
MythUIText * m_lastRecordedText
Definition: programrecpriority.h:122
MythUIButtonListItem
Definition: mythuibuttonlist.h:28
ProgramRecPriority::newTemplate
void newTemplate(QString category)
Definition: programrecpriority.cpp:850
ProgramRecPriorityInfo
Definition: programrecpriority.h:26
ProgramRecPriority::ProgramRecPriority
ProgramRecPriority(MythScreenStack *parent, const QString &name)
Definition: programrecpriority.cpp:386
ProgramRecPriority::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: programrecpriority.cpp:445
ProgramRecPriority::byRecPriority
@ byRecPriority
Definition: programrecpriority.h:73
ProgramRecPriority::byCount
@ byCount
Definition: programrecpriority.h:75
ProgramRecPriorityInfo::operator=
ProgramRecPriorityInfo & operator=(const ProgramRecPriorityInfo &other)
Definition: programrecpriority.h:32
ProgramRecPriority::m_listMatch
QMap< int, int > m_listMatch
Definition: programrecpriority.h:114
ProgramRecPriority::m_origRecPriorityData
QMap< int, int > m_origRecPriorityData
Definition: programrecpriority.h:108
ProgramRecPriority::m_chanNameText
MythUIText * m_chanNameText
Definition: programrecpriority.h:125
ProgramRecPriorityInfo::m_recType
RecordingType m_recType
Definition: programrecpriority.h:51
ProgramRecPriority::m_recMatch
QMap< int, int > m_recMatch
Definition: programrecpriority.h:113
ScheduleCommon
Definition: schedulecommon.h:16
ProgramRecPriority::m_programData
QMap< int, ProgramRecPriorityInfo > m_programData
Definition: programrecpriority.h:106
ProgramRecPriority::m_callSignText
MythUIText * m_callSignText
Definition: programrecpriority.h:127
ProgramRecPriority::FillList
void FillList(void)
Definition: programrecpriority.cpp:1112
uint
unsigned int uint
Definition: compat.h:141
ProgramRecPriority::customEvent
void customEvent(QEvent *event) override
Definition: programrecpriority.cpp:653
ProgramRecPriorityInfo::m_avg_delay
int m_avg_delay
Definition: programrecpriority.h:55
ProgramRecPriority::m_schedInfoText
MythUIText * m_schedInfoText
Definition: programrecpriority.h:118
ProgramRecPriority::m_programList
MythUIButtonList * m_programList
Definition: programrecpriority.h:116
ProgramRecPriority::countMatches
void countMatches(void)
Definition: programrecpriority.cpp:1194
ProgramRecPriority::m_sortedProgram
std::vector< ProgramRecPriorityInfo * > m_sortedProgram
Definition: programrecpriority.h:107
ProgramRecPriority::RemoveItemFromList
void RemoveItemFromList(MythUIButtonListItem *item)
Definition: programrecpriority.cpp:1524
ProgramRecPriority::scheduleChanged
void scheduleChanged(int recid)
Definition: programrecpriority.cpp:888
ProgramRecPriority::byTitle
@ byTitle
Definition: programrecpriority.h:72
ProgramRecPriority::byRecCount
@ byRecCount
Definition: programrecpriority.h:76
ProgramRecPriority::byLastRecord
@ byLastRecord
Definition: programrecpriority.h:77
recordinginfo.h
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:68
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
ProgramRecPriority::SortList
void SortList(ProgramRecPriorityInfo *newCurrentItem=nullptr)
Definition: programrecpriority.cpp:1224
kNotRecording
@ kNotRecording
Definition: recordingtypes.h:21
ProgramRecPriorityInfo::m_last_record
QDateTime m_last_record
Definition: programrecpriority.h:54
ProgramRecPriorityInfo::operator=
ProgramRecPriorityInfo & operator=(const RecordingInfo &other)
Definition: programrecpriority.h:34
ProgramRecPriority::m_conMatch
QMap< int, int > m_conMatch
Definition: programrecpriority.h:111
ProgramRecPriorityInfo::m_profile
QString m_profile
Definition: programrecpriority.h:56
ProgramRecPriority::byAvgDelay
@ byAvgDelay
Definition: programrecpriority.h:78
ProgramRecPriorityInfo::m_recCount
int m_recCount
Definition: programrecpriority.h:53
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:440
ProgramRecPriority::edit
void edit(MythUIButtonListItem *item) const
Definition: programrecpriority.cpp:824
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:152
ProgramRecPriorityInfo::ToMap
void ToMap(InfoMap &progMap, bool showrerecord=false, uint star_range=10) const override
Converts ProgramInfo into QString QHash containing each field in ProgramInfo converted into localized...
Definition: programrecpriority.cpp:93
ProgramRecPriority::m_lastRecordedDateText
MythUIText * m_lastRecordedDateText
Definition: programrecpriority.h:123
RecordingType
RecordingType
Definition: recordingtypes.h:20
ProgramRecPriorityInfo::clone
virtual void clone(const ProgramRecPriorityInfo &other, bool ignore_non_serialized_data=false)
Definition: programrecpriority.cpp:33
ProgramRecPriority::remove
void remove()
Definition: programrecpriority.cpp:964
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called.
Definition: mythuistatetype.h:23
mythscreentype.h
ProgramRecPriority::m_nowMatch
QMap< int, int > m_nowMatch
Definition: programrecpriority.h:112
ProgramRecPriorityInfo::ProgramRecPriorityInfo
ProgramRecPriorityInfo(const ProgramRecPriorityInfo &)=default