MythTV
master
mythtv
libs
libmythui
mythuifilebrowser.h
Go to the documentation of this file.
1
2
#ifndef MYTHUIFILEBROWSER_H_
3
#define MYTHUIFILEBROWSER_H_
4
5
// C++ headers
6
#include <utility>
7
8
// QT headers
9
#include <QDir>
10
#include <QEvent>
11
#include <QFileInfo>
12
13
#include "
mythscreentype.h
"
14
#include "
mythuitextedit.h
"
15
16
class
MythUIButtonListItem
;
17
class
MythUIButtonList
;
18
class
MythUIButton
;
19
class
MythUITextEdit
;
20
class
MythUIImage
;
21
class
MythUIStateType
;
22
23
class
MUI_PUBLIC
MFileInfo
:
public
QFileInfo
24
{
25
public
:
26
explicit
MFileInfo
(
const
QString& fileName =
""
, QString sgDir =
""
,
bool
isDir =
false
,
27
qint64 size = 0);
28
~
MFileInfo
() =
default
;
29
30
MFileInfo
(
const
MFileInfo
&other);
31
MFileInfo
&operator=(
const
MFileInfo
&other);
32
33
void
init(
const
QString& fileName =
""
, QString sgDir =
""
,
bool
isDir =
false
,
34
qint64 size = 0);
35
36
QString fileName(
void
)
const
;
37
QString filePath(
void
)
const
;
38
bool
isRemote
(
void
)
const
{
return
m_isRemote; }
39
bool
isDir(
void
)
const
;
40
bool
isFile(
void
)
const
;
41
bool
isParentDir(
void
)
const
;
42
bool
isExecutable(
void
)
const
;
43
QString absoluteFilePath(
void
)
const
;
44
qint64 size(
void
)
const
;
45
46
void
setFile
(
const
QString &
file
) { init(
file
); }
47
void
setSize
(qint64 size) { m_size = size; }
48
void
setIsDir
(
bool
isDir) { m_isDir = isDir; m_isFile = !isDir; }
49
void
setIsFile
(
bool
isFile) { m_isFile = isFile; m_isDir = !isFile; }
50
void
setIsParentDir
(
bool
isParentDir) { m_isParentDir = isParentDir; }
51
void
setSGDir
(QString sgDir) { m_storageGroupDir = std::move(sgDir); }
52
53
QString
hostName
(
void
)
const
{
return
m_hostName; }
54
QString
storageGroup
(
void
)
const
{
return
m_storageGroup; }
55
QString
storageGroupDir
(
void
)
const
{
return
m_storageGroupDir; }
56
QString
subDir
(
void
)
const
{
return
m_subDir; }
57
58
private
:
59
60
bool
m_isRemote {
false
};
61
bool
m_isDir {
false
};
62
bool
m_isFile {
true
};
63
bool
m_isParentDir {
false
};
64
65
QString
m_hostName
;
66
QString
m_storageGroup
;
67
QString
m_storageGroupDir
;
68
QString
m_fileName
;
69
QString
m_subDir
;
70
71
qint64 m_size {0};
72
};
73
74
Q_DECLARE_METATYPE
(
MFileInfo
);
75
76
class
MUI_PUBLIC
MythUIFileBrowser
:
public
MythScreenType
77
{
78
Q_OBJECT
79
80
public
:
81
MythUIFileBrowser
(
MythScreenStack
*parent,
const
QString &startPath);
82
~
MythUIFileBrowser
()
override
=
default
;
83
84
bool
Create
(
void
)
override
;
// MythScreenType
85
86
void
SetReturnEvent(QObject *retobject,
const
QString &resultid);
87
88
void
SetTypeFilter
(QDir::Filters filter) { m_typeFilter = filter; }
89
void
SetNameFilter
(QStringList filter) { m_nameFilter = std::move(filter); }
90
91
private
slots:
92
void
OKPressed(
void
);
93
void
cancelPressed(
void
);
94
void
backPressed(
void
);
95
void
homePressed(
void
);
96
void
editLostFocus(
void
);
97
void
PathSelected(
MythUIButtonListItem
*item);
98
void
PathClicked(
MythUIButtonListItem
*item);
99
void
LoadPreview(
void
);
100
101
private
:
102
void
SetPath(
const
QString &startPath);
103
static
bool
GetRemoteFileList(
const
QString &url,
const
QString &sgDir,
104
QStringList &list);
105
void
updateFileList(
void
);
106
void
updateRemoteFileList(
void
);
107
void
updateLocalFileList(
void
);
108
void
updateSelectedList(
void
);
109
void
updateWidgets(
void
);
110
111
static
bool
IsImage(QString extension);
112
static
QString FormatSize(int64_t size);
113
114
bool
m_isRemote {
false
};
115
116
QTimer *m_previewTimer {
nullptr
};
117
118
QString
m_baseDirectory
;
119
QString
m_subDirectory
;
120
QString
m_storageGroupDir
;
121
QString
m_parentDir
;
122
QString
m_parentSGDir
;
123
124
QDir::Filters m_typeFilter {QDir::AllDirs | QDir::Drives |
125
QDir::Files | QDir::Readable |
126
QDir::Writable | QDir::Executable};
127
QStringList
m_nameFilter
;
128
129
MythUIButtonList
*m_fileList {
nullptr
};
130
MythUITextEdit
*m_locationEdit {
nullptr
};
131
MythUIButton
*m_okButton {
nullptr
};
132
MythUIButton
*m_cancelButton {
nullptr
};
133
MythUIButton
*m_backButton {
nullptr
};
134
MythUIButton
*m_homeButton {
nullptr
};
135
MythUIImage
*m_previewImage {
nullptr
};
136
MythUIText
*m_infoText {
nullptr
};
137
MythUIText
*m_filenameText {
nullptr
};
138
MythUIText
*m_fullpathText {
nullptr
};
139
140
QObject *m_retObject {
nullptr
};
141
QString
m_id
;
142
};
143
144
#endif
145
/* vim: set expandtab tabstop=4 shiftwidth=4: */
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition:
mythuiimage.h:97
MFileInfo::m_subDir
QString m_subDir
Definition:
mythuifilebrowser.h:69
MUI_PUBLIC
#define MUI_PUBLIC
Definition:
mythuiexp.h:9
MFileInfo::m_storageGroup
QString m_storageGroup
Definition:
mythuifilebrowser.h:66
MFileInfo::subDir
QString subDir(void) const
Definition:
mythuifilebrowser.h:56
MythScreenStack
Definition:
mythscreenstack.h:16
MythScreenType::Create
virtual bool Create(void)
Definition:
mythscreentype.cpp:263
MythUIFileBrowser::m_nameFilter
QStringList m_nameFilter
Definition:
mythuifilebrowser.h:127
MythUITextEdit
A text entry and edit widget.
Definition:
mythuitextedit.h:34
MFileInfo::setIsDir
void setIsDir(bool isDir)
Definition:
mythuifilebrowser.h:48
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(MFileInfo)
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition:
mythscreentype.h:45
build_compdb.file
file
Definition:
build_compdb.py:55
MFileInfo::setIsParentDir
void setIsParentDir(bool isParentDir)
Definition:
mythuifilebrowser.h:50
MFileInfo::m_fileName
QString m_fileName
Definition:
mythuifilebrowser.h:68
MFileInfo::isRemote
bool isRemote(void) const
Definition:
mythuifilebrowser.h:38
MythUIButtonListItem
Definition:
mythuibuttonlist.h:41
MFileInfo::m_hostName
QString m_hostName
Definition:
mythuifilebrowser.h:65
MythUIFileBrowser::SetNameFilter
void SetNameFilter(QStringList filter)
Definition:
mythuifilebrowser.h:89
MFileInfo::hostName
QString hostName(void) const
Definition:
mythuifilebrowser.h:53
MFileInfo::setSize
void setSize(qint64 size)
Definition:
mythuifilebrowser.h:47
MFileInfo::setSGDir
void setSGDir(QString sgDir)
Definition:
mythuifilebrowser.h:51
MFileInfo::m_storageGroupDir
QString m_storageGroupDir
Definition:
mythuifilebrowser.h:67
MythUIButton
A single button widget.
Definition:
mythuibutton.h:21
MFileInfo::setFile
void setFile(const QString &file)
Definition:
mythuifilebrowser.h:46
MythUIFileBrowser::m_parentSGDir
QString m_parentSGDir
Definition:
mythuifilebrowser.h:122
MythUIFileBrowser::m_id
QString m_id
Definition:
mythuifilebrowser.h:141
MythUIFileBrowser::SetTypeFilter
void SetTypeFilter(QDir::Filters filter)
Definition:
mythuifilebrowser.h:88
MythUIFileBrowser::m_parentDir
QString m_parentDir
Definition:
mythuifilebrowser.h:121
MythUIFileBrowser
Definition:
mythuifilebrowser.h:76
MythUIFileBrowser::m_subDirectory
QString m_subDirectory
Definition:
mythuifilebrowser.h:119
MFileInfo::storageGroupDir
QString storageGroupDir(void) const
Definition:
mythuifilebrowser.h:55
MythUIFileBrowser::m_baseDirectory
QString m_baseDirectory
Definition:
mythuifilebrowser.h:118
MythUIText
All purpose text widget, displays a text string.
Definition:
mythuitext.h:28
mythuitextedit.h
MFileInfo::storageGroup
QString storageGroup(void) const
Definition:
mythuifilebrowser.h:54
MythUIFileBrowser::m_storageGroupDir
QString m_storageGroupDir
Definition:
mythuifilebrowser.h:120
MFileInfo::setIsFile
void setIsFile(bool isFile)
Definition:
mythuifilebrowser.h:49
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition:
mythuibuttonlist.h:191
MFileInfo
Definition:
mythuifilebrowser.h:23
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition:
mythuistatetype.h:22
mythscreentype.h
Generated on Thu Feb 6 2025 03:17:20 for MythTV by
1.8.17