2015-01-19 09:23:15 +01:00
|
|
|
#ifndef __SKINSETUP_H
|
|
|
|
#define __SKINSETUP_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <sstream>
|
|
|
|
#include <vdr/plugin.h>
|
|
|
|
#include <libxml/xmlstring.h>
|
2015-01-19 10:50:22 +01:00
|
|
|
#include "../libtemplate/globals.h"
|
2015-01-19 09:23:15 +01:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2015-01-20 09:29:16 +01:00
|
|
|
enum eSetupParameterType {
|
|
|
|
sptInt,
|
|
|
|
sptBool,
|
|
|
|
sptUnknown
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- cSkinSetupParameter -----------------------------------------------------------
|
|
|
|
|
|
|
|
class cSkinSetupParameter {
|
|
|
|
private:
|
|
|
|
public:
|
|
|
|
cSkinSetupParameter(void);
|
|
|
|
virtual ~cSkinSetupParameter(void) {};
|
|
|
|
eSetupParameterType type;
|
|
|
|
string name;
|
|
|
|
string displayText;
|
|
|
|
int min;
|
|
|
|
int max;
|
|
|
|
int value;
|
|
|
|
void Debug(void);
|
|
|
|
};
|
|
|
|
|
2015-01-31 11:46:06 +01:00
|
|
|
// --- cSkinSetupMenu -----------------------------------------------------------
|
|
|
|
|
|
|
|
class cSkinSetupMenu {
|
|
|
|
private:
|
|
|
|
string name;
|
|
|
|
string displayText;
|
|
|
|
cSkinSetupMenu *parent;
|
|
|
|
vector < cSkinSetupMenu* > subMenus;
|
|
|
|
vector < cSkinSetupMenu* >::iterator subMenuIt;
|
2015-05-30 16:43:59 +02:00
|
|
|
vector < cSkinSetupParameter* > parameters;
|
|
|
|
vector < cSkinSetupParameter* >::iterator paramIt;
|
2015-01-31 11:46:06 +01:00
|
|
|
public:
|
|
|
|
cSkinSetupMenu(void);
|
|
|
|
virtual ~cSkinSetupMenu(void);
|
|
|
|
void SetName(string name) { this->name = name; };
|
|
|
|
void SetDisplayText(string displayText) { this->displayText = displayText; };
|
|
|
|
string GetName(void) { return name; };
|
|
|
|
string GetDisplayText(void) { return displayText; };
|
|
|
|
void SetParent(cSkinSetupMenu *p) { parent = p; };
|
|
|
|
cSkinSetupMenu *GetParent(void) { return parent; };
|
|
|
|
void AddSubMenu(cSkinSetupMenu *sub) { subMenus.push_back(sub); };
|
|
|
|
void SetParameter(eSetupParameterType paramType, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value);
|
|
|
|
void InitIterators(void);
|
|
|
|
void InitParameterIterator(void) { paramIt = parameters.begin(); };
|
|
|
|
cSkinSetupParameter *GetNextParameter(bool deep = true);
|
|
|
|
cSkinSetupParameter *GetParameter(string name);
|
|
|
|
void InitSubmenuIterator(void) { subMenuIt = subMenus.begin(); };
|
|
|
|
cSkinSetupMenu *GetNextSubMenu(bool deep = true);
|
|
|
|
cSkinSetupMenu *GetMenu(string &name);
|
|
|
|
void Debug(bool deep = true);
|
|
|
|
};
|
|
|
|
|
2015-01-19 09:23:15 +01:00
|
|
|
// --- cSkinSetup -----------------------------------------------------------
|
|
|
|
|
|
|
|
class cSkinSetup {
|
|
|
|
private:
|
2015-01-31 11:46:06 +01:00
|
|
|
string skin;
|
|
|
|
cSkinSetupMenu *rootMenu;
|
|
|
|
cSkinSetupMenu *currentMenu;
|
|
|
|
map < string, map< string, string > > translations;
|
2015-01-20 09:29:16 +01:00
|
|
|
string DoTranslate(string token);
|
|
|
|
bool Translate(string text, string &translation);
|
2015-01-19 09:23:15 +01:00
|
|
|
public:
|
|
|
|
cSkinSetup(string skin);
|
2015-01-20 09:29:16 +01:00
|
|
|
virtual ~cSkinSetup(void);
|
2015-01-19 10:50:22 +01:00
|
|
|
bool ReadFromXML(void);
|
2015-01-31 11:46:06 +01:00
|
|
|
void SetSubMenu(xmlChar *name, xmlChar *displayText);
|
|
|
|
void SubMenuDone(void);
|
2015-01-19 09:23:15 +01:00
|
|
|
void SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value);
|
2015-01-31 11:46:06 +01:00
|
|
|
void InitParameterIterator(void) { rootMenu->InitIterators(); };
|
|
|
|
cSkinSetupParameter *GetNextParameter(void);
|
|
|
|
cSkinSetupParameter *GetParameter(string name);
|
2015-01-19 10:50:22 +01:00
|
|
|
void SetTranslation(string translationToken, map < string, string > transl);
|
|
|
|
void AddToGlobals(cGlobals *globals);
|
2015-01-20 09:29:16 +01:00
|
|
|
void TranslateSetup(void);
|
|
|
|
string GetSkin(void) { return skin; };
|
2015-01-31 11:46:06 +01:00
|
|
|
cSkinSetupMenu *GetMenu(string &name);
|
2015-01-19 09:23:15 +01:00
|
|
|
void Debug(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__SKINSETUP_H
|