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:
30  ProgramRecPriorityInfo() = default;
31  ProgramRecPriorityInfo(const ProgramRecPriorityInfo &/*other*/) = default;
33  { clone(other); return *this; }
35  { clone(other); return *this; }
37  { 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);
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
This widget is used for grouping other widgets for display when a particular named state is called.
MythUIText * m_lastRecordedDateText
ProgramRecPriority(MythScreenStack *parent, const QString &name)
MythUIText * m_lastRecordedTimeText
unsigned int slots[4]
Definition: element.c:38
std::vector< ProgramRecPriorityInfo * > m_sortedProgram
void newTemplate(QString category)
~ProgramRecPriority() override=default
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
ProgramRecPriorityInfo & operator=(const RecordingInfo &other)
MythUIText * m_finalPriorityText
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:34
QMap< int, int > m_listMatch
QMap< int, int > m_origRecPriorityData
void customEvent(QEvent *event) override
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...
MythUIText * m_lastRecordedText
Q_DECLARE_METATYPE(GrabberScript *)
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
MythUIText * m_recPriorityText
void changeRecPriority(int howMuch)
Holds information on recordings and videos.
Definition: programinfo.h:67
ProgramInfo * GetCurrentProgram(void) const override
MythUIButtonList * m_programList
void clear(void) override
ProgramRecPriorityInfo()=default
ProgramRecPriorityInfo * m_currentItem
void RemoveItemFromList(MythUIButtonListItem *item)
QMap< int, ProgramRecPriorityInfo > m_programData
bool Create(void) override
void scheduleChanged(int recid)
QMap< int, int > m_conMatch
unsigned int uint
Definition: compat.h:140
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:32
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
MythUIText * m_callSignText
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
virtual void clone(const ProgramRecPriorityInfo &other, bool ignore_non_serialized_data=false)
ProgramRecPriorityInfo & operator=(const ProgramInfo &other)
void SortList(ProgramRecPriorityInfo *newCurrentItem=nullptr)
MythUIText * m_recProfileText
QMap< int, int > m_recMatch
MythUIText * m_schedInfoText
QMap< int, int > m_nowMatch
MythUIText * m_recPriorityBText
ProgramRecPriorityInfo & operator=(const ProgramRecPriorityInfo &other)
MythUIText * m_chanNameText
void updateInfo(MythUIButtonListItem *item)
MythUIText * m_chanNumText
void edit(MythUIButtonListItem *item)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.