summaryrefslogtreecommitdiff
path: root/PLUGINS/SRC/hello/hello.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-05-11 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-05-11 18:00:00 +0200
commit803c6c6bf6340302f78171892bef599aa272c266 (patch)
tree01e24d99cf48cd3bed1506ed6727ff385655574e /PLUGINS/SRC/hello/hello.c
parentae8a947367b4be57c9b0ca7bbf0032de0e2018d3 (diff)
downloadvdr-patch-lnbsharing-803c6c6bf6340302f78171892bef599aa272c266.tar.gz
vdr-patch-lnbsharing-803c6c6bf6340302f78171892bef599aa272c266.tar.bz2
Version 1.1.1vdr-1.1.1
- Separated the actual DVB hardware OSD implementation from the abstract OSD interface. 'osdbase.c/.h' now implements the abstract OSD, while 'dvbosd.c/.h' is the actual implementation for the DVB hardware. This is in preparation for allowing additional kinds of OSD hardware implementations. - Fixed leftover references to the file FORMATS in MANUAL and svdrp.c. - Avoiding ambiguities in the cList template class in case one defines a "list of lists" (thanks to Stefan Huelswitt). - Simplified the basic cMenuSetupPage class for easier use in plugins. - Added setup parameters and a Setup menu to the 'hello' plugin example. - Fixed logging error message for unknown config parameters in plugins. - Rearranged cleanup sequence at the end of the main program. - Adapted PLUGINS.html to use the actual code examples from the 'hello' plugin.
Diffstat (limited to 'PLUGINS/SRC/hello/hello.c')
-rw-r--r--PLUGINS/SRC/hello/hello.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/PLUGINS/SRC/hello/hello.c b/PLUGINS/SRC/hello/hello.c
index 5db4f2a..65d03c8 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!