summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-01-06 06:07:48 +0100
committerlouis <louis.braun@gmx.de>2015-01-06 06:07:48 +0100
commitacd552d5f37ec4882f624baf8cb860c001cfdd89 (patch)
tree5545dbdf9b15d2bd1e0ff57c21f7b699a683570b /views
parent8328a5d4d928bd81179ab03490eb59655d418b58 (diff)
downloadvdr-plugin-skindesigner-acd552d5f37ec4882f624baf8cb860c001cfdd89.tar.gz
vdr-plugin-skindesigner-acd552d5f37ec4882f624baf8cb860c001cfdd89.tar.bz2
added skin blackhole
Diffstat (limited to 'views')
-rw-r--r--views/displaychannelview.c53
-rw-r--r--views/displaychannelview.h2
-rw-r--r--views/displaymenudetailview.c24
-rw-r--r--views/displaymenurootview.c73
-rw-r--r--views/displaymenurootview.h3
-rw-r--r--views/displaymenuview.c121
-rw-r--r--views/displaymenuview.h6
-rw-r--r--views/displayreplayview.c182
-rw-r--r--views/displayreplayview.h6
-rw-r--r--views/displayvolumeview.c2
-rw-r--r--views/viewhelpers.c49
-rw-r--r--views/viewhelpers.h4
12 files changed, 340 insertions, 185 deletions
diff --git a/views/displaychannelview.c b/views/displaychannelview.c
index 8c2b90c..dc4eeea 100644
--- a/views/displaychannelview.c
+++ b/views/displaychannelview.c
@@ -6,7 +6,6 @@
#include "../libcore/helpers.h"
cDisplayChannelView::cDisplayChannelView(cTemplateView *tmplView) : cView(tmplView) {
- lastDate = "";
lastScreenWidth = 0;
lastScreenHeight = 0;
lastSignalDisplay = 0;
@@ -64,35 +63,31 @@ void cDisplayChannelView::DrawDate(void) {
if (!ViewElementImplemented(veDateTime)) {
return;
}
- cString curDate = DayDateTime();
- if (strcmp(curDate, lastDate)) {
- map < string, string > stringTokens;
- map < string, int > intTokens;
-
- time_t t = time(0); // get time now
- struct tm * now = localtime(&t);
-
- intTokens.insert(pair<string, int>("year", now->tm_year + 1900));
- intTokens.insert(pair<string, int>("day", now->tm_mday));
-
- char monthname[20];
- char monthshort[10];
- strftime(monthshort, sizeof(monthshort), "%b", now);
- strftime(monthname, sizeof(monthname), "%B", now);
-
- stringTokens.insert(pair<string,string>("monthname", monthname));
- stringTokens.insert(pair<string,string>("monthnameshort", monthshort));
- stringTokens.insert(pair<string,string>("month", *cString::sprintf("%02d", now->tm_mon + 1)));
- stringTokens.insert(pair<string,string>("dayleadingzero", *cString::sprintf("%02d", now->tm_mday)));
- stringTokens.insert(pair<string,string>("dayname", *WeekDayNameFull(now->tm_wday)));
- stringTokens.insert(pair<string,string>("daynameshort", *WeekDayName(now->tm_wday)));
- stringTokens.insert(pair<string,string>("time", *TimeString(t)));
-
- ClearViewElement(veDateTime);
- DrawViewElement(veDateTime, &stringTokens, &intTokens);
-
- lastDate = curDate;
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ if (!SetDate(stringTokens, intTokens)) {
+ return;
}
+
+ ClearViewElement(veDateTime);
+ DrawViewElement(veDateTime, &stringTokens, &intTokens);
+}
+
+void cDisplayChannelView::DrawTime(void) {
+ if (!ViewElementImplemented(veTime)) {
+ return;
+ }
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ if (!SetTime(stringTokens, intTokens)) {
+ return;
+ }
+ ClearViewElement(veTime);
+ DrawViewElement(veTime, &stringTokens, &intTokens);
}
void cDisplayChannelView::DrawProgressBar(cString &start, cString &stop, int Current, int Total) {
diff --git a/views/displaychannelview.h b/views/displaychannelview.h
index 4cb0be4..bae9910 100644
--- a/views/displaychannelview.h
+++ b/views/displaychannelview.h
@@ -7,7 +7,6 @@
class cDisplayChannelView : public cView, public cViewHelpers {
private:
- cString lastDate;
int lastScreenWidth;
int lastScreenHeight;
int lastSignalDisplay;
@@ -27,6 +26,7 @@ public:
void DrawChannel(cString &number, cString &name, cString &id, bool switching);
void ClearChannel(void);
void DrawDate(void);
+ void DrawTime(void);
void DrawProgressBar(cString &start, cString &stop, int Current, int Total);
void ClearProgressBar(void);
void DrawProgressBarBack(void);
diff --git a/views/displaymenudetailview.c b/views/displaymenudetailview.c
index cec9749..527db7e 100644
--- a/views/displaymenudetailview.c
+++ b/views/displaymenudetailview.c
@@ -790,18 +790,42 @@ void cDisplayMenuDetailView::DrawTabLabels(void) {
map < string, int > labelIntTokens;
map < string, vector< map< string, string > > > labelLoopTokens;
+ string labelPrev = "";
+ string labelPrevTemp = "";
+ string labelCurrent = "";
+ string labelNext = "";
+ bool wasCurrent = false;
vector< map< string, string > > tabLabels;
for (list<cTemplateViewTab*>::iterator it = activeTabs.begin(); it != activeTabs.end(); it++) {
cTemplateViewTab *tab = *it;
map< string, string > tabLabel;
tabLabel.insert(pair< string, string >("tabs[title]", tab->GetName()));
+ if (wasCurrent) {
+ labelNext = tab->GetName();
+ }
if (tab == currentTmplTab) {
+ wasCurrent = true;
+ labelCurrent = tab->GetName();
+ labelPrev = labelPrevTemp;
tabLabel.insert(pair< string, string >("tabs[current]", "1"));
} else {
+ wasCurrent = false;
tabLabel.insert(pair< string, string >("tabs[current]", "0"));
}
+ labelPrevTemp = tab->GetName();
tabLabels.push_back(tabLabel);
}
+ if (labelNext.size() == 0 && activeTabs.size() > 0) {
+ cTemplateViewTab *firstTab = activeTabs.front();
+ labelNext = firstTab->GetName();
+ }
+ if (labelPrev.size() == 0 && activeTabs.size() > 0) {
+ cTemplateViewTab *lastTab = activeTabs.back();
+ labelPrev = lastTab->GetName();
+ }
+ labelStringTokens.insert(pair< string, string >("currenttab", labelCurrent));
+ labelStringTokens.insert(pair< string, string >("nexttab", labelNext));
+ labelStringTokens.insert(pair< string, string >("prevtab", labelPrev));
labelLoopTokens.insert(pair< string, vector< map< string, string > > >("tabs", tabLabels));
ClearViewElement(veTabLabels);
diff --git a/views/displaymenurootview.c b/views/displaymenurootview.c
index 47de424..556e19a 100644
--- a/views/displaymenurootview.c
+++ b/views/displaymenurootview.c
@@ -393,10 +393,8 @@ void cDisplayMenuRootView::Render(void) {
if (!view)
return;
if (!view->DrawBackground()) {
- if (!defaultBackgroundDrawn) {
- defaultBackgroundDrawn = true;
- DrawBackground();
- }
+ defaultBackgroundDrawn = true;
+ DrawBackground();
} else {
defaultBackgroundDrawn = false;
}
@@ -415,13 +413,6 @@ void cDisplayMenuRootView::Render(void) {
defaultButtonsDrawn = false;
}
- if (!view->DrawDateTime()) {
- defaultDateTimeDrawn = true;
- DrawDateTime();
- } else {
- defaultDateTimeDrawn = false;
- }
-
view->DrawStaticViewElements();
view->DrawDynamicViewElements();
}
@@ -443,7 +434,24 @@ void cDisplayMenuRootView::RenderMenuScrollBar(int Total, int Offset) {
}
bool cDisplayMenuRootView::RenderDynamicElements(void) {
- return view->DrawDynamicViewElements();
+ bool updated = false;
+ if (view->DrawTime()) {
+ updated = true;
+ } else if (DrawTime()) {
+ updated = true;
+ }
+ if (view->DrawDynamicViewElements()){
+ updated = true;
+ }
+
+ if (!view->DrawDateTime()) {
+ defaultDateTimeDrawn = true;
+ DrawDateTime();
+ } else {
+ defaultDateTimeDrawn = false;
+ }
+
+ return updated;
}
/*******************************************************************
@@ -451,7 +459,9 @@ bool cDisplayMenuRootView::RenderDynamicElements(void) {
*******************************************************************/
void cDisplayMenuRootView::DrawBackground(void) {
- DrawViewElement(veBackground);
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+ DrawViewElement(veBackground, &stringTokens, &intTokens);
}
void cDisplayMenuRootView::DrawHeader(void) {
if (!ViewElementImplemented(veHeader)) {
@@ -500,28 +510,29 @@ void cDisplayMenuRootView::DrawDateTime(void) {
map < string, string > stringTokens;
map < string, int > intTokens;
- time_t t = time(0); // get time now
- struct tm * now = localtime(&t);
-
- intTokens.insert(pair<string, int>("year", now->tm_year + 1900));
- intTokens.insert(pair<string, int>("day", now->tm_mday));
-
- char monthname[20];
- char monthshort[10];
- strftime(monthshort, sizeof(monthshort), "%b", now);
- strftime(monthname, sizeof(monthname), "%B", now);
-
- stringTokens.insert(pair<string,string>("monthname", monthname));
- stringTokens.insert(pair<string,string>("monthnameshort", monthshort));
- stringTokens.insert(pair<string,string>("month", *cString::sprintf("%02d", now->tm_mon + 1)));
- stringTokens.insert(pair<string,string>("dayleadingzero", *cString::sprintf("%02d", now->tm_mday)));
- stringTokens.insert(pair<string,string>("dayname", *WeekDayNameFull(now->tm_wday)));
- stringTokens.insert(pair<string,string>("daynameshort", *WeekDayName(now->tm_wday)));
- stringTokens.insert(pair<string,string>("time", *TimeString(t)));
+ if (!SetDate(stringTokens, intTokens)) {
+ return;
+ }
ClearViewElement(veDateTime);
DrawViewElement(veDateTime, &stringTokens, &intTokens);
+}
+bool cDisplayMenuRootView::DrawTime(void) {
+ if (!ViewElementImplemented(veTime)) {
+ return false;
+ }
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ if (!SetTime(stringTokens, intTokens)) {
+ return false;
+ }
+
+ ClearViewElement(veTime);
+ DrawViewElement(veTime, &stringTokens, &intTokens);
+ return true;
}
diff --git a/views/displaymenurootview.h b/views/displaymenurootview.h
index a605507..33a78a9 100644
--- a/views/displaymenurootview.h
+++ b/views/displaymenurootview.h
@@ -12,7 +12,7 @@ enum ePluginMenuType {
mtUnknown
};
-class cDisplayMenuRootView : public cView {
+class cDisplayMenuRootView : public cView, public cViewHelpers {
private:
eMenuCategory cat;
eSubView viewType;
@@ -35,6 +35,7 @@ private:
void DrawBackground(void);
void DrawHeader(void);
void DrawDateTime(void);
+ bool DrawTime(void);
void DrawColorButtons(void);
void DrawMessage(eMessageType type, const char *text);
void ClearRootView(void);
diff --git a/views/displaymenuview.c b/views/displaymenuview.c
index 5f9b0b8..e7ec491 100644
--- a/views/displaymenuview.c
+++ b/views/displaymenuview.c
@@ -1,4 +1,6 @@
#define __STL_CONFIG_H
+#include <fstream>
+#include <iostream>
#include <vdr/menu.h>
#include <vdr/videodir.h>
#include "displaymenuview.h"
@@ -25,7 +27,10 @@ bool cDisplayMenuView::DrawBackground(void) {
if (!ViewElementImplemented(veBackground)) {
return false;
}
- DrawViewElement(veBackground);
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ DrawViewElement(veBackground, &stringTokens, &intTokens);
return true;
}
@@ -72,35 +77,36 @@ bool cDisplayMenuView::DrawDateTime(void) {
return false;
}
- cString curDate = DayDateTime();
-
map < string, string > stringTokens;
map < string, int > intTokens;
- time_t t = time(0); // get time now
- struct tm * now = localtime(&t);
-
- intTokens.insert(pair<string, int>("year", now->tm_year + 1900));
- intTokens.insert(pair<string, int>("day", now->tm_mday));
-
- char monthname[20];
- char monthshort[10];
- strftime(monthshort, sizeof(monthshort), "%b", now);
- strftime(monthname, sizeof(monthname), "%B", now);
-
- stringTokens.insert(pair<string,string>("monthname", monthname));
- stringTokens.insert(pair<string,string>("monthnameshort", monthshort));
- stringTokens.insert(pair<string,string>("month", *cString::sprintf("%02d", now->tm_mon + 1)));
- stringTokens.insert(pair<string,string>("dayleadingzero", *cString::sprintf("%02d", now->tm_mday)));
- stringTokens.insert(pair<string,string>("dayname", *WeekDayNameFull(now->tm_wday)));
- stringTokens.insert(pair<string,string>("daynameshort", *WeekDayName(now->tm_wday)));
- stringTokens.insert(pair<string,string>("time", *TimeString(t)));
+ if (!SetDate(stringTokens, intTokens)) {
+ return false;
+ }
ClearViewElement(veDateTime);
DrawViewElement(veDateTime, &stringTokens, &intTokens);
return true;
}
+bool cDisplayMenuView::DrawTime(void) {
+ if (!ViewElementImplemented(veTime)) {
+ return false;
+ }
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ if (!SetTime(stringTokens, intTokens)) {
+ return false;
+ }
+
+ ClearViewElement(veTime);
+ DrawViewElement(veTime, &stringTokens, &intTokens);
+
+ return true;
+}
+
bool cDisplayMenuView::DrawColorButtons(void) {
if (!ViewElementImplemented(veButtons)) {
return false;
@@ -229,6 +235,7 @@ cDisplayMenuMainView::~cDisplayMenuMainView() {
void cDisplayMenuMainView::DrawStaticViewElements(void) {
DrawTimers();
DrawDiscUsage();
+ DrawTemperatures();
DrawCurrentSchedule();
DrawCustomTokens();
}
@@ -374,7 +381,30 @@ bool cDisplayMenuMainView::DrawLoad(void) {
return false;
}
string load = *cString::sprintf("%.2f", systemLoad);
+ int loadHand = systemLoad * 1000;
+ int loadHandValue = 0;
+ if (loadHand > 2500)
+ loadHandValue = 2525;
+ else {
+
+ int loadHandDec = loadHand - (loadHand / 100) * 100;
+
+ if (loadHandDec <= 12)
+ loadHandDec = 0;
+ else if (loadHandDec <= 37)
+ loadHandDec = 25;
+ else if (loadHandDec <= 62)
+ loadHandDec = 50;
+ else if (loadHandDec <= 87)
+ loadHandDec = 75;
+ else
+ loadHandDec = 0;
+
+ loadHandValue = loadHand / 100 * 100 + loadHandDec;
+ }
+
stringTokens.insert(pair<string,string>("load", load));
+ intTokens.insert(pair<string,int>("loadhand", loadHandValue));
lastSystemLoad = systemLoad;
}
@@ -384,6 +414,55 @@ bool cDisplayMenuMainView::DrawLoad(void) {
return true;
}
+void cDisplayMenuMainView::DrawTemperatures(void) {
+ if (!ViewElementImplemented(veTemperatures)) {
+ return;
+ }
+
+ cString execCommand = cString::sprintf("cd \"%s/\"; \"%s/temperatures\"", SCRIPTFOLDER, SCRIPTFOLDER);
+ system(*execCommand);
+
+ string tempCPU, tempGPU;
+ int cpu, gpu;
+
+ cString itemFilename = cString::sprintf("%s/cpu", SCRIPTOUTPUTPATH );
+ ifstream file(*itemFilename, ifstream::in);
+ if( file.is_open() ) {
+ std::getline(file, tempCPU);
+ if (tempCPU.size() > 2) {
+ cpu = atoi(tempCPU.substr(0,2).c_str());
+ } else
+ cpu = 0;
+ file.close();
+ } else {
+ tempCPU = "0°C";
+ cpu = 0;
+ }
+
+ itemFilename = cString::sprintf("%s/gpu", SCRIPTOUTPUTPATH );
+ ifstream file2(*itemFilename, ifstream::in);
+ if( file2.is_open() ) {
+ std::getline(file2, tempGPU);
+ if (tempGPU.size() > 2) {
+ gpu = atoi(tempGPU.substr(0,2).c_str());
+ } else
+ gpu = 0;
+ file2.close();
+ } else {
+ tempGPU = "0°C";
+ gpu = 0;
+ }
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ intTokens.insert(pair<string,int>("cputemp", cpu));
+ intTokens.insert(pair<string,int>("gputemp", gpu));
+
+ ClearViewElement(veTemperatures);
+ DrawViewElement(veTemperatures, &stringTokens, &intTokens);
+}
+
bool cDisplayMenuMainView::DrawDevices(void) {
if (!ViewElementImplemented(veDevices)) {
return false;
diff --git a/views/displaymenuview.h b/views/displaymenuview.h
index 04bc986..da1c55c 100644
--- a/views/displaymenuview.h
+++ b/views/displaymenuview.h
@@ -5,7 +5,7 @@
#include "viewhelpers.h"
#include "displaymenulistview.h"
-class cDisplayMenuView : public cView {
+class cDisplayMenuView : public cView, public cViewHelpers {
protected:
eMenuCategory cat;
string menuTitle;
@@ -22,6 +22,7 @@ public:
bool DrawBackground(void);
virtual bool DrawHeader(void);
bool DrawDateTime(void);
+ bool DrawTime(void);
bool DrawColorButtons(void);
bool DrawMessage(eMessageType type, const char *text);
void DrawScrollbar(int numMax, int numDisplayed, int offset);
@@ -30,13 +31,14 @@ public:
bool BackgroundImplemented(void);
};
-class cDisplayMenuMainView : public cDisplayMenuView, public cViewHelpers {
+class cDisplayMenuMainView : public cDisplayMenuView {
private:
bool initial;
double lastSystemLoad;
void DrawTimers(void);
void DrawDiscUsage(void);
bool DrawLoad(void);
+ void DrawTemperatures(void);
bool DrawDevices(void);
void DrawCurrentSchedule(void);
void DrawCustomTokens(void);
diff --git a/views/displayreplayview.c b/views/displayreplayview.c
index 299978f..1c8429b 100644
--- a/views/displayreplayview.c
+++ b/views/displayreplayview.c
@@ -6,7 +6,6 @@
cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) {
onPauseView = NULL;
- lastDate = "";
numMarksLast = 0;
lastMarks = NULL;
markActive = -1;
@@ -43,40 +42,35 @@ void cDisplayReplayView::DrawBackground(bool modeOnly) {
DrawViewElement(veBackground, &stringTokens, &intTokens);
}
-void cDisplayReplayView::DrawDate(bool modeOnly) {
- if (modeOnly)
- return;
+void cDisplayReplayView::DrawDate(void) {
if (!ViewElementImplemented(veDateTime)) {
return;
}
- cString curDate = DayDateTime();
- if (strcmp(curDate, lastDate)) {
- map < string, string > stringTokens;
- map < string, int > intTokens;
-
- time_t t = time(0); // get time now
- struct tm * now = localtime(&t);
-
- intTokens.insert(pair<string, int>("year", now->tm_year + 1900));
- intTokens.insert(pair<string, int>("day", now->tm_mday));
-
- char monthname[20];
- char monthshort[10];
- strftime(monthshort, sizeof(monthshort), "%b", now);
- strftime(monthname, sizeof(monthname), "%B", now);
- stringTokens.insert(pair<string,string>("monthname", monthname));
- stringTokens.insert(pair<string,string>("monthnameshort", monthshort));
- stringTokens.insert(pair<string,string>("month", *cString::sprintf("%02d", now->tm_mon + 1)));
- stringTokens.insert(pair<string,string>("dayleadingzero", *cString::sprintf("%02d", now->tm_mday)));
- stringTokens.insert(pair<string,string>("dayname", *WeekDayNameFull(now->tm_wday)));
- stringTokens.insert(pair<string,string>("daynameshort", *WeekDayName(now->tm_wday)));
- stringTokens.insert(pair<string,string>("time", *TimeString(t)));
-
- ClearViewElement(veDateTime);
- DrawViewElement(veDateTime, &stringTokens, &intTokens);
-
- lastDate = curDate;
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ if (!SetDate(stringTokens, intTokens)) {
+ return;
+ }
+
+ ClearViewElement(veDateTime);
+ DrawViewElement(veDateTime, &stringTokens, &intTokens);
+}
+
+void cDisplayReplayView::DrawTime(void) {
+ if (!ViewElementImplemented(veTime)) {
+ return;
}
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ if (!SetTime(stringTokens, intTokens)) {
+ return;
+ }
+ ClearViewElement(veTime);
+ DrawViewElement(veTime, &stringTokens, &intTokens);
}
void cDisplayReplayView::DrawTitle(const cRecording *recording) {
@@ -134,75 +128,71 @@ void cDisplayReplayView::DrawScraperContent(const cRecording *recording) {
return;
}
- static cPlugin *pScraper = GetScraperPlugin();
- if (!pScraper) {
- return;
- }
+ int mediaWidth = 0;
+ int mediaHeight = 0;
+ string mediaPath = "";
+ bool isBanner = false;
+ int posterWidth = 0;
+ int posterHeight = 0;
+ string posterPath = "";
+ bool hasPoster = false;
+ int bannerWidth = 0;
+ int bannerHeight = 0;
+ string bannerPath = "";
+ bool hasBanner = false;
- ScraperGetPosterBannerV2 call;
- call.event = NULL;
- call.recording = recording;
- if (pScraper->Service("GetPosterBannerV2", &call)) {
- int mediaWidth = 0;
- int mediaHeight = 0;
- string mediaPath = "";
- bool isBanner = false;
- int posterWidth = 0;
- int posterHeight = 0;
- string posterPath = "";
- bool hasPoster = false;
- int bannerWidth = 0;
- int bannerHeight = 0;
- string bannerPath = "";
- bool hasBanner = false;
-
- if ((call.type == tSeries) && call.banner.path.size() > 0) {
- mediaWidth = call.banner.width;
- mediaHeight = call.banner.height;
- mediaPath = call.banner.path;
- isBanner = true;
- bannerWidth = mediaWidth;
- bannerHeight = mediaHeight;
- bannerPath = mediaPath;
- hasBanner = true;
-
- ScraperGetPoster callPoster;
- callPoster.event = NULL;
- callPoster.recording = recording;
- if (pScraper->Service("GetPoster", &callPoster)) {
- posterWidth = callPoster.poster.width;
- posterHeight = callPoster.poster.height;
- posterPath = callPoster.poster.path;
+ static cPlugin *pScraper = GetScraperPlugin();
+ if (pScraper) {
+ ScraperGetPosterBannerV2 call;
+ call.event = NULL;
+ call.recording = recording;
+ if (pScraper->Service("GetPosterBannerV2", &call)) {
+ if ((call.type == tSeries) && call.banner.path.size() > 0) {
+ mediaWidth = call.banner.width;
+ mediaHeight = call.banner.height;
+ mediaPath = call.banner.path;
+ isBanner = true;
+ bannerWidth = mediaWidth;
+ bannerHeight = mediaHeight;
+ bannerPath = mediaPath;
+ hasBanner = true;
+
+ ScraperGetPoster callPoster;
+ callPoster.event = NULL;
+ callPoster.recording = recording;
+ if (pScraper->Service("GetPoster", &callPoster)) {
+ posterWidth = callPoster.poster.width;
+ posterHeight = callPoster.poster.height;
+ posterPath = callPoster.poster.path;
+ hasPoster = true;
+ }
+ } else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) {
+ mediaWidth = call.poster.width;
+ mediaHeight = call.poster.height;
+ mediaPath = call.poster.path;
+ posterWidth = call.poster.width;
+ posterHeight = call.poster.height;
+ posterPath = call.poster.path;
hasPoster = true;
}
- } else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) {
- mediaWidth = call.poster.width;
- mediaHeight = call.poster.height;
- mediaPath = call.poster.path;
- posterWidth = call.poster.width;
- posterHeight = call.poster.height;
- posterPath = call.poster.path;
- hasPoster = true;
- } else
- return;
-
- map < string, int > intTokens;
- map < string, string > stringTokens;
- intTokens.insert(pair<string,int>("mediawidth", mediaWidth));
- intTokens.insert(pair<string,int>("mediaheight", mediaHeight));
- intTokens.insert(pair<string,int>("isbanner", isBanner));
- stringTokens.insert(pair<string,string>("mediapath", mediaPath));
- intTokens.insert(pair<string,int>("posterwidth", posterWidth));
- intTokens.insert(pair<string,int>("posterheight", posterHeight));
- stringTokens.insert(pair<string,string>("posterpath", posterPath));
- intTokens.insert(pair<string,int>("hasposter", hasPoster));
- intTokens.insert(pair<string,int>("bannerwidth", bannerWidth));
- intTokens.insert(pair<string,int>("bannerheight", bannerHeight));
- stringTokens.insert(pair<string,string>("bannerpath", bannerPath));
- intTokens.insert(pair<string,int>("hasbanner", hasBanner));
- ClearViewElement(veScraperContent);
- DrawViewElement(veScraperContent, &stringTokens, &intTokens);
+ }
}
+ map < string, int > intTokens;
+ map < string, string > stringTokens;
+ intTokens.insert(pair<string,int>("mediawidth", mediaWidth));
+ intTokens.insert(pair<string,int>("mediaheight", mediaHeight));
+ intTokens.insert(pair<string,int>("isbanner", isBanner));
+ stringTokens.insert(pair<string,string>("mediapath", mediaPath));
+ intTokens.insert(pair<string,int>("posterwidth", posterWidth));
+ intTokens.insert(pair<string,int>("posterheight", posterHeight));
+ stringTokens.insert(pair<string,string>("posterpath", posterPath));
+ intTokens.insert(pair<string,int>("hasposter", hasPoster));
+ intTokens.insert(pair<string,int>("bannerwidth", bannerWidth));
+ intTokens.insert(pair<string,int>("bannerheight", bannerHeight));
+ stringTokens.insert(pair<string,string>("bannerpath", bannerPath));
+ intTokens.insert(pair<string,int>("hasbanner", hasBanner));
+ ClearViewElement(veScraperContent);
+ DrawViewElement(veScraperContent, &stringTokens, &intTokens);
}
void cDisplayReplayView::DrawCurrent(const char *current) {
diff --git a/views/displayreplayview.h b/views/displayreplayview.h
index cf94a4a..cb8f7f7 100644
--- a/views/displayreplayview.h
+++ b/views/displayreplayview.h
@@ -5,10 +5,9 @@
#include "view.h"
#include "displayreplayonpauseview.h"
-class cDisplayReplayView : public cView {
+class cDisplayReplayView : public cView, public cViewHelpers {
private:
cDisplayReplayOnPauseView *onPauseView;
- cString lastDate;
int numMarksLast;
int *lastMarks;
int markActive;
@@ -20,7 +19,8 @@ public:
virtual ~cDisplayReplayView();
bool createOsd(void);
void DrawBackground(bool modeOnly);
- void DrawDate(bool modeOnly);
+ void DrawDate(void);
+ void DrawTime(void);
void DrawTitle(const cRecording *recording);
void DrawRecordingInformation(const cRecording *recording);
void DrawScraperContent(const cRecording *recording);
diff --git a/views/displayvolumeview.c b/views/displayvolumeview.c
index e3700dd..4ab2fdd 100644
--- a/views/displayvolumeview.c
+++ b/views/displayvolumeview.c
@@ -40,7 +40,7 @@ void cDisplayVolumeView::DrawVolume(int current, int total, bool mute) {
intTokens.insert(pair<string,int>("volume", current));
intTokens.insert(pair<string,int>("maxvolume", total));
- intTokens.insert(pair<string,int>("volumepercent", (double)current *100 / (double)total));
+ intTokens.insert(pair<string,int>("volpercent", (double)current *100 / (double)total));
intTokens.insert(pair<string,int>("mute", mute));
ClearViewElement(veVolume);
diff --git a/views/viewhelpers.c b/views/viewhelpers.c
index 0bcc738..e0223af 100644
--- a/views/viewhelpers.c
+++ b/views/viewhelpers.c
@@ -6,6 +6,8 @@
cViewHelpers::cViewHelpers(void) {
devicesInit = false;
+ lastSecond = -1;
+ lastMinute = -1;
}
cViewHelpers::~cViewHelpers() {
@@ -377,3 +379,50 @@ void cViewHelpers::SetScraperTokens(const cEvent *event, const cRecording *recor
}
}
+
+bool cViewHelpers::SetTime(map < string, string > &stringTokens, map < string, int > &intTokens) {
+ time_t t = time(0); // get time now
+ struct tm * now = localtime(&t);
+ int sec = now->tm_sec;
+ if (sec == lastSecond)
+ return false;
+
+ int min = now->tm_min;
+ int hour = now->tm_hour;
+ int hourMinutes = hour%12 * 5 + min / 12;
+
+ intTokens.insert(pair<string, int>("sec", sec));
+ intTokens.insert(pair<string, int>("min", min));
+ intTokens.insert(pair<string, int>("hour", hour));
+ intTokens.insert(pair<string, int>("hmins", hourMinutes));
+
+ lastSecond = sec;
+ return true;
+}
+
+bool cViewHelpers::SetDate(map < string, string > &stringTokens, map < string, int > &intTokens) {
+ time_t t = time(0); // get time now
+ struct tm * now = localtime(&t);
+ int min = now->tm_min;
+ if (min == lastMinute)
+ return false;
+
+ intTokens.insert(pair<string, int>("year", now->tm_year + 1900));
+ intTokens.insert(pair<string, int>("day", now->tm_mday));
+
+ char monthname[20];
+ char monthshort[10];
+ strftime(monthshort, sizeof(monthshort), "%b", now);
+ strftime(monthname, sizeof(monthname), "%B", now);
+
+ stringTokens.insert(pair<string,string>("monthname", monthname));
+ stringTokens.insert(pair<string,string>("monthnameshort", monthshort));
+ stringTokens.insert(pair<string,string>("month", *cString::sprintf("%02d", now->tm_mon + 1)));
+ stringTokens.insert(pair<string,string>("dayleadingzero", *cString::sprintf("%02d", now->tm_mday)));
+ stringTokens.insert(pair<string,string>("dayname", *WeekDayNameFull(now->tm_wday)));
+ stringTokens.insert(pair<string,string>("daynameshort", *WeekDayName(now->tm_wday)));
+ stringTokens.insert(pair<string,string>("time", *TimeString(t)));
+
+ lastMinute = min;
+ return true;
+} \ No newline at end of file
diff --git a/views/viewhelpers.h b/views/viewhelpers.h
index 8e57bb4..2b3167b 100644
--- a/views/viewhelpers.h
+++ b/views/viewhelpers.h
@@ -7,11 +7,15 @@ private:
int* lastSignalStrength;
int* lastSignalQuality;
bool* recDevices;
+ int lastSecond;
+ int lastMinute;
protected:
void InitDevices(void);
bool SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices);
bool CheckNewMails(void);
void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens);
+ bool SetTime(map < string, string > &stringTokens, map < string, int > &intTokens);
+ bool SetDate(map < string, string > &stringTokens, map < string, int > &intTokens);
public:
cViewHelpers(void);
virtual ~cViewHelpers(void);