added discusage icons to menu header view element

This commit is contained in:
louis 2014-10-07 16:51:33 +02:00
parent 797e33441e
commit 82f2bbd5c4
5 changed files with 42 additions and 0 deletions

View File

@ -14,3 +14,4 @@ Version 0.0.2
- added Theme support, each skin can now have various themes
- fixed a crash if no skindesigner skins are found and plugin setup menu is called from another skin
- added {durationhours} and {durationminutes} tokens in several view elements
- added discusage icons to menu header view element so that it discusage can be displayed in every menu view

View File

@ -33,6 +33,12 @@
{vdrversion} running VDR Version
{hasicon} true if a menu icon is available
{icon} path of menu icon
{freetime} available disc capacity in hh:mm
{freepercent} available disc capacity in percent
{usedpercent} used disc capacity in percent
{freegb} available disc capacity in gigabytes
{discalert} true if disc usage is > 95%
{vdrusagestring} localized VDR internal usage string
-->
<header>
<area x="0" y="0" width="41%" height="10%" layer="2">

View File

@ -25,6 +25,12 @@
{vdrversion} running VDR Version
{hasicon} true if a menu icon is available
{icon} path of menu icon
{freetime} available disc capacity in hh:mm
{freepercent} available disc capacity in percent
{usedpercent} used disc capacity in percent
{freegb} available disc capacity in gigabytes
{discalert} true if disc usage is > 95%
{vdrusagestring} localized VDR internal usage string
-->
<header>
</header>

View File

@ -1,5 +1,6 @@
#define __STL_CONFIG_H
#include <vdr/menu.h>
#include <vdr/videodir.h>
#include "displaymenurootview.h"
#include "../config.h"
#include "../libcore/helpers.h"
@ -380,6 +381,20 @@ void cDisplayMenuRootView::DrawHeader(void) {
stringTokens.insert(pair<string,string>("icon", icon));
intTokens.insert(pair<string,int>("hasicon", hasIcon));
//Disc Usage
string vdrUsageString = *cVideoDiskUsage::String();
int discUsage = cVideoDiskUsage::UsedPercent();
bool discAlert = (discUsage > 95) ? true : false;
string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60);
int freeGB = cVideoDiskUsage::FreeMB() / 1024;
intTokens.insert(pair<string, int>("usedpercent", discUsage));
intTokens.insert(pair<string, int>("freepercent", 100-discUsage));
intTokens.insert(pair<string, int>("discalert", discAlert));
intTokens.insert(pair<string, int>("freegb", freeGB));
stringTokens.insert(pair<string,string>("freetime", freeTime));
stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
ClearViewElement(veHeader);
DrawViewElement(veHeader, &stringTokens, &intTokens);
}

View File

@ -46,6 +46,20 @@ bool cDisplayMenuView::DrawHeader(void) {
stringTokens.insert(pair<string,string>("icon", icon));
intTokens.insert(pair<string,int>("hasicon", hasIcon));
//Disc Usage
string vdrUsageString = *cVideoDiskUsage::String();
int discUsage = cVideoDiskUsage::UsedPercent();
bool discAlert = (discUsage > 95) ? true : false;
string freeTime = *cString::sprintf("%02d:%02d", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60);
int freeGB = cVideoDiskUsage::FreeMB() / 1024;
intTokens.insert(pair<string, int>("usedpercent", discUsage));
intTokens.insert(pair<string, int>("freepercent", 100-discUsage));
intTokens.insert(pair<string, int>("discalert", discAlert));
intTokens.insert(pair<string, int>("freegb", freeGB));
stringTokens.insert(pair<string,string>("freetime", freeTime));
stringTokens.insert(pair<string,string>("vdrusagestring", vdrUsageString));
ClearViewElement(veHeader);
DrawViewElement(veHeader, &stringTokens, &intTokens);
return true;