00001
00002 #include <unistd.h>
00003
00004
00005 #include <QApplication>
00006
00007
00008 #include <mythcontext.h>
00009 #include <mythplugin.h>
00010 #include <mythpluginapi.h>
00011 #include <mythversion.h>
00012 #include <mythmainwindow.h>
00013 #include <netgrabbermanager.h>
00014 #include <mythrssmanager.h>
00015
00016
00017 #include "netsearch.h"
00018 #include "nettree.h"
00019 #include "treeeditor.h"
00020
00021 using namespace std;
00022
00023 GrabberManager *grabMan = 0;
00024 RSSManager *rssMan = 0;
00025
00026 static int RunNetVision(void)
00027 {
00028 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
00029
00030 NetSearch *netsearch = new NetSearch(mainStack, "mythnetsearch");
00031
00032 if (netsearch->Create())
00033 {
00034 mainStack->AddScreen(netsearch);
00035 return 0;
00036 }
00037 else
00038 {
00039 delete netsearch;
00040 return -1;
00041 }
00042 }
00043
00044 static int RunNetTree(void)
00045 {
00046 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
00047
00048 DialogType type = static_cast<DialogType>(gCoreContext->GetNumSetting(
00049 "mythnetvision.ViewMode", DLG_TREE));
00050
00051 NetTree *nettree = new NetTree(type, mainStack, "mythnettree");
00052
00053 if (nettree->Create())
00054 {
00055 mainStack->AddScreen(nettree);
00056 return 0;
00057 }
00058 else
00059 {
00060 delete nettree;
00061 return -1;
00062 }
00063 }
00064
00065 static void runNetVision(void)
00066 {
00067 RunNetVision();
00068 }
00069
00070 static void runNetTree(void)
00071 {
00072 RunNetTree();
00073 }
00074
00075 static void setupKeys(void)
00076 {
00077 REG_JUMP("MythNetSearch", QT_TRANSLATE_NOOP("MythControls",
00078 "Internet Television Client - Search"), "", runNetVision);
00079 REG_JUMP("MythNetTree", QT_TRANSLATE_NOOP("MythControls",
00080 "Internet Television Client - Site/Tree View"), "", runNetTree);
00081 }
00082
00083 int mythplugin_init(const char *libversion)
00084 {
00085 if (!gContext->TestPopupVersion("mythnetvision",
00086 libversion,
00087 MYTH_BINARY_VERSION))
00088 return -1;
00089
00090 setupKeys();
00091
00092 return 0;
00093 }
00094
00095 int mythplugin_run(void)
00096 {
00097 return RunNetVision();
00098 }
00099