MythTV master
nettree.cpp
Go to the documentation of this file.
1// qt
2#include <QFileInfo>
3#include <QString>
4#include <QtAlgorithms>
5
6// MythTV
23
24// mythnetvision
25#include "netcommon.h"
26#include "nettree.h"
27#include "rsseditor.h"
28#include "treeeditor.h"
29
30class GrabberScript;
31
32const QString NetTree::kRSSNode = tr("RSS Feeds");
33const QString NetTree::kSearchNode = tr("Searches");
34const QString NetTree::kDownloadNode = tr("Downloaded Files");
35
36namespace
37{
39 {
40 if (item)
41 return item->GetData().value<MythGenericTree *>();
42
43 return nullptr;
44 }
45}
46
48 : NetBase(parent, name),
49 m_gdt(new GrabberDownloadThread(this)), m_type(type)
50{
53 "mythNetTree.updateFreq", 6);
55 "mythnetvision.rssBackgroundFetch", false);
57 "mythnetvision.backgroundFetch", false);
58}
59
61{
62 QString windowName = "gallery";
63
64 switch (m_type)
65 {
66 case DLG_GALLERY:
67 windowName = "gallery";
68 break;
69 case DLG_BROWSER:
70 windowName = "browser";
71 break;
72 case DLG_TREE:
73 windowName = "tree";
74 break;
75 case DLG_DEFAULT:
76 default:
77 break;
78 }
79
80 if (!LoadWindowFromXML("netvision-ui.xml", windowName, this))
81 return false;
82
83 bool err = false;
84 if (m_type == DLG_TREE)
85 UIUtilE::Assign(this, m_siteMap, "videos", &err);
86 else
87 UIUtilE::Assign(this, m_siteButtonList, "videos", &err);
88
89 UIUtilW::Assign(this, m_noSites, "nosites");
90
91 UIUtilW::Assign(this, m_thumbImage, "preview");
92
93 UIUtilW::Assign(this, m_downloadable, "downloadable");
94
95 m_siteGeneric = new MythGenericTree("site root", 0, false);
97
98 if (err)
99 {
100 LOG(VB_GENERAL, LOG_ERR, "Cannot load screen '" + windowName + "'");
101 return false;
102 }
103
105
107
108 if (m_type == DLG_TREE)
109 {
111
118 }
119 else
120 {
122
124 this, &NetTree::HandleSelect);
127 }
128
129 return true;
130}
131
133{
136
137 FillTree();
138}
139
141{
142 if (!node)
143 return;
144
145 m_currentNode = node;
146}
147
149{
150 delete m_siteGeneric;
151 m_siteGeneric = nullptr;
152
153 delete m_gdt;
154 m_gdt = nullptr;
155
156 m_rssList.clear();
157
158 qDeleteAll(m_videos);
159 m_videos.clear();
160}
161
163{
164 if (m_type == DLG_TREE)
166 else
167 {
169
170 if (!m_currentNode)
171 {
173 return;
174 }
175
177
178 using MGTreeChildList = QList<MythGenericTree *>;
179 MGTreeChildList *lchildren = m_currentNode->getAllChildren();
180
181 for (auto * child : std::as_const(*lchildren))
182 {
183 if (child != nullptr)
184 {
185 auto *item =
186 new MythUIButtonListItem(m_siteButtonList, QString(), nullptr,
188
189 item->SetData(QVariant::fromValue(child));
190
191 UpdateItem(item);
192
193 if (child == selectedNode)
195 }
196 }
197
199 }
200
201 if (m_siteGeneric->childCount() == 0 && m_noSites)
202 m_noSites->SetVisible(true);
203 else if (m_noSites)
204 m_noSites->SetVisible(false);
205
206 if (m_siteGeneric->childCount() == 0)
208}
209
211{
212 if (!item)
213 return;
214
216
217 if (!node)
218 return;
219
220 auto *site = node->GetData().value<RSSSite *>();
221 auto *video = node->GetData().value<ResultItem *>();
222
223 int nodeInt = node->getInt();
224
225 if (nodeInt == kSubFolder)
226 {
227 item->SetText(QString("%1").arg(node->visibleChildCount()),
228 "childcount");
229 item->DisplayState("subfolder", "nodetype");
230 item->SetText(node->GetText(), "title");
231 item->SetText(node->GetText());
232 item->SetImage(node->GetData().toString());
233 }
234 else if (nodeInt == kUpFolder)
235 {
236 item->DisplayState("upfolder", "nodetype");
237 item->SetText(node->GetText(), "title");
238 item->SetText(node->GetText());
239 }
240
241 if (site)
242 {
243 item->SetText(site->GetTitle());
244 item->SetText(site->GetDescription(), "description");
245 item->SetText(site->GetURL(), "url");
246 item->SetImage(site->GetImage());
247 }
248 else if (video)
249 {
250 item->SetText(video->GetTitle());
251
252 InfoMap metadataMap;
253 video->toMap(metadataMap);
254 item->SetTextFromMap(metadataMap);
255
256 int pos = 0;
257 if (m_type != DLG_TREE)
258 pos = m_siteButtonList->GetItemPos(item);
259
260 QString dlfile = video->GetThumbnail();
261 if (dlfile.contains("%SHAREDIR%"))
262 dlfile.replace("%SHAREDIR%", GetShareDir());
263 else
264 dlfile = getDownloadFilename(video->GetTitle(),
265 video->GetThumbnail());
266
267 if (QFile::exists(dlfile))
268 item->SetImage(dlfile);
269 else if (m_imageDownload && video->GetThumbnail().startsWith("http"))
270 m_imageDownload->addThumb(video->GetTitle(), video->GetThumbnail(),
271 QVariant::fromValue<uint>(pos));
272 }
273 else
274 {
275 item->SetText(node->GetText());
276 if (!node->GetData().toString().isEmpty())
277 {
278 QString tpath = node->GetData().toString();
279 if (tpath.startsWith("http://"))
280 {
281 uint pos = 0;
282 if (m_type != DLG_TREE)
283 pos = m_siteButtonList->GetItemPos(item);
284
285 QString dlfile = GetThumbnailFilename(tpath,
286 node->GetText());
287 if (QFile::exists(dlfile))
288 item->SetImage(dlfile);
289 else if (m_imageDownload)
290 m_imageDownload->addThumb(node->GetText(), tpath,
291 QVariant::fromValue<uint>(pos));
292 }
293 else if (tpath != "0")
294 {
295 QString filename = node->GetData().toString();
296 if (filename.contains("%SHAREDIR%"))
297 filename.replace("%SHAREDIR%", GetShareDir());
298 item->SetImage(filename);
299 }
300 }
301 }
302}
303
305{
307 if (!node)
308 return;
309
310 int nodeInt = node->getInt();
311
312 switch (nodeInt)
313 {
314 case kSubFolder:
315 HandleDirSelect(node);
316 break;
317 case kUpFolder:
318 GoBack();
319 break;
320 default:
321 {
323 }
324 }
326}
327
329{
332
333 SetCurrentNode(node);
334 LoadData();
335}
336
338{
339 bool handled = false;
340
343
345 {
347 if (lparent)
348 {
349 SetCurrentNode(lparent);
350 handled = true;
351 }
352 }
353
354 LoadData();
355
356 return handled;
357}
358
359bool NetTree::keyPressEvent(QKeyEvent *event)
360{
361 if (GetFocusWidget()->keyPressEvent(event))
362 return true;
363
364 QStringList actions;
365 bool handled = GetMythMainWindow()->TranslateKeyPress("Internet Video",
366 event, actions);
367
368 for (int i = 0; i < actions.size() && !handled; i++)
369 {
370 const QString& action = actions[i];
371 handled = true;
372
373 if (action == "MENU")
374 {
375 ShowMenu();
376 }
377 else if (action == "ESCAPE")
378 {
379 if (m_type != DLG_TREE
380 && !GetMythMainWindow()->IsExitingToMain()
382 handled = GoBack();
383 else
384 handled = false;
385 }
386 else
387 {
388 handled = false;
389 }
390 }
391
392 if (!handled && MythScreenType::keyPressEvent(event))
393 handled = true;
394
395 return handled;
396}
397
399{
400 QString label = tr("Playback/Download Options");
401
402 auto *menu = new MythMenu(label, this, "options");
403
404 ResultItem *item = nullptr;
405 if (m_type == DLG_TREE)
406 {
408
409 if (node)
410 item = node->GetData().value<ResultItem *>();
411 }
412 else
413 {
414 MythGenericTree *node =
416
417 if (node)
418 item = node->GetData().value<ResultItem *>();
419 }
420
421 if (item)
422 {
423 if (item->GetDownloadable())
424 menu->AddItem(tr("Stream Video"), &NetTree::StreamWebVideo);
425 menu->AddItem(tr("Open Web Link"), &NetTree::ShowWebVideo);
426
427 if (item->GetDownloadable())
428 menu->AddItem(tr("Save This Video"), &NetTree::DoDownloadAndPlay);
429 }
430
431 menu->AddItem(tr("Scan/Manage Subscriptions"), nullptr, CreateShowManageMenu());
432 menu->AddItem(tr("Change View"), nullptr, CreateShowViewMenu());
433
434 auto *menuPopup =
435 new MythDialogBox(menu, m_popupStack, "mythnettreemenupopup");
436
437 if (menuPopup->Create())
438 m_popupStack->AddScreen(menuPopup);
439 else
440 delete menuPopup;
441}
442
444{
445 QString label = tr("View Options");
446
447 auto *menu = new MythMenu(label, this, "options");
448
449 if (m_type != DLG_TREE)
450 menu->AddItem(tr("Switch to List View"), &NetTree::SwitchTreeView);
451 if (m_type != DLG_GALLERY)
452 menu->AddItem(tr("Switch to Gallery View"), &NetTree::SwitchGalleryView);
453 if (m_type != DLG_BROWSER)
454 menu->AddItem(tr("Switch to Browse View"), &NetTree::SwitchBrowseView);
455
456 return menu;
457}
458
460{
461 QString label = tr("Subscription Management");
462
463 auto *menu = new MythMenu(label, this, "options");
464
465 menu->AddItem(tr("Update Site Maps"), &NetTree::UpdateTrees);
466 menu->AddItem(tr("Update RSS"), &NetTree::UpdateRSS);
467 menu->AddItem(tr("Manage Site Subscriptions"), &NetTree::RunTreeEditor);
468 menu->AddItem(tr("Manage RSS Subscriptions"), &NetTree::RunRSSEditor);
469 if (!m_treeAutoUpdate)
470 {
471 menu->AddItem(tr("Enable Automatic Site Updates"),
473 }
474 else
475 {
476 menu->AddItem(tr("Disable Automatic Site Updates"),
478 }
479// if (!m_rssAutoUpdate)
480// menu->AddItem(tr("Enable Automatic RSS Updates"), &NetTree::ToggleRSSUpdates);
481// else
482// menu->AddItem(tr("Disable Automatic RSS Updates"), &NetTree::ToggleRSSUpdates);
483
484 return menu;
485}
486
488{
490 SwitchView();
491}
492
494{
496 SwitchView();
497}
498
500{
502 SwitchView();
503}
504
506{
507 auto *nettree =
508 new NetTree(m_type, GetMythMainWindow()->GetMainStack(), "nettree");
509
510 if (nettree->Create())
511 {
512 gCoreContext->SaveSetting("mythnetvision.ViewMode", m_type);
513 MythScreenStack *screenStack = GetScreenStack();
514 screenStack->AddScreen(nettree);
515 screenStack->PopScreen(this, false, false);
516 deleteLater();
517 }
518 else
519 {
520 delete nettree;
521 }
522}
523
525{
526 // First let's add all the RSS
527 if (!m_rssList.isEmpty())
528 {
529 auto *rssGeneric = new MythGenericTree(kRSSNode, kSubFolder, false);
530
531 // Add an upfolder
532 if (m_type != DLG_TREE)
533 rssGeneric->addNode(tr("Back"), kUpFolder, true, false);
534
535 rssGeneric->SetData(QString("%1/mythnetvision/icons/rss.png")
536 .arg(GetShareDir()));
537
538 for (const auto & feed : std::as_const(m_rssList))
539 {
540 ResultItem::resultList items = getRSSArticles(feed->GetTitle(),
542 auto *ret =
543 new MythGenericTree(feed->GetTitle(), kSubFolder, false);
544 ret->SetData(QVariant::fromValue(feed));
545 rssGeneric->addNode(ret);
546
547 // Add an upfolder
548 if (m_type != DLG_TREE)
549 ret->addNode(tr("Back"), kUpFolder, true, false);
550
551 for (const auto & item : std::as_const(items))
552 AddFileNode(ret, item);
553 SetSubfolderData(ret);
554 }
555
556 m_siteGeneric->addNode(rssGeneric);
557 SetSubfolderData(rssGeneric);
558 }
559
560 // Now let's add all the grabber trees
561 for (const auto & g : std::as_const(m_grabberList))
562 {
563
564 QMultiMap<QPair<QString,QString>, ResultItem*> treePathsNodes =
565 getTreeArticles(g->GetTitle(), VIDEO_FILE);
566
567 QList< QPair<QString,QString> > paths = treePathsNodes.uniqueKeys();
568
569 auto *ret = new MythGenericTree(g->GetTitle(), kSubFolder, false);
570 QString thumb = QString("%1mythnetvision/icons/%2")
571 .arg(GetShareDir(), g->GetImage());
572 ret->SetData(QVariant::fromValue(thumb));
573
574 // Add an upfolder
575 if (m_type != DLG_TREE)
576 ret->addNode(tr("Back"), kUpFolder, true, false);
577
578 for (const auto & path : std::as_const(paths))
579 {
580 QStringList curPaths = path.first.split("/");
581 QString dirthumb = path.second;
582 QList<ResultItem*> videos = treePathsNodes.values(path);
583 BuildGenericTree(ret, curPaths, dirthumb, videos);
584 }
586 SetSubfolderData(ret);
587 }
589}
590
592 const QString& dirthumb, const QList<ResultItem*>& videos)
593{
594 MythGenericTree *folder = nullptr;
595
596 // A little loop to determine what path of the provided path might
597 // already exist in the tree.
598
599 while (folder == nullptr && !paths.empty())
600 {
601 QString curPath = paths.takeFirst();
602 curPath.replace("|", "/");
603 MythGenericTree *tmp = dst->getChildByName(curPath);
604 if (tmp)
605 dst = tmp;
606 else
607 folder = new MythGenericTree(curPath, kSubFolder, false);
608 }
609
610 if (!folder)
611 return;
612
613 folder->SetData(dirthumb);
614 dst->addNode(folder);
615
616 // Add an upfolder
617 if (m_type != DLG_TREE)
618 folder->addNode(tr("Back"), kUpFolder, true, false);
619
620 if (!paths.empty())
621 BuildGenericTree(folder, paths, dirthumb, videos);
622 else
623 {
624 // File Handling
625 for (const auto & video : std::as_const(videos))
626 AddFileNode(folder, video);
627 }
628 SetSubfolderData(folder);
629}
630
632{
633 QString title = video->GetTitle();
634 title.replace("&amp;", "&");
635 MythGenericTree *sub_node = where_to_add->addNode(title, 0, true);
636 sub_node->SetData(QVariant::fromValue(video));
637
638 InfoMap textMap;
639 video->toMap(textMap);
640 sub_node->SetTextFromMap(textMap);
641
642 m_videos.append(video);
643}
644
646{
647 ResultItem *item = nullptr;
648
649 if (m_type == DLG_TREE)
650 item = m_siteMap->GetCurrentNode()->GetData().value<ResultItem *>();
651 else
652 {
653 MythGenericTree *node =
655
656 if (node)
657 item = node->GetData().value<ResultItem *>();
658 }
659 return item;
660}
661
663{
664 InfoMap metadataMap;
665 item->toMap(metadataMap);
666 SetTextFromMap(metadataMap);
667
668 if (!item->GetThumbnail().isEmpty() && m_thumbImage)
669 {
671 QString dlfile = item->GetThumbnail();
672 if (dlfile.contains("%SHAREDIR%"))
673 {
674 dlfile.replace("%SHAREDIR%", GetShareDir());
675 m_thumbImage->SetFilename(dlfile);
677 }
678 else
679 {
680 QString sFilename = getDownloadFilename(item->GetTitle(),
681 item->GetThumbnail());
682
683 bool exists = QFile::exists(sFilename);
684 if (exists)
685 {
686 m_thumbImage->SetFilename(sFilename);
688 }
689 else if (item->GetThumbnail().startsWith("http"))
690 {
692 item->GetThumbnail(),
693 QVariant::fromValue<uint>(0));
694 }
695 }
696 }
697 else if (m_thumbImage)
698 {
700 }
701
702 if (m_downloadable)
703 {
704 if (item->GetDownloadable())
706 else
708 }
709}
710
712{
713 ResultItem res =
714 ResultItem(site->GetTitle(), site->GetSortTitle(),
715 QString(), QString(), // no subtitle information
716 site->GetDescription(),
717 site->GetURL(), site->GetImage(), QString(),
718 site->GetAuthor(), QDateTime(), nullptr, nullptr, -1, QString(),
719 QStringList(), QString(), QStringList(), 0, 0, QString(),
720 false, QStringList(), 0, 0, false);
721
722 InfoMap metadataMap;
723 res.toMap(metadataMap);
724 SetTextFromMap(metadataMap);
725
726 if (!site->GetImage().isEmpty() && m_thumbImage)
727 {
730 }
731 else if (m_thumbImage)
732 {
734 }
735
736 if (m_downloadable)
738}
739
741{
742 QString title;
743
744 if (m_type == DLG_TREE)
745 title = m_siteMap->GetItemCurrent()->GetText();
746 else
748
749 QString thumb;
750 if (m_type == DLG_TREE)
751 thumb = m_siteMap->GetCurrentNode()->GetData().toString();
752 else
753 {
754 MythGenericTree *node =
756
757 if (node)
758 thumb = node->GetData().toString();
759 }
760
761 std::shared_ptr<MythSortHelper>sh = getMythSortHelper();
762 ResultItem res =
763 ResultItem(title, sh->doTitle(title), // title, sortTitle
764 QString(), QString(), // no subtitle information
765 QString(), // description
766 QString(), thumb, QString(),
767 QString(), QDateTime(), nullptr, nullptr, -1, QString(),
768 QStringList(), QString(), QStringList(), 0, 0, QString(),
769 false, QStringList(), 0, 0, false);
770
771 InfoMap metadataMap;
772 res.toMap(metadataMap);
773 SetTextFromMap(metadataMap);
774
775 if (m_thumbImage)
776 {
777 if (!thumb.startsWith("http://"))
778 {
779 if (thumb.contains("%SHAREDIR%"))
780 thumb.replace("%SHAREDIR%", GetShareDir());
781
782 bool exists = QFile::exists(thumb);
783
784 if (exists)
785 {
788 }
789 else
790 {
792 }
793 }
794 else
795 {
796 const QString& url = thumb;
797 QString title2;
798 if (m_type == DLG_TREE)
799 title2 = m_siteMap->GetItemCurrent()->GetText();
800 else
802
803 QString sFilename = GetDownloadFilename(title2, url);
804
805 bool exists = QFile::exists(sFilename);
806 if (exists && !url.isEmpty())
807 {
808 m_thumbImage->SetFilename(sFilename);
810 }
811 else
812 {
814 }
815 }
816 }
817
818 if (m_downloadable)
820}
821
823{
824 ResultItem *item = nullptr;
825 RSSSite *site = nullptr;
826
827 if (m_type == DLG_TREE)
828 {
829 item = m_siteMap->GetCurrentNode()->GetData().value<ResultItem *>();
830 site = m_siteMap->GetCurrentNode()->GetData().value<RSSSite *>();
831 }
832 else
833 {
834 MythGenericTree *node =
836
837 if (!node)
838 return;
839
840 item = node->GetData().value<ResultItem *>();
841 site = node->GetData().value<RSSSite *>();
842 }
843
844 if (item)
845 UpdateResultItem(item);
846 else if (site)
847 UpdateSiteItem(site);
848 else
850}
851
853{
855
856 auto *treeedit = new TreeEditor(mainStack, "mythnettreeedit");
857
858 if (treeedit->Create())
859 {
860 connect(treeedit, &NetEditorBase::ItemsChanged, this, &NetTree::DoTreeRefresh);
861
862 mainStack->AddScreen(treeedit);
863 }
864 else
865 {
866 delete treeedit;
867 }
868}
869
871{
873
874 auto *rssedit = new RSSEditor(mainStack, "mythnetrssedit");
875
876 if (rssedit->Create())
877 {
878 connect(rssedit, &RSSEditor::ItemsChanged, this, &NetTree::UpdateRSS);
879
880 mainStack->AddScreen(rssedit);
881 }
882 else
883 {
884 delete rssedit;
885 }
886}
887
889{
891
892 TreeRefresh();
893}
894
896{
897 delete m_siteGeneric;
898 m_siteGeneric = new MythGenericTree("site root", 0, false);
900
903
904 FillTree();
905 LoadData();
906 SwitchView();
907}
908
910{
911 if (findAllDBRSS().isEmpty())
912 return;
913
914 QString title(tr("Updating RSS. This could take a while..."));
915 OpenBusyPopup(title);
916
917 auto *rssMan = new RSSManager();
920 rssMan->doUpdate();
921}
922
924{
925 if (m_grabberList.count() == 0)
926 return;
927
928 QString title(tr("Updating Site Maps. This could take a while..."));
929 OpenBusyPopup(title);
930 m_gdt->refreshAll();
931}
932
934{
936 gCoreContext->SaveBoolSetting("mythnetvision.rssBackgroundFetch",
938}
939
941{
943 gCoreContext->SaveBoolSetting("mythnetvision.backgroundFetch",
945}
946
947void NetTree::customEvent(QEvent *event)
948{
949 if (event->type() == ThumbnailDLEvent::kEventType)
950 {
951 auto *tde = dynamic_cast<ThumbnailDLEvent *>(event);
952 if (!tde)
953 return;
954
955 ThumbnailData *data = tde->m_thumb;
956 if (!data)
957 return;
958
959 QString title = data->title;
960 QString file = data->url;
961 uint pos = data->data.value<uint>();
962
963 if (file.isEmpty())
964 return;
965
966 if (m_type == DLG_TREE)
967 {
968 if (title == m_siteMap->GetCurrentNode()->GetText() &&
970 {
974 }
975 }
976 else
977 {
978 if (!((uint)m_siteButtonList->GetCount() >= pos))
979 return;
980
982
983 if (item && item->GetText() == title)
984 item->SetImage(file);
985 }
986 }
987 else
988 {
990 }
991}
992
994{
995 folder->SetText(QString("%1").arg(folder->visibleChildCount()),
996 "childcount");
997 folder->DisplayState("subfolder", "nodetype");
998}
ArticleType m_type
bool isRunning(void) const
Definition: mthread.cpp:263
void addThumb(QString title, QString url, QVariant data)
void SaveBoolSetting(const QString &key, bool newValue)
void SaveSetting(const QString &key, int newValue)
int GetNumSetting(const QString &key, int defaultval=0)
bool GetBoolSetting(const QString &key, bool defaultval=false)
Basic menu dialog, message and a list of options.
int getInt() const
QVariant GetData(void) const
QString GetText(const QString &name="") const
MythGenericTree * getParent(void) const
void SetText(const QString &text, const QString &name="", const QString &state="")
MythGenericTree * addNode(const QString &a_string, int an_int=0, bool selectable_flag=false, bool visible=true)
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
int childCount(void) const
MythGenericTree * getSelectedChild(bool onlyVisible=false) const
uint visibleChildCount() const
void DisplayState(const QString &state, const QString &name="")
MythGenericTree * getChildByName(const QString &a_name) const
void SetData(QVariant data)
QList< MythGenericTree * > * getAllChildren() const
MythScreenStack * GetMainStack()
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void LoadInBackground(const QString &message="")
void OpenBusyPopup(const QString &message="")
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
MythScreenStack * GetScreenStack() const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool SetFocusWidget(MythUIType *widget=nullptr)
void CloseBusyPopup(void)
void DisplayState(const QString &state, const QString &name)
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
void SetImage(MythImage *image, const QString &name="")
Sets an image directly, should only be used in special circumstances since it bypasses the cache.
QString GetText(const QString &name="") const
void SetText(const QString &text, const QString &name="", const QString &state="")
MythUIButtonListItem * GetItemCurrent() const
void SetItemCurrent(MythUIButtonListItem *item)
void Reset() override
Reset the widget to it's original state, should not reset changes made by the theme.
int GetItemPos(MythUIButtonListItem *item) const
void itemClicked(MythUIButtonListItem *item)
MythUIButtonListItem * GetItemAt(int pos) const
void itemSelected(MythUIButtonListItem *item)
MythGenericTree * GetCurrentNode(void) const
void nodeChanged(MythGenericTree *node)
void itemSelected(MythUIButtonListItem *item)
void itemClicked(MythUIButtonListItem *item)
bool AssignTree(MythGenericTree *tree)
Assign the root node of the tree to be displayed.
MythUIButtonListItem * GetItemCurrent(void) const
Return the currently selected list item.
virtual void SetTextFromMap(const InfoMap &infoMap)
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void Reset(void) override
Reset the image back to the default defined in the theme.
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
bool DisplayState(const QString &name)
virtual void SetVisible(bool visible)
void Show(void)
GrabberScript::scriptList m_grabberList
Definition: netbase.h:53
void ShowWebVideo(void)
Definition: netbase.cpp:106
void customEvent(QEvent *event) override
Definition: netbase.cpp:223
MythUIStateType * m_downloadable
Definition: netbase.h:47
MetadataImageDownload * m_imageDownload
Definition: netbase.h:50
void StreamWebVideo(void)
Definition: netbase.cpp:86
MythScreenStack * m_popupStack
Definition: netbase.h:48
MythUIImage * m_thumbImage
Definition: netbase.h:46
void DoDownloadAndPlay(void)
Definition: netbase.cpp:282
void ItemsChanged(void)
void UpdateResultItem(ResultItem *item)
Definition: nettree.cpp:662
bool Create(void) override
Definition: nettree.cpp:60
static void SetSubfolderData(MythGenericTree *folder)
Definition: nettree.cpp:993
NetTree(DialogType type, MythScreenStack *parent, const char *name=nullptr)
Definition: nettree.cpp:47
void RunTreeEditor(void) const
Definition: nettree.cpp:852
RSSSite::rssList m_rssList
Definition: nettree.h:93
bool m_treeAutoUpdate
Definition: nettree.h:99
void ShowMenu(void) override
Definition: nettree.cpp:398
MythMenu * CreateShowManageMenu(void)
Definition: nettree.cpp:459
static const QString kRSSNode
Definition: nettree.h:127
void SwitchBrowseView(void)
Definition: nettree.cpp:499
static const QString kSearchNode
Definition: nettree.h:128
ResultItem * GetStreamItem() override
Definition: nettree.cpp:645
void SlotItemChanged()
Definition: nettree.cpp:822
void UpdateItem(MythUIButtonListItem *item)
Definition: nettree.cpp:210
MythMenu * CreateShowViewMenu(void)
Definition: nettree.cpp:443
MythUIText * m_noSites
Definition: nettree.h:90
void SwitchView(void)
Definition: nettree.cpp:505
void TreeRefresh()
Definition: nettree.cpp:895
void FillTree(void)
Definition: nettree.cpp:524
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: nettree.cpp:359
void SetCurrentNode(MythGenericTree *node)
Definition: nettree.cpp:140
bool m_rssAutoUpdate
Definition: nettree.h:98
void AddFileNode(MythGenericTree *where_to_add, ResultItem *video)
Definition: nettree.cpp:631
void SwitchTreeView(void)
Definition: nettree.cpp:487
QList< ResultItem * > m_videos
Definition: nettree.h:83
void customEvent(QEvent *levent) override
Definition: nettree.cpp:947
void HandleDirSelect(MythGenericTree *node)
Definition: nettree.cpp:328
void ToggleRSSUpdates()
Definition: nettree.cpp:933
void SwitchGalleryView(void)
Definition: nettree.cpp:493
void UpdateRSS()
Definition: nettree.cpp:909
MythGenericTree * m_siteGeneric
Definition: nettree.h:87
MythGenericTree * m_currentNode
Definition: nettree.h:88
static const QString kDownloadNode
Definition: nettree.h:129
void UpdateCurrentItem(void)
Definition: nettree.cpp:740
void UpdateSiteItem(RSSSite *site)
Definition: nettree.cpp:711
MythUIButtonTree * m_siteMap
Definition: nettree.h:85
void DoTreeRefresh()
Definition: nettree.cpp:888
MythUIButtonList * m_siteButtonList
Definition: nettree.h:86
void UpdateTrees()
Definition: nettree.cpp:923
~NetTree() override
Definition: nettree.cpp:148
void ToggleTreeUpdates()
Definition: nettree.cpp:940
void BuildGenericTree(MythGenericTree *dst, QDomElement &domElem)
bool GoBack()
Definition: nettree.cpp:337
void Load() override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Definition: nettree.cpp:132
void HandleSelect(MythUIButtonListItem *item)
Definition: nettree.cpp:304
DialogType m_type
Definition: nettree.h:95
GrabberDownloadThread * m_gdt
Definition: nettree.h:92
void RunRSSEditor(void) const
Definition: nettree.cpp:870
void LoadData(void) override
Definition: nettree.cpp:162
uint m_updateFreq
Definition: nettree.h:97
void ItemsChanged(void)
void doUpdate()
Definition: rssmanager.cpp:44
void startTimer()
Definition: rssmanager.cpp:34
void finished()
const QString & GetImage() const
Definition: rssmanager.h:57
const QString & GetAuthor() const
Definition: rssmanager.h:61
const QString & GetTitle() const
Definition: rssmanager.h:55
const QString & GetSortTitle() const
Definition: rssmanager.h:56
const QString & GetDescription() const
Definition: rssmanager.h:59
const QString & GetURL() const
Definition: rssmanager.h:60
void toMap(InfoMap &metadataMap)
Definition: rssparse.cpp:70
const QString & GetThumbnail() const
Definition: rssparse.h:140
const QString & GetTitle() const
Definition: rssparse.h:134
const bool & GetDownloadable() const
Definition: rssparse.h:154
QList< ResultItem * > resultList
Definition: rssparse.h:114
static const Type kEventType
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
unsigned int uint
Definition: freesurround.h:24
static guint32 * tmp
Definition: goom_core.cpp:26
QString getDownloadFilename(const QString &title, const QString &url)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QString GetShareDir(void)
Definition: mythdirs.cpp:261
RSSManager * rssMan
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythMainWindow * GetMythMainWindow(void)
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
static MythThemedMenu * menu
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythGenericTree * GetNodePtrFromButton(MythUIButtonListItem *item)
Definition: nettree.cpp:38
bool exists(str path)
Definition: xbmcvfs.py:51
QString GetThumbnailFilename(const QString &url, const QString &title)
Definition: netcommon.cpp:9
DialogType
Definition: nettree.h:21
@ DLG_DEFAULT
Definition: nettree.h:21
@ DLG_TREE
Definition: nettree.h:21
@ DLG_BROWSER
Definition: nettree.h:22
@ DLG_GALLERY
Definition: nettree.h:21
QMultiMap< QPair< QString, QString >, ResultItem * > getTreeArticles(const QString &feedtitle, ArticleType type)
Definition: netutils.cpp:463
ResultItem::resultList getRSSArticles(const QString &feedtitle, ArticleType type)
Definition: netutils.cpp:797
GrabberScript::scriptList findAllDBTreeGrabbersByHost(ArticleType type)
Definition: netutils.cpp:149
GrabberScript::scriptList findAllDBTreeGrabbers()
Definition: netutils.cpp:115
QString GetDownloadFilename(const QString &title, const QString &url)
Definition: netutils.cpp:854
RSSSite::rssList findAllDBRSS()
Definition: netutils.cpp:610
@ VIDEO_FILE
Definition: rssparse.h:21
@ VIDEO_PODCAST
Definition: rssparse.h:22
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
@ kSubFolder
Definition: videolist.h:6
@ kUpFolder
Definition: videolist.h:7