summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-12-12 17:52:16 +0100
committerlouis <louis.braun@gmx.de>2014-12-12 17:52:16 +0100
commit84756db20870696911fdac83313d256085b9966b (patch)
tree5e7d704d6e76c7245b9e3f499e83a8cc0813b02f
parente746d28750d231a57494f9cffe648087b6f4d37f (diff)
downloadvdr-plugin-skindesigner-84756db20870696911fdac83313d256085b9966b.tar.gz
vdr-plugin-skindesigner-84756db20870696911fdac83313d256085b9966b.tar.bz2
added currentschedule viewelement in displaymenumain
-rw-r--r--HISTORY3
-rw-r--r--dtd/displaymenu.dtd7
-rw-r--r--libtemplate/templateview.c9
-rw-r--r--libtemplate/templateviewelement.h1
-rw-r--r--libtemplate/xmlparser.c2
-rw-r--r--skinskeleton/xmlfiles/displaymenumain.xml22
-rw-r--r--views/displaymenuview.c100
-rw-r--r--views/displaymenuview.h1
8 files changed, 143 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index bdf1086..a9f7ac2 100644
--- a/HISTORY
+++ b/HISTORY
@@ -111,4 +111,5 @@ Version 0.0.8
Version 0.1.0
- fixed display of color buttons in detailed views
-- fixed possible Nullpointer access in displaymenurootview \ No newline at end of file
+- fixed possible Nullpointer access in displaymenurootview
+- added currentschedule viewelement in displaymenumain \ No newline at end of file
diff --git a/dtd/displaymenu.dtd b/dtd/displaymenu.dtd
index 4b93809..2a3da3f 100644
--- a/dtd/displaymenu.dtd
+++ b/dtd/displaymenu.dtd
@@ -60,6 +60,11 @@
debug CDATA #IMPLIED
>
+<!ELEMENT currentschedule (area|areascroll)*>
+<!ATTLIST currentschedule
+ debug CDATA #IMPLIED
+>
+
<!ELEMENT scrollbar (area|areascroll)*>
<!ATTLIST scrollbar
debug CDATA #IMPLIED
@@ -89,7 +94,7 @@
>
<!ELEMENT menumain (background | header | datetime | colorbuttons | scrollbar | timers |
- discusage | devices | systemload | menuitems)*>
+ discusage | devices | systemload | currentschedule | menuitems)*>
<!ATTLIST menumain
x CDATA #REQUIRED
y CDATA #REQUIRED
diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c
index 4783d13..16d0276 100644
--- a/libtemplate/templateview.c
+++ b/libtemplate/templateview.c
@@ -1030,6 +1030,7 @@ void cTemplateViewMenu::SetViewElements(void) {
viewElementsAllowed.insert("systemload");
viewElementsAllowed.insert("timers");
viewElementsAllowed.insert("devices");
+ viewElementsAllowed.insert("currentschedule");
viewElementsAllowed.insert("scrollbar");
viewElementsAllowed.insert("detailheader");
viewElementsAllowed.insert("tablabels");
@@ -1108,6 +1109,9 @@ string cTemplateViewMenu::GetViewElementName(eViewElement ve) {
case veTimers:
name = "Timers";
break;
+ case veCurrentSchedule:
+ name = "Current Schedule";
+ break;
case veDevices:
name = "Devices";
break;
@@ -1217,6 +1221,8 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
ve = veSystemLoad;
} else if (!sViewElement.compare("timers")) {
ve = veTimers;
+ } else if (!sViewElement.compare("currentschedule")) {
+ ve = veCurrentSchedule;
} else if (!sViewElement.compare("devices")) {
ve = veDevices;
} else if (!sViewElement.compare("scrollbar")) {
@@ -1238,6 +1244,9 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
if (hit == viewElements.end()) {
cTemplateViewElement *viewElement = new cTemplateViewElement();
viewElement->SetParameters(viewElementattributes);
+ if (viewElement->DebugTokens()) {
+ dsyslog("skindesigner: activating token debugging for view element %s", sViewElement.c_str());
+ }
viewElement->AddPixmap(pix);
viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement));
} else {
diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h
index 6d148e7..a2bd05a 100644
--- a/libtemplate/templateviewelement.h
+++ b/libtemplate/templateviewelement.h
@@ -44,6 +44,7 @@ enum eViewElement {
veDiscUsage,
veSystemLoad,
veTimers,
+ veCurrentSchedule,
veMenuItem,
veMenuCurrentItemDetail,
veScrollbar,
diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c
index 8931f2f..ce39dcc 100644
--- a/libtemplate/xmlparser.c
+++ b/libtemplate/xmlparser.c
@@ -514,7 +514,9 @@ bool cXmlParser::ParseSubView(xmlNodePtr node) {
}
if (subView->ValidViewElement((const char*)childNode->name)) {
+ xmlAttrPtr attr = childNode->properties;
vector<pair<string, string> > attribs;
+ ParseAttributes(attr, childNode, attribs);
ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, subView);
} else if (subView->ValidViewList((const char*)childNode->name)) {
ParseViewList(childNode, subView);
diff --git a/skinskeleton/xmlfiles/displaymenumain.xml b/skinskeleton/xmlfiles/displaymenumain.xml
index 0ad253d..d6d0173 100644
--- a/skinskeleton/xmlfiles/displaymenumain.xml
+++ b/skinskeleton/xmlfiles/displaymenumain.xml
@@ -57,6 +57,28 @@
<systemload>
</systemload>
+ <!-- Available Variables currentschedule:
+ {title} Title of the current Schedule
+ {subtitle} Subtitle of the current Schedule
+ {start} Start of current Schedule in hh:mm
+ {stop} End of current Schedule in hh:mm
+ {duration} Duration of current Schedule in min
+ {durationhours} Duration, full hours
+ {minutes} Duration, rest of minutes
+ {elapsed} Elapsed time of current Schedule in min
+ {remaining} Remaining time of current Schedule in min
+ {hasPoster} true if poster is available
+ {posterpath} Full Path of Poster to use in image path attribute
+ {posterwidth} width of poster in pixel
+ {posterheight} height of poster in pixel
+ {hasBanner} true if banner is available
+ {bannerpath} Full Path of banner to use in image path attribute
+ {bannerwidth} width of banner in pixel
+ {bannerheight} height of banner in pixel
+ -->
+ <currentschedule>
+ </currentschedule>
+
<menuitems x="0" y="0" orientation="vertical" width="100%" height="100%" align="center" numlistelements="8">
<!-- Available Variables main menu listelement:
{nummenuitem} number of item in list, starts with 1
diff --git a/views/displaymenuview.c b/views/displaymenuview.c
index a6ba49b..69337c9 100644
--- a/views/displaymenuview.c
+++ b/views/displaymenuview.c
@@ -5,6 +5,7 @@
#include "../config.h"
#include "../libcore/helpers.h"
#include "../libcore/timers.h"
+#include "../services/scraper2vdr.h"
cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) {
if (menuInit)
@@ -228,6 +229,7 @@ cDisplayMenuMainView::~cDisplayMenuMainView() {
void cDisplayMenuMainView::DrawStaticViewElements(void) {
DrawTimers();
DrawDiscUsage();
+ DrawCurrentSchedule();
}
bool cDisplayMenuMainView::DrawDynamicViewElements(void) {
@@ -401,6 +403,104 @@ bool cDisplayMenuMainView::DrawDevices(void) {
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
return true;
}
+
+void cDisplayMenuMainView::DrawCurrentSchedule(void) {
+ if (!ViewElementImplemented(veCurrentSchedule)) {
+ return;
+ }
+
+ cDevice *device = cDevice::PrimaryDevice();
+ const cChannel *channel = NULL;
+ if (!device->Replaying() || device->Transferring()) {
+ channel = Channels.GetByNumber(device->CurrentChannel());
+ }
+ if (!channel)
+ return;
+
+ const cEvent *event = NULL;
+ cSchedulesLock SchedulesLock;
+ if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock))
+ if (const cSchedule *Schedule = Schedules->GetSchedule(channel))
+ event = Schedule->GetPresentEvent();
+ if (!event)
+ return;
+
+ map < string, string > stringTokens;
+ map < string, int > intTokens;
+
+ stringTokens.insert(pair<string,string>("title", (event->Title())?event->Title():""));
+ stringTokens.insert(pair<string,string>("subtitle", (event->ShortText())?event->ShortText():""));
+ stringTokens.insert(pair<string,string>("start", *event->GetTimeString()));
+ stringTokens.insert(pair<string,string>("stop", *event->GetEndTimeString()));
+ intTokens.insert(pair<string,int>("duration", event->Duration() / 60));
+ intTokens.insert(pair<string,int>("durationhours", event->Duration() / 3600));
+ stringTokens.insert(pair<string,string>("durationminutes", *cString::sprintf("%.2d", (event->Duration() / 60)%60)));
+ intTokens.insert(pair<string,int>("elapsed", (int)round((time(NULL) - event->StartTime())/60)));
+ intTokens.insert(pair<string,int>("remaining", (int)round((event->EndTime() - time(NULL))/60)));
+
+ 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;
+ static cPlugin *pScraper = GetScraperPlugin();
+ if (pScraper) {
+ ScraperGetPosterBanner call;
+ call.event = event;
+ if (pScraper->Service("GetPosterBanner", &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 = event;
+ callPoster.recording = NULL;
+ 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;
+ }
+ }
+ }
+ 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(veCurrentSchedule);
+ DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
+}
+
/************************************************************************
* cDisplayMenuSchedulesView
************************************************************************/
diff --git a/views/displaymenuview.h b/views/displaymenuview.h
index b9ffb5f..665ed7f 100644
--- a/views/displaymenuview.h
+++ b/views/displaymenuview.h
@@ -38,6 +38,7 @@ private:
void DrawDiscUsage(void);
bool DrawLoad(void);
bool DrawDevices(void);
+ void DrawCurrentSchedule(void);
public:
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
virtual ~cDisplayMenuMainView();