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