Go to the documentation of this file.
29 m_archiveList(archiveList)
48 bool foundtheme =
LoadWindowFromXML(
"mytharchive-ui.xml",
"video_selector",
this);
66 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'video_selector'");
102 for (
int i = 0; i < actions.size() && !handled; i++)
104 QString
action = actions[i];
141 auto *menuPopup =
new MythDialogBox(tr(
"Menu"), popupStack,
"actionmenu");
143 if (menuPopup->Create())
146 menuPopup->SetReturnEvent(
this,
"action");
207 if (v->coverfile !=
"" && v->coverfile !=
"No Cover")
223 struct stat fileinfo {};
227 v->size = (uint64_t)fileinfo.st_size;
231 LOG(VB_GENERAL, LOG_ERR,
232 QString(
"VideoSelector: Cannot find file: %1")
245 QList<ArchiveItem *> tempAList;
252 if (a->type !=
"Video" || a->filename == v->filename)
263 for (
auto *x : qAsConst(tempAList))
267 QList<VideoInfo *> tempSList;
272 if (a->filename == v->filename)
280 for (
auto *x : qAsConst(tempSList))
290 a->description = v->plot;
294 a->newsize = v->size;
295 a->filename = v->filename;
296 a->hasCutlist =
false;
297 a->useCutlist =
false;
304 a->encoderProfile =
nullptr;
305 a->editedDetails =
false;
337 item->setCheckable(
true);
347 item->SetData(QVariant::fromValue(v));
373 using CategoryMap = QMap<int, QString>;
374 CategoryMap categoryMap;
376 query.
prepare(
"SELECT intid, category FROM videocategory");
382 int id = query.
value(0).toInt();
383 QString category = query.
value(1).toString();
384 categoryMap.insert(
id, category);
388 query.
prepare(
"SELECT intid, title, plot, length, filename, coverfile, "
389 "category, showlevel, subtitle, season, episode, host "
390 "FROM videometadata ORDER BY title,season,episode");
394 auto *videoList =
new std::vector<VideoInfo*>;
405 info->
id = query.
value(0).toInt();
406 if (query.
value(9).toInt() > 0)
408 episode = query.
value(10).toString();
409 if (episode.size() < 2)
410 episode.prepend(
"0");
411 info->title = QString(
"%1 %2x%3 - %4")
412 .arg(query.
value(1).toString(),
413 query.
value(9).toString(),
415 query.
value(8).toString());
418 info->title = query.
value(1).toString();
420 info->plot = query.
value(2).toString();
422 QString host = query.
value(11).toString();
439 if (!QFile::exists(info->filename))
441 LOG(VB_GENERAL, LOG_ERR,
442 QString(
"VideoSelector: Failed to find local file '%1'").arg(info->filename));
443 info->filename.clear();
447 if (info->filename.isEmpty())
454 LOG(VB_FILE, LOG_INFO,
455 QString(
"VideoSelector: found file '%1'").arg(info->filename));
457 info->coverfile = query.
value(5).toString();
458 info->category = categoryMap[query.
value(6).toInt()];
459 info->parentalLevel = query.
value(7).toInt();
460 if (info->category.isEmpty())
461 info->category =
"(None)";
462 videoList->push_back(info);
468 LOG(VB_GENERAL, LOG_ERR,
"VideoSelector: Failed to get any videos");
476 QStringList categories;
482 if (categories.indexOf(v->category) == -1)
483 categories.append(v->category);
500 for (
int x = 0; x < categories.count(); x++)
525 if (v->filename == a->filename)
549 ShowOkPopup(tr(
"You need to enter a valid password for this parental level"));
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
QString generate_file_url(const QString &storage_group, const QString &host, const QString &path)
void setCategory(MythUIButtonListItem *item)
MythUIButtonList * m_categorySelector
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
static bool Exists(const QString &url, struct stat *fileinfo)
MythUIText * m_warningText
QString FindFile(const QString &filename)
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void toggleSelected(MythUIButtonListItem *item)
QVariant value(int i) const
QList< VideoInfo * > m_selectedList
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
ParentalLevel::Level m_currentParentalLevel
static std::vector< VideoInfo * > * getVideoListFromDB(void)
void updateSelectedList(void)
ParentalLevelChangeChecker * m_parentalLevelChecker
void titleChanged(MythUIButtonListItem *item)
std::vector< VideoInfo * > * m_videoList
MythUIType * GetFocusWidget(void) const
void setParentalLevel(ParentalLevel::Level level)
QList< ArchiveItem * > * m_archiveList
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
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)
Basic menu dialog, message and a list of options.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
void BuildFocusList(void)
void parentalLevelChanged(bool passwordValid, ParentalLevel::Level newLevel)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void SigResultReady(bool passwordValid, ParentalLevel::Level newLevel)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
void ShowMenu(void) override
MBASE_PUBLIC QString formatKBytes(int64_t sizeKB, int prec=1)
MythUIImage * m_coverImage
MythUIButton * m_okButton
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void Check(ParentalLevel::Level fromLevel, ParentalLevel::Level toLevel)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
virtual void SetText(const QString &text)
MythUIButton * m_cancelButton
MythMainWindow * GetMythMainWindow(void)
MythUIText * m_filesizeText
MythScreenStack * GetStack(const QString &Stackname)
QString GetHostName(void)
VideoSelector(MythScreenStack *parent, QList< ArchiveItem * > *archiveList)
~VideoSelector(void) override
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void updateVideoList(void)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
MythUIButtonList * m_videoButtonList
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.