fixed bug in displaying plugin detail pages

This commit is contained in:
louis 2015-01-13 14:49:36 +01:00
parent 604ae1c8cc
commit 8c6a83b72a
5 changed files with 140 additions and 7 deletions

View File

@ -4,6 +4,7 @@
using namespace std; using namespace std;
#include <string> #include <string>
#include <vector>
#include <map> #include <map>
enum eMenuType { enum eMenuType {
@ -13,6 +14,7 @@ enum eMenuType {
class cSDDisplayMenu : public cSkinDisplayMenu { class cSDDisplayMenu : public cSkinDisplayMenu {
public: public:
virtual void SetTitle(const char *Title);
virtual void SetPluginMenu(string name, int menu, int type, bool init); virtual void SetPluginMenu(string name, int menu, int type, bool init);
virtual bool SetItemPlugin(map<string,string> *stringTokens, map<string,int> *intTokens, map<string,vector<map<string,string> > > *loopTokens, int Index, bool Current, bool Selectable); virtual bool SetItemPlugin(map<string,string> *stringTokens, map<string,int> *intTokens, map<string,vector<map<string,string> > > *loopTokens, int Index, bool Current, bool Selectable);
virtual bool SetPluginText(map<string,string> *stringTokens, map<string,int> *intTokens, map<string,vector<map<string,string> > > *loopTokens); virtual bool SetPluginText(map<string,string> *stringTokens, map<string,int> *intTokens, map<string,vector<map<string,string> > > *loopTokens);

View File

@ -142,27 +142,30 @@ void cSkindesignerOsdMenu::TextKeyDown(void) {
void cSkindesignerOsdMenu::Display(void) { void cSkindesignerOsdMenu::Display(void) {
if (displayText) { if (displayText) {
if (sdDisplayMenu) { if (sdDisplayMenu) {
sdDisplayMenu->SetTitle(Title());
if (sdDisplayMenu->SetPluginText(&stringTokens, &intTokens, &loopTokens)) { if (sdDisplayMenu->SetPluginText(&stringTokens, &intTokens, &loopTokens)) {
esyslog("skindesclient: template found");
sdDisplayMenu->Flush(); sdDisplayMenu->Flush();
} else { } else {
esyslog("skindesclient: no template found, drawing default");
DisplayMenu()->Clear(); DisplayMenu()->Clear();
DisplayMenu()->SetTitle(Title());
DisplayMenu()->SetText(text.c_str(), false); DisplayMenu()->SetText(text.c_str(), false);
DisplayMenu()->Flush(); DisplayMenu()->Flush();
} }
} else { } else {
DisplayMenu()->Clear(); DisplayMenu()->Clear();
DisplayMenu()->SetTitle(Title());
DisplayMenu()->SetText(text.c_str(), false); DisplayMenu()->SetText(text.c_str(), false);
DisplayMenu()->Flush(); DisplayMenu()->Flush();
} }
return; return;
} }
if (sdDisplayMenu) { if (sdDisplayMenu) {
sdDisplayMenu->SetTitle(Title());
for (cOsdItem *item = First(); item; item = Next(item)) { for (cOsdItem *item = First(); item; item = Next(item)) {
cSkindesignerOsdItem *sdItem = dynamic_cast<cSkindesignerOsdItem*>(item); cSkindesignerOsdItem *sdItem = dynamic_cast<cSkindesignerOsdItem*>(item);
if (sdItem) if (sdItem) {
sdItem->SetDisplayMenu(sdDisplayMenu); sdItem->SetDisplayMenu(sdDisplayMenu);
}
} }
} }
cOsdMenu::Display(); cOsdMenu::Display();

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE menuplugin SYSTEM "../../../dtd/displaymenuplugin.dtd">
<menuplugin x="0" y="0" width="100%" height="100%" fadetime="0">
<background>
<area x="0" y="0" width="100%" height="100%" layer="1">
<fill color="{clrTransBlack}" />
</area>
</background>
<header>
<area x="0" y="0" width="1" height="1" layer="1">
<fill color="{clrTransparent}" />
</area>
</header>
<detailheader>
<area x="0" y="0" width="100%" height="20%" layer="2">
<fill color="{clrTransBlueLight}" />
</area>
<area x="0" y="0" width="100%" height="20%" layer="3">
<drawtext x="20" valign="center" font="{light}" fontsize="40%" color="{clrWhite}" text="{menuheader}" />
</area>
<area x="{areawidth} - {areaheight}*0.2" y="0" width="{areaheight}*0.2" height="20%" layer="4">
<drawimage imagetype="icon" path="{icon}" align="center" valign="center" width="90%" height="90%"/>
</area>
<area x="{areawidth} - {areaheight}*0.6" y="0" width="{areaheight}*0.35" height="20%" layer="4">
<drawtext align="right" valign="center" font="{light}" fontsize="90%" color="{clrWhite}" text="{temperature}°C" />
</area>
</detailheader>
<datetime>
<area x="0" y="0" width="1" height="1" layer="1">
<fill color="{clrTransparent}" />
</area>
</datetime>
<colorbuttons>
<area x="0" y="0" width="1" height="1" layer="1">
<fill color="{clrTransparent}" />
</area>
</colorbuttons>
<scrollbar>
<area x="98%" y="20%" width="2%" height="65%" layer="3">
<fill color="{clrWhite}" />
<drawrectangle x="2" y="2" width="{areawidth} - 4" height="{areaheight} - 4" color="{clrTransparent}" />
<drawrectangle x="4" y="4 + {areaheight} * {offset} / 1000" width="{areawidth} - 8" height="{areaheight} * {height} / 1000 - 8" color="{clrWhite}" />
</area>
</scrollbar>
<tab name="current" x="2%" y="20%" width="94%" height="65%" layer="2" scrollheight="{areaheight}/4">
<drawtext x="0" y="0" font="{semibold}" fontsize="10%" color="{clrWhite}" text="Wetterlage: {summary}" />
<drawtext x="0" y="10%" font="{light}" fontsize="10%" color="{clrWhite}" text="Aktuelle Temperatur: {temperature}°C" />
<drawtext x="0" y="20%" font="{light}" fontsize="10%" color="{clrWhite}" text="Gefühlte Temperatur: {apparenttemperature}°C" />
<drawtext x="0" y="30%" font="{light}" fontsize="10%" color="{clrWhite}" text="heutiges Minimum: {mintemperature}°C, heutiges Maximum: {maxtemperature}°C" />
<drawtext x="0" y="40%" font="{light}" fontsize="10%" color="{clrWhite}" text="Niederschlagswahrscheinlichkeit: {precipitationprobability} %" />
<drawtext x="0" y="50%" font="{light}" fontsize="10%" color="{clrWhite}" text="Niederschlagsmenge: {precipitationintensity} l/qm" />
<drawtext x="0" y="60%" font="{light}" fontsize="10%" color="{clrWhite}" text="Luftfeuchtigkeit: {humidity} %" />
<drawtext x="0" y="70%" font="{light}" fontsize="10%" color="{clrWhite}" text="Windgeschwindigkeit: {windspeed} km/h aus {windbearingstring}" />
<drawtext x="0" y="80%" font="{light}" fontsize="10%" color="{clrWhite}" text="Sicht: {visibility} km" />
<drawtext x="0" y="90%" font="{light}" fontsize="10%" color="{clrWhite}" text="Bewölkung: {cloudcover} %" />
<drawtext x="0" y="100%" font="{light}" fontsize="10%" color="{clrWhite}" text="Luftdruck: {pressure} HPa" />
<drawtext x="0" y="110%" font="{light}" fontsize="10%" color="{clrWhite}" text="Ozon: {ozone} DU" />
</tab>
</menuplugin>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE menuplugin SYSTEM "../../../dtd/displaymenuplugin.dtd">
<menuplugin x="0" y="0" width="100%" height="100%" fadetime="0">
<background>
<area x="0" y="0" width="100%" height="100%" layer="1">
<fill color="{clrTransBlack}" />
</area>
</background>
<header>
<area x="0" y="0" width="1" height="1" layer="1">
<fill color="{clrTransparent}" />
</area>
</header>
<detailheader>
<area x="0" y="0" width="100%" height="20%" layer="2">
<fill color="{clrTransBlueLight}" />
</area>
<area x="0" y="0" width="100%" height="20%" layer="3">
<drawtext x="20" valign="center" font="{light}" fontsize="40%" color="{clrWhite}" text="{menuheader}" />
</area>
<area x="{areawidth} - {areaheight}*0.2" y="5" width="{areaheight}*0.2" height="20%" layer="4">
<drawimage imagetype="icon" path="{icon}" align="center" y="0" width="70%" height="70%"/>
</area>
<area x="0" y="0" width="100%" height="20%" layer="4">
<drawtext align="right" valign="bottom" font="{light}" fontsize="25%" color="{clrWhite}" text="{summary}" />
</area>
</detailheader>
<datetime>
<area x="0" y="0" width="1" height="1" layer="1">
<fill color="{clrTransparent}" />
</area>
</datetime>
<colorbuttons>
<area x="0" y="0" width="1" height="1" layer="1">
<fill color="{clrTransparent}" />
</area>
</colorbuttons>
<scrollbar>
<area x="98%" y="20%" width="2%" height="65%" layer="3">
<fill color="{clrWhite}" />
<drawrectangle x="2" y="2" width="{areawidth} - 4" height="{areaheight} - 4" color="{clrTransparent}" />
<drawrectangle x="4" y="4 + {areaheight} * {offset} / 1000" width="{areawidth} - 8" height="{areaheight} * {height} / 1000 - 8" color="{clrWhite}" />
</area>
</scrollbar>
<tab name="current" x="2%" y="20%" width="94%" height="65%" layer="2" scrollheight="{areaheight}/4">
<loop name="hourly" x="0" y="0" orientation="vertical" columnwidth="{areawidth}" rowheight="{areaheight}/5">
<drawtext x="0" font="{semibold}" fontsize="9%" valign="center" color="{clrWhite}" text="{hourly[timestamp]}" />
<drawimage imagetype="icon" path="{hourly[icon]}" x="{rowheight}" valign="center" width="{rowheight}*0.8" height="{rowheight}*0.8"/>
<drawtext name="temp" x="2*{rowheight} + 0.75*{rowheight} - {width(temp)}/2" font="{light}" fontsize="13%" y="0" color="{clrWhite}" text="{hourly[temperature]}°C" />
<drawtext name="felt" x="2*{rowheight} + 0.75*{rowheight} - {width(felt)}/2" font="{light}" fontsize="6%" y="{rowheight}*0.6" color="{clrWhite}" text="felt {hourly[apparenttemperature]}°C" />
<drawtext x="4*{rowheight}" font="{light}" fontsize="8%" y="0" width="{columnwidth} - 4*{rowheight}" color="{clrWhite}" text="{hourly[summary]}" />
<drawtext x="4*{rowheight}" font="{light}" fontsize="8%" y="{rowheight}/2" width="{columnwidth} - 4*{rowheight}" color="{clrWhite}" text="Precipitation {hourly[precipitationprobability]}%, {hourly[precipitationintensity]} l/qm, Wind {hourly[windspeed]} from {hourly[windbearingstring]}" />
<drawrectangle x="0" y="{rowheight} - 1" width="{columnwidth}" height="1" color="{clrWhite}" />
</loop>
</tab>
</menuplugin>

View File

@ -215,7 +215,6 @@ void cDisplayMenuRootView::SetPluginMenu(string name, int menu, int type) {
pluginMenuChanged = true; pluginMenuChanged = true;
else else
pluginMenuChanged = false; pluginMenuChanged = false;
pluginName = name; pluginName = name;
pluginMenu = menu; pluginMenu = menu;
pluginMenuType = (ePluginMenuType)type; pluginMenuType = (ePluginMenuType)type;
@ -301,9 +300,9 @@ void cDisplayMenuRootView::SetDetailedViewText(const char *text) {
bool cDisplayMenuRootView::SetDetailedViewPlugin(map<string,string> *stringTokens, map<string,int> *intTokens, map<string,vector<map<string,string> > > *loopTokens) { bool cDisplayMenuRootView::SetDetailedViewPlugin(map<string,string> *stringTokens, map<string,int> *intTokens, map<string,vector<map<string,string> > > *loopTokens) {
if (!detailView) { if (!detailView) {
SetMenu(mcPlugin, true); SetMenu(mcPlugin, true);
if (!subViewAvailable)
return false;
} }
if (!subViewAvailable)
return false;
detailView->SetPluginTokens(stringTokens, intTokens, loopTokens); detailView->SetPluginTokens(stringTokens, intTokens, loopTokens);
return true; return true;
} }