added viewelement <sortmode> in displaymenu to display the sort mode of the currently displayed menu

This commit is contained in:
louis 2015-03-31 16:08:42 +02:00
parent 43422fac91
commit 203754e204
13 changed files with 175 additions and 19 deletions

View File

@ -248,5 +248,8 @@ Version 0.3.3
- translate drawtextvertical - translate drawtextvertical
- added viewelement <endtime> in displayreplay to display the time - added viewelement <endtime> in displayreplay to display the time
the currently replayed recording ends the currently replayed recording ends
- added viewelement <sortmode> in displaymenu to display the sort
mode of the currently displayed menu. <sortmode> can be used in
any list menu, implementation in displaymenu.xml is default

View File

@ -56,6 +56,12 @@ void cSDDisplayMenu::SetMenuCategory(eMenuCategory MenuCat) {
state = vsMenuInit; state = vsMenuInit;
} }
void cSDDisplayMenu::SetMenuSortMode(eMenuSortMode MenuSortMode) {
if (!doOutput)
return;
rootView->SetSortMode(MenuSortMode);
}
void cSDDisplayMenu::SetPluginMenu(string name, int menu, int type, bool init) { void cSDDisplayMenu::SetPluginMenu(string name, int menu, int type, bool init) {
pluginName = name; pluginName = name;
pluginMenu = menu; pluginMenu = menu;

View File

@ -30,6 +30,7 @@ public:
virtual int MaxItems(void); virtual int MaxItems(void);
virtual void Clear(void); virtual void Clear(void);
virtual void SetMenuCategory(eMenuCategory MenuCat); virtual void SetMenuCategory(eMenuCategory MenuCat);
virtual void SetMenuSortMode(eMenuSortMode MenuSortMode);
virtual void SetPluginMenu(string name, int menu, int type, bool init); virtual void SetPluginMenu(string name, int menu, int type, bool init);
virtual void SetTitle(const char *Title); virtual void SetTitle(const char *Title);
virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL); virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);

View File

