improved menu icon display

This commit is contained in:
louis 2014-10-26 08:26:44 +01:00
parent 1e20f0c893
commit 52d9280c66
10 changed files with 67 additions and 8 deletions

View File

@ -35,6 +35,8 @@ Version 0.0.2
- implemented function drawslope, see Wiki for documentation
- using default menu list in case an invalid MenuCategory is set
- added device info in displaychannel, example in metrixHD
- improved menu icon display, additionally using menu cat

View File

@ -90,7 +90,7 @@ OBJS = $(PLUGIN).o \
libtemplate/templateloopfunction.o \
libtemplate/xmlparser.o \
views/view.o \
views/viewhelpers.o \
views/viewhelpers.o \
views/displaychannelview.o \
views/displaymenurootview.o \
views/displaymenuview.o \

View File

@ -199,7 +199,46 @@ cImage *cImageCache::GetIcon(eImageType type, string name, int width, int height
return NULL;
}
string cImageCache::GetIconName(string label) {
string cImageCache::GetIconName(string label, eMenuCategory cat) {
//if cat is set, use standard menu entries
switch (cat) {
case mcSchedule:
case mcScheduleNow:
case mcScheduleNext:
case mcEvent:
return "standardicons/Schedule";
case mcChannel:
case mcChannelEdit:
return "standardicons/Channels";
case mcTimer:
case mcTimerEdit:
return "standardicons/Timers";
case mcRecording:
case mcRecordingInfo:
case mcSetupRecord:
case mcSetupReplay:
return "standardicons/Recordings";
case mcPlugin:
case mcPluginSetup:
case mcSetupPlugins:
return "standardicons/Plugins";
case mcSetup:
return "standardicons/Setup";
case mcSetupOsd:
return "standardicons/OSD";
case mcSetupEpg:
return "standardicons/EPG";
case mcSetupDvb:
return "standardicons/DVB";
case mcSetupLnb:
return "standardicons/LNB";
case mcSetupCam:
return "standardicons/CAM";
case mcSetupMisc:
return "standardicons/Miscellaneous";
case mcCommand:
return "standardicons/Commands";
}
//check for standard menu entries
for (int i=0; i<16; i++) {
string s = trVDR(items[i].c_str());

View File

@ -28,7 +28,7 @@ public:
//icons
void CacheIcon(eImageType type, string path, int width, int height);
cImage *GetIcon(eImageType type, string name, int width, int height);
string GetIconName(string label);
string GetIconName(string label, eMenuCategory cat = mcUndefined);
//skinparts
void CacheSkinpart(string path, int width, int height);
cImage *GetSkinpart(string name, int width, int height);

View File

@ -2,6 +2,8 @@
<!-- Available Variables header:
{title} title of current menu
{vdrversion} running VDR Version
{hasicon} true if a menu icon is available
{icon} path of menu icon
{channelnumber} Number of Channel of current event
{channelname} Name of current Channel of current event
{channellogoexists} true if a channel logo exists
@ -12,7 +14,8 @@
-->
<header>
<area x="0" y="0" width="38%" height="10%" layer="2">
<drawtext condition="{whatsonnow}||{whatsonnext}" x="5" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{title}" />
<drawimage condition="{whatsonnow}||{whatsonnext}" name="menuicon" imagetype="menuicon" path="{icon}" x="5" valign="center" width="{areaheight}*8/10" height="80%"/>
<drawtext condition="{whatsonnow}||{whatsonnext}" x="{width(menuicon)} + 15" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{title}" />
<drawimage name="logo" condition="{whatson}" imagetype="channellogo" path="{channelid}" x="0" height="100%" align="left" valign="center" />
<drawtext condition="{whatson}" x="{width(logo)}+20" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{channelnumber} - {channelname}" />
</area>

View File

@ -13,10 +13,12 @@
<!-- Available Variables header:
{title} title of current menu
{vdrversion} running VDR Version
{icon} icon path
-->
<header>
<area x="0" y="0" width="70%" height="7%" layer="2">
<drawtext x="10" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{title}" />
<drawimage name="menuicon" imagetype="menuicon" path="{icon}" x="5" valign="center" width="{areaheight}*8/10" height="80%"/>
<drawtext x="{areaheight}" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{title}" />
</area>
</header>
<!-- Available Variables datetime:

View File

@ -2,6 +2,8 @@
<!-- Available Variables header:
{title} title of current menu
{vdrversion} running VDR Version
{hasicon} true if a menu icon is available
{icon} path of menu icon
{channelnumber} Number of Channel of current event
{channelname} Name of current Channel of current event
{channellogoexists} true if a channel logo exists

View File

@ -6,6 +6,7 @@
#include "../libcore/helpers.h"
cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(rootView) {
cat = mcUndefined;
viewType = svUndefined;
subView = NULL;
subViewAvailable = false;
@ -81,6 +82,7 @@ bool cDisplayMenuRootView::createOsd(void) {
void cDisplayMenuRootView::SetMenu(eMenuCategory menuCat, bool menuInit) {
eSubView newViewType = svUndefined;
cat = menuCat;
bool isListView = true;
switch (menuCat) {
case mcMain:
@ -157,7 +159,7 @@ void cDisplayMenuRootView::SetMenu(eMenuCategory menuCat, bool menuInit) {
default:
view = new cDisplayMenuView(subView, menuInit);
}
view->SetMenuCat(cat);
//Cleanup root view
ClearRootView();
@ -408,7 +410,8 @@ void cDisplayMenuRootView::DrawHeader(void) {
//check for standard menu entries
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle);
string icon = imgCache->GetIconName(menuTitle, cat);
if (icon.size() > 0)
hasIcon = true;

View File

@ -8,6 +8,7 @@
class cDisplayMenuRootView : public cView {
private:
eMenuCategory cat;
eSubView viewType;
cTemplateView *subView;
bool subViewAvailable;

View File

@ -41,7 +41,7 @@ bool cDisplayMenuView::DrawHeader(void) {
//check for standard menu entries
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle);
string icon = imgCache->GetIconName(menuTitle, cat);
if (icon.size() > 0)
hasIcon = true;
stringTokens.insert(pair<string,string>("icon", icon));
@ -435,6 +435,13 @@ bool cDisplayMenuSchedulesView::DrawHeader(void) {
stringTokens.insert(pair<string,string>("channelid", *(channel->GetChannelID().ToString())));
}
bool hasIcon = false;
string icon = imgCache->GetIconName(menuTitle, cat);
if (icon.size() > 0)
hasIcon = true;
stringTokens.insert(pair<string,string>("icon", icon));
intTokens.insert(pair<string,int>("hasicon", hasIcon));
ClearViewElement(veHeader);
DrawViewElement(veHeader, &stringTokens, &intTokens);
return true;