added possibility to hide root menu from a subview template

This commit is contained in:
louis 2015-03-15 18:11:07 +01:00
parent b6e6065b0f
commit 19dfd1af7b
7 changed files with 34 additions and 2 deletions

View File

@ -214,4 +214,6 @@ Version 0.3.0
- fixed bug detecting menu item numbers in main menu
- fixed recording progress bar in nopacity
- added <systemmemory> viewelement in main menu
- added possibility to hide root menu from a subview template

View File

@ -13,6 +13,7 @@
scaletvy CDATA #IMPLIED
scaletvwidth CDATA #IMPLIED
scaletvheight CDATA #IMPLIED
hideroot CDATA #IMPLIED
>
<!ELEMENT viewelement (area|areascroll)*>

View File

@ -125,6 +125,8 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) {
p.first = ptScaleTvWidth;
} else if (!name.compare("scaletvheight")) {
p.first = ptScaleTvHeight;
} else if (!name.compare("hideroot")) {
p.first = ptHideRoot;
} else if (!name.compare("cache")) {
p.first = ptCache;
} else if (!name.compare("determinatefont")) {
@ -260,6 +262,10 @@ bool cTemplateFunction::CalculateParameters(void) {
break;
case ptOverflow:
paramValid = SetOverflow(value);
break;
case ptHideRoot:
paramValid = SetHideRoot(value);
break;
default:
paramValid = true;
break;
@ -1046,6 +1052,14 @@ bool cTemplateFunction::SetOverflow(string value) {
return ok;
}
bool cTemplateFunction::SetHideRoot(string value) {
bool hideRoot = 0;
if (!value.compare("true"))
hideRoot = 1;
numericParameters.insert(pair<eParamType, int>(ptHideRoot, hideRoot));
return true;
}
void cTemplateFunction::ParseStringParameters(void) {
//first replace stringtokens in Text (drawText)
stringstream text;

View File

@ -76,6 +76,7 @@ enum eParamType {
ptScaleTvY,
ptScaleTvWidth,
ptScaleTvHeight,
ptHideRoot,
ptCache,
ptDeterminateFont,
ptNone
@ -150,6 +151,7 @@ protected:
bool SetOrientation(string value);
bool SetFloating(string value);
bool SetOverflow(string value);
bool SetHideRoot(string value);
void ParseStringParameters(void);
void ParseNumericalParameters(void);
void CalculateAlign(int elementWidth, int elementHeight);

View File

@ -194,6 +194,13 @@ int cTemplateView::GetNumPixmapsViewElement(eViewElement ve) {
return viewElement->GetNumPixmaps();
}
bool cTemplateView::HideView(void) {
if (!parameters)
return false;
return parameters->GetNumericParameter(ptHideRoot);
}
bool cTemplateView::ExecuteView(eViewElement ve) {
map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve);
if (hit == viewElements.end())
@ -1878,6 +1885,7 @@ cTemplateViewPlugin::cTemplateViewPlugin(string pluginName, int viewID) {
attributes.insert("scaletvy");
attributes.insert("scaletvwidth");
attributes.insert("scaletvheight");
attributes.insert("hideroot");
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
//definition of allowed parameters for viewtab

View File

@ -109,6 +109,7 @@ public:
cRect GetOsdSize(void);
int GetNumPixmaps(void);
int GetNumPixmapsViewElement(eViewElement ve);
bool HideView(void);
bool ExecuteView(eViewElement ve);
int GetNumListViewMenuItems(void);
bool GetScalingWindow(cRect &scalingWindow);

View File

@ -34,8 +34,12 @@ bool cDisplayPluginView::createOsd(void) {
void cDisplayPluginView::Deactivate(bool hide) {
Stop();
if (!hide)
if (!hide) {
bool hideFromTemplate = tmplView->HideView();
if (!hideFromTemplate)
return;
esyslog("skindesigner: hiding from template");
}
HidePixmaps();
for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
cViewGrid *viewGrid = it->second;