@ -2,7 +2,7 @@
<!ENTITY % functions SYSTEM "functions.dtd"> <!ENTITY % functions SYSTEM "functions.dtd">
<!ELEMENT displaymenu (background,header,datetime,time*,message,colorbuttons, <!ELEMENT displaymenu (background,header,datetime,time*,message,sortmode*,colorbuttons,
menudefault,menumain*,menusetup*,menuschedules*, menudefault,menumain*,menusetup*,menuschedules*,
menutimers*,menuchannels*,menurecordings*, menutimers*,menuchannels*,menurecordings*,
menudetailedepg,menudetailedrecording, menudetailedepg,menudetailedrecording,
@ -45,6 +45,12 @@
condition CDATA #IMPLIED condition CDATA #IMPLIED
> >
<!ELEMENT sortmode (area|areascroll)*>
<!ATTLIST sortmode
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
<!ELEMENT colorbuttons (area|areascroll)*> <!ELEMENT colorbuttons (area|areascroll)*>
<!ATTLIST colorbuttons <!ATTLIST colorbuttons
debug CDATA #IMPLIED debug CDATA #IMPLIED
@ -159,7 +165,7 @@
condition CDATA #IMPLIED condition CDATA #IMPLIED
> >
<!ELEMENT menudefault (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*> <!ELEMENT menudefault (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menudefault <!ATTLIST menudefault
x CDATA #REQUIRED x CDATA #REQUIRED
y CDATA #REQUIRED y CDATA #REQUIRED
@ -172,7 +178,7 @@
scaletvheight CDATA #IMPLIED scaletvheight CDATA #IMPLIED
> >
<!ELEMENT menumain (background | header | datetime | time | colorbuttons | scrollbar | timers | <!ELEMENT menumain (background | header | datetime | time | colorbuttons | scrollbar | sortmode | timers |
discusage | devices | systemload | systemmemory | temperatures | currentschedule | discusage | devices | systemload | systemmemory | temperatures | currentschedule |
currentweather | lastrecordings | customtokens | menuitems)*> currentweather | lastrecordings | customtokens | menuitems)*>
<!ATTLIST menumain <!ATTLIST menumain
@ -187,7 +193,7 @@
scaletvheight CDATA #IMPLIED scaletvheight CDATA #IMPLIED
> >
<!ELEMENT menusetup (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*> <!ELEMENT menusetup (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menusetup <!ATTLIST menusetup
x CDATA #REQUIRED x CDATA #REQUIRED
y CDATA #REQUIRED y CDATA #REQUIRED
@ -200,7 +206,7 @@
scaletvheight CDATA #IMPLIED scaletvheight CDATA #IMPLIED
> >
<!ELEMENT menuschedules (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*> <!ELEMENT menuschedules (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menuschedules <!ATTLIST menuschedules
x CDATA #REQUIRED x CDATA #REQUIRED
y CDATA #REQUIRED y CDATA #REQUIRED
@ -213,7 +219,7 @@
scaletvheight CDATA #IMPLIED scaletvheight CDATA #IMPLIED
> >
<!ELEMENT menutimers (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*> <!ELEMENT menutimers (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menutimers <!ATTLIST menutimers
x CDATA #REQUIRED x CDATA #REQUIRED
y CDATA #REQUIRED y CDATA #REQUIRED
@ -226,7 +232,7 @@
scaletvheight CDATA #IMPLIED scaletvheight CDATA #IMPLIED
> >
<!ELEMENT menuchannels (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*> <!ELEMENT menuchannels (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menuchannels <!ATTLIST menuchannels
x CDATA #REQUIRED x CDATA #REQUIRED
y CDATA #REQUIRED y CDATA #REQUIRED
@ -239,7 +245,7 @@
scaletvheight CDATA #IMPLIED scaletvheight CDATA #IMPLIED
> >
<!ELEMENT menurecordings (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*> <!ELEMENT menurecordings (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menurecordings <!ATTLIST menurecordings
x CDATA #REQUIRED x CDATA #REQUIRED
y CDATA #REQUIRED y CDATA #REQUIRED

View File

@ -1123,17 +1123,6 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
attributes.insert("scaletvheight"); attributes.insert("scaletvheight");
funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes)); funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes));
//definition of allowed parameters for timerlist viewlist
attributes.clear();
attributes.insert("x");
attributes.insert("y");
attributes.insert("width");
attributes.insert("height");
attributes.insert("orientation");
attributes.insert("align");
attributes.insert("numlistelements");
funcsAllowed.insert(pair< string, set<string> >("timerlist", attributes));
//definition of allowed parameters for menuitems viewlist //definition of allowed parameters for menuitems viewlist
attributes.clear(); attributes.clear();
attributes.insert("x"); attributes.insert("x");
@ -1209,6 +1198,7 @@ void cTemplateViewMenu::SetViewElements(void) {
viewElementsAllowed.insert("header"); viewElementsAllowed.insert("header");
viewElementsAllowed.insert("colorbuttons"); viewElementsAllowed.insert("colorbuttons");
viewElementsAllowed.insert("message"); viewElementsAllowed.insert("message");
viewElementsAllowed.insert("sortmode");
viewElementsAllowed.insert("discusage"); viewElementsAllowed.insert("discusage");
viewElementsAllowed.insert("systemload"); viewElementsAllowed.insert("systemload");
viewElementsAllowed.insert("systemmemory"); viewElementsAllowed.insert("systemmemory");
@ -1290,6 +1280,9 @@ string cTemplateViewMenu::GetViewElementName(eViewElement ve) {
case veMessage: case veMessage:
name = "Message"; name = "Message";
break; break;
case veSortMode:
name = "Sort Mode";
break;
case veDiscUsage: case veDiscUsage:
name = "Disc Usage"; name = "Disc Usage";
break; break;
@ -1419,6 +1412,8 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
ve = veButtons; ve = veButtons;
} else if (!sViewElement.compare("message")) { } else if (!sViewElement.compare("message")) {
ve = veMessage; ve = veMessage;
} else if (!sViewElement.compare("sortmode")) {
ve = veSortMode;
} else if (!sViewElement.compare("discusage")) { } else if (!sViewElement.compare("discusage")) {
ve = veDiscUsage; ve = veDiscUsage;
} else if (!sViewElement.compare("systemload")) { } else if (!sViewElement.compare("systemload")) {

View File

@ -25,6 +25,7 @@ enum eViewElement {
veDateTime, veDateTime,
veTime, veTime,
veMessage, veMessage,
veSortMode,
veDevices, veDevices,
veCurrentWeather, veCurrentWeather,
veCustomTokens, veCustomTokens,

View File

@ -105,6 +105,22 @@
<drawtext align="center" valign="center" font="{regular}" fontsize="40%" color="{clrWhite}" text="{text}" /> <drawtext align="center" valign="center" font="{regular}" fontsize="40%" color="{clrWhite}" text="{text}" />
</area> </area>
</message> </message>
<!-- Available Variables sortmode:
{sortnumber} true if menu is sorted by number
{sortname} true if menu is sorted alphabetical
{sorttime} true if menu is sorted by time
{sortprovider} true if menu is sorted by provider
-->
<sortmode>
<area x="44%" y="1%" width="6%" height="6%" layer="3">
<drawimage condition="{sortnumber}" imagetype="icon" path="ico_sort_number" x="0" y="0" width="100%" height="100%"/>
<drawimage condition="{sortname}" imagetype="icon" path="ico_sort_name" x="0" y="0" width="100%" height="100%"/>
<drawimage condition="{sorttime}" imagetype="icon" path="ico_sort_time" x="0" y="0" width="100%" height="100%"/>
<drawimage condition="{sortprovider}" imagetype="icon" path="ico_sort_provider" x="0" y="0" width="100%" height="100%"/>
</area>
</sortmode>
<!-- Available Variables colorbuttons: <!-- Available Variables colorbuttons:
{red1} true if red button is button 1 {red1} true if red button is button 1
{red2} true if red button is button 2 {red2} true if red button is button 2

View File

@ -84,6 +84,21 @@
<drawtext align="center" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{text}" /> <drawtext align="center" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{text}" />
</area> </area>
</message> </message>
<!-- Available Variables sortmode:
{sortnumber} true if menu is sorted by number
{sortname} true if menu is sorted alphabetical
{sorttime} true if menu is sorted by time
{sortprovider} true if menu is sorted by provider
-->
<sortmode>
<area x="35%" y="2%" width="6%" height="6%" layer="4">
<drawimage condition="{sortnumber}" imagetype="icon" path="ico_sort_number" x="0" y="0" width="100%" height="100%"/>
<drawimage condition="{sortname}" imagetype="icon" path="ico_sort_name" x="0" y="0" width="100%" height="100%"/>
<drawimage condition="{sorttime}" imagetype="icon" path="ico_sort_time" x="0" y="0" width="100%" height="100%"/>
<drawimage condition="{sortprovider}" imagetype="icon" path="ico_sort_provider" x="0" y="0" width="100%" height="100%"/>
</area>
</sortmode>
<!-- Available Variables colorbuttons: <!-- Available Variables colorbuttons:
{red1} true if red button is button 1 {red1} true if red button is button 1
{red2} true if red button is button 2 {red2} true if red button is button 2

View File

@ -55,6 +55,14 @@
--> -->
<time> <time>
</time> </time>
<!-- Available Variables sortmode:
{sortnumber} true if menu is sorted by number
{sortname} true if menu is sorted alphabetical
{sorttime} true if menu is sorted by time
{sortprovider} true if menu is sorted by provider
-->
<sortmode>
</sortmode>
<!-- Available Variables message: <!-- Available Variables message:
{text} message text {text} message text
{status} true if message is an status message {status} true if message is an status message

View File

@ -7,6 +7,8 @@
cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(rootView) { cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(rootView) {
cat = mcUndefined; cat = mcUndefined;
sortMode = msmUnknown;
sortModeLast = msmUnknown;
menuTitle = ""; menuTitle = "";
viewType = svUndefined; viewType = svUndefined;
subView = NULL; subView = NULL;
@ -27,6 +29,7 @@ cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(root
defaultButtonsDrawn = false; defaultButtonsDrawn = false;
defaultDateTimeDrawn = false; defaultDateTimeDrawn = false;
defaultMessageDrawn = false; defaultMessageDrawn = false;
defaultSortmodeDrawn = false;
DeleteOsdOnExit(); DeleteOsdOnExit();
SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); SetFadeTime(tmplView->GetNumericParameter(ptFadeTime));
} }
@ -212,6 +215,13 @@ void cDisplayMenuRootView::SetMenu(eMenuCategory menuCat, bool menuInit) {
} }
} }
void cDisplayMenuRootView::SetSortMode(eMenuSortMode sortMode) {
this->sortMode = sortMode;
if (!view)
return;
view->SetSortMode(sortMode);
}
void cDisplayMenuRootView::CorrectDefaultMenu(void) { void cDisplayMenuRootView::CorrectDefaultMenu(void) {
if (viewType > svMenuDefault && viewType != svMenuPlugin) { if (viewType > svMenuDefault && viewType != svMenuPlugin) {
SetMenu(mcUnknown, true); SetMenu(mcUnknown, true);
@ -355,6 +365,8 @@ void cDisplayMenuRootView::ClearRootView(void) {
ClearViewElement(veDateTime); ClearViewElement(veDateTime);
if (defaultMessageDrawn) if (defaultMessageDrawn)
ClearViewElement(veMessage); ClearViewElement(veMessage);
if (defaultSortmodeDrawn)
ClearViewElement(veSortMode);
} }
int cDisplayMenuRootView::GetMaxItems(void) { int cDisplayMenuRootView::GetMaxItems(void) {
@ -417,6 +429,13 @@ void cDisplayMenuRootView::Render(void) {
defaultHeaderDrawn = false; defaultHeaderDrawn = false;
} }
if (!view->DrawSortMode()) {
defaultSortmodeDrawn = true;
DrawSortMode();
} else {
defaultSortmodeDrawn = false;
}
if (!view->DrawColorButtons()) { if (!view->DrawColorButtons()) {
defaultButtonsDrawn = true; defaultButtonsDrawn = true;
DrawColorButtons(); DrawColorButtons();
@ -476,6 +495,7 @@ void cDisplayMenuRootView::DrawBackground(void) {
map < string, int > intTokens; map < string, int > intTokens;
DrawViewElement(veBackground, &stringTokens, &intTokens); DrawViewElement(veBackground, &stringTokens, &intTokens);
} }
void cDisplayMenuRootView::DrawHeader(void) { void cDisplayMenuRootView::DrawHeader(void) {
if (!ExecuteViewElement(veHeader)) { if (!ExecuteViewElement(veHeader)) {
return; return;
@ -520,6 +540,38 @@ bool cDisplayMenuRootView::DrawTime(void) {
return true; return true;
} }
void cDisplayMenuRootView::DrawSortMode(void) {
if (!ExecuteViewElement(veSortMode)) {
return;
}
if (sortMode == msmUnknown) {
if (sortModeLast != msmUnknown)
ClearViewElement(veSortMode);
sortModeLast = msmUnknown;
return;
}
if (sortMode == sortModeLast) {
return;
}
sortModeLast = sortMode;
map < string, string > stringTokens;
map < string, int > intTokens;
bool sortNumber = (sortMode == msmNumber) ? true : false;
bool sortName = (sortMode == msmName) ? true : false;
bool sortTime = (sortMode == msmTime) ? true : false;
bool sortProvider = (sortMode == msmProvider) ? true : false;
intTokens.insert(pair<string, int>("sortnumber", sortNumber));
intTokens.insert(pair<string, int>("sortname", sortName));
intTokens.insert(pair<string, int>("sorttime", sortTime));
intTokens.insert(pair<string, int>("sortprovider", sortProvider));
ClearViewElement(veSortMode);
DrawViewElement(veSortMode, &stringTokens, &intTokens);
return;
}
void cDisplayMenuRootView::DrawColorButtons(void) { void cDisplayMenuRootView::DrawColorButtons(void) {
if (!ExecuteViewElement(veButtons)) { if (!ExecuteViewElement(veButtons)) {

View File

@ -15,6 +15,8 @@ enum ePluginMenuType {
class cDisplayMenuRootView : public cView, public cViewHelpers { class cDisplayMenuRootView : public cView, public cViewHelpers {
private: private:
eMenuCategory cat; eMenuCategory cat;
eMenuSortMode sortMode;
eMenuSortMode sortModeLast;
eSubView viewType; eSubView viewType;
cTemplateView *subView; cTemplateView *subView;
bool subViewAvailable; bool subViewAvailable;
@ -32,10 +34,12 @@ private:
bool defaultButtonsDrawn; bool defaultButtonsDrawn;
bool defaultDateTimeDrawn; bool defaultDateTimeDrawn;
bool defaultMessageDrawn; bool defaultMessageDrawn;
bool defaultSortmodeDrawn;
void DrawBackground(void); void DrawBackground(void);
void DrawHeader(void); void DrawHeader(void);
void DrawDateTime(void); void DrawDateTime(void);
bool DrawTime(void); bool DrawTime(void);
void DrawSortMode(void);
void DrawColorButtons(void); void DrawColorButtons(void);
void DrawMessage(eMessageType type, const char *text); void DrawMessage(eMessageType type, const char *text);
void ClearRootView(void); void ClearRootView(void);
@ -45,6 +49,7 @@ public:
virtual ~cDisplayMenuRootView(); virtual ~cDisplayMenuRootView();
bool createOsd(void); bool createOsd(void);
void SetMenu(eMenuCategory menuCat, bool menuInit); void SetMenu(eMenuCategory menuCat, bool menuInit);
void SetSortMode(eMenuSortMode sortMode);
void CorrectDefaultMenu(void); void CorrectDefaultMenu(void);
void SetPluginMenu(string name, int menu, int type); void SetPluginMenu(string name, int menu, int type);
void SetTitle(const char *title); void SetTitle(const char *title);

View File

@ -13,6 +13,8 @@ cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cVi
else else
SetFadeTime(0); SetFadeTime(0);
cat = mcUndefined; cat = mcUndefined;
sortMode = msmUnknown;
sortModeLast = msmUnknown;
buttonTexts = NULL; buttonTexts = NULL;
} }
@ -175,6 +177,38 @@ void cDisplayMenuView::DrawScrollbar(int numMax, int numDisplayed, int offset) {
DrawViewElement(veScrollbar, &stringTokens, &intTokens); DrawViewElement(veScrollbar, &stringTokens, &intTokens);
} }
bool cDisplayMenuView::DrawSortMode(void) {
if (!ExecuteViewElement(veSortMode)) {
return false;
}
if (sortMode == msmUnknown) {
if (sortModeLast != msmUnknown)
ClearViewElement(veSortMode);
sortModeLast = msmUnknown;
return true;
}
if (sortMode == sortModeLast)
return true;
sortModeLast = sortMode;
map < string, string > stringTokens;
map < string, int > intTokens;
bool sortNumber = (sortMode == msmNumber) ? true : false;
bool sortName = (sortMode == msmName) ? true : false;
bool sortTime = (sortMode == msmTime) ? true : false;
bool sortProvider = (sortMode == msmProvider) ? true : false;
intTokens.insert(pair<string, int>("sortnumber", sortNumber));
intTokens.insert(pair<string, int>("sortname", sortName));
intTokens.insert(pair<string, int>("sorttime", sortTime));
intTokens.insert(pair<string, int>("sortprovider", sortProvider));
ClearViewElement(veSortMode);
DrawViewElement(veSortMode, &stringTokens, &intTokens);
return true;
}
bool cDisplayMenuView::BackgroundImplemented(void) { bool cDisplayMenuView::BackgroundImplemented(void) {
if (!ExecuteViewElement(veBackground)) { if (!ExecuteViewElement(veBackground)) {
return false; return false;

View File

@ -5,9 +5,21 @@
#include "viewhelpers.h" #include "viewhelpers.h"
#include "displaymenulistview.h" #include "displaymenulistview.h"
#if APIVERSNUM < 20107
enum eMenuSortMode {
msmUnknown = 0,
msmNumber,
msmName,
msmTime,
msmProvider
};
#endif
class cDisplayMenuView : public cView, public cViewHelpers { class cDisplayMenuView : public cView, public cViewHelpers {
protected: protected:
eMenuCategory cat; eMenuCategory cat;
eMenuSortMode sortMode;
eMenuSortMode sortModeLast;
string menuTitle; string menuTitle;
string *buttonTexts; string *buttonTexts;
virtual void Action(void); virtual void Action(void);
@ -15,6 +27,7 @@ public:
cDisplayMenuView(cTemplateView *tmplView, bool menuInit); cDisplayMenuView(cTemplateView *tmplView, bool menuInit);
virtual ~cDisplayMenuView(); virtual ~cDisplayMenuView();
void SetMenuCat(eMenuCategory newCat) { cat = newCat; }; void SetMenuCat(eMenuCategory newCat) { cat = newCat; };
void SetSortMode(eMenuSortMode sortMode) { this->sortMode = sortMode; };
void SetTitle(const char *title) {menuTitle = title; }; void SetTitle(const char *title) {menuTitle = title; };
virtual void SetChannel(const cChannel *channel) {}; virtual void SetChannel(const cChannel *channel) {};
virtual const cChannel *GetChannel(void) { return NULL; }; virtual const cChannel *GetChannel(void) { return NULL; };
@ -29,6 +42,7 @@ public:
bool DrawColorButtons(void); bool DrawColorButtons(void);
bool DrawMessage(eMessageType type, const char *text); bool DrawMessage(eMessageType type, const char *text);
void DrawScrollbar(int numMax, int numDisplayed, int offset); void DrawScrollbar(int numMax, int numDisplayed, int offset);
bool DrawSortMode(void);
virtual void DrawStaticViewElements(void) {}; virtual void DrawStaticViewElements(void) {};
virtual bool DrawDynamicViewElements(void) { return false; }; virtual bool DrawDynamicViewElements(void) { return false; };
bool BackgroundImplemented(void); bool BackgroundImplemented(void);