MythTV master
libmythnews.cpp
Go to the documentation of this file.
1
2// C++ headers
3#include <unistd.h>
4
5// QT headers
6#include <QApplication>
7
8// MythTV headers
13#include <libmythbase/mythversion.h>
15
16// MythNews headers
17#include "mythnews.h"
18#include "mythnewsconfig.h"
19#include "newsdbcheck.h"
20
21static int RunNews(void)
22{
24
25 auto *mythnews = new MythNews(mainStack, "mythnews");
26
27 if (mythnews->Create())
28 {
29 mainStack->AddScreen(mythnews);
30 return 0;
31 }
32 delete mythnews;
33 return -1;
34}
35
36static void runNews(void)
37{
38 RunNews();
39}
40
41static void setupKeys(void)
42{
43 REG_JUMP("MythNews", QT_TRANSLATE_NOOP("MythControls",
44 "RSS News feed reader"), "", runNews);
45
46 REG_KEY("News", "RETRIEVENEWS",
47 QT_TRANSLATE_NOOP("MythControls", "Update news items"), "I,Home Page");
48 REG_KEY("News", "FORCERETRIEVE",
49 QT_TRANSLATE_NOOP("MythControls", "Force update news items"), "M,Menu");
50 REG_KEY("News", "CANCEL",
51 QT_TRANSLATE_NOOP("MythControls", "Cancel news item updating"), "C");
52}
53
54int mythplugin_init(const char *libversion)
55{
57 libversion,
58 MYTH_BINARY_VERSION))
59 return -1;
60
63 {
64 LOG(VB_GENERAL, LOG_ERR,
65 "Couldn't upgrade database to new schema, exiting.");
66 return -1;
67 }
69
70 setupKeys();
71
72 return 0;
73}
74
76{
77 return RunNews();
78}
79
81{
83
84 auto *mythnewsconfig = new MythNewsConfig(mainStack, "mythnewsconfig");
85
86 if (mythnewsconfig->Create())
87 {
88 mainStack->AddScreen(mythnewsconfig);
89 return 0;
90 }
91 delete mythnewsconfig;
92 return -1;
93}
94
95
96
void ActivateSettingsCache(bool activate=true)
static bool TestPluginVersion(const QString &name, const QString &libversion, const QString &pluginversion)
MythScreenStack * GetMainStack()
Plugin for browsing RSS news feeds.
Definition: mythnews.h:22
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
int mythplugin_config(void)
Definition: libmythnews.cpp:80
static void runNews(void)
Definition: libmythnews.cpp:36
static int RunNews(void)
Definition: libmythnews.cpp:21
static void setupKeys(void)
Definition: libmythnews.cpp:41
int mythplugin_run(void)
Definition: libmythnews.cpp:75
int mythplugin_init(const char *libversion)
Definition: libmythnews.cpp:54
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythMainWindow * GetMythMainWindow(void)
static void REG_JUMP(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void))
static void REG_KEY(const QString &Context, const QString &Action, const QString &Description, const QString &Key)
bool UpgradeNewsDatabaseSchema(void)
Definition: newsdbcheck.cpp:20