From 13817c785fcf2589f857b169fd9af9e428dc64b5 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 1 Nov 2014 10:23:34 +0100 Subject: [PATCH] added {channelname}, {channelid}, {channellogoexists} for all schedules list and current views --- HISTORY | 1 + displaymenu.c | 15 ++++++++------- skins/metrixhd/xmlfiles/displaymenuschedules.xml | 7 +++++-- skinskeleton/xmlfiles/displaymenuschedules.xml | 7 +++++-- views/displaymenuitemcurrentview.c | 5 ++++- views/displaymenuitemview.c | 5 ++++- views/displaymenurootview.h | 1 + views/displaymenuview.c | 5 +++-- views/displaymenuview.h | 2 ++ 9 files changed, 33 insertions(+), 15 deletions(-) diff --git a/HISTORY b/HISTORY index 35945a8..81551b4 100644 --- a/HISTORY +++ b/HISTORY @@ -47,5 +47,6 @@ Version 0.0.3 - changed skin metrixHD to display bitrate infos - added "active" Token for cutting marks so that a mark can be displayed in a dedicated way if current position in replay exactly hits the mark +- added {channelname}, {channelid}, {channellogoexists} for all schedules list and current views diff --git a/displaymenu.c b/displaymenu.c index 9f0e97e..d9ec692 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -81,17 +81,18 @@ bool cSDDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, return false; if (config.blockFlush) rootView->LockFlush(); - if (Current) { - if (Channel) { - rootView->SetChannel(Channel); - } else if (Event) { - rootView->SetChannel(Channels.GetByChannelID(Event->ChannelID())); - } + const cChannel *channel = Channel; + if (!channel) { + channel = rootView->GetChannel(); + } + if (!channel && Event) { + channel = Channels.GetByChannelID(Event->ChannelID()); + rootView->SetChannel(channel); } cDisplayMenuListView *list = rootView->GetListView(); if (!list) return false; - list->AddSchedulesMenuItem(Index, Event, Channel, TimerMatch, MenuCategory(), Current, Selectable); + list->AddSchedulesMenuItem(Index, Event, channel, TimerMatch, MenuCategory(), Current, Selectable); if (state == vsIdle) state = vsMenuUpdate; return true; diff --git a/skins/metrixhd/xmlfiles/displaymenuschedules.xml b/skins/metrixhd/xmlfiles/displaymenuschedules.xml index b28471e..42169eb 100644 --- a/skins/metrixhd/xmlfiles/displaymenuschedules.xml +++ b/skins/metrixhd/xmlfiles/displaymenuschedules.xml @@ -40,8 +40,9 @@ {durationminutes} duration, rest of minutes {current} true if item is currently selected {separator} true if item is a list separator - {channelname} Channel Name (for what's on now and next) - {channelid} ChannelID as path to display channel logo (for what's on now and next) + {channelname} Channel Name + {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {whatson} true if menu "What's on" is displayed {whatsonnow} true if menu "What's on now" is displayed {whatsonnext} true if menu "What's on next" is displayed @@ -124,7 +125,9 @@ {duration} duration of event {durationhours} duration, full hours {durationminutes} duration, rest of minutes + {channelname} Channel Name {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {hasposter} true if a scraped poster is available for this element {posterwidth} width of scraped poster {posterheight} height of scraped poster diff --git a/skinskeleton/xmlfiles/displaymenuschedules.xml b/skinskeleton/xmlfiles/displaymenuschedules.xml index 5864fcf..4b6b20d 100644 --- a/skinskeleton/xmlfiles/displaymenuschedules.xml +++ b/skinskeleton/xmlfiles/displaymenuschedules.xml @@ -34,8 +34,9 @@ {durationminutes} duration, rest of minutes {current} true if item is currently selected {separator} true if item is a list separator - {channelname} Channel Name (for what's on now and next) - {channelid} ChannelID as path to display channel logo (for what's on now and next) + {channelname} Channel Name + {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {whatson} true if menu "What's on" is displayed {whatsonnow} true if menu "What's on now" is displayed {whatsonnext} true if menu "What's on next" is displayed @@ -65,7 +66,9 @@ {duration} duration of event {durationhours} duration, full hours {durationminutes} duration, rest of minutes + {channelname} Channel Name {channelid} ChannelID as path to display channel logo + {channellogoexists} true if a channel logo exists {hasposter} true if a scraped poster is available for this element {posterwidth} width of scraped poster {posterheight} height of scraped poster diff --git a/views/displaymenuitemcurrentview.c b/views/displaymenuitemcurrentview.c index 312b041..ce9fb22 100644 --- a/views/displaymenuitemcurrentview.c +++ b/views/displaymenuitemcurrentview.c @@ -165,7 +165,10 @@ void cDisplayMenuItemCurrentSchedulesView::Render(void) { SetScraperPoster(event); } if (channel) { - stringTokens.insert(pair("channelid", *(channel->GetChannelID().ToString()))); + stringTokens.insert(pair("channelname", channel->Name() ? channel->Name() : "")); + string channelID = *(channel->GetChannelID().ToString()); + stringTokens.insert(pair("channelid", channelID)); + intTokens.insert(pair("channellogoexists", imgCache->LogoExists(channelID))); } vector< map > schedulesTokens; diff --git a/views/displaymenuitemview.c b/views/displaymenuitemview.c index 5e995c5..67fd641 100644 --- a/views/displaymenuitemview.c +++ b/views/displaymenuitemview.c @@ -333,13 +333,16 @@ void cDisplayMenuItemSchedulesView::SetTokens(void) { } if (channel) { stringTokens.insert(pair("channelname", channel->Name() ? channel->Name() : "")); - stringTokens.insert(pair("channelid", *(channel->GetChannelID().ToString()))); + string channelID = *(channel->GetChannelID().ToString()); + stringTokens.insert(pair("channelid", channelID)); + intTokens.insert(pair("channellogoexists", imgCache->LogoExists(channelID))); if (!event && !selectable) { stringTokens.insert(pair("title", channel->Name() ? ParseSeparator(channel->Name()) : "")); } } else { stringTokens.insert(pair("channelname", "")); stringTokens.insert(pair("channelid", "")); + intTokens.insert(pair("channellogoexists", 0)); } } diff --git a/views/displaymenurootview.h b/views/displaymenurootview.h index 0852570..5b491e5 100644 --- a/views/displaymenurootview.h +++ b/views/displaymenurootview.h @@ -36,6 +36,7 @@ public: void SetMenu(eMenuCategory menuCat, bool menuInit); void SetTitle(const char *title); void SetChannel(const cChannel *channel) { view->SetChannel(channel); }; + const cChannel *GetChannel(void) { return view->GetChannel(); }; void SetButtonTexts(const char *Red, const char *Green, const char *Yellow, const char *Blue); void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5); void SetMessage(eMessageType type, const char *text); diff --git a/views/displaymenuview.c b/views/displaymenuview.c index f5a841c..5a54628 100644 --- a/views/displaymenuview.c +++ b/views/displaymenuview.c @@ -432,8 +432,9 @@ bool cDisplayMenuSchedulesView::DrawHeader(void) { if (channel) { stringTokens.insert(pair("channelnumber", *cString::sprintf("%d", channel->Number()))); stringTokens.insert(pair("channelname", channel->Name())); - stringTokens.insert(pair("channelid", *(channel->GetChannelID().ToString()))); - + string channelID = *(channel->GetChannelID().ToString()); + stringTokens.insert(pair("channelid", channelID)); + intTokens.insert(pair("channellogoexists", imgCache->LogoExists(channelID))); } bool hasIcon = false; string icon = imgCache->GetIconName(menuTitle, cat); diff --git a/views/displaymenuview.h b/views/displaymenuview.h index 34fed44..3247c76 100644 --- a/views/displaymenuview.h +++ b/views/displaymenuview.h @@ -17,6 +17,7 @@ public: void SetMenuCat(eMenuCategory newCat) { cat = newCat; }; void SetTitle(const char *title) {menuTitle = title; }; virtual void SetChannel(const cChannel *channel) {}; + virtual const cChannel *GetChannel(void) { return NULL; }; void SetButtonTexts(string *buttonTexts) { this->buttonTexts = buttonTexts; }; bool DrawBackground(void); virtual bool DrawHeader(void); @@ -51,6 +52,7 @@ public: cDisplayMenuSchedulesView(cTemplateView *tmplView, eMenuCategory menuCat, bool menuInit); virtual ~cDisplayMenuSchedulesView(); void SetChannel(const cChannel *channel) { this->channel = channel; }; + const cChannel *GetChannel(void) { return channel; }; bool DrawHeader(void); };