MythTV  master
fileselector.h
Go to the documentation of this file.
1 #ifndef FILESELECTOR_H_
2 #define FILESELECTOR_H_
3 
4 #include <iostream>
5 
6 // qt
7 #include <QString>
8 #include <QStringList>
9 #include <QKeyEvent>
10 
11 // myth
12 #include <mythscreentype.h>
13 
14 // mytharchive
15 #include "archiveutil.h"
16 
17 typedef struct
18 {
19  bool directory;
20  bool selected;
21  QString filename;
22  int64_t size;
23 } FileData;
24 
25 typedef enum
26 {
30 } FSTYPE;
31 
32 class MythUIText;
33 class MythUITextEdit;
34 class MythUIButton;
35 class MythUIButtonList;
37 
39 {
40  Q_OBJECT
41 
42  public:
43  FileSelector(MythScreenStack *parent, QList<ArchiveItem *> *archiveList,
44  FSTYPE type, const QString &startDir, const QString &filemask)
45  : MythScreenType(parent, "FileSelector"),
47  m_filemask(filemask),
48  m_curDirectory(startDir),
49  m_archiveList(archiveList) {}
50  ~FileSelector();
51 
52  bool Create(void) override; // MythScreenType
53  bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
54 
55  QString getSelected(void);
56 
57  signals:
58  void haveResult(bool ok); // used in FSTYPE_FILELIST mode
59  void haveResult(QString filename); // used in FSTYPE_FILE or FSTYPE_DIRECTORY mode
60 
61  protected slots:
62  void OKPressed(void);
63  void cancelPressed(void);
64  void backPressed(void);
65  void homePressed(void);
67  void locationEditLostFocus(void);
68 
69  protected:
70  void updateFileList(void);
71  void updateSelectedList(void);
72  void updateWidgets(void);
73  void wireUpTheme(void);
74  void updateScrollArrows(void);
75 
77  QString m_filemask;
78  QString m_curDirectory;
79  QList<FileData *> m_fileData;
80  QStringList m_selectedList;
81  QList<ArchiveItem *> *m_archiveList;
82  //
83  // GUI stuff
84  //
85  MythUIText *m_titleText {nullptr};
92 };
93 
95 
96 #endif
QList< FileData * > m_fileData
Definition: fileselector.h:79
FileSelector(MythScreenStack *parent, QList< ArchiveItem * > *archiveList, FSTYPE type, const QString &startDir, const QString &filemask)
Definition: fileselector.h:43
unsigned int slots[4]
Definition: element.c:38
MythUIText * m_titleText
Definition: fileselector.h:85
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
void cancelPressed(void)
void updateWidgets(void)
MythUIButton * m_okButton
Definition: fileselector.h:88
FSTYPE
Definition: fileselector.h:25
bool selected
Definition: fileselector.h:20
void backPressed(void)
void updateFileList(void)
Q_DECLARE_METATYPE(GrabberScript *)
QString m_curDirectory
Definition: fileselector.h:78
bool Create(void) override
MythUIButton * m_homeButton
Definition: fileselector.h:91
void updateSelectedList(void)
MythUIButton * m_cancelButton
Definition: fileselector.h:89
MythUIButtonList * m_fileButtonList
Definition: fileselector.h:86
A text entry and edit widget.
FSTYPE m_selectorType
Definition: fileselector.h:76
int64_t size
Definition: fileselector.h:22
void updateScrollArrows(void)
void homePressed(void)
bool directory
Definition: fileselector.h:19
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
A single button widget.
Definition: mythuibutton.h:21
QString filename
Definition: fileselector.h:21
QStringList m_selectedList
Definition: fileselector.h:80
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
QList< ArchiveItem * > * m_archiveList
Definition: fileselector.h:81
MythUIButton * m_backButton
Definition: fileselector.h:90
void wireUpTheme(void)
void OKPressed(void)
QString getSelected(void)
Screen in which all other widgets are contained and rendered.
void itemClicked(MythUIButtonListItem *item)
void haveResult(bool ok)
void locationEditLostFocus(void)
QString m_filemask
Definition: fileselector.h:77
MythUITextEdit * m_locationEdit
Definition: fileselector.h:87