summaryrefslogtreecommitdiff
path: root/loader.c
diff options
context:
space:
mode:
authorlordjaxom <lordjaxom>2004-06-02 19:56:58 +0000
committerlordjaxom <lordjaxom>2004-06-02 19:56:58 +0000
commite0c2ee1d37c0f213f22a04df71710bebe3526f85 (patch)
tree8bfd3a4fa065abeb016134466523a1152202e597 /loader.c
parente535cdbe09d9c13d79cd6722aafca5798b7d1e35 (diff)
downloadvdr-plugin-text2skin-e0c2ee1d37c0f213f22a04df71710bebe3526f85.tar.gz
vdr-plugin-text2skin-e0c2ee1d37c0f213f22a04df71710bebe3526f85.tar.bz2
- implemented image loading through ImageMagick (fixes crashes when runningv0.0.1-rc4
together with GraphTFT) - implemented Theme support (see file demo.colors in the demo skin) - implemented translations for texts used in skins (see file demo.trans in the demo skin)
Diffstat (limited to 'loader.c')
-rw-r--r--loader.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/loader.c b/loader.c
index 0e07d90..3ec9052 100644
--- a/loader.c
+++ b/loader.c
@@ -1,19 +1,16 @@
/*
- * $Id: loader.c,v 1.5 2004/06/01 21:02:38 lordjaxom Exp $
+ * $Id: loader.c,v 1.6 2004/06/02 20:43:05 lordjaxom Exp $
*/
-#define __STL_CONFIG_H
-#include <vdr/plugin.h>
-#undef __STL_CONFIG_H
#include "loader.h"
#include "data.h"
+#include "i18n.h"
+#include "theme.h"
#include "display.h"
-#include "common.h"
+#include <vdr/plugin.h>
#include <sys/types.h>
#include <dirent.h>
-static cTheme Theme;
-
void cText2SkinLoader::Start(void) {
DIR *d = opendir(SkinPath());
if (d) {
@@ -33,14 +30,26 @@ void cText2SkinLoader::Start(void) {
}
void cText2SkinLoader::Load(const char *Skin) {
- struct stat buf;
- string file = (string)SkinPath() + "/" + Skin + "/" + Skin + ".skin";
- if (stat(file.c_str(), &buf) == 0) {
+ cText2SkinI18n *translations = NULL;
+ string transfile = (string)SkinPath() + "/" + Skin + "/" + Skin + ".trans";
+ if (access(transfile.c_str(), F_OK) == 0) {
+ translations = new cText2SkinI18n(Skin);
+ if (!translations->Load(transfile)) {
+ DELETENULL(translations);
+ }
+ }
+
+ cText2SkinTheme *theme = new cText2SkinTheme(Skin);
+ string themefile = (string)SkinPath() + "/" + Skin + "/" + Skin + ".colors";
+ theme->Load(themefile);
+
+ string skinfile = (string)SkinPath() + "/" + Skin + "/" + Skin + ".skin";
+ if (access(skinfile.c_str(), F_OK) == 0) {
cText2SkinData *data = new cText2SkinData(Skin);
- if (data->Load(file.c_str())) {
- cText2SkinItem *skin = data->Get(itemSkin);
+ if (data->Load(skinfile)) {
+ cText2SkinItem *skin = data->Get(sectionSkin, itemSkin);
if (skin) {
- new cText2SkinLoader(data, Skin, skin->Name());
+ new cText2SkinLoader(data, translations, theme, Skin, skin->Name());
return;
} else
esyslog("ERROR: Item=Skin is missing in Skin\n");
@@ -50,32 +59,37 @@ void cText2SkinLoader::Load(const char *Skin) {
esyslog("ERROR: text2skin: %s/%s is not a valid skin directory\n", SkinPath(), Skin);
}
-cText2SkinLoader::cText2SkinLoader(cText2SkinData *Data, const string &Skin, const string &Description): cSkin(Skin.c_str(), &::Theme) {
+cText2SkinLoader::cText2SkinLoader(cText2SkinData *Data, cText2SkinI18n *I18n, cText2SkinTheme *Theme, const string &Skin, const string &Description): cSkin(Skin.c_str(), Theme->Theme()) {
mData = Data;
+ mI18n = I18n;
+ mTheme = Theme;
mDescription = Description;
}
cText2SkinLoader::~cText2SkinLoader() {
delete mData;
+ delete mI18n;
+ delete mTheme;
// mDescription is part of mData
}
cSkinDisplayChannel *cText2SkinLoader::DisplayChannel(bool WithInfo) {
printf("WithInfo: %d\n", WithInfo);
- return new cText2SkinDisplayChannel(mData, WithInfo);
+ return new cText2SkinDisplayChannel(mData, mI18n, mTheme, WithInfo);
}
cSkinDisplayMenu *cText2SkinLoader::DisplayMenu(void) {
- return new cText2SkinDisplayMenu(mData);
+ return new cText2SkinDisplayMenu(mData, mI18n, mTheme);
}
cSkinDisplayVolume *cText2SkinLoader::DisplayVolume(void) {
- return new cText2SkinDisplayVolume(mData);
+ return new cText2SkinDisplayVolume(mData, mI18n, mTheme);
}
cSkinDisplayReplay *cText2SkinLoader::DisplayReplay(bool ModeOnly) {
- return new cText2SkinDisplayReplay(mData, ModeOnly);
+ return new cText2SkinDisplayReplay(mData, mI18n, mTheme, ModeOnly);
}
+
cSkinDisplayMessage *cText2SkinLoader::DisplayMessage(void) {
- return new cText2SkinDisplayMessage(mData);
+ return new cText2SkinDisplayMessage(mData, mI18n, mTheme);
}