summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-01-09 15:53:59 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2004-01-09 15:53:59 +0100
commit6484771bf61aeabbb0d9fc28e257b50fdf2e205b (patch)
treedc88cf0849cdcdea9d35397a2ae15f9d3b101ad4 /config.c
parentbd38a10ff94787d463bc9a45b1b27d6c502f5c77 (diff)
downloadvdr-6484771bf61aeabbb0d9fc28e257b50fdf2e205b.tar.gz
vdr-6484771bf61aeabbb0d9fc28e257b50fdf2e205b.tar.bz2
Added support for selecting preferred EPG languages
Diffstat (limited to 'config.c')
-rw-r--r--config.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/config.c b/config.c
index 12172900..094d632a 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.118 2004/01/05 11:45:40 kls Exp $
+ * $Id: config.c 1.119 2004/01/06 17:09:54 kls Exp $
*/
#include "config.h"
@@ -259,6 +259,7 @@ cSetup::cSetup(void)
TimeTransponder = 0;
MarginStart = 2;
MarginStop = 10;
+ EPGLanguages[0] = -1;
EPGScanTimeout = 5;
EPGBugfixLevel = 2;
SVDRPTimeout = 300;
@@ -395,6 +396,39 @@ bool cSetup::ParseCaCaps(const char *Value)
return false;
}
+void cSetup::StoreLanguages(const char *Name, int *Values)
+{
+ char buffer[I18nNumLanguages * 4];
+ char *q = buffer;
+ for (int i = 0; i < I18nNumLanguages; i++) {
+ if (Values[i] < 0)
+ break;
+ const char *s = I18nLanguageAbbreviation(Values[i]);
+ if (s) {
+ if (q > buffer)
+ *q++ = ' ';
+ strncpy(q, s, 3);
+ q += 3;
+ }
+ }
+ *q = 0;
+ Store(Name, buffer);
+}
+
+bool cSetup::ParseLanguages(const char *Value, int *Values)
+{
+ int n = 0;
+ while (Value && *Value && n < I18nNumLanguages) {
+ int i = I18nLanguageIndex(Value);
+ if (i >= 0)
+ Values[n++] = i;
+ if ((Value = strchr(Value, ' ')) != NULL)
+ Value++;
+ }
+ Values[n] = -1;
+ return true;
+}
+
bool cSetup::Parse(const char *Name, const char *Value)
{
if (!strcasecmp(Name, "OSDLanguage")) OSDLanguage = atoi(Value);
@@ -412,6 +446,7 @@ bool cSetup::Parse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder = atoi(Value);
else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value);
else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
+ else if (!strcasecmp(Name, "EPGLanguages")) return ParseLanguages(Value, EPGLanguages);
else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
else if (!strcasecmp(Name, "SVDRPTimeout")) SVDRPTimeout = atoi(Value);
@@ -463,6 +498,7 @@ bool cSetup::Save(void)
Store("TimeTransponder", TimeTransponder);
Store("MarginStart", MarginStart);
Store("MarginStop", MarginStop);
+ StoreLanguages("EPGLanguages", EPGLanguages);
Store("EPGScanTimeout", EPGScanTimeout);
Store("EPGBugfixLevel", EPGBugfixLevel);
Store("SVDRPTimeout", SVDRPTimeout);