summaryrefslogtreecommitdiff
path: root/file.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 /file.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 'file.c')
-rw-r--r--file.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/file.c b/file.c
new file mode 100644
index 0000000..083384d
--- /dev/null
+++ b/file.c
@@ -0,0 +1,44 @@
+/*
+ * $Id: file.c,v 1.1 2004/06/02 20:43:05 lordjaxom Exp $
+ */
+
+#include "file.h"
+#include <unistd.h>
+
+cText2SkinFile::cText2SkinFile(const char *Skin) {
+ mSkin = Skin;
+}
+
+cText2SkinFile::~cText2SkinFile() {
+}
+
+bool cText2SkinFile::Load(const string &Filename) {
+ bool result = true;
+ if (access(Filename.c_str(), F_OK) == 0) {
+ isyslog("text2skin: loading %s", Filename.c_str());
+ FILE *f = fopen(Filename.c_str(), "r");
+ if (f) {
+ int line = 0;
+ char buffer[MAXPARSEBUFFER];
+ result = true;
+ while (fgets(buffer, sizeof(buffer), f) > 0) {
+ line++;
+ char *ptr = skipspace(stripspace(buffer));
+ if (!isempty(ptr) && ptr[0] != '#') {
+ if (!Parse(ptr)) {
+ esyslog("ERROR: error in %s, line %d\n", Filename.c_str(), line);
+ result = false;
+ break;
+ }
+ }
+ }
+ fclose(f);
+ } else {
+ LOG_ERROR_STR(Filename.c_str());
+ result = false;
+ }
+ }
+ return result;
+}
+
+