MythTV  master
progfind.h
Go to the documentation of this file.
1 #ifndef PROGFIND_H_
2 #define PROGFIND_H_
3 
4 // Qt
5 #include <QDateTime>
6 #include <QEvent>
7 
8 // MythTV
9 #include "mythscreentype.h"
10 #include "programinfo.h"
11 #include "mythdialogbox.h"
12 #include "playercontext.h"
13 
14 // mythfrontend
15 #include "schedulecommon.h"
16 
17 class TV;
18 class MythUIText;
19 class MythUIButtonList;
20 
21 void RunProgramFinder(TV *player = nullptr, bool embedVideo = false, bool allowEPG = true);
22 
23 class ProgFinder : public ScheduleCommon
24 {
25  Q_OBJECT
26  public:
27  explicit ProgFinder(MythScreenStack *parentStack, bool allowEPG = true,
28  TV *player = nullptr, bool embedVideo = false)
29  : ScheduleCommon(parentStack, "ProgFinder"),
30  m_player(player),
31  m_embedVideo(embedVideo),
32  m_allowEPG(allowEPG) {}
33  ~ProgFinder() override;
34 
35  bool Create(void) override; // MythScreenType
36  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
37 
38  private slots:
40  void showListTakeFocus(void);
41  void timesListTakeFocus(void);
42  void timesListLosingFocus(void);
43 
44  void ShowGuide() const override; // ScheduleCommon
45  void select();
46 
47  void customEvent(QEvent *e) override; // ScheduleCommon
48  void updateInfo(void);
49 
50  protected:
51  using ShowName = QMap<QString,QString>;
52 
53  void Init(void) override; // MythScreenType
54 
55  virtual void initAlphabetList(void);
56  virtual bool formatSelectedData(QString &data);
57  virtual bool formatSelectedData(QString &data, int charNum);
58  virtual void restoreSelectedData(QString &data);
59  virtual void whereClauseGetSearchData(QString &where, MSqlBindings &bindings);
60  ProgramInfo *GetCurrentProgram(void) const override; // ScheduleCommon
61 
62  void ShowMenu(void) override; // MythScreenType
63  void getShowNames(void);
64  void updateShowList();
65  void updateTimesList();
66  void selectShowData(QString progTitle, int newCurShow);
67 
69 
70  QString m_searchStr;
71  QString m_currentLetter;
72 
73  TV *m_player {nullptr};
74  bool m_embedVideo {false};
75  bool m_allowEPG {true};
76  bool m_allowKeypress {true};
77 
80 
82 
86 
88  MythUIText *m_help1Text {nullptr};
89  MythUIText *m_help2Text {nullptr};
90 };
91 
92 class JaProgFinder : public ProgFinder
93 {
94  public:
95  explicit JaProgFinder(MythScreenStack *parentStack, bool gg = false,
96  TV *player = nullptr, bool embedVideo = false)
97  : ProgFinder(parentStack, gg, player, embedVideo) {}
98 
99  protected:
100  void initAlphabetList() override; // ProgFinder
101  bool formatSelectedData(QString &data) override; // ProgFinder
102  bool formatSelectedData(QString &data, int charNum) override; // ProgFinder
103  void restoreSelectedData(QString &data) override; // ProgFinder
104  void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override; // ProgFinder
105 
106  private:
107  static const std::vector<QChar> kSearchChars;
108 };
109 
110 class HeProgFinder : public ProgFinder
111 {
112  public:
113  explicit HeProgFinder(MythScreenStack *parentStack, bool gg = false,
114  TV *player = nullptr, bool embedVideo = false)
115  : ProgFinder(parentStack, gg, player, embedVideo) {}
116 
117  protected:
118  void initAlphabetList() override; // ProgFinder
119  bool formatSelectedData(QString &data) override; // ProgFinder
120  bool formatSelectedData(QString &data, int charNum) override; // ProgFinder
121  void restoreSelectedData(QString &data) override; // ProgFinder
122  void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override; // ProgFinder
123 
124  private:
125  static const std::vector<QChar> kSearchChars;
126 };
128 class RuProgFinder : public ProgFinder
129 {
130  public:
131  explicit RuProgFinder(MythScreenStack *parentStack, bool gg = false,
132  TV *player = nullptr, bool embedVideo = false)
133  : ProgFinder(parentStack, gg, player, embedVideo) {}
134 
135  protected:
136  void initAlphabetList() override; // ProgFinder
137  bool formatSelectedData(QString &data) override; // ProgFinder
138  bool formatSelectedData(QString &data, int charNum) override; // ProgFinder
139  void restoreSelectedData(QString &data) override; // ProgFinder
140  void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override; // ProgFinder
141 
142  private:
143  static const std::vector<QChar> kSearchChars;
144 };
146 
148 {
149  Q_OBJECT
150 
151  public:
152  SearchInputDialog(MythScreenStack *parent, const QString &defaultValue)
153  : MythTextInputDialog(parent, "", FilterNone, false, defaultValue) {}
154 
155  bool Create(void) override; // MythTextInputDialog
156 
157  signals:
158  void valueChanged(QString);
159 
160  private slots:
161  void editChanged(void);
162 };
163 
164 #endif
MSqlBindings
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
e
QDomElement e
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1423
ProgFinder::ShowGuide
void ShowGuide() const override
Definition: progfind.cpp:401
FilterNone
@ FilterNone
Definition: mythuitextedit.h:19
slots
std::array< unsigned int, 4 > slots
Definition: element.cpp:38
ProgFinder::m_help1Text
MythUIText * m_help1Text
Definition: progfind.h:88
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
HeProgFinder::restoreSelectedData
void restoreSelectedData(QString &data) override
Definition: progfind.cpp:890
ProgFinder::~ProgFinder
~ProgFinder() override
Definition: progfind.cpp:115
ProgFinder::alphabetListItemSelected
void alphabetListItemSelected(MythUIButtonListItem *item)
Definition: progfind.cpp:128
ProgFinder::m_schedList
ProgramList m_schedList
Definition: progfind.h:79
JaProgFinder::initAlphabetList
void initAlphabetList() override
Definition: progfind.cpp:716
ProgFinder::formatSelectedData
virtual bool formatSelectedData(QString &data)
Definition: progfind.cpp:605
RuProgFinder::kSearchChars
static const std::vector< QChar > kSearchChars
Definition: progfind.h:143
mythdialogbox.h
MythScreenStack
Definition: mythscreenstack.h:16
ProgFinder::m_searchStr
QString m_searchStr
Definition: progfind.h:70
schedulecommon.h
ProgFinder::updateShowList
void updateShowList()
Definition: progfind.cpp:490
ProgFinder::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: progfind.cpp:155
ProgFinder
Definition: progfind.h:24
ProgFinder::m_timesList
MythUIButtonList * m_timesList
Definition: progfind.h:85
ProgFinder::select
void select()
Definition: progfind.cpp:424
ProgFinder::m_player
TV * m_player
Definition: progfind.h:73
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
ProgFinder::m_alphabetList
MythUIButtonList * m_alphabetList
Definition: progfind.h:83
ProgFinder::ProgFinder
ProgFinder(MythScreenStack *parentStack, bool allowEPG=true, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.h:27
MythUIButtonListItem
Definition: mythuibuttonlist.h:28
JaProgFinder::JaProgFinder
JaProgFinder(MythScreenStack *parentStack, bool gg=false, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.h:95
ProgFinder::timesListTakeFocus
void timesListTakeFocus(void)
Definition: progfind.cpp:149
ProgFinder::initAlphabetList
virtual void initAlphabetList(void)
Definition: progfind.cpp:530
programinfo.h
JaProgFinder::kSearchChars
static const std::vector< QChar > kSearchChars
Definition: progfind.h:107
ProgFinder::showListTakeFocus
void showListTakeFocus(void)
Definition: progfind.cpp:144
ProgFinder::m_allowEPG
bool m_allowEPG
Definition: progfind.h:75
ProgFinder::Create
bool Create(void) override
Definition: progfind.cpp:55
ProgFinder::updateTimesList
void updateTimesList()
Definition: progfind.cpp:434
HeProgFinder::formatSelectedData
bool formatSelectedData(QString &data) override
Definition: progfind.cpp:877
HeProgFinder::whereClauseGetSearchData
void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override
Definition: progfind.cpp:837
ProgFinder::m_help2Text
MythUIText * m_help2Text
Definition: progfind.h:89
ProgFinder::m_showNames
ShowName m_showNames
Definition: progfind.h:68
SearchInputDialog::SearchInputDialog
SearchInputDialog(MythScreenStack *parent, const QString &defaultValue)
Definition: progfind.h:152
ProgFinder::updateInfo
void updateInfo(void)
Definition: progfind.cpp:336
ProgFinder::m_infoMap
InfoMap m_infoMap
Definition: progfind.h:81
ScheduleCommon
Definition: schedulecommon.h:16
ProgFinder::m_showList
MythUIButtonList * m_showList
Definition: progfind.h:84
SearchInputDialog::editChanged
void editChanged(void)
Definition: progfind.cpp:1069
JaProgFinder::whereClauseGetSearchData
void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override
Definition: progfind.cpp:728
ProgFinder::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: progfind.cpp:88
SearchInputDialog
Definition: progfind.h:148
ProgFinder::m_searchText
MythUIText * m_searchText
Definition: progfind.h:87
SearchInputDialog::valueChanged
void valueChanged(QString)
HeProgFinder::kSearchChars
static const std::vector< QChar > kSearchChars
Definition: progfind.h:125
ProgFinder::ShowName
QMap< QString, QString > ShowName
Definition: progfind.h:51
JaProgFinder::restoreSelectedData
void restoreSelectedData(QString &data) override
Definition: progfind.cpp:803
RuProgFinder::initAlphabetList
void initAlphabetList() override
Definition: progfind.cpp:930
ProgFinder::ShowMenu
void ShowMenu(void) override
Definition: progfind.cpp:212
AutoDeleteDeque< ProgramInfo * >
JaProgFinder::formatSelectedData
bool formatSelectedData(QString &data) override
Definition: progfind.cpp:790
ProgFinder::whereClauseGetSearchData
virtual void whereClauseGetSearchData(QString &where, MSqlBindings &bindings)
Definition: progfind.cpp:543
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:68
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
RuProgFinder::restoreSelectedData
void restoreSelectedData(QString &data) override
Definition: progfind.cpp:1021
ProgFinder::m_currentLetter
QString m_currentLetter
Definition: progfind.h:71
ProgFinder::timesListLosingFocus
void timesListLosingFocus(void)
Definition: progfind.cpp:139
playercontext.h
HeProgFinder
Definition: progfind.h:111
ProgFinder::selectShowData
void selectShowData(QString progTitle, int newCurShow)
Definition: progfind.cpp:508
RuProgFinder
Definition: progfind.h:129
ProgFinder::customEvent
void customEvent(QEvent *e) override
Definition: progfind.cpp:245
HeProgFinder::initAlphabetList
void initAlphabetList() override
Definition: progfind.cpp:827
RunProgramFinder
void RunProgramFinder(TV *player=nullptr, bool embedVideo=false, bool allowEPG=true)
Definition: progfind.cpp:35
HeProgFinder::HeProgFinder
HeProgFinder(MythScreenStack *parentStack, bool gg=false, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.h:113
ProgFinder::GetCurrentProgram
ProgramInfo * GetCurrentProgram(void) const override
Definition: progfind.cpp:1026
RuProgFinder::RuProgFinder
RuProgFinder(MythScreenStack *parentStack, bool gg=false, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.h:131
RuProgFinder::formatSelectedData
bool formatSelectedData(QString &data) override
Definition: progfind.cpp:1008
MythTextInputDialog
Dialog prompting the user to enter a text string.
Definition: mythdialogbox.h:264
SearchInputDialog::Create
bool Create(void) override
Definition: progfind.cpp:1034
ProgFinder::m_embedVideo
bool m_embedVideo
Definition: progfind.h:74
ProgFinder::m_showData
ProgramList m_showData
Definition: progfind.h:78
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:144
JaProgFinder
Definition: progfind.h:93
RuProgFinder::whereClauseGetSearchData
void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override
Definition: progfind.cpp:940
ProgFinder::m_allowKeypress
bool m_allowKeypress
Definition: progfind.h:76
ProgFinder::getShowNames
void getShowNames(void)
Definition: progfind.cpp:462
mythscreentype.h
ProgFinder::restoreSelectedData
virtual void restoreSelectedData(QString &data)
Definition: progfind.cpp:694
TV
Control TV playback.
Definition: tv_play.h:281