MythTV  master
nettree.cpp
Go to the documentation of this file.
1 // qt
2 #include <QString>
3 #include <QFileInfo>
4 #include <QtAlgorithms>
5 
6 // myth
7 #include <mythdb.h>
8 #include <mythcontext.h>
9 #include <mythdirs.h>
10 #include <mythsystemlegacy.h>
11 #include <mythprogressdialog.h>
12 #include <rssparse.h>
13 #include <netutils.h>
14 #include <mythrssmanager.h>
15 #include <netgrabbermanager.h>
16 #include <mythcoreutil.h>
17 #include <metadata/videoutils.h>
18 #include <mythuiimage.h>
19 #include <mythuitext.h>
20 #include <mythscreenstack.h>
21 #include <mythmainwindow.h>
22 #include <mythsorthelper.h>
23 
24 // mythnetvision
25 #include "treeeditor.h"
26 #include "nettree.h"
27 #include "rsseditor.h"
28 #include "netcommon.h"
29 
30 class GrabberScript;
31 
32 const QString NetTree::kRSSNode = tr("RSS Feeds");
33 const QString NetTree::kSearchNode = tr("Searches");
34 const QString NetTree::kDownloadNode = tr("Downloaded Files");
35 
36 namespace
37 {
38  MythGenericTree *GetNodePtrFromButton(MythUIButtonListItem *item)
39  {
40  if (item)
41  return item->GetData().value<MythGenericTree *>();
42 
43  return nullptr;
44  }
45 }
46 
47 NetTree::NetTree(DialogType type, MythScreenStack *parent, const char *name)
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 
104  BuildFocusList();
105 
107 
108  if (m_type == DLG_TREE)
109  {
111 
113  this, &NetTree::StreamWebVideo);
115  this, &NetTree::SlotItemChanged);
117  this, &NetTree::SlotItemChanged);
118  }
119  else
120  {
122 
124  this, &NetTree::HandleSelect);
126  this, &NetTree::SlotItemChanged);
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 : qAsConst(*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 
198  SlotItemChanged();
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)
207  RunTreeEditor();
208 }
209 
211 {
212  if (!item)
213  return;
214 
215  MythGenericTree *node = GetNodePtrFromButton(item);
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 {
306  MythGenericTree *node = GetNodePtrFromButton(item);
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  {
322  StreamWebVideo();
323  }
324  }
325  SlotItemChanged();
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 
359 bool 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  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  handled = false;
388  }
389 
390  if (!handled && MythScreenType::keyPressEvent(event))
391  handled = true;
392 
393  return handled;
394 }
395 
397 {
398  QString label = tr("Playback/Download Options");
399 
400  auto *menu = new MythMenu(label, this, "options");
401 
402  ResultItem *item = nullptr;
403  if (m_type == DLG_TREE)
404  {
406 
407  if (node)
408  item = node->GetData().value<ResultItem *>();
409  }
410  else
411  {
412  MythGenericTree *node =
413  GetNodePtrFromButton(m_siteButtonList->GetItemCurrent());
414 
415  if (node)
416  item = node->GetData().value<ResultItem *>();
417  }
418 
419  if (item)
420  {
421  if (item->GetDownloadable())
422  menu->AddItem(tr("Stream Video"), SLOT(StreamWebVideo()));
423  menu->AddItem(tr("Open Web Link"), SLOT(ShowWebVideo()));
424 
425  if (item->GetDownloadable())
426  menu->AddItem(tr("Save This Video"), SLOT(DoDownloadAndPlay()));
427  }
428 
429  menu->AddItem(tr("Scan/Manage Subscriptions"), nullptr, CreateShowManageMenu());
430  menu->AddItem(tr("Change View"), nullptr, CreateShowViewMenu());
431 
432  auto *menuPopup =
433  new MythDialogBox(menu, m_popupStack, "mythnettreemenupopup");
434 
435  if (menuPopup->Create())
436  m_popupStack->AddScreen(menuPopup);
437  else
438  delete menuPopup;
439 }
440 
442 {
443  QString label = tr("View Options");
444 
445  auto *menu = new MythMenu(label, this, "options");
446 
447  if (m_type != DLG_TREE)
448  menu->AddItem(tr("Switch to List View"), SLOT(SwitchTreeView()));
449  if (m_type != DLG_GALLERY)
450  menu->AddItem(tr("Switch to Gallery View"), SLOT(SwitchGalleryView()));
451  if (m_type != DLG_BROWSER)
452  menu->AddItem(tr("Switch to Browse View"), SLOT(SwitchBrowseView()));
453 
454  return menu;
455 }
456 
458 {
459  QString label = tr("Subscription Management");
460 
461  auto *menu = new MythMenu(label, this, "options");
462 
463  menu->AddItem(tr("Update Site Maps"), SLOT(UpdateTrees()));
464  menu->AddItem(tr("Update RSS"), SLOT(UpdateRSS()));
465  menu->AddItem(tr("Manage Site Subscriptions"), SLOT(RunTreeEditor()));
466  menu->AddItem(tr("Manage RSS Subscriptions"), SLOT(RunRSSEditor()));
467  if (!m_treeAutoUpdate)
468  {
469  menu->AddItem(tr("Enable Automatic Site Updates"),
470  SLOT(ToggleTreeUpdates()));
471  }
472  else
473  {
474  menu->AddItem(tr("Disable Automatic Site Updates"),
475  SLOT(ToggleTreeUpdates()));
476  }
477 // if (!m_rssAutoUpdate)
478 // menu->AddItem(tr("Enable Automatic RSS Updates"), SLOT(ToggleRSSUpdates()));
479 // else
480 // menu->AddItem(tr("Disable Automatic RSS Updates"), SLOT(ToggleRSSUpdates()));
481 
482  return menu;
483 }
484 
486 {
487  m_type = DLG_TREE;
488  SwitchView();
489 }
490 
492 {
494  SwitchView();
495 }
496 
498 {
500  SwitchView();
501 }
502 
504 {
505  auto *nettree =
506  new NetTree(m_type, GetMythMainWindow()->GetMainStack(), "nettree");
507 
508  if (nettree->Create())
509  {
510  gCoreContext->SaveSetting("mythnetvision.ViewMode", m_type);
511  MythScreenStack *screenStack = GetScreenStack();
512  screenStack->AddScreen(nettree);
513  screenStack->PopScreen(this, false, false);
514  deleteLater();
515  }
516  else
517  delete nettree;
518 }
519 
521 {
522  // First let's add all the RSS
523  if (!m_rssList.isEmpty())
524  {
525  auto *rssGeneric = new MythGenericTree(kRSSNode, kSubFolder, false);
526 
527  // Add an upfolder
528  if (m_type != DLG_TREE)
529  rssGeneric->addNode(tr("Back"), kUpFolder, true, false);
530 
531  rssGeneric->SetData(QString("%1/mythnetvision/icons/rss.png")
532  .arg(GetShareDir()));
533 
534  for (const auto & feed : qAsConst(m_rssList))
535  {
536  ResultItem::resultList items = getRSSArticles(feed->GetTitle(),
537  VIDEO_PODCAST);
538  auto *ret =
539  new MythGenericTree(feed->GetTitle(), kSubFolder, false);
540  ret->SetData(QVariant::fromValue(feed));
541  rssGeneric->addNode(ret);
542 
543  // Add an upfolder
544  if (m_type != DLG_TREE)
545  ret->addNode(tr("Back"), kUpFolder, true, false);
546 
547  for (const auto & item : qAsConst(items))
548  AddFileNode(ret, item);
549  SetSubfolderData(ret);
550  }
551 
552  m_siteGeneric->addNode(rssGeneric);
553  SetSubfolderData(rssGeneric);
554  }
555 
556  // Now let's add all the grabber trees
557  for (const auto & g : qAsConst(m_grabberList))
558  {
559 
560  QMultiMap<QPair<QString,QString>, ResultItem*> treePathsNodes =
561  getTreeArticles(g->GetTitle(), VIDEO_FILE);
562 
563  QList< QPair<QString,QString> > paths = treePathsNodes.uniqueKeys();
564 
565  auto *ret = new MythGenericTree(g->GetTitle(), kSubFolder, false);
566  QString thumb = QString("%1mythnetvision/icons/%2").arg(GetShareDir())
567  .arg(g->GetImage());
568  ret->SetData(QVariant::fromValue(thumb));
569 
570  // Add an upfolder
571  if (m_type != DLG_TREE)
572  ret->addNode(tr("Back"), kUpFolder, true, false);
573 
574  for (const auto & path : qAsConst(paths))
575  {
576  QStringList curPaths = path.first.split("/");
577  QString dirthumb = path.second;
578  QList<ResultItem*> videos = treePathsNodes.values(path);
579  BuildGenericTree(ret, curPaths, dirthumb, videos);
580  }
581  m_siteGeneric->addNode(ret);
582  SetSubfolderData(ret);
583  }
585 }
586 
588  const QString& dirthumb, const QList<ResultItem*>& videos)
589 {
590  MythGenericTree *folder = nullptr;
591 
592  // A little loop to determine what path of the provided path might
593  // already exist in the tree.
594 
595  while (folder == nullptr && !paths.empty())
596  {
597  QString curPath = paths.takeFirst();
598  curPath.replace("|", "/");
599  MythGenericTree *tmp = dst->getChildByName(curPath);
600  if (tmp)
601  dst = tmp;
602  else
603  folder = new MythGenericTree(curPath, kSubFolder, false);
604  }
605 
606  if (!folder)
607  return;
608 
609  folder->SetData(dirthumb);
610  dst->addNode(folder);
611 
612  // Add an upfolder
613  if (m_type != DLG_TREE)
614  folder->addNode(tr("Back"), kUpFolder, true, false);
615 
616  if (!paths.empty())
617  BuildGenericTree(folder, paths, dirthumb, videos);
618  else
619  {
620  // File Handling
621  for (const auto & video : qAsConst(videos))
622  AddFileNode(folder, video);
623  }
624  SetSubfolderData(folder);
625 }
626 
628 {
629  QString title = video->GetTitle();
630  title.replace("&amp;", "&");
631  MythGenericTree *sub_node = where_to_add->addNode(title, 0, true);
632  sub_node->SetData(QVariant::fromValue(video));
633 
634  InfoMap textMap;
635  video->toMap(textMap);
636  sub_node->SetTextFromMap(textMap);
637 
638  m_videos.append(video);
639 }
640 
642 {
643  ResultItem *item = nullptr;
644 
645  if (m_type == DLG_TREE)
646  item = m_siteMap->GetCurrentNode()->GetData().value<ResultItem *>();
647  else
648  {
649  MythGenericTree *node =
650  GetNodePtrFromButton(m_siteButtonList->GetItemCurrent());
651 
652  if (node)
653  item = node->GetData().value<ResultItem *>();
654  }
655  return item;
656 }
657 
659 {
660  InfoMap metadataMap;
661  item->toMap(metadataMap);
662  SetTextFromMap(metadataMap);
663 
664  if (!item->GetThumbnail().isEmpty() && m_thumbImage)
665  {
666  m_thumbImage->Reset();
667  QString dlfile = item->GetThumbnail();
668  if (dlfile.contains("%SHAREDIR%"))
669  {
670  dlfile.replace("%SHAREDIR%", GetShareDir());
671  m_thumbImage->SetFilename(dlfile);
672  m_thumbImage->Load();
673  }
674  else
675  {
676  QString sFilename = getDownloadFilename(item->GetTitle(),
677  item->GetThumbnail());
678 
679  bool exists = QFile::exists(sFilename);
680  if (exists)
681  {
682  m_thumbImage->SetFilename(sFilename);
683  m_thumbImage->Load();
684  }
685  else if (item->GetThumbnail().startsWith("http"))
686  {
688  item->GetThumbnail(),
689  QVariant::fromValue<uint>(0));
690  }
691  }
692  }
693  else if (m_thumbImage)
694  m_thumbImage->Reset();
695 
696  if (m_downloadable)
697  {
698  if (item->GetDownloadable())
700  else
702  }
703 }
704 
706 {
707  ResultItem res =
708  ResultItem(site->GetTitle(), site->GetSortTitle(),
709  QString(), QString(), // no subtitle information
710  site->GetDescription(),
711  site->GetURL(), site->GetImage(), QString(),
712  site->GetAuthor(), QDateTime(), nullptr, nullptr, -1, QString(),
713  QStringList(), QString(), QStringList(), 0, 0, QString(),
714  false, QStringList(), 0, 0, false);
715 
716  InfoMap metadataMap;
717  res.toMap(metadataMap);
718  SetTextFromMap(metadataMap);
719 
720  if (!site->GetImage().isEmpty() && m_thumbImage)
721  {
723  m_thumbImage->Load();
724  }
725  else if (m_thumbImage)
726  m_thumbImage->Reset();
727 
728  if (m_downloadable)
730 }
731 
733 {
734  QString title;
735 
736  if (m_type == DLG_TREE)
738  else
740 
741  QString thumb;
742  if (m_type == DLG_TREE)
743  thumb = m_siteMap->GetCurrentNode()->GetData().toString();
744  else
745  {
746  MythGenericTree *node =
747  GetNodePtrFromButton(m_siteButtonList->GetItemCurrent());
748 
749  if (node)
750  thumb = node->GetData().toString();
751  }
752 
753  std::shared_ptr<MythSortHelper>sh = getMythSortHelper();
754  ResultItem res =
755  ResultItem(title, sh->doTitle(title), // title, sortTitle
756  QString(), QString(), // no subtitle information
757  QString(), // description
758  QString(), thumb, QString(),
759  QString(), QDateTime(), nullptr, nullptr, -1, QString(),
760  QStringList(), QString(), QStringList(), 0, 0, QString(),
761  false, QStringList(), 0, 0, false);
762 
763  InfoMap metadataMap;
764  res.toMap(metadataMap);
765  SetTextFromMap(metadataMap);
766 
767  if (m_thumbImage)
768  {
769  if (!thumb.startsWith("http://"))
770  {
771  if (thumb.contains("%SHAREDIR%"))
772  thumb.replace("%SHAREDIR%", GetShareDir());
773 
774  bool exists = QFile::exists(thumb);
775 
776  if (exists)
777  {
778  m_thumbImage->SetFilename(thumb);
779  m_thumbImage->Load();
780  }
781  else
782  m_thumbImage->Reset();
783  }
784  else
785  {
786  const QString& url = thumb;
787  QString title2;
788  if (m_type == DLG_TREE)
789  title2 = m_siteMap->GetItemCurrent()->GetText();
790  else
791  title2 = m_siteButtonList->GetItemCurrent()->GetText();
792 
793  QString sFilename = GetDownloadFilename(title2, url);
794 
795  bool exists = QFile::exists(sFilename);
796  if (exists && !url.isEmpty())
797  {
798  m_thumbImage->SetFilename(sFilename);
799  m_thumbImage->Load();
800  }
801  else
802  m_thumbImage->Reset();
803  }
804  }
805 
806  if (m_downloadable)
808 }
809 
811 {
812  ResultItem *item = nullptr;
813  RSSSite *site = nullptr;
814 
815  if (m_type == DLG_TREE)
816  {
817  item = m_siteMap->GetCurrentNode()->GetData().value<ResultItem *>();
818  site = m_siteMap->GetCurrentNode()->GetData().value<RSSSite *>();
819  }
820  else
821  {
822  MythGenericTree *node =
823  GetNodePtrFromButton(m_siteButtonList->GetItemCurrent());
824 
825  if (!node)
826  return;
827 
828  item = node->GetData().value<ResultItem *>();
829  site = node->GetData().value<RSSSite *>();
830  }
831 
832  if (item)
833  UpdateResultItem(item);
834  else if (site)
835  UpdateSiteItem(site);
836  else
838 }
839 
841 {
843 
844  auto *treeedit = new TreeEditor(mainStack, "mythnettreeedit");
845 
846  if (treeedit->Create())
847  {
848  connect(treeedit, &NetEditorBase::ItemsChanged, this, &NetTree::DoTreeRefresh);
849 
850  mainStack->AddScreen(treeedit);
851  }
852  else
853  delete treeedit;
854 }
855 
857 {
859 
860  auto *rssedit = new RSSEditor(mainStack, "mythnetrssedit");
861 
862  if (rssedit->Create())
863  {
864  connect(rssedit, &RSSEditor::ItemsChanged, this, &NetTree::UpdateRSS);
865 
866  mainStack->AddScreen(rssedit);
867  }
868  else
869  delete rssedit;
870 }
871 
873 {
874  CloseBusyPopup();
875 
876  TreeRefresh();
877 }
878 
880 {
881  delete m_siteGeneric;
882  m_siteGeneric = new MythGenericTree("site root", 0, false);
884 
887 
888  FillTree();
889  LoadData();
890  SwitchView();
891 }
892 
894 {
895  if (findAllDBRSS().isEmpty())
896  return;
897 
898  QString title(tr("Updating RSS. This could take a while..."));
900 
901  auto *rssMan = new RSSManager();
903  rssMan->startTimer();
904  rssMan->doUpdate();
905 }
906 
908 {
909  if (m_grabberList.count() == 0)
910  return;
911 
912  QString title(tr("Updating Site Maps. This could take a while..."));
914  m_gdt->refreshAll();
915 }
916 
918 {
920  gCoreContext->SaveBoolSetting("mythnetvision.rssBackgroundFetch",
922 }
923 
925 {
927  gCoreContext->SaveBoolSetting("mythnetvision.backgroundFetch",
929 }
930 
931 void NetTree::customEvent(QEvent *event)
932 {
933  if (event->type() == ThumbnailDLEvent::kEventType)
934  {
935  auto *tde = dynamic_cast<ThumbnailDLEvent *>(event);
936  if (!tde)
937  return;
938 
939  ThumbnailData *data = tde->m_thumb;
940  if (!data)
941  return;
942 
943  QString title = data->title;
944  QString file = data->url;
945  uint pos = data->data.value<uint>();
946 
947  if (file.isEmpty())
948  return;
949 
950  if (m_type == DLG_TREE)
951  {
952  if (title == m_siteMap->GetCurrentNode()->GetText() &&
953  m_thumbImage)
954  {
956  m_thumbImage->Load();
957  m_thumbImage->Show();
958  }
959  }
960  else
961  {
962  if (!((uint)m_siteButtonList->GetCount() >= pos))
963  return;
964 
966 
967  if (item && item->GetText() == title)
968  item->SetImage(file);
969  }
970  }
971  else
972  NetBase::customEvent(event);
973 }
974 
976 {
977  folder->SetText(QString("%1").arg(folder->visibleChildCount()),
978  "childcount");
979  folder->DisplayState("subfolder", "nodetype");
980 }
MythUIButtonList::GetItemAt
MythUIButtonListItem * GetItemAt(int pos) const
Definition: mythuibuttonlist.cpp:1676
MythScreenType::LoadInBackground
void LoadInBackground(const QString &message="")
Definition: mythscreentype.cpp:302
RSSEditor::ItemsChanged
void ItemsChanged(void)
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:321
NetTree::DoTreeRefresh
void DoTreeRefresh()
Definition: nettree.cpp:872
MythUIButtonList::GetItemCurrent
MythUIButtonListItem * GetItemCurrent() const
Definition: mythuibuttonlist.cpp:1590
NetTree::m_currentNode
MythGenericTree * m_currentNode
Definition: nettree.h:87
GrabberScript::m_type
ArticleType m_type
Definition: netgrabbermanager.h:61
NetTree::CreateShowViewMenu
MythMenu * CreateShowViewMenu(void)
Definition: nettree.cpp:441
RSSManager::doUpdate
void doUpdate()
Definition: mythrssmanager.cpp:46
mythuitext.h
GetDownloadFilename
QString GetDownloadFilename(const QString &title, const QString &url)
Definition: netutils.cpp:855
MythGenericTree::SetData
void SetData(QVariant data)
Definition: mythgenerictree.h:87
NetTree::HandleDirSelect
void HandleDirSelect(MythGenericTree *node)
Definition: nettree.cpp:328
NetTree::UpdateResultItem
void UpdateResultItem(ResultItem *item)
Definition: nettree.cpp:658
getMythSortHelper
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
Definition: mythsorthelper.cpp:132
MythGenericTree::GetText
QString GetText(const QString &name="") const
Definition: mythgenerictree.cpp:548
NetTree::RunTreeEditor
void RunTreeEditor(void) const
Definition: nettree.cpp:840
mythdb.h
MythGenericTree::SetTextFromMap
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
Definition: mythgenerictree.cpp:534
mythrssmanager.h
NetTree::TreeRefresh
void TreeRefresh()
Definition: nettree.cpp:879
MythUIButtonListItem::DisplayState
void DisplayState(const QString &state, const QString &name)
Definition: mythuibuttonlist.cpp:3499
RSSSite::GetSortTitle
const QString & GetSortTitle() const
Definition: mythrssmanager.h:54
NetTree::UpdateRSS
void UpdateRSS()
Definition: nettree.cpp:893
DLG_BROWSER
@ DLG_BROWSER
Definition: nettree.h:21
title
QString title
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:636
RSSManager
Definition: mythrssmanager.h:110
NetTree::UpdateSiteItem
void UpdateSiteItem(RSSSite *site)
Definition: nettree.cpp:705
MetadataImageDownload::cancel
void cancel()
Definition: metadataimagedownload.cpp:63
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1139
NetTree::SwitchTreeView
void SwitchTreeView(void)
Definition: nettree.cpp:485
mythscreenstack.h
NetTree::m_siteGeneric
MythGenericTree * m_siteGeneric
Definition: nettree.h:86
MythGenericTree::visibleChildCount
uint visibleChildCount() const
Definition: mythgenerictree.h:91
MythUIImage::Load
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
Definition: mythuiimage.cpp:968
MythGenericTree::getInt
int getInt() const
Definition: mythgenerictree.h:66
MythUIButtonTree::itemSelected
void itemSelected(MythUIButtonListItem *item)
MythUIButtonList::itemSelected
void itemSelected(MythUIButtonListItem *item)
rssparse.h
DLG_GALLERY
@ DLG_GALLERY
Definition: nettree.h:20
mythcoreutil.h
ResultItem::GetTitle
const QString & GetTitle() const
Definition: rssparse.h:134
TreeEditor
Definition: treeeditor.h:10
MythScreenStack
Definition: mythscreenstack.h:16
arg
arg(title).arg(filename).arg(doDelete))
MythGenericTree::GetData
QVariant GetData(void) const
Definition: mythgenerictree.h:88
MythUIButtonTree::GetItemCurrent
MythUIButtonListItem * GetItemCurrent(void) const
Return the currently selected list item.
Definition: mythuibuttontree.cpp:554
NetTree::m_gdt
GrabberDownloadThread * m_gdt
Definition: nettree.h:91
RSSSite::GetDescription
const QString & GetDescription() const
Definition: mythrssmanager.h:57
MythGenericTree::getChildByName
MythGenericTree * getChildByName(const QString &a_name) const
Definition: mythgenerictree.cpp:379
NetTree::CreateShowManageMenu
MythMenu * CreateShowManageMenu(void)
Definition: nettree.cpp:457
MythScreenType::OpenBusyPopup
void OpenBusyPopup(const QString &message="")
Definition: mythscreentype.cpp:336
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MetadataImageDownload::addThumb
void addThumb(QString title, QString url, QVariant data)
Definition: metadataimagedownload.cpp:35
NetBase::customEvent
void customEvent(QEvent *event) override
Definition: netbase.cpp:220
MythUIStateType::Reset
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuistatetype.cpp:197
build_compdb.file
file
Definition: build_compdb.py:55
mythdirs.h
mythsorthelper.h
netcommon.h
MythUIImage::Reset
void Reset(void) override
Reset the image back to the default defined in the theme.
Definition: mythuiimage.cpp:645
NetTree::Load
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
MythUIButtonTree::AssignTree
bool AssignTree(MythGenericTree *tree)
Assign the root node of the tree to be displayed.
Definition: mythuibuttontree.cpp:211
findAllDBTreeGrabbers
GrabberScript::scriptList findAllDBTreeGrabbers()
Definition: netutils.cpp:115
menu
static MythThemedMenu * menu
Definition: mythtv/programs/mythtv-setup/main.cpp:53
rsseditor.h
NetTree::SwitchView
void SwitchView(void)
Definition: nettree.cpp:503
NetBase::m_thumbImage
MythUIImage * m_thumbImage
Definition: netbase.h:45
mythuiimage.h
getTreeArticles
QMultiMap< QPair< QString, QString >, ResultItem * > getTreeArticles(const QString &feedtitle, ArticleType type)
Definition: netutils.cpp:464
MythUIButtonList::GetCount
int GetCount() const
Definition: mythuibuttonlist.cpp:1655
NetTree::SwitchGalleryView
void SwitchGalleryView(void)
Definition: nettree.cpp:491
mythprogressdialog.h
video
QDomElement video
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:661
ThumbnailData::title
QString title
Definition: metadataimagedownload.h:13
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition: mythscreentype.cpp:112
mythsystemlegacy.h
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythUIButtonListItem::SetText
void SetText(const QString &text, const QString &name="", const QString &state="")
Definition: mythuibuttonlist.cpp:3264
MythGenericTree::addNode
MythGenericTree * addNode(const QString &a_string, int an_int=0, bool selectable_flag=false, bool visible=true)
Definition: mythgenerictree.cpp:87
NetTree::NetTree
NetTree(DialogType type, MythScreenStack *parent, const char *name=nullptr)
Definition: nettree.cpp:47
MythUIButtonList::GetItemPos
int GetItemPos(MythUIButtonListItem *item) const
Definition: mythuibuttonlist.cpp:1698
NetBase::m_popupStack
MythScreenStack * m_popupStack
Definition: netbase.h:47
nettree.h
MythGenericTree::getSelectedChild
MythGenericTree * getSelectedChild(bool onlyVisible=false) const
Definition: mythgenerictree.cpp:312
getDownloadFilename
QString getDownloadFilename(const QString &title, const QString &url)
Definition: metadataimagedownload.cpp:334
MythUIButtonListItem
Definition: mythuibuttonlist.h:28
MythUIButtonTree::itemClicked
void itemClicked(MythUIButtonListItem *item)
ThumbnailDLEvent::kEventType
static Type kEventType
Definition: metadataimagedownload.h:84
kSubFolder
@ kSubFolder
Definition: videolist.h:6
NetTree::RunRSSEditor
void RunRSSEditor(void) const
Definition: nettree.cpp:856
MythUIType::Show
void Show(void)
Definition: mythuitype.cpp:1125
ResultItem::GetThumbnail
const QString & GetThumbnail() const
Definition: rssparse.h:140
NetTree::SwitchBrowseView
void SwitchBrowseView(void)
Definition: nettree.cpp:497
DLG_TREE
@ DLG_TREE
Definition: nettree.h:20
MythUIButtonList::itemClicked
void itemClicked(MythUIButtonListItem *item)
ThumbnailData::url
QString url
Definition: metadataimagedownload.h:15
MythGenericTree::sortByString
void sortByString()
Definition: mythgenerictree.cpp:421
RSSManager::startTimer
void startTimer()
Definition: mythrssmanager.cpp:36
NetTree::ToggleTreeUpdates
void ToggleTreeUpdates()
Definition: nettree.cpp:924
NetTree::LoadData
void LoadData(void) override
Definition: nettree.cpp:162
NetBase::m_grabberList
GrabberScript::scriptList m_grabberList
Definition: netbase.h:52
NetTree::UpdateItem
void UpdateItem(MythUIButtonListItem *item)
Definition: nettree.cpp:210
netgrabbermanager.h
MythScreenType::SetFocusWidget
bool SetFocusWidget(MythUIType *widget=nullptr)
Definition: mythscreentype.cpp:117
NetTree::AddFileNode
void AddFileNode(MythGenericTree *where_to_add, ResultItem *video)
Definition: nettree.cpp:627
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:138
NetTree::m_siteButtonList
MythUIButtonList * m_siteButtonList
Definition: nettree.h:85
GetShareDir
QString GetShareDir(void)
Definition: mythdirs.cpp:222
NetBase::m_imageDownload
MetadataImageDownload * m_imageDownload
Definition: netbase.h:49
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition: mythscreentype.cpp:222
RSSManager::finished
void finished()
rssMan
RSSManager * rssMan
Definition: mythplugins/mythnetvision/mythfillnetvision/main.cpp:27
DialogType
DialogType
Definition: nettree.h:20
NetTree::m_treeAutoUpdate
bool m_treeAutoUpdate
Definition: nettree.h:98
NetTree::m_videos
QList< ResultItem * > m_videos
Definition: nettree.h:82
MythGenericTree::childCount
int childCount(void) const
Definition: mythgenerictree.cpp:256
netutils.h
MythUIComposite::SetTextFromMap
virtual void SetTextFromMap(const InfoMap &infoMap)
Definition: mythuicomposite.cpp:9
ThumbnailDLEvent
Definition: metadataimagedownload.h:71
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
NetEditorBase::ItemsChanged
void ItemsChanged(void)
GrabberScript
Definition: netgrabbermanager.h:17
ResultItem::toMap
void toMap(InfoMap &metadataMap)
Definition: rssparse.cpp:74
NetTree::customEvent
void customEvent(QEvent *levent) override
Definition: nettree.cpp:931
NetBase::StreamWebVideo
void StreamWebVideo(void)
Definition: netbase.cpp:86
kUpFolder
@ kUpFolder
Definition: videolist.h:7
NetTree::HandleSelect
void HandleSelect(MythUIButtonListItem *item)
Definition: nettree.cpp:304
MythUIButtonTree::GetCurrentNode
MythGenericTree * GetCurrentNode(void) const
Definition: mythuibuttontree.h:32
MythUIButtonListItem::GetData
QVariant GetData()
Definition: mythuibuttonlist.cpp:3580
uint
unsigned int uint
Definition: compat.h:140
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:56
NetTree::m_rssList
RSSSite::rssList m_rssList
Definition: nettree.h:92
RSSSite::GetAuthor
const QString & GetAuthor() const
Definition: mythrssmanager.h:59
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:929
MythScreenType::GetScreenStack
MythScreenStack * GetScreenStack() const
Definition: mythscreentype.cpp:233
ThumbnailData::data
QVariant data
Definition: metadataimagedownload.h:14
MythGenericTree::getAllChildren
QList< MythGenericTree * > * getAllChildren() const
Definition: mythgenerictree.cpp:278
UIUtilDisp::Assign
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
MythUIButtonListItem::SetTextFromMap
void SetTextFromMap(const InfoMap &infoMap, const QString &state="")
Definition: mythuibuttonlist.cpp:3281
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:923
MythUIButtonListItem::GetText
QString GetText(const QString &name="") const
Definition: mythuibuttonlist.cpp:3305
GrabberDownloadThread::refreshAll
void refreshAll()
Definition: netgrabbermanager.cpp:212
NetTree::BuildGenericTree
void BuildGenericTree(MythGenericTree *dst, QDomElement &domElem)
NetTree::SetCurrentNode
void SetCurrentNode(MythGenericTree *node)
Definition: nettree.cpp:140
findAllDBRSS
RSSSite::rssList findAllDBRSS()
Definition: netutils.cpp:611
MythMenu
Definition: mythdialogbox.h:93
NetTree::m_rssAutoUpdate
bool m_rssAutoUpdate
Definition: nettree.h:97
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:414
NetTree::SetSubfolderData
static void SetSubfolderData(MythGenericTree *folder)
Definition: nettree.cpp:975
RSSSite::GetImage
const QString & GetImage() const
Definition: mythrssmanager.h:55
RSSEditor
Definition: rsseditor.h:86
VIDEO_FILE
@ VIDEO_FILE
Definition: rssparse.h:21
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:692
NetTree::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: nettree.cpp:359
MythUIButtonListItem::SetImage
void SetImage(MythImage *image, const QString &name="")
Sets an image directly, should only be used in special circumstances since it bypasses the cache.
Definition: mythuibuttonlist.cpp:3398
ResultItem
Definition: rssparse.h:110
MythGenericTree::getParent
MythGenericTree * getParent(void) const
Definition: mythgenerictree.cpp:372
NetTree::m_type
DialogType m_type
Definition: nettree.h:94
GetThumbnailFilename
QString GetThumbnailFilename(const QString &url, const QString &title)
Definition: netcommon.cpp:9
RSSSite::GetTitle
const QString & GetTitle() const
Definition: mythrssmanager.h:53
NetTree::GetStreamItem
ResultItem * GetStreamItem() override
Definition: nettree.cpp:641
MythGenericTree
Definition: mythgenerictree.h:21
NetTree::m_siteMap
MythUIButtonTree * m_siteMap
Definition: nettree.h:84
NetTree::kRSSNode
static const QString kRSSNode
Definition: nettree.h:126
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1086
MythGenericTree::DisplayState
void DisplayState(const QString &state, const QString &name="")
Definition: mythgenerictree.cpp:587
mythcontext.h
DLG_DEFAULT
@ DLG_DEFAULT
Definition: nettree.h:20
MythScreenStack::PopScreen
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
Definition: mythscreenstack.cpp:83
MythUIButtonList::Reset
void Reset() override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuibuttonlist.cpp:114
VIDEO_PODCAST
@ VIDEO_PODCAST
Definition: rssparse.h:22
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:105
MThread::isRunning
bool isRunning(void) const
Definition: mthread.cpp:268
MythUIButtonList::SetItemCurrent
void SetItemCurrent(MythUIButtonListItem *item)
Definition: mythuibuttonlist.cpp:1557
build_compdb.action
action
Definition: build_compdb.py:9
NetBase::ShowWebVideo
void ShowWebVideo(void)
Definition: netbase.cpp:105
NetTree::m_updateFreq
uint m_updateFreq
Definition: nettree.h:96
ResultItem::resultList
QList< ResultItem * > resultList
Definition: rssparse.h:114
NetTree::m_noSites
MythUIText * m_noSites
Definition: nettree.h:89
NetTree::FillTree
void FillTree(void)
Definition: nettree.cpp:520
NetTree::~NetTree
~NetTree() override
Definition: nettree.cpp:148
NetBase::m_downloadable
MythUIStateType * m_downloadable
Definition: netbase.h:46
NetTree::kSearchNode
static const QString kSearchNode
Definition: nettree.h:127
NetTree::UpdateCurrentItem
void UpdateCurrentItem(void)
Definition: nettree.cpp:732
NetBase
Definition: netbase.h:19
NetTree::ShowMenu
void ShowMenu(void) override
Definition: nettree.cpp:396
MythGenericTree::SetText
void SetText(const QString &text, const QString &name="", const QString &state="")
Definition: mythgenerictree.cpp:516
getRSSArticles
ResultItem::resultList getRSSArticles(const QString &feedtitle, ArticleType type)
Definition: netutils.cpp:798
NetTree::UpdateTrees
void UpdateTrees()
Definition: nettree.cpp:907
NetTree::Create
bool Create(void) override
Definition: nettree.cpp:60
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:898
NetTree::kDownloadNode
static const QString kDownloadNode
Definition: nettree.h:128
MythUIImage::SetFilename
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
Definition: mythuiimage.cpp:676
ThumbnailData
Definition: metadataimagedownload.h:12
mythmainwindow.h
NetTree::SlotItemChanged
void SlotItemChanged()
Definition: nettree.cpp:810
MythUIButtonListItem::SetData
void SetData(QVariant data)
Definition: mythuibuttonlist.cpp:3575
NetTree::GoBack
bool GoBack()
Definition: nettree.cpp:337
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:49
ResultItem::GetDownloadable
const bool & GetDownloadable() const
Definition: rssparse.h:154
RSSSite::GetURL
const QString & GetURL() const
Definition: mythrssmanager.h:58
treeeditor.h
RSSSite
Definition: mythrssmanager.h:20
videoutils.h
MythScreenType::CloseBusyPopup
void CloseBusyPopup(void)
Definition: mythscreentype.cpp:354
GrabberDownloadThread::finished
void finished()
findAllDBTreeGrabbersByHost
GrabberScript::scriptList findAllDBTreeGrabbersByHost(ArticleType type)
Definition: netutils.cpp:149
NetBase::DoDownloadAndPlay
void DoDownloadAndPlay(void)
Definition: netbase.cpp:283
MythCoreContext::SaveBoolSetting
void SaveBoolSetting(const QString &key, bool newValue)
Definition: mythcorecontext.h:148
MythUIStateType::DisplayState
bool DisplayState(const QString &name)
Definition: mythuistatetype.cpp:84
MythUIButtonTree::nodeChanged
void nodeChanged(MythGenericTree *node)
GrabberDownloadThread
Definition: netgrabbermanager.h:110
MythUIButtonListItem::NotChecked
@ NotChecked
Definition: mythuibuttonlist.h:32
NetTree::ToggleRSSUpdates
void ToggleRSSUpdates()
Definition: nettree.cpp:917
build_compdb.paths
paths
Definition: build_compdb.py:13