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 const QString&
action = actions[i];
133 if (fileData->directory)
135 if (fileData->filename ==
"..")
157 if (!fullPath.endsWith(
"/"))
159 fullPath += fileData->filename;
213 QList<ArchiveItem *> tempAList;
216 if (a->type !=
"File")
220 {return a->filename == f; } ))
224 for (
auto *x : std::as_const(tempAList))
228 QStringList tempSList;
231 auto namematch = [f](
const auto *a){
return a->filename == f; };
236 for (
const auto & name : std::as_const(tempSList))
246 int pos = f.lastIndexOf(
'/');
248 title = f.mid(pos + 1);
257 a->size = (int64_t)
file.size();
259 a->hasCutlist =
false;
260 a->useCutlist =
false;
267 a->encoderProfile =
nullptr;
268 a->editedDetails =
false;
280 if (!fileData->directory)
282 ShowOkPopup(tr(
"The selected item is not a directory!"));
286 if (fileData->filename !=
"..")
295 if (fileData->directory)
336 auto samename = [a](
const auto *f)
337 {
return f->filename == a->filename; };
365 QFileInfoList list =
d.entryInfoList(filters, QDir::Dirs, QDir::Name);
367 for (
const auto & fi : std::as_const(list))
369 if (fi.fileName() !=
".")
373 data->directory =
true;
374 data->filename = fi.fileName();
381 item->setCheckable(
false);
382 item->SetImage(
"ma_folder.png");
383 item->SetData(QVariant::fromValue(data));
391 filters =
m_filemask.split(
" ", Qt::SkipEmptyParts);
392 list =
d.entryInfoList(filters, QDir::Files, QDir::Name);
393 for (
const auto & fi : std::as_const(list))
397 data->directory =
false;
398 data->filename = fi.fileName();
399 data->size = fi.size();
409 item->setCheckable(
true);
412 if (!fullPath.endsWith(
"/"))
414 fullPath += data->filename;
427 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