Go to the documentation of this file.
4 #include <QtAlgorithms>
53 "mythNetTree.updateFreq", 6);
55 "mythnetvision.rssBackgroundFetch",
false);
57 "mythnetvision.backgroundFetch",
false);
62 QString windowName =
"gallery";
67 windowName =
"gallery";
70 windowName =
"browser";
100 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen '" + windowName +
"'");
178 using MGTreeChildList = QList<MythGenericTree *>;
181 for (
auto * child : qAsConst(*lchildren))
183 if (child !=
nullptr)
189 item->
SetData(QVariant::fromValue(child));
193 if (child == selectedNode)
223 int nodeInt = node->
getInt();
243 item->
SetText(site->GetTitle());
244 item->
SetText(site->GetDescription(),
"description");
245 item->
SetText(site->GetURL(),
"url");
253 video->toMap(metadataMap);
260 QString dlfile = video->GetThumbnail();
261 if (dlfile.contains(
"%SHAREDIR%"))
265 video->GetThumbnail());
267 if (QFile::exists(dlfile))
271 QVariant::fromValue<uint>(pos));
276 if (!node->
GetData().toString().isEmpty())
278 QString tpath = node->
GetData().toString();
279 if (tpath.startsWith(
"http://"))
287 if (QFile::exists(dlfile))
291 QVariant::fromValue<uint>(pos));
293 else if (tpath !=
"0")
296 if (
filename.contains(
"%SHAREDIR%"))
310 int nodeInt = node->
getInt();
339 bool handled =
false;
368 for (
int i = 0; i < actions.size() && !handled; i++)
370 QString
action = actions[i];
377 else if (
action ==
"ESCAPE")
398 QString label = tr(
"Playback/Download Options");
435 if (menuPopup->Create())
443 QString label = tr(
"View Options");
459 QString label = tr(
"Subscription Management");
469 menu->AddItem(tr(
"Enable Automatic Site Updates"),
474 menu->AddItem(tr(
"Disable Automatic Site Updates"),
508 if (nettree->Create())
513 screenStack->
PopScreen(
this,
false,
false);
529 rssGeneric->addNode(tr(
"Back"),
kUpFolder,
true,
false);
531 rssGeneric->SetData(QString(
"%1/mythnetvision/icons/rss.png")
534 for (
const auto & feed : qAsConst(
m_rssList))
540 ret->SetData(QVariant::fromValue(feed));
541 rssGeneric->addNode(ret);
545 ret->addNode(tr(
"Back"),
kUpFolder,
true,
false);
547 for (
const auto & item : qAsConst(items))
560 QMultiMap<QPair<QString,QString>,
ResultItem*> treePathsNodes =
563 QList< QPair<QString,QString> >
paths = treePathsNodes.uniqueKeys();
566 QString thumb = QString(
"%1mythnetvision/icons/%2")
568 ret->SetData(QVariant::fromValue(thumb));
572 ret->addNode(tr(
"Back"),
kUpFolder,
true,
false);
574 for (
const auto & path : qAsConst(
paths))
576 QStringList curPaths = path.first.split(
"/");
577 QString dirthumb = path.second;
578 QList<ResultItem*> videos = treePathsNodes.values(path);
588 const QString& dirthumb,
const QList<ResultItem*>& videos)
595 while (folder ==
nullptr && !
paths.empty())
597 QString curPath =
paths.takeFirst();
598 curPath.replace(
"|",
"/");
621 for (
const auto & video : qAsConst(videos))
630 title.replace(
"&",
"&");
632 sub_node->
SetData(QVariant::fromValue(video));
635 video->
toMap(textMap);
661 item->
toMap(metadataMap);
668 if (dlfile.contains(
"%SHAREDIR%"))
679 bool exists = QFile::exists(sFilename);
689 QVariant::fromValue<uint>(0));
709 QString(), QString(),
712 site->
GetAuthor(), QDateTime(),
nullptr,
nullptr, -1, QString(),
713 QStringList(), QString(), QStringList(), 0, 0, QString(),
714 false, QStringList(), 0, 0,
false);
717 res.
toMap(metadataMap);
750 thumb = node->
GetData().toString();
756 QString(), QString(),
758 QString(), thumb, QString(),
759 QString(), QDateTime(),
nullptr,
nullptr, -1, QString(),
760 QStringList(), QString(), QStringList(), 0, 0, QString(),
761 false, QStringList(), 0, 0,
false);
764 res.
toMap(metadataMap);
769 if (!thumb.startsWith(
"http://"))
771 if (thumb.contains(
"%SHAREDIR%"))
774 bool exists = QFile::exists(thumb);
786 const QString& url = thumb;
795 bool exists = QFile::exists(sFilename);
796 if (exists && !url.isEmpty())
844 auto *treeedit =
new TreeEditor(mainStack,
"mythnettreeedit");
846 if (treeedit->Create())
860 auto *rssedit =
new RSSEditor(mainStack,
"mythnetrssedit");
862 if (rssedit->Create())
898 QString title(tr(
"Updating RSS. This could take a while..."));
912 QString title(tr(
"Updating Site Maps. This could take a while..."));
943 QString title = data->
title;
967 if (item && item->
GetText() == title)
void LoadInBackground(const QString &message="")
MythScreenStack * GetMainStack()
MythGenericTree * m_currentNode
MythMenu * CreateShowViewMenu(void)
QString GetDownloadFilename(const QString &title, const QString &url)
void SetData(QVariant data)
void HandleDirSelect(MythGenericTree *node)
void UpdateResultItem(ResultItem *item)
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
QString GetText(const QString &name="") const
void RunTreeEditor(void) const
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
void UpdateSiteItem(RSSSite *site)
static const Type kEventType
void SwitchTreeView(void)
MythGenericTree * m_siteGeneric
uint visibleChildCount() const
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
const QString & GetTitle() const
QVariant GetData(void) const
GrabberDownloadThread * m_gdt
MythGenericTree * getChildByName(const QString &a_name) const
MythMenu * CreateShowManageMenu(void)
void OpenBusyPopup(const QString &message="")
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void customEvent(QEvent *event) override
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
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...
GrabberScript::scriptList findAllDBTreeGrabbers()
MythUIImage * m_thumbImage
QMultiMap< QPair< QString, QString >, ResultItem * > getTreeArticles(const QString &feedtitle, ArticleType type)
void SwitchGalleryView(void)
MythUIType * GetFocusWidget(void) const
QHash< QString, QString > InfoMap
MythGenericTree * addNode(const QString &a_string, int an_int=0, bool selectable_flag=false, bool visible=true)
NetTree(DialogType type, MythScreenStack *parent, const char *name=nullptr)
MythScreenStack * m_popupStack
MythGenericTree * getSelectedChild(bool onlyVisible=false) const
void RunRSSEditor(void) const
const QString & GetThumbnail() const
void SwitchBrowseView(void)
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 LoadData(void) override
GrabberScript::scriptList m_grabberList
void UpdateItem(MythUIButtonListItem *item)
bool SetFocusWidget(MythUIType *widget=nullptr)
void AddFileNode(MythGenericTree *where_to_add, ResultItem *video)
Basic menu dialog, message and a list of options.
static MythThemedMenu * menu
MythUIButtonList * m_siteButtonList
QString GetShareDir(void)
MetadataImageDownload * m_imageDownload
void BuildFocusList(void)
QList< ResultItem * > m_videos
int childCount(void) const
virtual void SetTextFromMap(const InfoMap &infoMap)
void toMap(InfoMap &metadataMap)
void customEvent(QEvent *levent) override
void StreamWebVideo(void)
void HandleSelect(MythUIButtonListItem *item)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
RSSSite::rssList m_rssList
int GetNumSetting(const QString &key, int defaultval=0)
MythScreenStack * GetScreenStack() const
QList< MythGenericTree * > * getAllChildren() const
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
bool GetBoolSetting(const QString &key, bool defaultval=false)
void BuildGenericTree(MythGenericTree *dst, QDomElement &domElem)
void SetCurrentNode(MythGenericTree *node)
RSSSite::rssList findAllDBRSS()
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static void SetSubfolderData(MythGenericTree *folder)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
MythGenericTree * getParent(void) const
QString GetThumbnailFilename(const QString &url, const QString &title)
ResultItem * GetStreamItem() override
MythUIButtonTree * m_siteMap
static const QString kRSSNode
virtual void SetVisible(bool visible)
void DisplayState(const QString &state, const QString &name="")
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
MythMainWindow * GetMythMainWindow(void)
bool isRunning(void) const
QList< ResultItem * > resultList
MythUIStateType * m_downloadable
static const QString kSearchNode
void UpdateCurrentItem(void)
void ShowMenu(void) override
void SetText(const QString &text, const QString &name="", const QString &state="")
ResultItem::resultList getRSSArticles(const QString &feedtitle, ArticleType type)
bool Create(void) override
void SaveSetting(const QString &key, int newValue)
static const QString kDownloadNode
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)
const bool & GetDownloadable() const
void CloseBusyPopup(void)
GrabberScript::scriptList findAllDBTreeGrabbersByHost(ArticleType type)
void DoDownloadAndPlay(void)
void SaveBoolSetting(const QString &key, bool newValue)
bool DisplayState(const QString &name)