Go to the documentation of this file.
6 #include <QImageReader>
70 LOG(VB_GENERAL, LOG_ERR,
"Theme is missing critical theme elements.");
130 for (
int i = 0; i < actions.size() && !handled; i++)
132 QString
action = actions[i];
169 QString label = tr(
"Search Options");
172 "mythnetvisionmenupopup");
174 if (menuPopup->Create())
178 menuPopup->SetReturnEvent(
this,
"options");
186 menuPopup->AddButton(tr(
"Stream Video"),
204 menuPopup->AddButton(tr(
"Play"),
209 menuPopup->AddButton(tr(
"Save This Video"),
228 menuPopup->AddButton(tr(
"Skip 10 Pages Back"),
232 menuPopup->AddButton(tr(
"Skip 10 Pages Forward"),
235 menuPopup->AddButton(tr(
"Manage Search Scripts"),
249 item->SetText(g->GetTitle(),
"title");
250 item->SetData(g->GetCommandline());
251 QString thumb = QString(
"%1mythnetvision/icons/%2").arg(
GetShareDir())
253 item->SetImage(thumb);
262 for (
int i = 0; i < numScripts; i++)
283 QString
title = tr(
"Searching %1 for \"%2\"...")
284 .arg(grabber).arg(
query);
290 connect(
m_netSearch, &QNetworkAccessManager::finished,
295 QUrl req(init.toEncoded(), QUrl::TolerantMode);
296 LOG(VB_GENERAL, LOG_INFO,
297 QString(
"Using Search URL %1").
arg(req.toString()));
307 QString
title = tr(
"Changing to page %1 of search \"%2\"...")
326 QString
title = tr(
"Changing to page %1 of search \"%2\"...")
360 auto *item =
new Search();
361 QByteArray data =
m_reply->readAll();
366 uint searchresults = item->numResults();
367 uint returned = item->numReturned();
368 uint firstitem = item->numIndex();
377 SetText(QString::number(searchresults),
"count");
379 if (firstitem + returned == searchresults)
384 if (searchresults % returned != 0)
403 QString message = tr(
"Timed out waiting for query to "
404 "finish. API might be down.");
422 for (
const auto & result : qAsConst(list))
424 QString
title = result->GetTitle();
426 QVariant::fromValue(result));
428 result->toMap(metadataMap);
429 item->SetTextFromMap(metadataMap);
431 if (!result->GetThumbnail().isEmpty())
433 QString dlfile = result->GetThumbnail();
435 if (dlfile.contains(
"%SHAREDIR%"))
438 item->SetImage(dlfile);
445 result->GetThumbnail(),
446 QVariant::fromValue<uint>(pos));
461 auto *searchedit =
new SearchEditor(mainStack,
"mythnetsearchedit");
463 if (searchedit->Create())
493 if (item->GetDownloadable())
506 QString(), QString(),
508 QString(), QString(), QString(), QString(),
509 QDateTime(),
nullptr,
nullptr, -1, QString(), QStringList(),
510 QString(), QStringList(), 0, 0, QString(),
511 false, QStringList(), 0, 0,
false);
520 item->
toMap(metadataMap);
531 if (
filename.contains(
"%SHAREDIR%"))
void LoadInBackground(const QString &message="")
MythScreenStack * GetMainStack()
void SetMaxLength(int length)
Image widget, displays a single image or multiple images in sequence.
QString GetDownloadFilename(const QString &title, const QString &url)
bool Create(void) override
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
void FillGrabberButtonList(void)
void SlotItemChanged(void)
GrabberScript::scriptList findAllDBSearchGrabbers(ArticleType type)
void RunSearchEditor() const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static bool Exists(const QString &url, struct stat *fileinfo)
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void SearchTimeout(Search *item)
void SlotDeleteVideo(void)
MythConfirmationDialog * m_okPopup
const QString & GetTitle() const
QUrl GetMythXMLSearch(const QString &url, const QString &query, const QString &grabber, const QString &pagenum)
arg(title).arg(filename).arg(doDelete))
void SetTextAndThumbnail(MythUIButtonListItem *btn, ResultItem *item)
A text entry and edit widget.
void OpenBusyPopup(const QString &message="")
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void customEvent(QEvent *event) override
QString GetText(void) const
void ShowMenu(void) override
void Reset(void) override
Reset the image back to the default defined in the theme.
void Load() override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
MythUIImage * m_thumbImage
MythUIButtonList * m_siteList
MythUIType * GetFocusWidget(void) const
void LoadData(void) override
QHash< QString, QString > InfoMap
bool Create(void) override
MythScreenStack * m_popupStack
void SearchFinished(void)
MythUIProgressBar * m_progress
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
void customEvent(QEvent *levent) override
GrabberScript::scriptList m_grabberList
bool SetFocusWidget(MythUIType *widget=nullptr)
Basic menu dialog, message and a list of options.
QString GetMythXMLURL(void)
QString GetShareDir(void)
MetadataImageDownload * m_imageDownload
void BuildFocusList(void)
ResultItem * GetStreamItem() override
MythUIButtonList * m_searchResultList
virtual void SetTextFromMap(const InfoMap &infoMap)
QNetworkAccessManager * m_netSearch
void toMap(InfoMap &metadataMap)
void StreamWebVideo(void)
NetSearch(MythScreenStack *parent, const char *name=nullptr)
All purpose text widget, displays a text string.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void PopulateResultList(const ResultItem::resultList &list)
Dialog asking for user confirmation. Ok and optional Cancel button.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void SetThumbnail(MythUIButtonListItem *btn)
virtual void SetText(const QString &text)
virtual void SetVisible(bool visible)
MythUITextEdit * m_search
MythMainWindow * GetMythMainWindow(void)
QList< ResultItem * > resultList
MythUIStateType * m_downloadable
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void SetVisible(bool visible) override
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MSqlQuery query(MSqlQuery::InitCon())
const bool & GetDownloadable() const
void CloseBusyPopup(void)
This widget is used for grouping other widgets for display when a particular named state is called....
void DoDownloadAndPlay(void)
bool DisplayState(const QString &name)
const QString & GetMediaURL() const