diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-05-11 13:44:58 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-05-11 13:44:58 +0200 |
commit | 51eb880da0365236e6a08aca3b1d84b14f6294b3 (patch) | |
tree | c05286856f7a422ce95b547935c30ae7fb0ae60e /menuitems.c | |
parent | 0fac78954c1d1afeaa772baa4daa0a6e52e1e0a2 (diff) | |
download | vdr-51eb880da0365236e6a08aca3b1d84b14f6294b3.tar.gz vdr-51eb880da0365236e6a08aca3b1d84b14f6294b3.tar.bz2 |
Improved implementation of setup menus for plugins
Diffstat (limited to 'menuitems.c')
-rw-r--r-- | menuitems.c | 48 |
1 files changed, 28 insertions, 20 deletions
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 <ctype.h> #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); +} |