MythTV  master
mythplugins/mythnetvision/mythnetvision/main.cpp
Go to the documentation of this file.
1 // C++ headers
2 #include <unistd.h>
3 
4 // QT headers
5 #include <QApplication>
6 
7 // MythTV headers
8 #include <mythcontext.h>
9 #include <mythplugin.h>
10 #include <mythpluginapi.h>
11 #include <mythversion.h>
12 #include <mythmainwindow.h>
13 #include <netgrabbermanager.h>
14 #include <mythrssmanager.h>
15 
16 // MythNetVision headers
17 #include "netsearch.h"
18 #include "nettree.h"
19 #include "treeeditor.h"
20 
21 using namespace std;
22 
24 RSSManager *rssMan = nullptr;
25 
26 static int RunNetVision(void)
27 {
29 
30  auto *netsearch = new NetSearch(mainStack, "mythnetsearch");
31 
32  if (netsearch->Create())
33  {
34  mainStack->AddScreen(netsearch);
35  return 0;
36  }
37  delete netsearch;
38  return -1;
39 }
40 
41 static int RunNetTree(void)
42 {
44 
46  "mythnetvision.ViewMode", DLG_TREE));
47 
48  auto *nettree = new NetTree(type, mainStack, "mythnettree");
49 
50  if (nettree->Create())
51  {
52  mainStack->AddScreen(nettree);
53  return 0;
54  }
55  delete nettree;
56  return -1;
57 }
58 
59 static void runNetVision(void)
60 {
61  RunNetVision();
62 }
63 
64 static void runNetTree(void)
65 {
66  RunNetTree();
67 }
68 
69 static void setupKeys(void)
70 {
71  REG_JUMP("MythNetSearch", QT_TRANSLATE_NOOP("MythControls",
72  "Internet Television Client - Search"), "", runNetVision);
73  REG_JUMP("MythNetTree", QT_TRANSLATE_NOOP("MythControls",
74  "Internet Television Client - Site/Tree View"), "", runNetTree);
75 
76  REG_KEY("Internet Video", "PAGELEFT", QT_TRANSLATE_NOOP("MythControls",
77  "Previous Page"), "");
78  REG_KEY("Internet Video", "PAGERIGHT", QT_TRANSLATE_NOOP("MythControls",
79  "Next Page"), "");
80 }
81 
82 int mythplugin_init(const char *libversion)
83 {
84  if (!MythCoreContext::TestPluginVersion("mythnetvision",
85  libversion,
87  return -1;
88 
89  setupKeys();
90 
91  return 0;
92 }
93 
94 int mythplugin_run(void)
95 {
96  return RunNetVision();
97 }
98 
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:304
netsearch.h
runNetVision
static void runNetVision(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:59
mythrssmanager.h
RSSManager
Definition: mythrssmanager.h:109
RunNetVision
static int RunNetVision(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:26
mythplugin.h
MythScreenStack
Definition: mythscreenstack.h:15
rssMan
RSSManager * rssMan
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:24
MythCoreContext::TestPluginVersion
static bool TestPluginVersion(const QString &name, const QString &libversion, const QString &pluginversion)
Definition: mythcorecontext.cpp:2073
GrabberManager
Definition: netgrabbermanager.h:71
NetTree
Definition: nettree.h:41
mythversion.h
nettree.h
REG_KEY
#define REG_KEY(a, b, c, d)
Definition: mythmainwindow.h:17
mythplugin_init
int mythplugin_init(const char *libversion)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:82
DLG_TREE
@ DLG_TREE
Definition: nettree.h:20
netgrabbermanager.h
DialogType
DialogType
Definition: nettree.h:20
REG_JUMP
#define REG_JUMP(a, b, c, d)
Definition: mythmainwindow.h:19
RunNetTree
static int RunNetTree(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:41
setupKeys
static void setupKeys(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:69
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
grabMan
GrabberManager * grabMan
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:23
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:930
mythpluginapi.h
MYTH_BINARY_VERSION
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:16
NetSearch
Definition: netsearch.h:19
mythplugin_run
int mythplugin_run(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:94
mythcontext.h
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:107
mythmainwindow.h
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:49
treeeditor.h
runNetTree
static void runNetTree(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:64