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 
22 RSSManager *rssMan = nullptr;
23 
24 static int RunNetVision(void)
25 {
27 
28  auto *netsearch = new NetSearch(mainStack, "mythnetsearch");
29 
30  if (netsearch->Create())
31  {
32  mainStack->AddScreen(netsearch);
33  return 0;
34  }
35  delete netsearch;
36  return -1;
37 }
38 
39 static int RunNetTree(void)
40 {
42 
44  "mythnetvision.ViewMode", DLG_TREE));
45 
46  auto *nettree = new NetTree(type, mainStack, "mythnettree");
47 
48  if (nettree->Create())
49  {
50  mainStack->AddScreen(nettree);
51  return 0;
52  }
53  delete nettree;
54  return -1;
55 }
56 
57 static void runNetVision(void)
58 {
59  RunNetVision();
60 }
61 
62 static void runNetTree(void)
63 {
64  RunNetTree();
65 }
66 
67 static void setupKeys(void)
68 {
69  REG_JUMP("MythNetSearch", QT_TRANSLATE_NOOP("MythControls",
70  "Internet Television Client - Search"), "", runNetVision);
71  REG_JUMP("MythNetTree", QT_TRANSLATE_NOOP("MythControls",
72  "Internet Television Client - Site/Tree View"), "", runNetTree);
73 
74  REG_KEY("Internet Video", "PAGELEFT", QT_TRANSLATE_NOOP("MythControls",
75  "Previous Page"), "");
76  REG_KEY("Internet Video", "PAGERIGHT", QT_TRANSLATE_NOOP("MythControls",
77  "Next Page"), "");
78 }
79 
80 int mythplugin_init(const char *libversion)
81 {
82  if (!MythCoreContext::TestPluginVersion("mythnetvision",
83  libversion,
85  return -1;
86 
87  setupKeys();
88 
89  return 0;
90 }
91 
92 int mythplugin_run(void)
93 {
94  return RunNetVision();
95 }
96 
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:324
netsearch.h
runNetVision
static void runNetVision(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:57
mythrssmanager.h
RSSManager
Definition: mythrssmanager.h:110
RunNetVision
static int RunNetVision(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:24
mythplugin.h
MythScreenStack
Definition: mythscreenstack.h:16
rssMan
RSSManager * rssMan
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:22
MythCoreContext::TestPluginVersion
static bool TestPluginVersion(const QString &name, const QString &libversion, const QString &pluginversion)
Definition: mythcorecontext.cpp:2060
GrabberManager
Definition: netgrabbermanager.h:72
NetTree
Definition: nettree.h:42
mythversion.h
nettree.h
REG_KEY
#define REG_KEY(a, b, c, d)
Definition: mythmainwindow.h:18
mythplugin_init
int mythplugin_init(const char *libversion)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:80
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:20
RunNetTree
static int RunNetTree(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:39
setupKeys
static void setupKeys(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:67
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
grabMan
GrabberManager * grabMan
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:21
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:933
mythpluginapi.h
MYTH_BINARY_VERSION
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:15
NetSearch
Definition: netsearch.h:20
mythplugin_run
int mythplugin_run(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:92
mythcontext.h
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:108
mythmainwindow.h
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:52
treeeditor.h
runNetTree
static void runNetTree(void)
Definition: mythplugins/mythnetvision/mythnetvision/main.cpp:62