diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-05-11 14:17:20 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-05-11 14:17:20 +0200 |
commit | 64ed6cffd8b462c316183be755f6fc85ffa012a1 (patch) | |
tree | 3a114cb42822c7c3c076c8d0e3040600296ef904 /PLUGINS/src | |
parent | 51eb880da0365236e6a08aca3b1d84b14f6294b3 (diff) | |
download | vdr-64ed6cffd8b462c316183be755f6fc85ffa012a1.tar.gz vdr-64ed6cffd8b462c316183be755f6fc85ffa012a1.tar.bz2 |
Added setup parameters and a Setup menu to adjust them
Diffstat (limited to 'PLUGINS/src')
-rw-r--r-- | PLUGINS/src/hello/HISTORY | 4 | ||||
-rw-r--r-- | PLUGINS/src/hello/hello.c | 47 | ||||
-rw-r--r-- | PLUGINS/src/hello/i18n.c | 41 |
3 files changed, 86 insertions, 6 deletions
diff --git a/PLUGINS/src/hello/HISTORY b/PLUGINS/src/hello/HISTORY index b35760ca..dff114d5 100644 --- a/PLUGINS/src/hello/HISTORY +++ b/PLUGINS/src/hello/HISTORY @@ -4,3 +4,7 @@ VDR Plugin 'hello' Revision History 2002-05-09: Version 0.0.1 - Initial revision. + +2002-05-11: Version 0.0.2 + +- Added setup parameters and a Setup menu to adjust them. diff --git a/PLUGINS/src/hello/hello.c b/PLUGINS/src/hello/hello.c index 5db4f2a2..65d03c8b 100644 --- a/PLUGINS/src/hello/hello.c +++ b/PLUGINS/src/hello/hello.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: hello.c 1.1 2002/05/09 15:28:51 kls Exp $ + * $Id: hello.c 1.2 2002/05/11 14:17:20 kls Exp $ */ #include <getopt.h> @@ -11,7 +11,7 @@ #include <vdr/plugin.h> #include "i18n.h" -static const char *VERSION = "0.0.1"; +static const char *VERSION = "0.0.2"; static const char *DESCRIPTION = "A friendly greeting"; static const char *MAINMENUENTRY = "Hello"; @@ -34,6 +34,39 @@ public: virtual bool SetupParse(const char *Name, const char *Value); }; +// Global variables that control the overall behaviour: + +int GreetingTime = 3; +int UseAlternateGreeting = false; + +// --- cMenuSetupHello ------------------------------------------------------- + +class cMenuSetupHello : public cMenuSetupPage { +private: + int newGreetingTime; + int newUseAlternateGreeting; +protected: + virtual void Store(void); +public: + cMenuSetupHello(void); + }; + +cMenuSetupHello::cMenuSetupHello(void) +{ + newGreetingTime = GreetingTime; + newUseAlternateGreeting = UseAlternateGreeting; + Add(new cMenuEditIntItem( tr("Greeting time (s)"), &newGreetingTime)); + Add(new cMenuEditBoolItem(tr("Use alternate greeting"), &newUseAlternateGreeting)); +} + +void cMenuSetupHello::Store(void) +{ + SetupStore("GreetingTime", GreetingTime = newGreetingTime); + SetupStore("UseAlternateGreeting", UseAlternateGreeting = newUseAlternateGreeting); +} + +// --- cPluginHello ---------------------------------------------------------- + cPluginHello::cPluginHello(void) { // Initialize any member varaiables here. @@ -86,20 +119,24 @@ void cPluginHello::Start(void) cOsdMenu *cPluginHello::MainMenuAction(void) { // Perform the action when selected from the main VDR menu. - Interface->Info(tr("Hello world!")); + Interface->Confirm(UseAlternateGreeting ? tr("Howdy folks!") : tr("Hello world!"), GreetingTime); return NULL; } cMenuSetupPage *cPluginHello::SetupMenu(void) { // Return a setup menu in case the plugin supports one. - return NULL; + return new cMenuSetupHello; } bool cPluginHello::SetupParse(const char *Name, const char *Value) { // Parse your own setup parameters and store their values. - return false; + if (!strcasecmp(Name, "GreetingTime")) GreetingTime = atoi(Value); + else if (!strcasecmp(Name, "UseAlternateGreeting")) UseAlternateGreeting = atoi(Value); + else + return false; + return true; } VDRPLUGINCREATOR(cPluginHello); // Don't touch this! diff --git a/PLUGINS/src/hello/i18n.c b/PLUGINS/src/hello/i18n.c index 70617421..a4dec4ca 100644 --- a/PLUGINS/src/hello/i18n.c +++ b/PLUGINS/src/hello/i18n.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: i18n.c 1.1 2002/05/09 15:13:31 kls Exp $ + * $Id: i18n.c 1.2 2002/05/11 14:13:53 kls Exp $ */ #include "i18n.h" @@ -35,6 +35,19 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO }, + { "Howdy folks!", + "Tach zusammen!", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, { "A friendly greeting", "Ein freundlicher Gruß", "",// TODO @@ -48,5 +61,31 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO }, + { "Greeting time (s)", + "Dauer des Grußes (s)", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "Use alternate greeting", + "Alternativen Gruß verwenden", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, { NULL } }; |