diff options
author | lordjaxom <lordjaxom> | 2004-06-11 15:32:39 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2004-06-11 15:32:39 +0000 |
commit | c73c6b62067cef765a85dd2a19dcc7296b813b2c (patch) | |
tree | 7e340834d60d30a50b682c3e00c6f09eabeacf2e /common.c | |
parent | e0de96fc7168daeaf414fb6196e08969468427d2 (diff) | |
download | vdr-plugin-text2skin-c73c6b62067cef765a85dd2a19dcc7296b813b2c.tar.gz vdr-plugin-text2skin-c73c6b62067cef765a85dd2a19dcc7296b813b2c.tar.bz2 |
- fixed VPSTime which was displayed on channels that didn't even have VPSv0.0.3
- fixed Symbols in channel display when viewing a group
- fixed text translation if no translation is present
- fixed compile error with gcc 3.4 (thanks to Gregoire Favre for reporting this)
- restructured Skin (now the official Skin version is 0.0.2)
it is now possible to control visibility of all items
- added a script to convert 0.0.1 themes to 0.0.2
- added support for animated logos (mng or gif files) ONLY IMAGEMAGICK!!!
- added finnish language translations (thanks to Rolf Ahrenberg)
Diffstat (limited to 'common.c')
-rw-r--r-- | common.c | 66 |
1 files changed, 62 insertions, 4 deletions
@@ -1,11 +1,35 @@ /* - * $Id: common.c,v 1.7 2004/06/05 16:52:44 lordjaxom Exp $ + * $Id: common.c,v 1.8 2004/06/11 15:01:58 lordjaxom Exp $ */ #include "data.h" #include "common.h" #include <vdr/plugin.h> +const string SectionNames[__SECTION_COUNT__] = + { "Skin", "ChannelSmall", "Channel", "Volume", "ReplayMode", "Replay", + "Message", "Menu" }; + +const string ItemNames[__ITEM_COUNT__] = + { "Unknown", "Skin", "Background", "Text", "Scrolltext", "Image", "Rectangle", + "Ellipse", "Slope", "Progress", "Logo", "Symbol", "MenuArea", "MenuItem" }; + +const string DisplayNames[__DISPLAY_COUNT__] = + { "Always", "DateTimeF", "DateTime", "Date", "Time", "ChannelNumberName", + "ChannelNumber", "ChannelName", "Language", "PresentDateTimeF", + "PresentStartTime", "PresentDate", "PresentVPSTime", "PresentEndTime", + "PresentDuration", "PresentVPS", "PresentRunning", "PresentTimer", + "PresentTitle", "PresentShortText", "PresentDescription", + "FollowingStartTime", "FollowingEndTime", "FollowingDuration", + "FollowingTitle", "FollowingShortText", "Teletext", "Audio", "Dolby", + "Encrypted", "Recording", "Radio", "VolumeCurrent", "VolumeTotal", "Mute", + "ReplayTime", "ReplayDuration", "ReplayTitle", "ReplayPrompt", "Play", + "Pause", "FastFwd", "FastRew", "SlowFwd", "SlowRew", "Message", + "MessageStatus", "MessageInfo", "MessageWarning", "MessageError", + "MenuTitle", "MenuRed", "MenuGreen", "MenuYellow", "MenuBlue", "MenuText", + "MenuRecording", "MenuScrollUp", "MenuScrollDown", "MenuItems", + "MenuCurrent", "MenuGroups" }; + const char *SkinPath(void) { return cPlugin::ConfigDirectory(PLUGIN_NAME_I18N); } @@ -44,6 +68,38 @@ string ItemText(cText2SkinItem *Item, const string &Content) { return s; } +bool ParseVar(const char *Text, const char *Name, eSkinItem *Value) { + string value; + if (ParseVar(Text, Name, value)) { + int i; + for (i = 0; i < __ITEM_COUNT__; ++i) { + if (ItemNames[i] == value) { + *Value = (eSkinItem)i; + return true; + } + if (i == __ITEM_COUNT__) + esyslog("ERROR: text2skin: unknown item %s", value.c_str()); + } + } + return false; +} + +bool ParseVar(const char *Text, const char *Name, eSkinDisplay *Value) { + string value; + if (ParseVar(Text, Name, value)) { + int i; + for (i = 0; i < __DISPLAY_COUNT__; ++i) { + if (DisplayNames[i] == value) { + *Value = (eSkinDisplay)i; + return true; + } + if (i == __DISPLAY_COUNT__) + esyslog("ERROR: text2skin: unknown display parameter %s", value.c_str()); + } + } + return false; +} + bool ParseVar(const char *Text, const char *Name, int *Value) { string value; if (ParseVar(Text, Name, value)) { @@ -54,11 +110,13 @@ bool ParseVar(const char *Text, const char *Name, int *Value) { } bool ParseVar(const char *Text, const char *Name, string &Value){ - char *ptr1, *ptr2; + const char *ptr1, *ptr2; char *str; bool res = false; - asprintf(&str, "%s=", Name); - if ((ptr1 = strstr(Text, str))) { + asprintf(&str, ",%s=", Name); + if ((ptr1 = strstr(Text, str)) || (strncmp(ptr1 = Text, str + 1, strlen(str) - 1) == 0)) { + if (ptr1 == Text) + --ptr1; ptr1 += strlen(str); if ((ptr2 = strchr(ptr1, ',')) || (ptr2 = strchr(ptr1, ';'))) { Value = ptr1; |