mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added currentschedule viewelement in displaymenumain
This commit is contained in:
parent
e746d28750
commit
84756db208
3
HISTORY
3
HISTORY
@ -111,4 +111,5 @@ Version 0.0.8
|
|||||||
Version 0.1.0
|
Version 0.1.0
|
||||||
|
|
||||||
- fixed display of color buttons in detailed views
|
- fixed display of color buttons in detailed views
|
||||||
- fixed possible Nullpointer access in displaymenurootview
|
- fixed possible Nullpointer access in displaymenurootview
|
||||||
|
- added currentschedule viewelement in displaymenumain
|
@ -60,6 +60,11 @@
|
|||||||
debug CDATA #IMPLIED
|
debug CDATA #IMPLIED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT currentschedule (area|areascroll)*>
|
||||||
|
<!ATTLIST currentschedule
|
||||||
|
debug CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
<!ELEMENT scrollbar (area|areascroll)*>
|
<!ELEMENT scrollbar (area|areascroll)*>
|
||||||
<!ATTLIST scrollbar
|
<!ATTLIST scrollbar
|
||||||
debug CDATA #IMPLIED
|
debug CDATA #IMPLIED
|
||||||
@ -89,7 +94,7 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<!ELEMENT menumain (background | header | datetime | colorbuttons | scrollbar | timers |
|
<!ELEMENT menumain (background | header | datetime | colorbuttons | scrollbar | timers |
|
||||||
discusage | devices | systemload | menuitems)*>
|
discusage | devices | systemload | currentschedule | menuitems)*>
|
||||||
<!ATTLIST menumain
|
<!ATTLIST menumain
|
||||||
x CDATA #REQUIRED
|
x CDATA #REQUIRED
|
||||||
y CDATA #REQUIRED
|
y CDATA #REQUIRED
|
||||||
|
@ -1030,6 +1030,7 @@ void cTemplateViewMenu::SetViewElements(void) {
|
|||||||
viewElementsAllowed.insert("systemload");
|
viewElementsAllowed.insert("systemload");
|
||||||
viewElementsAllowed.insert("timers");
|
viewElementsAllowed.insert("timers");
|
||||||
viewElementsAllowed.insert("devices");
|
viewElementsAllowed.insert("devices");
|
||||||
|
viewElementsAllowed.insert("currentschedule");
|
||||||
viewElementsAllowed.insert("scrollbar");
|
viewElementsAllowed.insert("scrollbar");
|
||||||
viewElementsAllowed.insert("detailheader");
|
viewElementsAllowed.insert("detailheader");
|
||||||
viewElementsAllowed.insert("tablabels");
|
viewElementsAllowed.insert("tablabels");
|
||||||
@ -1108,6 +1109,9 @@ string cTemplateViewMenu::GetViewElementName(eViewElement ve) {
|
|||||||
case veTimers:
|
case veTimers:
|
||||||
name = "Timers";
|
name = "Timers";
|
||||||
break;
|
break;
|
||||||
|
case veCurrentSchedule:
|
||||||
|
name = "Current Schedule";
|
||||||
|
break;
|
||||||
case veDevices:
|
case veDevices:
|
||||||
name = "Devices";
|
name = "Devices";
|
||||||
break;
|
break;
|
||||||
@ -1217,6 +1221,8 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
|
|||||||
ve = veSystemLoad;
|
ve = veSystemLoad;
|
||||||
} else if (!sViewElement.compare("timers")) {
|
} else if (!sViewElement.compare("timers")) {
|
||||||
ve = veTimers;
|
ve = veTimers;
|
||||||
|
} else if (!sViewElement.compare("currentschedule")) {
|
||||||
|
ve = veCurrentSchedule;
|
||||||
} else if (!sViewElement.compare("devices")) {
|
} else if (!sViewElement.compare("devices")) {
|
||||||
ve = veDevices;
|
ve = veDevices;
|
||||||
} else if (!sViewElement.compare("scrollbar")) {
|
} else if (!sViewElement.compare("scrollbar")) {
|
||||||
@ -1238,6 +1244,9 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
|
|||||||
if (hit == viewElements.end()) {
|
if (hit == viewElements.end()) {
|
||||||
cTemplateViewElement *viewElement = new cTemplateViewElement();
|
cTemplateViewElement *viewElement = new cTemplateViewElement();
|
||||||
viewElement->SetParameters(viewElementattributes);
|
viewElement->SetParameters(viewElementattributes);
|
||||||
|
if (viewElement->DebugTokens()) {
|
||||||
|
dsyslog("skindesigner: activating token debugging for view element %s", sViewElement.c_str());
|
||||||
|
}
|
||||||
viewElement->AddPixmap(pix);
|
viewElement->AddPixmap(pix);
|
||||||
viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement));
|
viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement));
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,6 +44,7 @@ enum eViewElement {
|
|||||||
veDiscUsage,
|
veDiscUsage,
|
||||||
veSystemLoad,
|
veSystemLoad,
|
||||||
veTimers,
|
veTimers,
|
||||||
|
veCurrentSchedule,
|
||||||
veMenuItem,
|
veMenuItem,
|
||||||
veMenuCurrentItemDetail,
|
veMenuCurrentItemDetail,
|
||||||
veScrollbar,
|
veScrollbar,
|
||||||
|
@ -514,7 +514,9 @@ bool cXmlParser::ParseSubView(xmlNodePtr node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (subView->ValidViewElement((const char*)childNode->name)) {
|
if (subView->ValidViewElement((const char*)childNode->name)) {
|
||||||
|
xmlAttrPtr attr = childNode->properties;
|
||||||
vector<pair<string, string> > attribs;
|
vector<pair<string, string> > attribs;
|
||||||
|
ParseAttributes(attr, childNode, attribs);
|
||||||
ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, subView);
|
ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, subView);
|
||||||
} else if (subView->ValidViewList((const char*)childNode->name)) {
|
} else if (subView->ValidViewList((const char*)childNode->name)) {
|
||||||
ParseViewList(childNode, subView);
|
ParseViewList(childNode, subView);
|
||||||
|
@ -57,6 +57,28 @@
|
|||||||
<systemload>
|
<systemload>
|
||||||
</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">
|
<menuitems x="0" y="0" orientation="vertical" width="100%" height="100%" align="center" numlistelements="8">
|
||||||
<!-- Available Variables main menu listelement:
|
<!-- Available Variables main menu listelement:
|
||||||
{nummenuitem} number of item in list, starts with 1
|
{nummenuitem} number of item in list, starts with 1
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../libcore/helpers.h"
|
#include "../libcore/helpers.h"
|
||||||
#include "../libcore/timers.h"
|
#include "../libcore/timers.h"
|
||||||
|
#include "../services/scraper2vdr.h"
|
||||||
|
|
||||||
cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) {
|
cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cView(tmplView) {
|
||||||
if (menuInit)
|
if (menuInit)
|
||||||
@ -228,6 +229,7 @@ cDisplayMenuMainView::~cDisplayMenuMainView() {
|
|||||||
void cDisplayMenuMainView::DrawStaticViewElements(void) {
|
void cDisplayMenuMainView::DrawStaticViewElements(void) {
|
||||||
DrawTimers();
|
DrawTimers();
|
||||||
DrawDiscUsage();
|
DrawDiscUsage();
|
||||||
|
DrawCurrentSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDisplayMenuMainView::DrawDynamicViewElements(void) {
|
bool cDisplayMenuMainView::DrawDynamicViewElements(void) {
|
||||||
@ -401,6 +403,104 @@ bool cDisplayMenuMainView::DrawDevices(void) {
|
|||||||
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
|
DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens);
|
||||||
return true;
|
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
|
* cDisplayMenuSchedulesView
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
@ -38,6 +38,7 @@ private:
|
|||||||
void DrawDiscUsage(void);
|
void DrawDiscUsage(void);
|
||||||
bool DrawLoad(void);
|
bool DrawLoad(void);
|
||||||
bool DrawDevices(void);
|
bool DrawDevices(void);
|
||||||
|
void DrawCurrentSchedule(void);
|
||||||
public:
|
public:
|
||||||
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
|
cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
|
||||||
virtual ~cDisplayMenuMainView();
|
virtual ~cDisplayMenuMainView();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user