Go to the documentation of this file.
4 #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")
253 item->SetImage(thumb);
262 for (
int i = 0; i < numScripts; i++)
283 QString title = tr(
"Searching %1 for \"%2\"...")
284 .arg(grabber, 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\"...")
325 QString title = tr(
"Changing to page %1 of search \"%2\"...")
358 auto *item =
new Search();
359 QByteArray data =
m_reply->readAll();
364 uint searchresults = item->numResults();
365 uint returned = item->numReturned();
366 uint firstitem = item->numIndex();
375 SetText(QString::number(searchresults),
"count");
377 if (firstitem + returned == searchresults)
382 if (searchresults % returned != 0)
401 QString message = tr(
"Timed out waiting for query to "
402 "finish. API might be down.");
420 for (
const auto & result : qAsConst(list))
422 QString title = result->GetTitle();
424 QVariant::fromValue(result));
426 result->toMap(metadataMap);
427 item->SetTextFromMap(metadataMap);
429 if (!result->GetThumbnail().isEmpty())
431 QString dlfile = result->GetThumbnail();
433 if (dlfile.contains(
"%SHAREDIR%"))
436 item->SetImage(dlfile);
443 result->GetThumbnail(),
444 QVariant::fromValue<uint>(pos));
459 auto *searchedit =
new SearchEditor(mainStack,
"mythnetsearchedit");
461 if (searchedit->Create())
491 if (item->GetDownloadable())
501 QString title = btn->
GetText();
504 QString(), QString(),
506 QString(), QString(), QString(), QString(),
507 QDateTime(),
nullptr,
nullptr, -1, QString(), QStringList(),
508 QString(), QStringList(), 0, 0, QString(),
509 false, QStringList(), 0, 0,
false);
518 item->
toMap(metadataMap);
529 if (
filename.contains(
"%SHAREDIR%"))
554 QString title = data->
title;
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)
static const Type kEventType
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)
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)
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