From 51eb880da0365236e6a08aca3b1d84b14f6294b3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 11 May 2002 13:44:58 +0200 Subject: Improved implementation of setup menus for plugins --- menuitems.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'menuitems.c') diff --git a/menuitems.c b/menuitems.c index d09f5b70..3a6f94ea 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,12 +4,13 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 1.1 2002/05/09 10:10:12 kls Exp $ + * $Id: menuitems.c 1.2 2002/05/11 10:49:45 kls Exp $ */ #include "menuitems.h" #include #include "i18n.h" +#include "plugin.h" // --- cMenuEditItem --------------------------------------------------------- @@ -437,15 +438,13 @@ eOSState cMenuTextItem::ProcessKey(eKeys Key) cMenuSetupPage::cMenuSetupPage(void) :cOsdMenu("", 33) { - data = Setup; - osdLanguage = Setup.OSDLanguage; + plugin = NULL; } -void cMenuSetupPage::SetupTitle(const char *s) +void cMenuSetupPage::SetSection(const char *Section) { - char buf[40]; // can't call tr() for more than one string at a time! - char *q = buf + snprintf(buf, sizeof(buf), "%s - ", tr("Setup")); - snprintf(q, sizeof(buf) - strlen(buf), "%s", tr(s)); + char buf[40]; + snprintf(buf, sizeof(buf), "%s - %s", tr("Setup"), Section); SetTitle(buf); } @@ -455,22 +454,31 @@ eOSState cMenuSetupPage::ProcessKey(eKeys Key) if (state == osUnknown) { switch (Key) { - case kOk: state = (Setup.PrimaryDVB != data.PrimaryDVB) ? osSwitchDvb : osBack; - cDvbApi::PrimaryDvbApi->SetVideoFormat(data.VideoFormat ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3); - Setup = data; - Setup.Save(); - cDvbApi::SetCaCaps(); + case kOk: Store(); + state = osBack; break; default: break; } } - if (data.OSDLanguage != osdLanguage) { - int OriginalOSDLanguage = Setup.OSDLanguage; - Setup.OSDLanguage = data.OSDLanguage; - Set(); - Display(); - osdLanguage = data.OSDLanguage; - Setup.OSDLanguage = OriginalOSDLanguage; - } return state; } + +void cMenuSetupPage::SetPlugin(cPlugin *Plugin) +{ + plugin = Plugin; + char buf[40]; + snprintf(buf, sizeof(buf), "%s '%s'", tr("Plugin"), plugin->Name()); + SetSection(buf); +} + +void cMenuSetupPage::SetupStore(const char *Name, const char *Value = NULL) +{ + if (plugin) + plugin->SetupStore(Name, Value); +} + +void cMenuSetupPage::SetupStore(const char *Name, int Value) +{ + if (plugin) + plugin->SetupStore(Name, Value); +} -- cgit v1.2.3