Go to the documentation of this file.
4 #include <QtAlgorithms>
54 "mythNetTree.updateFreq", 6);
56 "mythnetvision.rssBackgroundFetch",
false);
58 "mythnetvision.backgroundFetch",
false);
63 QString windowName =
"gallery";
68 windowName =
"gallery";
71 windowName =
"browser";
101 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen '" + windowName +
"'");
179 using MGTreeChildList = QList<MythGenericTree *>;
182 for (
auto * child : std::as_const(*lchildren))
184 if (child !=
nullptr)
190 item->SetData(QVariant::fromValue(child));
194 if (child == selectedNode)
224 int nodeInt = node->
getInt();
244 item->
SetText(site->GetTitle());
245 item->
SetText(site->GetDescription(),
"description");
246 item->
SetText(site->GetURL(),
"url");
254 video->toMap(metadataMap);
261 QString dlfile = video->GetThumbnail();
262 if (dlfile.contains(
"%SHAREDIR%"))
266 video->GetThumbnail());
272 QVariant::fromValue<uint>(pos));
277 if (!node->
GetData().toString().isEmpty())
279 QString tpath = node->
GetData().toString();
280 if (tpath.startsWith(
"http://"))
292 QVariant::fromValue<uint>(pos));
294 else if (tpath !=
"0")
297 if (
filename.contains(
"%SHAREDIR%"))
311 int nodeInt = node->
getInt();
340 bool handled =
false;
369 for (
int i = 0; i < actions.size() && !handled; i++)
371 const QString&
action = actions[i];
378 else if (
action ==
"ESCAPE")
401 QString label = tr(
"Playback/Download Options");
438 if (menuPopup->Create())
446 QString label = tr(
"View Options");
462 QString label = tr(
"Subscription Management");
472 menu->AddItem(tr(
"Enable Automatic Site Updates"),
477 menu->AddItem(tr(
"Disable Automatic Site Updates"),
511 if (nettree->Create())
516 screenStack->
PopScreen(
this,
false,
false);
534 rssGeneric->addNode(tr(
"Back"),
kUpFolder,
true,
false);
536 rssGeneric->SetData(QString(
"%1/mythnetvision/icons/rss.png")
539 for (
const auto & feed : std::as_const(
m_rssList))
545 ret->SetData(QVariant::fromValue(feed));
546 rssGeneric->addNode(ret);
550 ret->addNode(tr(
"Back"),
kUpFolder,
true,
false);
552 for (
const auto & item : std::as_const(items))
565 QMultiMap<QPair<QString,QString>,
ResultItem*> treePathsNodes =
568 QList< QPair<QString,QString> >
paths = treePathsNodes.uniqueKeys();
571 QString thumb = QString(
"%1mythnetvision/icons/%2")
573 ret->SetData(QVariant::fromValue(thumb));
577 ret->addNode(tr(
"Back"),
kUpFolder,
true,
false);
579 for (
const auto & path : std::as_const(
paths))
581 QStringList curPaths = path.first.split(
"/");
582 QString dirthumb = path.second;
583 QList<ResultItem*> videos = treePathsNodes.values(path);
593 const QString& dirthumb,
const QList<ResultItem*>& videos)
600 while (folder ==
nullptr && !
paths.empty())
602 QString curPath =
paths.takeFirst();
603 curPath.replace(
"|",
"/");
626 for (
const auto & video : std::as_const(videos))
635 title.replace(
"&",
"&");
637 sub_node->
SetData(QVariant::fromValue(video));
640 video->
toMap(textMap);
666 item->
toMap(metadataMap);
673 if (dlfile.contains(
"%SHAREDIR%"))
694 QVariant::fromValue<uint>(0));
716 QString(), QString(),
719 site->
GetAuthor(), QDateTime(),
nullptr,
nullptr, -1, QString(),
720 QStringList(), QString(), QStringList(), 0, 0, QString(),
721 false, QStringList(), 0, 0,
false);
724 res.
toMap(metadataMap);
759 thumb = node->
GetData().toString();
765 QString(), QString(),
767 QString(), thumb, QString(),
768 QString(), QDateTime(),
nullptr,
nullptr, -1, QString(),
769 QStringList(), QString(), QStringList(), 0, 0, QString(),
770 false, QStringList(), 0, 0,
false);
773 res.
toMap(metadataMap);
778 if (!thumb.startsWith(
"http://"))
780 if (thumb.contains(
"%SHAREDIR%"))
797 const QString& url = thumb;
807 if (
exists && !url.isEmpty())
857 auto *treeedit =
new TreeEditor(mainStack,
"mythnettreeedit");
859 if (treeedit->Create())
875 auto *rssedit =
new RSSEditor(mainStack,
"mythnetrssedit");
877 if (rssedit->Create())
915 QString title(tr(
"Updating RSS. This could take a while..."));
929 QString title(tr(
"Updating Site Maps. This could take a while..."));
960 QString title = data->
title;
984 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
QString doTitle(const QString &title) const
Create the sortable form of an title string.
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)
MythGenericTree * GetNodePtrFromButton(MythUIButtonListItem *item)
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)