Go to the documentation of this file.
4 #include <QApplication>
52 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'file_selector'");
103 for (
int i = 0; i < actions.size() && !handled; i++)
105 QString
action = actions[i];
131 if (fileData->directory)
133 if (fileData->filename ==
"..")
155 if (!fullPath.endsWith(
"/"))
157 fullPath += fileData->filename;
211 QList<ArchiveItem *> tempAList;
214 if (a->type !=
"File")
218 {return a->filename == f; } ))
222 for (
auto *x : qAsConst(tempAList))
226 QStringList tempSList;
229 auto namematch = [f](
const auto *a){
return a->filename == f; };
234 for (
const auto & name : qAsConst(tempSList))
244 int pos = f.lastIndexOf(
'/');
246 title = f.mid(pos + 1);
255 a->size = (int64_t)
file.size();
257 a->hasCutlist =
false;
258 a->useCutlist =
false;
265 a->encoderProfile =
nullptr;
266 a->editedDetails =
false;
278 if (!fileData->directory)
280 ShowOkPopup(tr(
"The selected item is not a directory!"));
284 if (fileData->filename !=
"..")
293 if (fileData->directory)
334 auto samename = [a](
const auto *f)
335 {
return f->filename == a->filename; };
363 QFileInfoList list =
d.entryInfoList(filters, QDir::Dirs, QDir::Name);
365 for (
const auto & fi : qAsConst(list))
367 if (fi.fileName() !=
".")
371 data->directory =
true;
372 data->filename = fi.fileName();
379 item->setCheckable(
false);
380 item->SetImage(
"ma_folder.png");
381 item->SetData(QVariant::fromValue(data));
389 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
390 filters =
m_filemask.split(
" ", QString::SkipEmptyParts);
392 filters =
m_filemask.split(
" ", Qt::SkipEmptyParts);
394 list =
d.entryInfoList(filters, QDir::Files, QDir::Name);
395 for (
const auto & fi : qAsConst(list))
399 data->directory =
false;
400 data->filename = fi.fileName();
401 data->size = fi.size();
411 item->setCheckable(
true);
414 if (!fullPath.endsWith(
"/"))
416 fullPath += data->filename;
428 item->setCheckable(
false);
430 item->SetData(QVariant::fromValue(data));
438 LOG(VB_GENERAL, LOG_ERR,
439 "MythArchive: current directory does not exist!");
void itemClicked(MythUIButtonListItem *item)
bool Create(void) override
void updateFileList(void)
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
QList< FileData * > m_fileData
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QString GetText(void) const
MythUIButton * m_backButton
QString getSelected(void)
MythUIType * GetFocusWidget(void) const
void SetText(const QString &text, bool moveCursor=true)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
bool SetFocusWidget(MythUIType *widget=nullptr)
QStringList m_selectedList
void BuildFocusList(void)
QList< ArchiveItem * > * m_archiveList
void locationEditLostFocus(void)
MythUITextEdit * m_locationEdit
void updateSelectedList(void)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
MythUIButton * m_okButton
MBASE_PUBLIC QString formatKBytes(int64_t sizeKB, int prec=1)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
virtual void SetText(const QString &text)
MythMainWindow * GetMythMainWindow(void)
MythUIButton * m_homeButton
static const iso6937table * d
MythUIButtonList * m_fileButtonList
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
MythUIButton * m_cancelButton