diff options
author | lordjaxom <lordjaxom> | 2004-05-23 00:35:46 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2004-05-23 00:35:46 +0000 |
commit | d309055320433e5fd899de53dc688d679609e6db (patch) | |
tree | ee3c3c97b3881f1e35e0da745b9571d11c0b6ac2 /loader.c | |
download | vdr-plugin-text2skin-d309055320433e5fd899de53dc688d679609e6db.tar.gz vdr-plugin-text2skin-d309055320433e5fd899de53dc688d679609e6db.tar.bz2 |
- Initial revision.v0.0.1-pre1
Diffstat (limited to 'loader.c')
-rw-r--r-- | loader.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/loader.c b/loader.c new file mode 100644 index 0000000..c5d71af --- /dev/null +++ b/loader.c @@ -0,0 +1,79 @@ +/* + * $Id: loader.c,v 1.1.1.1 2004/05/23 00:08:03 lordjaxom Exp $ + */ + +#include <vdr/plugin.h> +#include "loader.h" +#include "data.h" +#include "display.h" +#include "common.h" +#include <sys/types.h> +#include <dirent.h> + +static cTheme Theme; + +void cText2SkinLoader::Start(void) { + DIR *d = opendir(SkinPath()); + if (d) { + struct dirent *ent; + while ((ent = readdir(d)) != NULL) { + char *path; + struct stat buf; + if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) + continue; + asprintf(&path, "%s/%s", SkinPath(), ent->d_name); + if (stat(path, &buf) == 0 && S_ISDIR(buf.st_mode)) + Load(ent->d_name); + free(path); + } + closedir(d); + } +} + +void cText2SkinLoader::Load(const char *Skin) { + char *skinfile; + struct stat buf; + asprintf(&skinfile, "%s/%s/%s.skin", SkinPath(), Skin, Skin); + if (stat(skinfile, &buf) == 0) { + cText2SkinData *data = new cText2SkinData(Skin); + if (data->Load(skinfile)) { + cText2SkinItem *skin = data->Get(itemSkin); + if (skin) { + new cText2SkinLoader(data, Skin, skin->Name()); + return; + } else + esyslog("ERROR: Item=Skin is missing in Skin\n"); + } + delete data; + } else + esyslog("ERROR: text2skin: %s/%s is not a valid skin directory\n", SkinPath(), Skin); +} + +cText2SkinLoader::cText2SkinLoader(cText2SkinData *Data, const char *Skin, const char *Description): cSkin(Skin, &::Theme) { + mData = Data; + mDescription = Description; +} + +cText2SkinLoader::~cText2SkinLoader() { + delete mData; + // mDescription is part of mData +} + +cSkinDisplayChannel *cText2SkinLoader::DisplayChannel(bool WithInfo) { + return new cText2SkinDisplayChannel(mData, WithInfo); +} + +cSkinDisplayMenu *cText2SkinLoader::DisplayMenu(void) { + return new cText2SkinDisplayMenu(mData); +} + +cSkinDisplayVolume *cText2SkinLoader::DisplayVolume(void) { + return new cText2SkinDisplayVolume(mData); +} + +cSkinDisplayReplay *cText2SkinLoader::DisplayReplay(bool ModeOnly) { + return new cText2SkinDisplayReplay(mData, ModeOnly); +} +cSkinDisplayMessage *cText2SkinLoader::DisplayMessage(void) { + return new cText2SkinDisplayMessage(mData); +} |