2014-09-27 09:25:14 +02:00
|
|
|
#ifndef __TEMPLATEVIEW_H
|
|
|
|
#define __TEMPLATEVIEW_H
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include "templateviewelement.h"
|
|
|
|
#include "templateviewlist.h"
|
2015-02-12 18:50:58 +01:00
|
|
|
#include "templateviewgrid.h"
|
2014-09-27 09:25:14 +02:00
|
|
|
#include "templatepixmap.h"
|
|
|
|
#include "templateviewtab.h"
|
|
|
|
#include "templatefunction.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
// --- cTemplateView -------------------------------------------------------------
|
|
|
|
|
|
|
|
enum eSubView {
|
|
|
|
svUndefined,
|
|
|
|
svMenuDefault,
|
|
|
|
svMenuMain,
|
|
|
|
svMenuSetup,
|
|
|
|
svMenuSchedules,
|
|
|
|
svMenuTimers,
|
|
|
|
svMenuRecordings,
|
|
|
|
svMenuChannels,
|
|
|
|
svMenuDetailedEpg,
|
|
|
|
svMenuDetailedRecording,
|
2014-11-15 09:47:22 +01:00
|
|
|
svMenuDetailedText,
|
|
|
|
svMenuPlugin,
|
2014-09-27 09:25:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class cTemplateView {
|
|
|
|
private:
|
|
|
|
protected:
|
|
|
|
cGlobals *globals;
|
|
|
|
//view parameters
|
|
|
|
string viewName;
|
|
|
|
cTemplateFunction *parameters;
|
|
|
|
int containerX;
|
|
|
|
int containerY;
|
|
|
|
int containerWidth;
|
|
|
|
int containerHeight;
|
|
|
|
//basic view data structures
|
|
|
|
map < eViewElement, cTemplateViewElement* > viewElements;
|
|
|
|
map < eViewList, cTemplateViewList* > viewLists;
|
2015-02-12 18:50:58 +01:00
|
|
|
map < int, cTemplateViewGrid* > viewGrids;
|
2014-09-27 09:25:14 +02:00
|
|
|
map < eSubView, cTemplateView* > subViews;
|
|
|
|
vector< cTemplateViewTab* > viewTabs;
|
2014-11-15 09:47:22 +01:00
|
|
|
map < string, map< int, cTemplateView*> > pluginViews;
|
2014-09-27 09:25:14 +02:00
|
|
|
//helpers to iterate data structures
|
|
|
|
map < eViewElement, cTemplateViewElement* >::iterator veIt;
|
|
|
|
map < eViewList, cTemplateViewList* >::iterator vlIt;
|
2015-03-20 16:43:20 +01:00
|
|
|
map < int, cTemplateViewGrid* >::iterator geIt;
|
2014-09-27 09:25:14 +02:00
|
|
|
map < eSubView, cTemplateView* >::iterator svIt;
|
|
|
|
vector< cTemplateViewTab* >::iterator vtIt;
|
|
|
|
//helpers to check valid xml templates
|
|
|
|
set<string> subViewsAllowed;
|
|
|
|
set<string> viewElementsAllowed;
|
|
|
|
set<string> viewListsAllowed;
|
2015-02-12 18:50:58 +01:00
|
|
|
set<string> viewGridsAllowed;
|
2014-09-27 09:25:14 +02:00
|
|
|
map < string, set < string > > funcsAllowed;
|
|
|
|
void SetFunctionDefinitions(void);
|
|
|
|
public:
|
|
|
|
cTemplateView(void);
|
|
|
|
virtual ~cTemplateView(void);
|
|
|
|
virtual string GetSubViewName(eSubView sv) { return ""; };
|
|
|
|
virtual string GetViewElementName(eViewElement ve) { return ""; };
|
|
|
|
virtual string GetViewListName(eViewList vl) { return ""; };
|
2014-11-15 09:47:22 +01:00
|
|
|
virtual void AddSubView(string sSubView, cTemplateView *subView) {};
|
|
|
|
virtual void AddPluginView(string plugName, int templNo, cTemplateView *plugView) {};
|
2014-11-29 11:23:54 +01:00
|
|
|
virtual void AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {};
|
2015-02-12 18:50:58 +01:00
|
|
|
virtual void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes) {};
|
2014-09-27 09:25:14 +02:00
|
|
|
virtual void AddViewList(string sViewList, cTemplateViewList *viewList) {};
|
|
|
|
virtual void AddViewTab(cTemplateViewTab *viewTab) {};
|
|
|
|
//Setter Functions
|
|
|
|
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
|
|
|
void SetParameters(vector<pair<string, string> > ¶ms);
|
|
|
|
void SetContainer(int x, int y, int width, int height);
|
|
|
|
//access view elements
|
|
|
|
cTemplateViewElement *GetViewElement(eViewElement ve);
|
|
|
|
void InitViewElementIterator(void);
|
|
|
|
cTemplateViewElement *GetNextViewElement(void);
|
2015-02-12 18:50:58 +01:00
|
|
|
//access view grids
|
|
|
|
cTemplateViewGrid *GetViewGrid(int gridID);
|
2015-03-20 16:43:20 +01:00
|
|
|
void InitViewGridIterator(void);
|
|
|
|
cTemplateViewGrid *GetNextViewGrid(void);
|
2014-09-27 09:25:14 +02:00
|
|
|
//access list elements
|
|
|
|
cTemplateViewList *GetViewList(eViewList vl);
|
|
|
|
void InitViewListIterator(void);
|
|
|
|
cTemplateViewList *GetNextViewList(void);
|
2014-11-15 09:47:22 +01:00
|
|
|
bool IsListView(void) { return viewLists.size() > 0 ? true : false; };
|
2014-09-27 09:25:14 +02:00
|
|
|
//access tabs
|
|
|
|
void InitViewTabIterator(void);
|
|
|
|
cTemplateViewTab *GetNextViewTab(void);
|
|
|
|
//access sub views
|
|
|
|
cTemplateView *GetSubView(eSubView sv);
|
|
|
|
void InitSubViewIterator(void);
|
|
|
|
cTemplateView *GetNextSubView(void);
|
2014-11-15 09:47:22 +01:00
|
|
|
//access plugin views
|
|
|
|
cTemplateView *GetPluginView(string pluginName, int pluginMenu);
|
2014-09-27 09:25:14 +02:00
|
|
|
//Getter Functions
|
|
|
|
const char *GetViewName(void) { return viewName.c_str(); };
|
|
|
|
int GetNumericParameter(eParamType type);
|
|
|
|
cRect GetOsdSize(void);
|
|
|
|
int GetNumPixmaps(void);
|
|
|
|
int GetNumPixmapsViewElement(eViewElement ve);
|
2015-03-15 18:11:07 +01:00
|
|
|
bool HideView(void);
|
2015-03-13 18:00:39 +01:00
|
|
|
bool ExecuteView(eViewElement ve);
|
2014-09-27 09:25:14 +02:00
|
|
|
int GetNumListViewMenuItems(void);
|
|
|
|
bool GetScalingWindow(cRect &scalingWindow);
|
2015-01-24 10:47:47 +01:00
|
|
|
map<string,string> GetCustomStringTokens(void) { return globals->GetCustomStringTokens(); };
|
|
|
|
map<string,int> GetCustomIntTokens(void) { return globals->GetCustomIntTokens(); };
|
2014-09-27 09:25:14 +02:00
|
|
|
//Checks for parsing template XML files
|
|
|
|
bool ValidSubView(const char *subView);
|
|
|
|
bool ValidViewElement(const char *viewElement);
|
2015-02-12 18:50:58 +01:00
|
|
|
bool ValidViewList(const char *viewList);
|
|
|
|
bool ValidViewGrid(const char *viewGrid);
|
2014-09-27 09:25:14 +02:00
|
|
|
bool ValidFunction(const char *func);
|
|
|
|
bool ValidAttribute(const char *func, const char *att);
|
|
|
|
//Caching
|
|
|
|
void Translate(void);
|
|
|
|
void PreCache(bool isSubview);
|
|
|
|
//Debug
|
|
|
|
void Debug(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- cTemplateViewChannel -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cTemplateViewChannel : public cTemplateView {
|
|
|
|
private:
|
|
|
|
void SetViewElements(void);
|
|
|
|
void SetViewLists(void);
|
|
|
|
public:
|
|
|
|
cTemplateViewChannel(void);
|
|
|
|
virtual ~cTemplateViewChannel(void);
|
|
|
|
string GetViewElementName(eViewElement ve);
|
2014-11-29 11:23:54 +01:00
|
|
|
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
2014-09-27 09:25:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// --- cTemplateViewMenu -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cTemplateViewMenu : public cTemplateView {
|
|
|
|
private:
|
|
|
|
void SetSubViews(void);
|
|
|
|
void SetViewElements(void);
|
|
|
|
void SetViewLists(void);
|
|
|
|
public:
|
|
|
|
cTemplateViewMenu(void);
|
|
|
|
virtual ~cTemplateViewMenu(void);
|
|
|
|
string GetSubViewName(eSubView sv);
|
|
|
|
string GetViewElementName(eViewElement ve);
|
|
|
|
string GetViewListName(eViewList vl);
|
|
|
|
void AddSubView(string sSubView, cTemplateView *subView);
|
2014-11-15 09:47:22 +01:00
|
|
|
void AddPluginView(string plugName, int templNo, cTemplateView *plugView);
|
2014-11-29 11:23:54 +01:00
|
|
|
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
2014-09-27 09:25:14 +02:00
|
|
|
void AddViewList(string sViewList, cTemplateViewList *viewList);
|
|
|
|
void AddViewTab(cTemplateViewTab *viewTab);
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- cTemplateViewMessage -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cTemplateViewMessage : public cTemplateView {
|
|
|
|
private:
|
|
|
|
void SetViewElements(void);
|
|
|
|
public:
|
|
|
|
cTemplateViewMessage(void);
|
|
|
|
virtual ~cTemplateViewMessage(void);
|
|
|
|
string GetViewElementName(eViewElement ve);
|
2014-11-29 11:23:54 +01:00
|
|
|
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
2014-09-27 09:25:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// --- cTemplateViewReplay -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cTemplateViewReplay : public cTemplateView {
|
|
|
|
private:
|
|
|
|
void SetViewElements(void);
|
|
|
|
public:
|
|
|
|
cTemplateViewReplay(void);
|
|
|
|
virtual ~cTemplateViewReplay(void);
|
|
|
|
string GetViewElementName(eViewElement ve);
|
2014-11-29 11:23:54 +01:00
|
|
|
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
2014-09-27 09:25:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// --- cTemplateViewVolume -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cTemplateViewVolume : public cTemplateView {
|
|
|
|
private:
|
|
|
|
void SetViewElements(void);
|
|
|
|
public:
|
|
|
|
cTemplateViewVolume(void);
|
|
|
|
virtual ~cTemplateViewVolume(void);
|
|
|
|
string GetViewElementName(eViewElement ve);
|
2014-11-29 11:23:54 +01:00
|
|
|
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
2014-09-27 09:25:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// --- cTemplateViewAudioTracks -------------------------------------------------------------
|
|
|
|
|
|
|
|
class cTemplateViewAudioTracks : public cTemplateView {
|
|
|
|
private:
|
|
|
|
void SetViewElements(void);
|
|
|
|
void SetViewLists(void);
|
|
|
|
public:
|
|
|
|
cTemplateViewAudioTracks(void);
|
|
|
|
virtual ~cTemplateViewAudioTracks(void);
|
|
|
|
string GetViewElementName(eViewElement ve);
|
|
|
|
string GetViewListName(eViewList vl);
|
2014-11-29 11:23:54 +01:00
|
|
|
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
2014-09-27 09:25:14 +02:00
|
|
|
void AddViewList(string sViewList, cTemplateViewList *viewList);
|
|
|
|
};
|
|
|
|
|
2015-03-12 17:28:35 +01:00
|
|
|
// --- cTemplateViewPlugin -------------------------------------------------------------
|
2015-02-12 18:50:58 +01:00
|
|
|
|
|
|
|
class cTemplateViewPlugin : public cTemplateView {
|
|
|
|
private:
|
|
|
|
string pluginName;
|
|
|
|
int viewID;
|
|
|
|
public:
|
|
|
|
cTemplateViewPlugin(string pluginName, int viewID);
|
|
|
|
virtual ~cTemplateViewPlugin(void);
|
2015-03-12 17:28:35 +01:00
|
|
|
void AddSubView(string sSubView, cTemplateView *subView);
|
2015-02-12 18:50:58 +01:00
|
|
|
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
|
|
|
void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes);
|
2015-03-12 17:28:35 +01:00
|
|
|
void AddViewTab(cTemplateViewTab *viewTab);
|
2015-02-12 18:50:58 +01:00
|
|
|
};
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
#endif //__TEMPLATEVIEW_H
|