summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-01-17 13:16:44 +0100
committerlouis <louis.braun@gmx.de>2013-01-17 13:16:44 +0100
commit47c3fea545a1b4607deda1e7d2fa51cbcf89a656 (patch)
tree4109469360bfb71ce467c240a33d0738ad44c18e /config.c
downloadvdr-plugin-tvguide-47c3fea545a1b4607deda1e7d2fa51cbcf89a656.tar.gz
vdr-plugin-tvguide-47c3fea545a1b4607deda1e7d2fa51cbcf89a656.tar.bz2
Initial push tvguide 0.0.1
Diffstat (limited to 'config.c')
-rw-r--r--config.c176
1 files changed, 176 insertions, 0 deletions
diff --git a/config.c b/config.c
new file mode 100644
index 0000000..229f8aa
--- /dev/null
+++ b/config.c
@@ -0,0 +1,176 @@
+#include "config.h"
+
+enum {
+ e12Hours,
+ e24Hours
+};
+
+cTvguideConfig::cTvguideConfig() {
+ osdWidth = 0;
+ osdHeight = 0;
+ colWidth = 0;
+ channelCols = 5;
+ displayTime = 160;
+ minuteHeight = 0;
+ timeColWidth = 120;
+ headerHeight = 120;
+ footerHeight = 80;
+ stepMinutes = 30;
+ bigStepHours = 3;
+ hugeStepHours = 24;
+ jumpChannels = 5;
+ hideChannelLogos = 0;
+ logoWidth = 130;
+ logoHeight = 73;
+ logoExtension = 0;
+ hideEpgImages = 0;
+ epgImageWidth = 315;
+ epgImageHeight = 240;
+ fontIndex = 0;
+ fontNameDefault = "VDRSymbols Sans:Book";
+ fontHeaderSize = 33;
+ fontGridSize = 27;
+ fontGridSmallSize = 24;
+ fontTimeLineWeekdaySize = 40;
+ fontTimeLineDateSize = 33;
+ fontTimeLineTimeSize = 0;
+ fontTimeLineTimeSizeDef12 = 24;
+ fontTimeLineTimeSizeDef24 = 33;
+ fontButtonSize = 33;
+ fontDetailViewSize = 33;
+ fontDetailHeaderSize = 40;
+ fontMessageBoxSize = 33;
+ fontMessageBoxLargeSize = 40;
+
+
+ FontHeader = NULL;
+ FontGrid = NULL;
+ FontGridSmall = NULL;
+ FontTimeLineWeekday = NULL;
+ FontTimeLineDate = NULL;
+ FontTimeLineTime = NULL;
+ FontButton = NULL;
+ FontDetailView = NULL;
+ FontDetailHeader = NULL;
+ FontMessageBox = NULL;
+ FontMessageBoxLarge = NULL;
+
+ timeFormat = 1;
+ themeIndex = 0;
+ useBlending = 1;
+ roundedCorners = 0;
+}
+
+cTvguideConfig::~cTvguideConfig() {
+ delete FontHeader;
+ delete FontGrid;
+ delete FontGridSmall;
+ delete FontTimeLineWeekday;
+ delete FontTimeLineDate;
+ delete FontTimeLineTime;
+ delete FontButton;
+ delete FontDetailView;
+ delete FontDetailHeader;
+ delete FontMessageBox;
+ delete FontMessageBoxLarge;
+}
+
+void cTvguideConfig::setDynamicValues(int width, int height) {
+ osdWidth = width;
+ osdHeight = height;
+ colWidth = (osdWidth - timeColWidth) / channelCols;
+ minuteHeight = (osdHeight - headerHeight - footerHeight) / displayTime;
+
+ if (!fontTimeLineTimeSize) {
+ if (timeFormat == e12Hours) {
+ fontTimeLineTimeSize = fontTimeLineTimeSizeDef12;
+ } else if (timeFormat == e24Hours) {
+ fontTimeLineTimeSize = fontTimeLineTimeSizeDef24;
+ }
+ } else if ((fontTimeLineTimeSize == fontTimeLineTimeSizeDef12) && (timeFormat == e24Hours)) {
+ fontTimeLineTimeSize = fontTimeLineTimeSizeDef24;
+ } else if ((fontTimeLineTimeSize == fontTimeLineTimeSizeDef24) && (timeFormat == e12Hours)) {
+ fontTimeLineTimeSize = fontTimeLineTimeSizeDef12;
+ }
+ cString fontname;
+ if (fontIndex == 0) {
+ fontname = fontNameDefault;
+ } else {
+ cStringList availableFonts;
+ cFont::GetAvailableFontNames(&availableFonts);
+ if (availableFonts[fontIndex-1]) {
+ fontname = availableFonts[fontIndex-1];
+ } else
+ fontname = fontNameDefault;
+ }
+ cFont *test = NULL;
+ test = cFont::CreateFont(*fontname, fontHeaderSize);
+ if (!test) {
+ fontname = DefaultFontSml;
+ }
+ delete test;
+ FontHeader = cFont::CreateFont(*fontname, fontHeaderSize);
+ FontGrid = cFont::CreateFont(*fontname, fontGridSize);
+ FontGridSmall = cFont::CreateFont(*fontname, fontGridSmallSize);
+ FontTimeLineWeekday = cFont::CreateFont(*fontname, fontTimeLineWeekdaySize);
+ FontTimeLineDate = cFont::CreateFont(*fontname, fontTimeLineDateSize);
+ FontTimeLineTime = cFont::CreateFont(*fontname, fontTimeLineTimeSize);
+ FontButton = cFont::CreateFont(*fontname, fontButtonSize);
+ FontDetailView = cFont::CreateFont(*fontname, fontDetailViewSize);
+ FontDetailHeader = cFont::CreateFont(*fontname, fontDetailHeaderSize);
+ FontMessageBox = cFont::CreateFont(*fontname, fontMessageBoxSize);
+ FontMessageBoxLarge = cFont::CreateFont(*fontname, fontMessageBoxLargeSize);
+}
+
+void cTvguideConfig::SetLogoPath(cString path) {
+ logoPath = path;
+}
+
+void cTvguideConfig::SetImagesPath(cString path) {
+ epgImagePath = path;
+}
+
+void cTvguideConfig::loadTheme() {
+ cThemes themes;
+ themes.Load(*cString("tvguide"));
+ const char *FileName = themes.FileName(themeIndex);
+ if (access(FileName, F_OK) == 0) {
+ ::theme.Load(FileName);
+ }
+}
+
+bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
+ if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
+ else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value);
+ else if (strcmp(Name, "useBlending") == 0) useBlending = atoi(Value);
+ else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value);
+ else if (strcmp(Name, "channelCols") == 0) channelCols = atoi(Value);
+ else if (strcmp(Name, "displayTime") == 0) displayTime = atoi(Value);
+ else if (strcmp(Name, "hideChannelLogos") == 0) hideChannelLogos = atoi(Value);
+ else if (strcmp(Name, "logoExtension") == 0) logoExtension = atoi(Value);
+ else if (strcmp(Name, "logoWidth") == 0) logoWidth = atoi(Value);
+ else if (strcmp(Name, "logoHeight") == 0) logoHeight = atoi(Value);
+ else if (strcmp(Name, "bigStepHours") == 0) bigStepHours = atoi(Value);
+ else if (strcmp(Name, "hugeStepHours") == 0) hugeStepHours = atoi(Value);
+ else if (strcmp(Name, "jumpChannels") == 0) jumpChannels = atoi(Value);
+ else if (strcmp(Name, "hideEpgImages") == 0) hideEpgImages = atoi(Value);
+ else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value);
+ else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value);
+ else if (strcmp(Name, "timeColWidth") == 0) timeColWidth = atoi(Value);
+ else if (strcmp(Name, "headerHeight") == 0) headerHeight = atoi(Value);
+ else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value);
+ else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value);
+ else if (strcmp(Name, "fontHeaderSize") == 0) fontHeaderSize = atoi(Value);
+ else if (strcmp(Name, "fontGridSize") == 0) fontGridSize = atoi(Value);
+ else if (strcmp(Name, "fontGridSmallSize") == 0) fontGridSmallSize = atoi(Value);
+ else if (strcmp(Name, "fontTimeLineWeekdaySize") == 0) fontTimeLineWeekdaySize = atoi(Value);
+ else if (strcmp(Name, "fontTimeLineDateSize") == 0) fontTimeLineDateSize = atoi(Value);
+ else if (strcmp(Name, "fontTimeLineTimeSize") == 0) fontTimeLineTimeSize = atoi(Value);
+ else if (strcmp(Name, "fontButtonSize") == 0) fontButtonSize = atoi(Value);
+ else if (strcmp(Name, "fontDetailViewSize") == 0) fontDetailViewSize = atoi(Value);
+ else if (strcmp(Name, "fontDetailHeaderSize") == 0) fontDetailHeaderSize = atoi(Value);
+ else if (strcmp(Name, "fontMessageBoxSize") == 0) fontMessageBoxSize = atoi(Value);
+ else if (strcmp(Name, "fontMessageBoxLargeSize") == 0) fontMessageBoxLargeSize = atoi(Value);
+ else return false;
+ return true;
+} \ No newline at end of file