summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schirrmacher <vdr.skinflat@schirrmacher.eu>2013-08-19 15:44:43 (GMT)
committerMartin Schirrmacher <vdr.skinflat@schirrmacher.eu>2013-08-19 15:44:43 (GMT)
commit85e4985984c836c5800b7d548ec3ed84d523eb38 (patch)
treeb8cfdab3b08b78af42fa5eb900eddede4587c7a1
parentf44adfed65bfac7d6bb15da30ffae9fffafa4a40 (diff)
downloadskin-flat-85e4985984c836c5800b7d548ec3ed84d523eb38.tar.gz
skin-flat-85e4985984c836c5800b7d548ec3ed84d523eb38.tar.bz2
show disk usage in topbar
-rw-r--r--HISTORY3
-rw-r--r--baserender.c29
-rw-r--r--baserender.h2
-rw-r--r--displaymenu.c18
-rw-r--r--displaymenu.h5
-rw-r--r--po/de_DE.po8
6 files changed, 56 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index ab0a0e2..91387ad 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,9 @@
VDR Plugin 'skinflat' Revision History
---------------------------------------
+2013-XX-XX: Version 0.1.1
+- [add] show disk usage in topbar @ menu recordings & timer
+
2013-09-08: Version 0.1.0
- [add] parameter to set channel logos path (-l --logo)
- [add] 3 new themes - green, gold, red (include icons)
diff --git a/baserender.c b/baserender.c
index 11bca47..d68ab3c 100644
--- a/baserender.c
+++ b/baserender.c
@@ -10,6 +10,8 @@ cFlatBaseRender::cFlatBaseRender(void) {
fontSmlHeight = fontSml->Height();
topBarTitle = "";
+ tobBarTitleExtra1 = "";
+ tobBarTitleExtra2 = "";
topBarLastDate = "";
topBarUpdateTitle = false;
topBarHeight = 0;
@@ -83,6 +85,12 @@ void cFlatBaseRender::TopBarSetTitle(cString title) {
topBarUpdateTitle = true;
}
+void cFlatBaseRender::TopBarSetTitleExtra(cString extra1, cString extra2) {
+ tobBarTitleExtra1 = extra1;
+ tobBarTitleExtra2 = extra2;
+ topBarUpdateTitle = true;
+}
+
// sollte bei jedum "Flush" aufgerufen werden!
void cFlatBaseRender::TopBarUpdate(void) {
cString curDate = DayDateTime();
@@ -91,27 +99,36 @@ void cFlatBaseRender::TopBarUpdate(void) {
topBarLastDate = curDate;
int fontTop = (topBarHeight - fontHeight) / 2;
+ int fontSmlTop = (topBarHeight - fontSmlHeight*2) / 2;
+
topBarPixmap->Fill(Theme.Color(clrTopBarBg));
topBarPixmap->DrawText(cPoint(marginItem*2, fontTop), topBarTitle, Theme.Color(clrTopBarFont), Theme.Color(clrTopBarBg), font);
+
+ int extra1Width = fontSml->Width(tobBarTitleExtra1);
+ int extra2Width = fontSml->Width(tobBarTitleExtra2);
+ int extraMaxWidth = max(extra1Width, extra2Width);
+ int extraLeft = osdWidth/2 - extraMaxWidth/2;
+ topBarPixmap->DrawText(cPoint(extraLeft, fontSmlTop), tobBarTitleExtra1, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, extraMaxWidth);
+ topBarPixmap->DrawText(cPoint(extraLeft, fontSmlTop + fontSmlHeight), tobBarTitleExtra2, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, extraMaxWidth);
+
time_t t;
time(&t);
-
+
cString time = TimeString(t);
cString time2 = cString::sprintf("%s %s", *time, tr("clock"));
-
+
int timeWidth = font->Width(*time2) + marginItem*2;
topBarPixmap->DrawText(cPoint(osdWidth - timeWidth, fontTop), time2, Theme.Color(clrTopBarTimeFont), Theme.Color(clrTopBarBg), font);
-
+
cString weekday = WeekDayNameFull(t);
int weekdayWidth = fontSml->Width(*weekday);
-
+
cString date = ShortDateString(t);
int dateWidth = fontSml->Width(*date);
int fullWidth = max(weekdayWidth, dateWidth);
-
- int fontSmlTop = (topBarHeight - fontSmlHeight*2) / 2;
+
topBarPixmap->DrawText(cPoint(osdWidth - timeWidth - fullWidth - marginItem*2, fontSmlTop), weekday, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, fullWidth, 0, taCenter);
topBarPixmap->DrawText(cPoint(osdWidth - timeWidth - fullWidth - marginItem*2, fontSmlTop + fontSmlHeight), date, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), fontSml, fullWidth, 0, taCenter);
}
diff --git a/baserender.h b/baserender.h
index 698e1c6..5bd55ee 100644
--- a/baserender.h
+++ b/baserender.h
@@ -22,6 +22,7 @@ class cFlatBaseRender
// TopBar
cPixmap *topBarPixmap;
cString topBarTitle;
+ cString tobBarTitleExtra1, tobBarTitleExtra2;
bool topBarUpdateTitle;
cString topBarLastDate;
int topBarHeight;
@@ -66,6 +67,7 @@ class cFlatBaseRender
void TopBarCreate(void);
void TopBarSetTitle(cString title);
+ void TopBarSetTitleExtra(cString extra1, cString extra2);
void TopBarUpdate(void);
void ButtonsCreate(void);
diff --git a/displaymenu.c b/displaymenu.c
index 3d7881b..5ec1116 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -23,6 +23,8 @@ cFlatDisplayMenu::cFlatDisplayMenu(void) {
menuPixmap->Fill(clrTransparent);
scrollbarPixmap->Fill(clrTransparent);
+
+ menuCategory = mcUndefined;
}
cFlatDisplayMenu::~cFlatDisplayMenu() {
@@ -30,6 +32,10 @@ cFlatDisplayMenu::~cFlatDisplayMenu() {
osd->DestroyPixmap(scrollbarPixmap);
}
+void cFlatDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) {
+ menuCategory = MenuCategory;
+}
+
void cFlatDisplayMenu::DrawScrollbar(int Total, int Offset, int Shown, int Top, int Height, bool CanScrollUp, bool CanScrollDown) {
if (Total > 0 && Total > Shown) {
int scrollHeight = max(int((Height) * double(Shown) / Total + 0.5), 5);
@@ -76,7 +82,17 @@ void cFlatDisplayMenu::Clear(void) {
}
void cFlatDisplayMenu::SetTitle(const char *Title) {
- TopBarSetTitle(Title);
+ if( menuCategory == mcRecording || menuCategory == mcTimer ) {
+ cVideoDiskUsage::HasChanged(VideoDiskUsageState);
+ int DiskUsage = cVideoDiskUsage::UsedPercent();
+ int FreeGB = cVideoDiskUsage::FreeMB() / 1024;
+ cString extra1 = cString::sprintf("%s: %d%%", tr("disk usage"), DiskUsage);
+ cString extra2 = cString::sprintf("%s: %d GB", tr("free space"), FreeGB);
+
+ TopBarSetTitle(Title);
+ TopBarSetTitleExtra(extra1, extra2);
+ } else
+ TopBarSetTitle(Title);
}
void cFlatDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) {
diff --git a/displaymenu.h b/displaymenu.h
index 37662ea..77ab33b 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -8,6 +8,9 @@ class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu {
cPixmap *menuPixmap;
int menuWidth;
+ eMenuCategory menuCategory;
+ int VideoDiskUsageState = -1;
+
int contentTop;
cPixmap *scrollbarPixmap;
@@ -24,7 +27,7 @@ class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu {
virtual int MaxItems(void);
virtual void Clear(void);
- //virtual void SetMenuCategory(eMenuCategory MenuCategory);
+ virtual void SetMenuCategory(eMenuCategory MenuCategory);
//virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0);
virtual void SetTitle(const char *Title);
diff --git a/po/de_DE.po b/po/de_DE.po
index 0c2e182..0d2c59f 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-skinflat 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-08-04 18:47+0200\n"
+"POT-Creation-Date: 2013-08-18 22:35+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,5 +18,11 @@ msgstr ""
msgid "clock"
msgstr "Uhr"
+msgid "disk usage"
+msgstr ""
+
+msgid "free space"
+msgstr ""
+
msgid "Volume"
msgstr "Lautstärke"