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  virtual ~ProgFinder();
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  typedef QMap<QString,QString> ShowName;
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, int);
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 
98  protected:
99  void initAlphabetList() override; // ProgFinder
100  bool formatSelectedData(QString &data) override; // ProgFinder
101  bool formatSelectedData(QString &data, int charNum) override; // ProgFinder
102  void restoreSelectedData(QString &data) override; // ProgFinder
103  void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override; // ProgFinder
104 
105  private:
106  static const QChar s_searchChars[];
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 
116  protected:
117  void initAlphabetList() override; // ProgFinder
118  bool formatSelectedData(QString &data) override; // ProgFinder
119  bool formatSelectedData(QString &data, int charNum) override; // ProgFinder
120  void restoreSelectedData(QString &data) override; // ProgFinder
121  void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override; // ProgFinder
122 
123  private:
124  static const QChar s_searchChars[];
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 
134  protected:
135  void initAlphabetList() override; // ProgFinder
136  bool formatSelectedData(QString &data) override; // ProgFinder
137  bool formatSelectedData(QString &data, int charNum) override; // ProgFinder
138  void restoreSelectedData(QString &data) override; // ProgFinder
139  void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override; // ProgFinder
140 
141  private:
142  static const QChar s_searchChars[];
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
ProgramInfo * GetCurrentProgram(void) const override
Definition: progfind.cpp:1047
void restoreSelectedData(QString &data) override
Definition: progfind.cpp:904
void initAlphabetList() override
Definition: progfind.cpp:841
bool Create(void) override
Definition: progfind.cpp:1055
unsigned int slots[4]
Definition: element.c:38
void alphabetListItemSelected(MythUIButtonListItem *item)
Definition: progfind.cpp:128
void updateShowList()
Definition: progfind.cpp:485
QString m_searchStr
Definition: progfind.h:70
void restoreSelectedData(QString &data) override
Definition: progfind.cpp:1042
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
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
static const QChar s_searchChars[]
Definition: progfind.h:106
void showListTakeFocus(void)
Definition: progfind.cpp:144
void ShowMenu(void) override
Definition: progfind.cpp:212
bool formatSelectedData(QString &data) override
Definition: progfind.cpp:1029
void getShowNames(void)
Definition: progfind.cpp:457
void ShowGuide() const override
Definition: progfind.cpp:398
virtual void restoreSelectedData(QString &data)
Definition: progfind.cpp:688
ProgFinder(MythScreenStack *parentStack, bool allowEPG=true, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.h:27
void initAlphabetList() override
Definition: progfind.cpp:953
MythUIText * m_help2Text
Definition: progfind.h:89
void RunProgramFinder(TV *player=nullptr, bool embedVideo=false, bool allowEPG=true)
Definition: progfind.cpp:35
TV * m_player
Definition: progfind.h:73
JaProgFinder(MythScreenStack *parentStack, bool gg=false, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.cpp:711
virtual bool formatSelectedData(QString &data)
Definition: progfind.cpp:597
void selectShowData(QString, int)
Definition: progfind.cpp:503
void updateTimesList()
Definition: progfind.cpp:428
virtual void initAlphabetList(void)
Definition: progfind.cpp:524
int m_numberOfSearchChars
Definition: progfind.h:107
bool m_embedVideo
Definition: progfind.h:74
MythUIText * m_help1Text
Definition: progfind.h:88
bool formatSelectedData(QString &data) override
Definition: progfind.cpp:891
virtual ~ProgFinder()
Definition: progfind.cpp:115
Holds information on recordings and videos.
Definition: programinfo.h:66
MythUIButtonList * m_timesList
Definition: progfind.h:85
static const QChar s_searchChars[]
Definition: progfind.h:124
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
SearchInputDialog(MythScreenStack *parent, const QString &defaultValue)
Definition: progfind.h:152
bool m_allowEPG
Definition: progfind.h:75
QString m_currentLetter
Definition: progfind.h:71
MythUIButtonList * m_showList
Definition: progfind.h:84
void valueChanged(QString)
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
InfoMap m_infoMap
Definition: progfind.h:81
RuProgFinder(MythScreenStack *parentStack, bool gg=false, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.cpp:944
void editChanged(void)
Definition: progfind.cpp:1090
int m_numberOfSearchChars
Definition: progfind.h:125
MythUIButtonList * m_alphabetList
Definition: progfind.h:83
ProgramList m_schedList
Definition: progfind.h:79
Control TV playback.
Definition: tv_play.h:284
void restoreSelectedData(QString &data) override
Definition: progfind.cpp:807
bool Create(void) override
Definition: progfind.cpp:55
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
bool formatSelectedData(QString &data) override
Definition: progfind.cpp:794
virtual void whereClauseGetSearchData(QString &where, MSqlBindings &bindings)
Definition: progfind.cpp:537
void timesListTakeFocus(void)
Definition: progfind.cpp:149
MythUIText * m_searchText
Definition: progfind.h:87
Dialog prompting the user to enter a text string.
void customEvent(QEvent *e) override
Definition: progfind.cpp:245
void select()
Definition: progfind.cpp:418
void updateInfo(void)
Definition: progfind.cpp:334
void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override
Definition: progfind.cpp:851
QMap< QString, QString > ShowName
Definition: progfind.h:51
void initAlphabetList() override
Definition: progfind.cpp:720
ShowName m_showNames
Definition: progfind.h:68
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
Definition: mythdbcon.h:98
HeProgFinder(MythScreenStack *parentStack, bool gg=false, TV *player=nullptr, bool embedVideo=false)
Definition: progfind.cpp:832
int m_numberOfSearchChars
Definition: progfind.h:143
void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override
Definition: progfind.cpp:963
ProgramList m_showData
Definition: progfind.h:78
bool m_allowKeypress
Definition: progfind.h:76
static const QChar s_searchChars[]
Definition: progfind.h:142
void timesListLosingFocus(void)
Definition: progfind.cpp:139
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: progfind.cpp:155
void whereClauseGetSearchData(QString &where, MSqlBindings &bindings) override
Definition: progfind.cpp:732