diff options
author | louis <louis.braun@gmx.de> | 2016-05-26 10:47:45 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2016-05-26 10:47:45 +0200 |
commit | a57c44b06874ba146ca27a5c87868c1e3c304875 (patch) | |
tree | 844945c2f05d05ae80eb6fb1126db267253a1deb /coreengine | |
parent | ffb414cdee209097f19f925c46de9f105cf5358e (diff) | |
download | vdr-plugin-skindesigner-a57c44b06874ba146ca27a5c87868c1e3c304875.tar.gz vdr-plugin-skindesigner-a57c44b06874ba146ca27a5c87868c1e3c304875.tar.bz2 |
introduced zapcockpit extension
Diffstat (limited to 'coreengine')
-rw-r--r-- | coreengine/area.c | 12 | ||||
-rw-r--r-- | coreengine/attributes.c | 23 | ||||
-rw-r--r-- | coreengine/attributes.h | 7 | ||||
-rw-r--r-- | coreengine/definitions.h | 279 | ||||
-rw-r--r-- | coreengine/listelements.c | 127 | ||||
-rw-r--r-- | coreengine/listelements.h | 31 | ||||
-rw-r--r-- | coreengine/view.c | 44 | ||||
-rw-r--r-- | coreengine/view.h | 6 | ||||
-rw-r--r-- | coreengine/viewdisplaychannel.c | 447 | ||||
-rw-r--r-- | coreengine/viewdisplaychannel.h | 62 | ||||
-rw-r--r-- | coreengine/viewelement.c | 22 | ||||
-rw-r--r-- | coreengine/viewelement.h | 9 | ||||
-rw-r--r-- | coreengine/viewelementsdisplaychannel.c | 258 | ||||
-rw-r--r-- | coreengine/viewelementsdisplaychannel.h | 49 | ||||
-rw-r--r-- | coreengine/viewelementsdisplaymenu.c | 8 | ||||
-rw-r--r-- | coreengine/viewlist.c | 221 | ||||
-rw-r--r-- | coreengine/viewlist.h | 44 | ||||
-rw-r--r-- | coreengine/xmlparser.c | 36 | ||||
-rw-r--r-- | coreengine/xmlparser.h | 2 |
19 files changed, 1526 insertions, 161 deletions
diff --git a/coreengine/area.c b/coreengine/area.c index a2a9641..6e4beb1 100644 --- a/coreengine/area.c +++ b/coreengine/area.c @@ -425,8 +425,14 @@ void cArea::SetViewPort(cRect &vp) { void cArea::SetPosition(cPoint &pos, cPoint &ref) { if (!pix) return; - int x = (attribs->X() - ref.X()) + pos.X(); - int y = (attribs->Y() - ref.Y()) + pos.Y(); + int x0 = attribs->X() == -1 ? 0 : attribs->X(); + int y0 = attribs->Y() == -1 ? 0 : attribs->Y(); + int x = (x0 - ref.X()) + pos.X(); + int y = (y0 - ref.Y()) + pos.Y(); +/* Enable for xineliboutput OSD Bug + if (x < 0) x = 0; + if (y < 0) y = 0; +*/ pix->SetViewPort(cRect(x, y, pix->ViewPort().Width(), pix->ViewPort().Height())); } @@ -518,7 +524,7 @@ void cArea::CreatePixmap(cRect drawPort) { } int layer = attribs->Layer(); - cRect viewPort(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height()); + cRect viewPort(attribs->X() == -1 ? 0 : attribs->X(), attribs->Y() == -1 ? 0 : attribs->Y(), attribs->Width(), attribs->Height()); pix = sdOsd->CreatePixmap(layer, viewPort, drawPort); if (pix) pix->Clear(); diff --git a/coreengine/attributes.c b/coreengine/attributes.c index 8e71c1a..4840dbc 100644 --- a/coreengine/attributes.c +++ b/coreengine/attributes.c @@ -126,15 +126,18 @@ void cViewAttribs::SetOrientationDynamic(int id, const char *val) { ***************************************************************************/ cViewElementAttribs::cViewElementAttribs(int numAttributes) : cAttributes(numAttributes) { name = NULL; + clearOnDisplay = NULL; SetAttributesDefs(); } cViewElementAttribs::cViewElementAttribs(const cViewElementAttribs &other) : cAttributes(other) { name = NULL; + clearOnDisplay = NULL; } cViewElementAttribs::~cViewElementAttribs(void) { free(name); + free(clearOnDisplay); } void cViewElementAttribs::Set(vector<stringpair> &attributes) { @@ -158,6 +161,8 @@ void cViewElementAttribs::Set(vector<stringpair> &attributes) { SetOrientation(id, attVal); } else if (IdEqual(id, (int)eViewElementAttribs::name)) { name = strdup(attVal); + } else if (IdEqual(id, (int)eViewElementAttribs::clearondisplay)) { + clearOnDisplay = strdup(attVal); } else { attribCtors[id] = new cNumericExpr(attVal); if (id == (int)eViewElementAttribs::starty + (int)eCommonAttribs::count) { @@ -178,6 +183,7 @@ void cViewElementAttribs::SetAttributesDefs(void) { attribIDs.insert(pair<string, int>("orientation", (int)eViewElementAttribs::orientation)); attribIDs.insert(pair<string, int>("mode", (int)eViewElementAttribs::mode)); attribIDs.insert(pair<string, int>("name", (int)eViewElementAttribs::name)); + attribIDs.insert(pair<string, int>("clearondisplay", (int)eViewElementAttribs::clearondisplay)); attribNames.insert(pair<int, string>((int)eViewElementAttribs::delay, "delay")); attribNames.insert(pair<int, string>((int)eViewElementAttribs::fadetime, "fadetime")); attribNames.insert(pair<int, string>((int)eViewElementAttribs::shifttime, "shifttime")); @@ -188,6 +194,7 @@ void cViewElementAttribs::SetAttributesDefs(void) { attribNames.insert(pair<int, string>((int)eViewElementAttribs::orientation, "orientation")); attribNames.insert(pair<int, string>((int)eViewElementAttribs::mode, "mode")); attribNames.insert(pair<int, string>((int)eViewElementAttribs::name, "name")); + attribNames.insert(pair<int, string>((int)eViewElementAttribs::clearondisplay, "clearondisplay")); } eOrientation cViewElementAttribs::Orientation(void) { @@ -233,6 +240,10 @@ void cViewListAttribs::Set(vector<stringpair> &attributes) { determinateFont = strdup(attVal); } else if (IdEqual(id, (int)eViewListAttribs::orientation)) { SetOrientation(id, attVal); + } else if (IdEqual(id, (int)eViewListAttribs::shifttype)) { + SetShiftType(id, attVal); + } else if (IdEqual(id, (int)eViewListAttribs::shiftmode)) { + SetShiftMode(id, attVal); } else { attribCtors[id] = new cNumericExpr(attVal); } @@ -271,12 +282,24 @@ void cViewListAttribs::SetAttributesDefs(void) { attribIDs.insert(pair<string, int>("determinatefont", (int)eViewListAttribs::determinatefont)); attribIDs.insert(pair<string, int>("numlistelements", (int)eViewListAttribs::numlistelements)); attribIDs.insert(pair<string, int>("orientation", (int)eViewListAttribs::orientation)); + attribIDs.insert(pair<string, int>("fadetime", (int)eViewListAttribs::fadetime)); + attribIDs.insert(pair<string, int>("shifttime", (int)eViewListAttribs::shifttime)); + attribIDs.insert(pair<string, int>("shifttype", (int)eViewListAttribs::shifttype)); + attribIDs.insert(pair<string, int>("shiftmode", (int)eViewListAttribs::shiftmode)); + attribIDs.insert(pair<string, int>("startx", (int)eViewListAttribs::startx)); + attribIDs.insert(pair<string, int>("starty", (int)eViewListAttribs::starty)); attribIDs.insert(pair<string, int>("condition", (int)eViewListAttribs::condition)); attribNames.insert(pair<int, string>((int)eViewListAttribs::align, "align")); attribNames.insert(pair<int, string>((int)eViewListAttribs::menuitemwidth, "menuitemwidth")); attribNames.insert(pair<int, string>((int)eViewListAttribs::determinatefont, "determinatefont")); attribNames.insert(pair<int, string>((int)eViewListAttribs::numlistelements, "numlistelements")); attribNames.insert(pair<int, string>((int)eViewListAttribs::orientation, "orientation")); + attribNames.insert(pair<int, string>((int)eViewListAttribs::fadetime, "fadetime")); + attribNames.insert(pair<int, string>((int)eViewListAttribs::shifttime, "shifttime")); + attribNames.insert(pair<int, string>((int)eViewListAttribs::shifttype, "shifttype")); + attribNames.insert(pair<int, string>((int)eViewListAttribs::shiftmode, "shiftmode")); + attribNames.insert(pair<int, string>((int)eViewListAttribs::startx, "startx")); + attribNames.insert(pair<int, string>((int)eViewListAttribs::starty, "starty")); attribNames.insert(pair<int, string>((int)eViewListAttribs::condition, "condition")); } diff --git a/coreengine/attributes.h b/coreengine/attributes.h index 1af17ef..228964d 100644 --- a/coreengine/attributes.h +++ b/coreengine/attributes.h @@ -30,6 +30,7 @@ public: class cViewElementAttribs : public cAttributes { private: char *name; + char *clearOnDisplay; void SetAttributesDefs(void); public: cViewElementAttribs(int numAttributes); @@ -45,6 +46,7 @@ public: int ShiftType(void) { return GetValue((int)eViewElementAttribs::shifttype); }; int ShiftMode(void) { return GetValue((int)eViewElementAttribs::shiftmode); }; const char *Name(void) { return name; }; + const char *ClearOnDisplay(void) { return clearOnDisplay; }; void Debug(void); }; /****************************************************************** @@ -63,6 +65,11 @@ public: const char *DeterminateFont(void); eAlign Align(void); eOrientation Orientation(void); + int FadeTime(void) { return GetValue((int)eViewListAttribs::fadetime); }; + int ShiftTime(void) { return GetValue((int)eViewListAttribs::shifttime); }; + cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewListAttribs::startx), GetValue((int)eViewListAttribs::starty)); }; + int ShiftType(void) { return GetValue((int)eViewListAttribs::shifttype); }; + int ShiftMode(void) { return GetValue((int)eViewListAttribs::shiftmode); }; void Debug(void); }; /****************************************************************** diff --git a/coreengine/definitions.h b/coreengine/definitions.h index ccb9acb..51f298d 100644 --- a/coreengine/definitions.h +++ b/coreengine/definitions.h @@ -45,6 +45,13 @@ enum class eVeDisplayChannel { signalquality, scrapercontent, ecminfo, + channelhints, + channeldetail, + channellistback, + channellistdetail, + grouplistback, + groupchannellistback, + groupchannellistdetail, count }; /****************************************************************** @@ -276,6 +283,101 @@ enum class eScraperPosterBannerIT { count }; +enum class eScraperST { + movietitle = 0, + movieoriginalTitle, + movietagline, + movieoverview, + moviegenres, + moviehomepage, + moviereleasedate, + moviepopularity, + movievoteaverage, + posterpath, + fanartpath, + moviecollectionName, + collectionposterpath, + collectionfanartpath, + seriesname, + seriesoverview, + seriesfirstaired, + seriesnetwork, + seriesgenre, + seriesrating, + seriesstatus, + episodetitle, + episodefirstaired, + episodegueststars, + episodeoverview, + episoderating, + episodeimagepath, + seasonposterpath, + seriesposter1path, + seriesposter2path, + seriesposter3path, + seriesfanart1path, + seriesfanart2path, + seriesfanart3path, + seriesbanner1path, + seriesbanner2path, + seriesbanner3path, + count +}; + +enum class eScraperIT { + ismovie = 0, + moviebudget, + movierevenue, + movieadult, + movieruntime, + isseries, + posterwidth, + posterheight, + fanartwidth, + fanartheight, + movieiscollection, + collectionposterwidth, + collectionposterheight, + collectionfanartwidth, + collectionfanartheight, + epgpicavailable, + episodenumber, + episodeseason, + episodeimagewidth, + episodeimageheight, + seasonposterwidth, + seasonposterheight, + seriesposter1width, + seriesposter1height, + seriesposter2width, + seriesposter2height, + seriesposter3width, + seriesposter3height, + seriesfanart1width, + seriesfanart1height, + seriesfanart2width, + seriesfanart2height, + seriesfanart3width, + seriesfanart3height, + seriesbanner1width, + seriesbanner1height, + seriesbanner2width, + seriesbanner2height, + seriesbanner3width, + seriesbanner3height, + count +}; + +enum class eScraperLT { + //actors + name = 0, + role, + thumb, + thumbwidth, + thumbheight, + count +}; + /****************************************************************** * Tokens displaychannel viewelements *******************************************************************/ @@ -417,6 +519,46 @@ enum class eDCSignalQualityIT { count }; +enum class eDCChannelHintsIT { + numhints = 0, + count +}; + +enum class eDCChannelHintsLT { + channelnumber = 0, + channelname, + channelid, + channellogoexists, + count +}; + +enum class eDCChannelDetailST { + channelname = (int)eScraperST::count, + currenttitle, + currentshorttext, + currentdescription, + currentstart, + currentstop, + currentdurationminutes, + nexttitle, + nextshorttext, + nextdescription, + nextstart, + nextstop, + nextdurationminutes, + count +}; + +enum class eDCChannelDetailIT { + channelnumber = (int)eScraperIT::count, + currentduration, + currentdurationhours, + currentelapsed, + currentremaining, + nextduration, + nextdurationhours, + count +}; /****************************************************************** * Tokens displaymenu viewelements *******************************************************************/ @@ -601,7 +743,7 @@ enum class eDMTemperaturesIT { }; /****************************************************************** -* Tokens displaymenu listelements +* Tokens listelements *******************************************************************/ enum class eLeMenuDefaultST { column1 = 0, @@ -1057,6 +1199,39 @@ enum class eCeMenuRecordingsIT { count }; +enum class eLeChannelListST { + name = 0, + channelid, + presenteventtitle, + presenteventstart, + presenteventstop, + nexteventtitle, + nexteventstart, + nexteventstop, + count +}; + +enum class eLeChannelListIT { + nummenuitem = 0, + current, + number, + channellogoexists, + presenteventelapsed, + presenteventremaining, + count +}; + +enum class eLeGroupListST { + groupname = 0, + count +}; + +enum class eLeGroupListIT { + nummenuitem = 0, + current, + numchannels, + count +}; /****************************************************************** * Tokens displaymenu detailed views *******************************************************************/ @@ -1151,101 +1326,6 @@ enum class eDmTabsLT { count }; -enum class eScraperST { - movietitle = 0, - movieoriginalTitle, - movietagline, - movieoverview, - moviegenres, - moviehomepage, - moviereleasedate, - moviepopularity, - movievoteaverage, - posterpath, - fanartpath, - moviecollectionName, - collectionposterpath, - collectionfanartpath, - seriesname, - seriesoverview, - seriesfirstaired, - seriesnetwork, - seriesgenre, - seriesrating, - seriesstatus, - episodetitle, - episodefirstaired, - episodegueststars, - episodeoverview, - episoderating, - episodeimagepath, - seasonposterpath, - seriesposter1path, - seriesposter2path, - seriesposter3path, - seriesfanart1path, - seriesfanart2path, - seriesfanart3path, - seriesbanner1path, - seriesbanner2path, - seriesbanner3path, - count -}; - -enum class eScraperIT { - ismovie = 0, - moviebudget, - movierevenue, - movieadult, - movieruntime, - isseries, - posterwidth, - posterheight, - fanartwidth, - fanartheight, - movieiscollection, - collectionposterwidth, - collectionposterheight, - collectionfanartwidth, - collectionfanartheight, - epgpicavailable, - episodenumber, - episodeseason, - episodeimagewidth, - episodeimageheight, - seasonposterwidth, - seasonposterheight, - seriesposter1width, - seriesposter1height, - seriesposter2width, - seriesposter2height, - seriesposter3width, - seriesposter3height, - seriesfanart1width, - seriesfanart1height, - seriesfanart2width, - seriesfanart2height, - seriesfanart3width, - seriesfanart3height, - seriesbanner1width, - seriesbanner1height, - seriesbanner2width, - seriesbanner2height, - seriesbanner3width, - seriesbanner3height, - count -}; - -enum class eScraperLT { - //actors - name = 0, - role, - thumb, - thumbwidth, - thumbheight, - count -}; - enum class eDmDetailedEpgST { title = (int)eScraperST::count, shorttext, @@ -1567,6 +1647,7 @@ enum class eViewElementAttribs { mode, orientation, name, + clearondisplay, count }; @@ -1576,6 +1657,12 @@ enum class eViewListAttribs { determinatefont, numlistelements, orientation, + fadetime, + shifttime, + shifttype, + shiftmode, + startx, + starty, condition, count }; diff --git a/coreengine/listelements.c b/coreengine/listelements.c index e5dfd93..8f7c2ee 100644 --- a/coreengine/listelements.c +++ b/coreengine/listelements.c @@ -2021,3 +2021,130 @@ bool cLeAudioTracks::Parse(bool forced) { tokenContainer->AddStringToken((int)eLeDisplayTracksST::title, text); return true; } + +/****************************************************************** +* cLeChannelList +******************************************************************/ +cLeChannelList::cLeChannelList(void) { + channel = NULL; +} + +cLeChannelList::cLeChannelList(const cLeChannelList &other) : cListElement(other) { + channel = NULL; +} + +cLeChannelList::~cLeChannelList(void) { +} + +void cLeChannelList::SetTokenContainer(void) { + tokenContainer = new skindesignerapi::cTokenContainer(); + tokenContainer->DefineStringToken("{name}", (int)eLeChannelListST::name); + tokenContainer->DefineStringToken("{channelid}", (int)eLeChannelListST::channelid); + tokenContainer->DefineStringToken("{presenteventtitle}", (int)eLeChannelListST::presenteventtitle); + tokenContainer->DefineStringToken("{presenteventstart}", (int)eLeChannelListST::presenteventstart); + tokenContainer->DefineStringToken("{presenteventstop}", (int)eLeChannelListST::presenteventstop); + tokenContainer->DefineStringToken("{nexteventtitle}", (int)eLeChannelListST::nexteventtitle); + tokenContainer->DefineStringToken("{nexteventstart}", (int)eLeChannelListST::nexteventstart); + tokenContainer->DefineStringToken("{nexteventstop}", (int)eLeChannelListST::nexteventstop); + tokenContainer->DefineIntToken("{nummenuitem}", (int)eLeChannelListIT::nummenuitem); + tokenContainer->DefineIntToken("{current}", (int)eLeChannelListIT::current); + tokenContainer->DefineIntToken("{number}", (int)eLeChannelListIT::number); + tokenContainer->DefineIntToken("{channellogoexists}", (int)eLeChannelListIT::channellogoexists); + tokenContainer->DefineIntToken("{presenteventelapsed}", (int)eLeChannelListIT::presenteventelapsed); + tokenContainer->DefineIntToken("{presenteventremaining}", (int)eLeChannelListIT::presenteventremaining); + InheritTokenContainer(); +} + +void cLeChannelList::Set(const cChannel *channel) { + dirty = true; + this->channel = channel; +} + +bool cLeChannelList::Parse(bool forced) { + if (!cViewElement::Parse(forced)) + return false; + if (!dirty) + return false; + tokenContainer->Clear(); + tokenContainer->AddIntToken((int)eLeChannelListIT::nummenuitem, num); + tokenContainer->AddIntToken((int)eLeChannelListIT::current, current); + tokenContainer->AddIntToken((int)eLeChannelListIT::number, channel->Number()); + tokenContainer->AddStringToken((int)eLeChannelListST::name, channel->Name()); + cString channelID = channel->GetChannelID().ToString(); + tokenContainer->AddStringToken((int)eLeChannelListST::channelid, *channelID); + tokenContainer->AddIntToken((int)eLeChannelListIT::channellogoexists, imgCache->LogoExists(*channelID)); + +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_SCHEDULES_READ; + const cSchedules* schedules = Schedules; +#else + cSchedulesLock schedulesLock; + const cSchedules* schedules = (cSchedules*)cSchedules::Schedules(schedulesLock); +#endif + const cSchedule *schedule = schedules->GetSchedule(channel); + if (schedule) { + const cEvent *presentEvent = schedule->GetPresentEvent(); + if (presentEvent) { + tokenContainer->AddStringToken((int)eLeChannelListST::presenteventtitle, presentEvent->Title()); + tokenContainer->AddStringToken((int)eLeChannelListST::presenteventstart, *presentEvent->GetTimeString()); + tokenContainer->AddStringToken((int)eLeChannelListST::presenteventstop, *presentEvent->GetEndTimeString()); + tokenContainer->AddIntToken((int)eLeChannelListIT::presenteventelapsed, (time(0) - presentEvent->StartTime())/60); + tokenContainer->AddIntToken((int)eLeChannelListIT::presenteventremaining, presentEvent->Duration()/60 - (time(0) - presentEvent->StartTime())/60); + } + const cList<cEvent> *events = schedule->Events(); + if (events && presentEvent) { + const cEvent *nextEvent = events->Next(presentEvent); + if (nextEvent) { + tokenContainer->AddStringToken((int)eLeChannelListST::nexteventtitle, nextEvent->Title()); + tokenContainer->AddStringToken((int)eLeChannelListST::nexteventstart, *nextEvent->GetTimeString()); + tokenContainer->AddStringToken((int)eLeChannelListST::nexteventstop, *nextEvent->GetEndTimeString()); + } + } + } + + return true; +} + +/****************************************************************** +* cLeGroupList +******************************************************************/ +cLeGroupList::cLeGroupList(void) { + group = NULL; + numChannels = 0; +} + +cLeGroupList::cLeGroupList(const cLeGroupList &other) : cListElement(other) { + group = NULL; + numChannels = 0; +} + +cLeGroupList::~cLeGroupList(void) { +} + +void cLeGroupList::SetTokenContainer(void) { + tokenContainer = new skindesignerapi::cTokenContainer(); + tokenContainer->DefineStringToken("{groupname}", (int)eLeGroupListST::groupname); + tokenContainer->DefineIntToken("{numchannels}", (int)eLeGroupListIT::numchannels); + tokenContainer->DefineIntToken("{nummenuitem}", (int)eLeGroupListIT::nummenuitem); + tokenContainer->DefineIntToken("{current}", (int)eLeGroupListIT::current); + InheritTokenContainer(); +} + +void cLeGroupList::Set(const char *group, int numChannels) { + dirty = true; + this->group = group; + this->numChannels = numChannels; +} + +bool cLeGroupList::Parse(bool forced) { + if (!cViewElement::Parse(forced)) + return false; + if (!dirty) + return false; + tokenContainer->Clear(); + tokenContainer->AddIntToken((int)eLeGroupListIT::nummenuitem, num); + tokenContainer->AddIntToken((int)eLeGroupListIT::current, current); + tokenContainer->AddIntToken((int)eLeGroupListIT::numchannels, numChannels); + tokenContainer->AddStringToken((int)eLeGroupListST::groupname, group); + return true; +} diff --git a/coreengine/listelements.h b/coreengine/listelements.h index 8f2b5b2..a63fa4d 100644 --- a/coreengine/listelements.h +++ b/coreengine/listelements.h @@ -339,4 +339,35 @@ public: bool Parse(bool forced = true); }; +/****************************************************************** +* cLeChannelList +******************************************************************/ +class cLeChannelList : public cListElement { +private: + const cChannel *channel; +public: + cLeChannelList(void); + cLeChannelList(const cLeChannelList &other); + virtual ~cLeChannelList(void); + void SetTokenContainer(void); + void Set(const cChannel *channel); + bool Parse(bool forced = true); +}; + +/****************************************************************** +* cLeGroupList +******************************************************************/ +class cLeGroupList : public cListElement { +private: + const char *group; + int numChannels; +public: + cLeGroupList(void); + cLeGroupList(const cLeGroupList &other); + virtual ~cLeGroupList(void); + void SetTokenContainer(void); + void Set(const char *group, int numChannels); + bool Parse(bool forced = true); +}; + #endif //__LISTELEMENTS_H
\ No newline at end of file diff --git a/coreengine/view.c b/coreengine/view.c index ae7cee5..f9db80d 100644 --- a/coreengine/view.c +++ b/coreengine/view.c @@ -141,6 +141,12 @@ bool cView::ValidViewElement(const char *viewElement) { bool cView::ValidViewList(const char *viewList) { if (!strcmp(viewList, "menuitems")) return true; + else if (!strcmp(viewList, "channellist")) + return true; + else if (!strcmp(viewList, "grouplist")) + return true; + else if (!strcmp(viewList, "groupchannellist")) + return true; return false; } @@ -162,6 +168,8 @@ void cView::PreCache(void) { continue; viewElements[i]->SetContainer(contX, contY, attribs->Width(), attribs->Height()); viewElements[i]->Cache(); + if (const char *clearOnDisplay = viewElements[i]->ClearOnDisplay()) + SetClearOnDisplay(i, clearOnDisplay); } if (viewElementsHorizontal) { for (int i=0; i < numViewElements; i++) { @@ -209,6 +217,13 @@ void cView::Clear(int ve, bool forceClearBackground) { viewElements[ve]->Clear(forceClearBackground); } +void cView::SetDirty(int ve) { + if (!viewElements[ve]) + return; + viewElements[ve]->SetDirty(); + viewElements[ve]->SetRestartAnimation(); +} + void cView::Render(int ve, bool force) { if (!viewElements[ve]) return; @@ -216,6 +231,18 @@ void cView::Render(int ve, bool force) { viewElements[ve]->Render(); } +void cView::Hide(int ve) { + if (!viewElements[ve]) + return; + viewElements[ve]->Hide(); +} + +void cView::Show(int ve) { + if (!viewElements[ve]) + return; + viewElements[ve]->Show(); +} + void cView::Close(void) { delete fader; fader = NULL; @@ -435,3 +462,20 @@ void cView::DoScaleTv(const cRect *frame) { } } } + +void cView::SetClearOnDisplay(int ve, const char *clearOnDisplay) { + if (!strcmp(clearOnDisplay, "all")) { + viewElements[ve]->SetClearAll(); + return; + } + vector<int> clearVEs; + for (map<string,int>::iterator it = viewElementNames.begin(); it != viewElementNames.end(); it++) { + string name = it->first; + int id = it->second; + if (strstr(clearOnDisplay, name.c_str())) { + clearVEs.push_back(id); + } + } + viewElements[ve]->SetClearOnDisplay(clearVEs); +} + diff --git a/coreengine/view.h b/coreengine/view.h index efdd351..a27ed7a 100644 --- a/coreengine/view.h +++ b/coreengine/view.h @@ -26,6 +26,7 @@ using namespace std; class cView : public cFadable, public cShiftable { private: void DoScaleTv(const cRect *frame); + void SetClearOnDisplay(int ve, const char *clearOnDisplay); protected: cSdOsd sdOsd; cViewAttribs *attribs; @@ -76,13 +77,16 @@ public: //View API virtual bool Init(void); void Clear(int ve, bool forceClearBackground = false); + void SetDirty(int ve); void Render(int ve, bool force = false); + void Hide(int ve); + void Show(int ve); virtual void Close(void); virtual void Flush(bool animFlush); virtual void Debug(void); + //Fadable bool Detached(void) { return false; }; int Delay(void) { return 0; }; - //Fadable int FadeTime(void); virtual void SetTransparency(int transparency, bool force = false); //Shiftable diff --git a/coreengine/viewdisplaychannel.c b/coreengine/viewdisplaychannel.c index f8e163a..7ab36ce 100644 --- a/coreengine/viewdisplaychannel.c +++ b/coreengine/viewdisplaychannel.c @@ -24,9 +24,66 @@ cViewChannel::cViewChannel(void) { veStatusInfo = NULL; veScraperContent = NULL; veEcmInfo = NULL; +#ifdef USE_ZAPCOCKPIT + veChannelHints = NULL; + veChannelDetail = NULL; + veChannelListDetail = NULL; + veGroupChannelListDetail = NULL; + channelList = NULL; + groupList = NULL; + groupChannelList = NULL; +#endif } cViewChannel::~cViewChannel() { +#ifdef USE_ZAPCOCKPIT + delete channelList; + delete groupList; + delete groupChannelList; +#endif +} + +void cViewChannel::SetGlobals(cGlobals *globals) { + cView::SetGlobals(globals); +#ifdef USE_ZAPCOCKPIT + if (channelList) + channelList->SetGlobals(globals); + if (groupList) + groupList->SetGlobals(globals); + if (groupChannelList) + groupChannelList->SetGlobals(globals); +#endif +} + +void cViewChannel::PreCache(void) { + cView::PreCache(); +#ifdef USE_ZAPCOCKPIT + if (channelList) { + channelList->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height()); + channelList->PreCache(); + } + if (groupList) { + groupList->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height()); + groupList->PreCache(); + } + if (groupChannelList) { + groupChannelList->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height()); + groupChannelList->PreCache(); + } +#endif +} + +void cViewChannel::AddChannelViewList(const char *listName, cViewList *viewList) { +#ifdef USE_ZAPCOCKPIT + if (!strcmp(listName, "channellist")) + channelList = dynamic_cast<cViewListChannelList*>(viewList); + else if (!strcmp(listName, "grouplist")) + groupList = dynamic_cast<cViewListGroupList*>(viewList); + else if (!strcmp(listName, "groupchannellist")) + groupChannelList = dynamic_cast<cViewListChannelList*>(viewList); + else + esyslog("skindesigner: invalid view list %s in displaychannel", listName); +#endif } void cViewChannel::SetViewElements(void) { @@ -43,6 +100,13 @@ void cViewChannel::SetViewElements(void) { viewElementNames.insert(pair<string, int>("devices", (int)eVeDisplayChannel::devices)); viewElementNames.insert(pair<string, int>("currentweather", (int)eVeDisplayChannel::currentweather)); viewElementNames.insert(pair<string, int>("scrapercontent", (int)eVeDisplayChannel::scrapercontent)); + viewElementNames.insert(pair<string, int>("channelhints", (int)eVeDisplayChannel::channelhints)); + viewElementNames.insert(pair<string, int>("channeldetail", (int)eVeDisplayChannel::channeldetail)); + viewElementNames.insert(pair<string, int>("channellistback", (int)eVeDisplayChannel::channellistback)); + viewElementNames.insert(pair<string, int>("channellistdetail", (int)eVeDisplayChannel::channellistdetail)); + viewElementNames.insert(pair<string, int>("grouplistback", (int)eVeDisplayChannel::grouplistback)); + viewElementNames.insert(pair<string, int>("groupchannellistback", (int)eVeDisplayChannel::groupchannellistback)); + viewElementNames.insert(pair<string, int>("groupchannellistdetail", (int)eVeDisplayChannel::groupchannellistdetail)); viewElementNames.insert(pair<string, int>("datetime", (int)eVeDisplayChannel::datetime)); viewElementNames.insert(pair<string, int>("time", (int)eVeDisplayChannel::time)); viewElementNames.insert(pair<string, int>("message", (int)eVeDisplayChannel::message)); @@ -83,6 +147,24 @@ void cViewChannel::SetViewElementObjects(void) { { veScraperContent = dynamic_cast<cVeDcScraperContent*>(viewElements[i]); } +#ifdef USE_ZAPCOCKPIT + else if (dynamic_cast<cVeDcChannelListDetail*>(viewElements[i])) + { + veChannelListDetail = dynamic_cast<cVeDcChannelListDetail*>(viewElements[i]); + } + else if (dynamic_cast<cVeDcGroupChannelListDetail*>(viewElements[i])) + { + veGroupChannelListDetail = dynamic_cast<cVeDcGroupChannelListDetail*>(viewElements[i]); + } + else if (dynamic_cast<cVeDcChannelHints*>(viewElements[i])) + { + veChannelHints = dynamic_cast<cVeDcChannelHints*>(viewElements[i]); + } + else if (dynamic_cast<cVeDcChannelDetail*>(viewElements[i])) + { + veChannelDetail = dynamic_cast<cVeDcChannelDetail*>(viewElements[i]); + } +#endif else if (dynamic_cast<cVeDcEcmInfo*>(viewElements[i])) { veEcmInfo = dynamic_cast<cVeDcEcmInfo*>(viewElements[i]); @@ -100,8 +182,16 @@ void cViewChannel::SetViewElementObjects(void) { void cViewChannel::ClearVariables(void) { cView::ClearVariables(); +#ifdef USE_ZAPCOCKPIT + viewType = dcDefault; + viewTypeLast = dcDefault; + initExtended = true; + displayList = false; + initList = false; + channelInput = false; +#endif channelChange = false; - displayChannelGroups = false; + mode = dmDefault; if (veCustomTokens) veCustomTokens->Reset(); timersLoaded = false; @@ -114,8 +204,23 @@ void cViewChannel::SetChannel(const cChannel *channel, int number) { globalTimers.LoadTimers(); } channelChange = true; - bool wasChannelGroups = displayChannelGroups; - displayChannelGroups = false; + + //check if channelgroups have to be cleared + bool clearChannelGroups = (mode == dmChannelGroups) ? true : false; + mode = dmDefault; + +#ifdef USE_ZAPCOCKPIT + //check if channel hints have to be cleared + if (number) { + channelInput = true; + } else if (channelInput) { + channelInput = false; + if (veChannelHints) + veChannelHints->Close(); + } + if (veChannelDetail) + veChannelDetail->Clear(true); +#endif if (veChannelInfo) { veChannelInfo->Clear(); @@ -124,24 +229,15 @@ void cViewChannel::SetChannel(const cChannel *channel, int number) { if (channel) { if (!channel->GroupSep()) { - if (wasChannelGroups) + if (clearChannelGroups) Clear((int)eVeDisplayChannel::channelgroup); if (veStatusInfo) veStatusInfo->Set(channel); if (veEcmInfo) veEcmInfo->Set(channel); } else { - displayChannelGroups = true; - Clear((int)eVeDisplayChannel::channelinfo, true); - Clear((int)eVeDisplayChannel::epginfo, true); - Clear((int)eVeDisplayChannel::statusinfo, true); - Clear((int)eVeDisplayChannel::progressbar, true); - Clear((int)eVeDisplayChannel::screenresolution, true); - Clear((int)eVeDisplayChannel::signalquality, true); - Clear((int)eVeDisplayChannel::audioinfo, true); - Clear((int)eVeDisplayChannel::ecminfo, true); - Clear((int)eVeDisplayChannel::devices, true); - Clear((int)eVeDisplayChannel::customtokens, true); + mode = dmChannelGroups; + ClearBasic(false); if (veChannelGroup) veChannelGroup->Set(channel); } @@ -178,31 +274,310 @@ void cViewChannel::SetMessage(eMessageType type, const char *text) { } } +#ifdef USE_ZAPCOCKPIT + +void cViewChannel::SetViewType(eDisplaychannelView viewType) { + viewTypeLast = this->viewType; + this->viewType = viewType; +} + +int cViewChannel::MaxItems(void) { + initList = true; + if (viewType == dcChannelList && channelList) + return channelList->NumItems(); + else if (viewType == dcGroupsList && groupList) + return groupList->NumItems(); + else if (viewType == dcGroupsChannelList && groupChannelList) + return groupChannelList->NumItems(); + return 0; +} + +void cViewChannel::SetChannelInfo(const cChannel *channel) { + if (!channel) + return; + if (viewType == dcChannelInfo && veChannelDetail) { + ClearOnDisplay(); + veChannelDetail->Set(channel); + Render((int)eVeDisplayChannel::channeldetail); + } else if (viewType == dcChannelListInfo && veChannelListDetail) { + veChannelListDetail->Set(channel); + Render((int)eVeDisplayChannel::channellistdetail); + } else if (viewType == dcGroupsChannelListInfo && veGroupChannelListDetail) { + veGroupChannelListDetail->Set(channel); + Render((int)eVeDisplayChannel::groupchannellistdetail); + } +} + +void cViewChannel::SetChannelList(const cChannel *channel, int index, bool current) { + displayList = true; + if (viewType == dcChannelList && channelList) { + channelList->Set(channel, index, current); + } else if (viewType == dcGroupsChannelList && groupChannelList) { + groupChannelList->Set(channel, index, current); + } +} + +void cViewChannel::SetGroupList(const char *group, int numChannels, int index, bool current) { + displayList = true; + if (groupList) { + groupList->Set(group, numChannels, index, current); + } +} + +void cViewChannel::ClearList(void) { + if (viewType == dcChannelList && channelList) + channelList->Clear(); + if (viewType == dcGroupsList && groupList) + groupList->Clear(); +} + +void cViewChannel::SetNumChannelHints(int num) { + if (veChannelHints) + veChannelHints->SetNumHints(num); + channelHints = true; +} + +void cViewChannel::SetChannelHint(const cChannel *channel) { + if (veChannelHints) + veChannelHints->SetHint(channel); +} + +#endif //USE_ZAPCOCKPIT + +void cViewChannel::Close(void) { + delete fader; + fader = NULL; + delete shifter; + shifter = NULL; + if (initFinished && ShiftTime() > 0) { + cRect shiftbox = CoveredArea(); + cPoint ref = cPoint(shiftbox.X(), shiftbox.Y()); + cPoint end = ShiftStart(shiftbox); + shifter = new cAnimation((cShiftable*)this, end, ref, false); + shifter->Shift(); + delete shifter; + shifter = NULL; + } else if (initFinished && FadeTime() > 0) { + fader = new cAnimation((cFadable*)this, false); + fader->Fade(); + delete fader; + fader = NULL; + } + UnScaleTv(); + ClearVariables(); + for (int i=0; i < numViewElements; i++) { + if (!viewElements[i]) + continue; + viewElements[i]->Close(); + } +#ifdef USE_ZAPCOCKPIT + if (channelList) + channelList->Close(); + if (groupList) + groupList->Close(); + if (groupChannelList) + groupChannelList->Close(); +#endif + sdOsd.Flush(); + sdOsd.DeleteOsd(); +} + +void cViewChannel::ClearBasic(bool clearBackground) { + if (clearBackground) { + Clear((int)eVeDisplayChannel::background, true); + Clear((int)eVeDisplayChannel::currentweather, true); + } + Clear((int)eVeDisplayChannel::channelinfo, true); + Clear((int)eVeDisplayChannel::epginfo, true); + Clear((int)eVeDisplayChannel::statusinfo, true); + Clear((int)eVeDisplayChannel::scrapercontent, true); + Clear((int)eVeDisplayChannel::progressbar, true); + Clear((int)eVeDisplayChannel::screenresolution, true); + Clear((int)eVeDisplayChannel::signalquality, true); + Clear((int)eVeDisplayChannel::audioinfo, true); + Clear((int)eVeDisplayChannel::ecminfo, true); + Clear((int)eVeDisplayChannel::devices, true); + Clear((int)eVeDisplayChannel::customtokens, true); +} + +void cViewChannel::ClearExtended(void) { +#ifdef USE_ZAPCOCKPIT + //exit from channel list + if ((viewTypeLast == dcChannelList || viewTypeLast == dcChannelListInfo) && viewType == dcDefault && channelList) { + channelList->Clear(); + Clear((int)eVeDisplayChannel::channellistback); + Clear((int)eVeDisplayChannel::channellistdetail); + SetDirty((int)eVeDisplayChannel::channellistback); + initExtended = true; + ShowBasic(); + } + //exit from channellist info to channel list + if (viewTypeLast == dcChannelListInfo && viewType == dcChannelList) { + Clear((int)eVeDisplayChannel::channellistdetail); + SetDirty((int)eVeDisplayChannel::channellistdetail); + } + //exit from group list + if (viewTypeLast == dcGroupsList && viewType == dcDefault && groupList) { + groupList->Clear(); + Clear((int)eVeDisplayChannel::grouplistback); + SetDirty((int)eVeDisplayChannel::grouplistback); + initExtended = true; + ShowBasic(); + } + //exit from group channel list to group list + if (viewTypeLast == dcGroupsChannelList && viewType == dcGroupsList && groupChannelList) { + groupChannelList->Clear(); + Clear((int)eVeDisplayChannel::groupchannellistback); + SetDirty((int)eVeDisplayChannel::groupchannellistback); + } + //exit from groupchannellist info to groupchannel list + if (viewTypeLast == dcGroupsChannelListInfo && viewType == dcGroupsChannelList) { + Clear((int)eVeDisplayChannel::groupchannellistdetail); + SetDirty((int)eVeDisplayChannel::groupchannellistdetail); + } + //exit from channel list + if ((viewTypeLast == dcGroupsChannelList || viewTypeLast == dcGroupsChannelListInfo) && viewType == dcDefault && groupList && groupChannelList) { + groupList->Clear(); + groupChannelList->Clear(); + Clear((int)eVeDisplayChannel::grouplistback); + Clear((int)eVeDisplayChannel::groupchannellistback); + Clear((int)eVeDisplayChannel::groupchannellistdetail); + SetDirty((int)eVeDisplayChannel::groupchannellistback); + SetDirty((int)eVeDisplayChannel::grouplistback); + SetDirty((int)eVeDisplayChannel::groupchannellistdetail); + initExtended = true; + ShowBasic(); + } + //exit from channel info to channel or group list + if (viewTypeLast == dcChannelInfo && (viewType == dcChannelList || viewType == dcGroupsList)) { + Clear((int)eVeDisplayChannel::channeldetail, true); + } + viewTypeLast = dcDefault; +#endif +} + +void cViewChannel::ClearOnDisplay(void) { +#ifdef USE_ZAPCOCKPIT + if (viewType == dcChannelInfo && veChannelDetail) { + vector<int> clear = veChannelDetail->GetClearOnDisplay(); + for (vector<int>::iterator ve = clear.begin(); ve != clear.end(); ve++) { + Hide(*ve); + } + } else { + cViewElement *listBack = NULL; + if (viewType == dcChannelList) + listBack = viewElements[(int)eVeDisplayChannel::channellistback]; + else if (viewType == dcGroupsList) + listBack = viewElements[(int)eVeDisplayChannel::grouplistback]; + if (!listBack) + return; + if (listBack->DoClearAll()) { + HideBasic(); + return; + } + vector<int> clear = listBack->GetClearOnDisplay(); + for (vector<int>::iterator ve = clear.begin(); ve != clear.end(); ve++) { + Hide(*ve); + } + } +#endif +} + +void cViewChannel::DrawBasic(bool initial) { + if (initial) { + Render((int)eVeDisplayChannel::background); + Render((int)eVeDisplayChannel::currentweather); + } + Render((int)eVeDisplayChannel::channelinfo); + Render((int)eVeDisplayChannel::epginfo); + Render((int)eVeDisplayChannel::statusinfo); + Render((int)eVeDisplayChannel::scrapercontent); + Render((int)eVeDisplayChannel::progressbar, channelChange); + Render((int)eVeDisplayChannel::screenresolution); + Render((int)eVeDisplayChannel::signalquality); + Render((int)eVeDisplayChannel::audioinfo); + Render((int)eVeDisplayChannel::ecminfo); + Render((int)eVeDisplayChannel::devices); + Render((int)eVeDisplayChannel::customtokens); + Render((int)eVeDisplayChannel::message); + +#ifdef USE_ZAPCOCKPIT + if (channelHints) { + channelHints = false; + if (veChannelHints) { + if (veChannelHints->Active()) + veChannelHints->Close(); + veChannelHints->Parse(); + veChannelHints->Render(); + } + } +#endif +} + +void cViewChannel::HideBasic(void) { + for (int ve = (int)eVeDisplayChannel::background; ve <= (int)eVeDisplayChannel::ecminfo; ve++) { + Hide(ve); + } +} + +void cViewChannel::ShowBasic(void) { + for (int ve = (int)eVeDisplayChannel::background; ve <= (int)eVeDisplayChannel::ecminfo; ve++) { + Show(ve); + } +} + +void cViewChannel::DrawExtended(void) { +#ifdef USE_ZAPCOCKPIT + if (!displayList) + return; + if (initExtended) { + ClearOnDisplay(); + initExtended = false; + } + if (!init && initList) + sdOsd.LockFlush(); + if (viewType == dcChannelList && channelList) { + Render((int)eVeDisplayChannel::channellistback); + channelList->Draw(mcUndefined); + if (initList) + channelList->StartAnimation(); + } else if (viewType == dcGroupsList && groupList) { + Render((int)eVeDisplayChannel::grouplistback); + groupList->Draw(mcUndefined); + if (initList) + groupList->StartAnimation(); + } else if (viewType == dcGroupsChannelList && groupChannelList) { + Render((int)eVeDisplayChannel::groupchannellistback); + groupChannelList->Draw(mcUndefined); + if (initList) + groupChannelList->StartAnimation(); + } + if (!init && initList) + sdOsd.UnlockFlush(); + displayList = false; + initList = false; +#endif +} + void cViewChannel::Flush(bool animFlush) { if (init) { sdOsd.LockFlush(); - Render((int)eVeDisplayChannel::background); - Render((int)eVeDisplayChannel::currentweather); } - if (!displayChannelGroups) { - //normal display +#ifdef USE_ZAPCOCKPIT + ClearExtended(); +#endif + + //Basic Display Handling + if (mode == dmDefault) { if (!shifting) { - Render((int)eVeDisplayChannel::channelinfo); - Render((int)eVeDisplayChannel::epginfo); - Render((int)eVeDisplayChannel::statusinfo); - Render((int)eVeDisplayChannel::scrapercontent); - Render((int)eVeDisplayChannel::progressbar, channelChange); - Render((int)eVeDisplayChannel::screenresolution); - Render((int)eVeDisplayChannel::signalquality); - Render((int)eVeDisplayChannel::audioinfo); - Render((int)eVeDisplayChannel::ecminfo); - Render((int)eVeDisplayChannel::devices); - Render((int)eVeDisplayChannel::customtokens); - Render((int)eVeDisplayChannel::message); + DrawBasic(init); + } + } else if (mode == dmChannelGroups) { + if (init) { + Render((int)eVeDisplayChannel::background); + Render((int)eVeDisplayChannel::currentweather); } - } else { - //channelgroup display Render((int)eVeDisplayChannel::channelgroup); } if (!shifting) { @@ -210,6 +585,10 @@ void cViewChannel::Flush(bool animFlush) { Render((int)eVeDisplayChannel::time); } channelChange = false; + +#ifdef USE_ZAPCOCKPIT + DrawExtended(); +#endif + cView::Flush(animFlush); } - diff --git a/coreengine/viewdisplaychannel.h b/coreengine/viewdisplaychannel.h index 623ec14..aa7c278 100644 --- a/coreengine/viewdisplaychannel.h +++ b/coreengine/viewdisplaychannel.h @@ -4,30 +4,72 @@ #include "view.h" #include "../extensions/globaltimers.h" +enum eDisplayMode { + dmDefault, + dmChannelGroups +}; + class cViewChannel : public cView { private: - cVeMessage *veMessage; - cVeCustomTokens *veCustomTokens; - cVeDcChannelInfo *veChannelInfo; - cVeDcChannelGroup *veChannelGroup; - cVeDcEpgInfo *veEpgInfo; - cVeDcProgressBar *veProgressBar; - cVeDcStatusInfo *veStatusInfo; - cVeDcScraperContent *veScraperContent; - cVeDcEcmInfo *veEcmInfo; + cVeMessage *veMessage; + cVeCustomTokens *veCustomTokens; + cVeDcChannelInfo *veChannelInfo; + cVeDcChannelGroup *veChannelGroup; + cVeDcEpgInfo *veEpgInfo; + cVeDcProgressBar *veProgressBar; + cVeDcStatusInfo *veStatusInfo; + cVeDcScraperContent *veScraperContent; + cVeDcEcmInfo *veEcmInfo; +#ifdef USE_ZAPCOCKPIT + cVeDcChannelHints *veChannelHints; + cVeDcChannelDetail *veChannelDetail; + cVeDcChannelListDetail *veChannelListDetail; + cVeDcGroupChannelListDetail *veGroupChannelListDetail; + cViewListChannelList *channelList; + cViewListGroupList *groupList; + cViewListChannelList *groupChannelList; + eDisplaychannelView viewType; + eDisplaychannelView viewTypeLast; + bool initExtended; + bool displayList; + bool initList; + bool channelHints; + bool channelInput; +#endif bool channelChange; - bool displayChannelGroups; + eDisplayMode mode; bool timersLoaded; cGlobalTimers globalTimers; void SetViewElements(void); void ClearVariables(void); void SetViewElementObjects(void); + void ClearBasic(bool clearBackground); + void ClearExtended(void); + void ClearOnDisplay(void); + void DrawBasic(bool initial); + void HideBasic(void); + void ShowBasic(void); + void DrawExtended(void); public: cViewChannel(void); virtual ~cViewChannel(void); + void SetGlobals(cGlobals *globals); + void PreCache(void); + void AddChannelViewList(const char *listName, cViewList *viewList); void SetChannel(const cChannel *channel, int number); void SetEvents(const cEvent *present, const cEvent *following); void SetMessage(eMessageType type, const char *text); +#ifdef USE_ZAPCOCKPIT + void SetViewType(eDisplaychannelView viewType); + int MaxItems(void); + void SetChannelInfo(const cChannel *channel); + void SetChannelList(const cChannel *channel, int index, bool current); + void SetGroupList(const char *group, int numChannels, int index, bool current); + void ClearList(void); + void SetNumChannelHints(int num); + void SetChannelHint(const cChannel *channel); +#endif + void Close(void); void Flush(bool animFlush); }; diff --git a/coreengine/viewelement.c b/coreengine/viewelement.c index 06ca23e..eaa9814 100644 --- a/coreengine/viewelement.c +++ b/coreengine/viewelement.c @@ -15,9 +15,11 @@ cViewElement::cViewElement(void) { detached = false; waitOnWakeup = true; startAnimation = true; + restartAnimation = false; globals = NULL; tokenContainer = NULL; attribs = new cViewElementAttribs((int)eViewElementAttribs::count); + clearAll = false; detacher = NULL; fader = NULL; shifter = NULL; @@ -34,10 +36,12 @@ cViewElement::cViewElement(const cViewElement &other) { detached = false; waitOnWakeup = true; startAnimation = true; + restartAnimation = false; globals = other.globals; container.Set(other.container.X(), other.container.Y(), other.container.Width(), other.container.Height()); tokenContainer = NULL; attribs = new cViewElementAttribs(*other.attribs); + clearAll = false; for (const cAreaNode *node = other.areaNodes.First(); node; node = other.areaNodes.Next(node)) { if (cArea *a = dynamic_cast<cArea*>((cAreaNode*)node)) { @@ -101,6 +105,20 @@ cViewElement *cViewElement::CreateViewElement(const char *name, const char *view e = new cVeDcSignalQuality(); else if (!strcmp(name, "scrapercontent") && !strcmp(viewname, "displaychannel")) e = new cVeDcScraperContent(); + else if (!strcmp(name, "channelhints")) + e = new cVeDcChannelHints(); + else if (!strcmp(name, "channeldetail")) + e = new cVeDcChannelDetail(); + else if (!strcmp(name, "channellistback")) + e = new cViewElement(); + else if (!strcmp(name, "grouplistback")) + e = new cViewElement(); + else if (!strcmp(name, "groupchannellistback")) + e = new cViewElement(); + else if (!strcmp(name, "channellistdetail")) + e = new cVeDcChannelListDetail(); + else if (!strcmp(name, "groupchannellistdetail")) + e = new cVeDcGroupChannelListDetail(); else if (!strcmp(name, "ecminfo")) e = new cVeDcEcmInfo(); @@ -326,6 +344,7 @@ void cViewElement::Close(void) { dirty = true; init = true; startAnimation = true; + restartAnimation = false; drawn = false; scrollingStarted = false; blocked = false; @@ -378,8 +397,9 @@ void cViewElement::Render(void) { } dirty = false; drawn = true; - if (startAnimation) { + if (startAnimation || restartAnimation) { startAnimation = false; + restartAnimation = false; StartAnimation(); } } diff --git a/coreengine/viewelement.h b/coreengine/viewelement.h index 9341ddf..fb5e7dd 100644 --- a/coreengine/viewelement.h +++ b/coreengine/viewelement.h @@ -27,9 +27,12 @@ protected: bool waitOnWakeup; bool scrollingStarted; bool startAnimation; + bool restartAnimation; cGlobals *globals; cRect container; cViewElementAttribs *attribs; + vector<int> clearOnDisplay; + bool clearAll; cList<cAreaNode> areaNodes; skindesignerapi::cTokenContainer *tokenContainer; cList<cAnimation> scrollers; @@ -74,6 +77,11 @@ public: void StopScrolling(bool deletePixmaps = true); eOrientation Orientation(void) { return attribs->Orientation(); }; virtual int Delay(void) { return attribs->Delay(); }; + const char *ClearOnDisplay(void) { return attribs->ClearOnDisplay(); }; + void SetClearOnDisplay(vector<int> clearOnDisplay) { this->clearOnDisplay = clearOnDisplay; }; + vector<int> GetClearOnDisplay(void) { return clearOnDisplay; }; + void SetClearAll(void) { clearAll = true; }; + bool DoClearAll(void) { return clearAll; }; void ParseDetached(void); void RenderDetached(void); bool Shifting(void); @@ -82,6 +90,7 @@ public: int ShiftTime(void); int ShiftMode(void); void StartAnimation(void); + void SetRestartAnimation(void) { restartAnimation = true; }; virtual void SetTransparency(int transparency, bool force = false); virtual void SetPosition(cPoint &position, cPoint &reference, bool force = false); void SetStartShifting(void) { }; diff --git a/coreengine/viewelementsdisplaychannel.c b/coreengine/viewelementsdisplaychannel.c index b4a2f89..c73807e 100644 --- a/coreengine/viewelementsdisplaychannel.c +++ b/coreengine/viewelementsdisplaychannel.c @@ -676,3 +676,261 @@ bool cVeDcEcmInfo::CompareECMInfos(sDVBAPIEcmInfo *ecmInfo) { return false; return true; } + +/****************************************************************** +* cVeDcChannelHints +******************************************************************/ +cVeDcChannelHints::cVeDcChannelHints(void) { + hints = NULL; + numHints = 0; + current = 0; + hintsIndex = -1; + active = false; +} + +cVeDcChannelHints::~cVeDcChannelHints(void) { + delete[] hints; +} + +void cVeDcChannelHints::Close(void) { + cViewElement::Close(); +} + +void cVeDcChannelHints::SetTokenContainer(void) { + tokenContainer = new skindesignerapi::cTokenContainer(); + tokenContainer->DefineIntToken("{numhints}", (int)eDCChannelHintsIT::numhints); + tokenContainer->DefineLoopToken("{hints[channelnumber]}", (int)eDCChannelHintsLT::channelnumber); + tokenContainer->DefineLoopToken("{hints[channelname]}", (int)eDCChannelHintsLT::channelname); + tokenContainer->DefineLoopToken("{hints[channelid]}", (int)eDCChannelHintsLT::channelid); + tokenContainer->DefineLoopToken("{hints[channellogoexists]}", (int)eDCChannelHintsLT::channellogoexists); + hintsIndex = tokenContainer->LoopIndex("hints"); + InheritTokenContainer(); +} + +void cVeDcChannelHints::SetNumHints(int num) { + delete[] hints; + numHints = num; + hints = new const cChannel*[num]; + current = 0; + active = true; + SetDirty(); +} + + +void cVeDcChannelHints::SetHint(const cChannel *c) { + hints[current++] = c; +} + +bool cVeDcChannelHints::Parse(bool forced) { + if (!cViewElement::Parse(forced)) + return false; + if (!Dirty()) + return false; + if (!hints) + return false; + tokenContainer->Clear(); + tokenContainer->AddIntToken((int)eDCChannelHintsIT::numhints, numHints); + + vector<int> loopInfo; + loopInfo.push_back(numHints); + tokenContainer->CreateLoopTokenContainer(&loopInfo); + + for (int i=0; i < numHints; i++) { + if (hints[i]) { + tokenContainer->AddLoopToken(hintsIndex, i, (int)eDCChannelHintsLT::channelnumber, *cString::sprintf("%d", hints[i]->Number())); + tokenContainer->AddLoopToken(hintsIndex, i, (int)eDCChannelHintsLT::channelname, hints[i]->Name()); + cString channelID = hints[i]->GetChannelID().ToString(); + tokenContainer->AddLoopToken(hintsIndex, i, (int)eDCChannelHintsLT::channelid, *channelID); + bool logoExists = imgCache->LogoExists(*channelID); + tokenContainer->AddLoopToken(hintsIndex, i, (int)eDCChannelHintsLT::channellogoexists, *cString::sprintf("%d", logoExists ? 1 : 0)); + } + } + return true; +} + +/****************************************************************** +* cVeDcChannelDetail +******************************************************************/ +cVeDcChannelDetail::cVeDcChannelDetail(void) { + channel = NULL; +} + +cVeDcChannelDetail::~cVeDcChannelDetail(void) { + channel = NULL; +} + +void cVeDcChannelDetail::Close(void) { + channel = NULL; + cViewElement::Close(); +} + +void cVeDcChannelDetail::SetTokenContainer(void) { + tokenContainer = new skindesignerapi::cTokenContainer(); + tokenContainer->DefineStringToken("{channelname}", (int)eDCChannelDetailST::channelname); + tokenContainer->DefineStringToken("{currenttitle}", (int)eDCChannelDetailST::currenttitle); + tokenContainer->DefineStringToken("{currentshorttext}", (int)eDCChannelDetailST::currentshorttext); + tokenContainer->DefineStringToken("{currentdescription}", (int)eDCChannelDetailST::currentdescription); + tokenContainer->DefineStringToken("{currentstart}", (int)eDCChannelDetailST::currentstart); + tokenContainer->DefineStringToken("{currentstop}", (int)eDCChannelDetailST::currentstop); + tokenContainer->DefineStringToken("{currentdurationminutes}", (int)eDCChannelDetailST::currentdurationminutes); + tokenContainer->DefineStringToken("{nexttitle}", (int)eDCChannelDetailST::nexttitle); + tokenContainer->DefineStringToken("{nextshorttext}", (int)eDCChannelDetailST::nextshorttext); + tokenContainer->DefineStringToken("{nextdescription}", (int)eDCChannelDetailST::nextdescription); + tokenContainer->DefineStringToken("{nextstart}", (int)eDCChannelDetailST::nextstart); + tokenContainer->DefineStringToken("{nextstop}", (int)eDCChannelDetailST::nextstop); + tokenContainer->DefineStringToken("{nextdurationminutes}", (int)eDCChannelDetailST::nextdurationminutes); + tokenContainer->DefineIntToken("{channelnumber}", (int)eDCChannelDetailIT::channelnumber); + tokenContainer->DefineIntToken("{currentduration}", (int)eDCChannelDetailIT::currentduration); + tokenContainer->DefineIntToken("{currentdurationhours}", (int)eDCChannelDetailIT::currentdurationhours); + tokenContainer->DefineIntToken("{currentelapsed}", (int)eDCChannelDetailIT::currentelapsed); + tokenContainer->DefineIntToken("{currentremaining}", (int)eDCChannelDetailIT::currentremaining); + tokenContainer->DefineIntToken("{nextduration}", (int)eDCChannelDetailIT::nextduration); + tokenContainer->DefineIntToken("{nextdurationhours}", (int)eDCChannelDetailIT::nextdurationhours); + tokenContainer->DefineStringToken("{movietitle}", (int)eScraperST::movietitle); + tokenContainer->DefineStringToken("{movieoriginalTitle}", (int)eScraperST::movieoriginalTitle); + tokenContainer->DefineStringToken("{movietagline}", (int)eScraperST::movietagline); + tokenContainer->DefineStringToken("{movieoverview}", (int)eScraperST::movieoverview); + tokenContainer->DefineStringToken("{moviegenres}", (int)eScraperST::moviegenres); + tokenContainer->DefineStringToken("{moviehomepage}", (int)eScraperST::moviehomepage); + tokenContainer->DefineStringToken("{moviereleasedate}", (int)eScraperST::moviereleasedate); + tokenContainer->DefineStringToken("{moviepopularity}", (int)eScraperST::moviepopularity); + tokenContainer->DefineStringToken("{movievoteaverage}", (int)eScraperST::movievoteaverage); + tokenContainer->DefineStringToken("{posterpath}", (int)eScraperST::posterpath); + tokenContainer->DefineStringToken("{fanartpath}", (int)eScraperST::fanartpath); + tokenContainer->DefineStringToken("{moviecollectionName}", (int)eScraperST::moviecollectionName); + tokenContainer->DefineStringToken("{collectionposterpath}", (int)eScraperST::collectionposterpath); + tokenContainer->DefineStringToken("{collectionfanartpath}", (int)eScraperST::collectionfanartpath); + tokenContainer->DefineStringToken("{seriesname}", (int)eScraperST::seriesname); + tokenContainer->DefineStringToken("{seriesoverview}", (int)eScraperST::seriesoverview); + tokenContainer->DefineStringToken("{seriesfirstaired}", (int)eScraperST::seriesfirstaired); + tokenContainer->DefineStringToken("{seriesnetwork}", (int)eScraperST::seriesnetwork); + tokenContainer->DefineStringToken("{seriesgenre}", (int)eScraperST::seriesgenre); + tokenContainer->DefineStringToken("{seriesrating}", (int)eScraperST::seriesrating); + tokenContainer->DefineStringToken("{seriesstatus}", (int)eScraperST::seriesstatus); + tokenContainer->DefineStringToken("{episodetitle}", (int)eScraperST::episodetitle); + tokenContainer->DefineStringToken("{episodefirstaired}", (int)eScraperST::episodefirstaired); + tokenContainer->DefineStringToken("{episodegueststars}", (int)eScraperST::episodegueststars); + tokenContainer->DefineStringToken("{episodeoverview}", (int)eScraperST::episodeoverview); + tokenContainer->DefineStringToken("{episoderating}", (int)eScraperST::episoderating); + tokenContainer->DefineStringToken("{episodeimagepath}", (int)eScraperST::episodeimagepath); + tokenContainer->DefineStringToken("{seasonposterpath}", (int)eScraperST::seasonposterpath); + tokenContainer->DefineStringToken("{seriesposter1path}", (int)eScraperST::seriesposter1path); + tokenContainer->DefineStringToken("{seriesposter2path}", (int)eScraperST::seriesposter2path); + tokenContainer->DefineStringToken("{seriesposter3path}", (int)eScraperST::seriesposter3path); + tokenContainer->DefineStringToken("{seriesfanart1path}", (int)eScraperST::seriesfanart1path); + tokenContainer->DefineStringToken("{seriesfanart2path}", (int)eScraperST::seriesfanart2path); + tokenContainer->DefineStringToken("{seriesfanart3path}", (int)eScraperST::seriesfanart3path); + tokenContainer->DefineStringToken("{seriesbanner1path}", (int)eScraperST::seriesbanner1path); + tokenContainer->DefineStringToken("{seriesbanner2path}", (int)eScraperST::seriesbanner2path); + tokenContainer->DefineStringToken("{seriesbanner3path}", (int)eScraperST::seriesbanner3path); + tokenContainer->DefineIntToken("{ismovie}", (int)eScraperIT::ismovie); + tokenContainer->DefineIntToken("{moviebudget}", (int)eScraperIT::moviebudget); + tokenContainer->DefineIntToken("{movierevenue}", (int)eScraperIT::movierevenue); + tokenContainer->DefineIntToken("{movieadult}", (int)eScraperIT::movieadult); + tokenContainer->DefineIntToken("{movieruntime}", (int)eScraperIT::movieruntime); + tokenContainer->DefineIntToken("{isseries}", (int)eScraperIT::isseries); + tokenContainer->DefineIntToken("{posterwidth}", (int)eScraperIT::posterwidth); + tokenContainer->DefineIntToken("{posterheight}", (int)eScraperIT::posterheight); + tokenContainer->DefineIntToken("{fanartwidth}", (int)eScraperIT::fanartwidth); + tokenContainer->DefineIntToken("{fanartheight}", (int)eScraperIT::fanartheight); + tokenContainer->DefineIntToken("{movieiscollection}", (int)eScraperIT::movieiscollection); + tokenContainer->DefineIntToken("{collectionposterwidth}", (int)eScraperIT::collectionposterwidth); + tokenContainer->DefineIntToken("{collectionposterheight}", (int)eScraperIT::collectionposterheight); + tokenContainer->DefineIntToken("{collectionfanartwidth}", (int)eScraperIT::collectionfanartwidth); + tokenContainer->DefineIntToken("{collectionfanartheight}", (int)eScraperIT::collectionfanartheight); + tokenContainer->DefineIntToken("{epgpicavailable}", (int)eScraperIT::epgpicavailable); + tokenContainer->DefineIntToken("{episodenumber}", (int)eScraperIT::episodenumber); + tokenContainer->DefineIntToken("{episodeseason}", (int)eScraperIT::episodeseason); + tokenContainer->DefineIntToken("{episodeimagewidth}", (int)eScraperIT::episodeimagewidth); + tokenContainer->DefineIntToken("{episodeimageheight}", (int)eScraperIT::episodeimageheight); + tokenContainer->DefineIntToken("{seasonposterwidth}", (int)eScraperIT::seasonposterwidth); + tokenContainer->DefineIntToken("{seasonposterheight}", (int)eScraperIT::seasonposterheight); + tokenContainer->DefineIntToken("{seriesposter1width}", (int)eScraperIT::seriesposter1width); + tokenContainer->DefineIntToken("{seriesposter1height}", (int)eScraperIT::seriesposter1height); + tokenContainer->DefineIntToken("{seriesposter2width}", (int)eScraperIT::seriesposter2width); + tokenContainer->DefineIntToken("{seriesposter2height}", (int)eScraperIT::seriesposter2height); + tokenContainer->DefineIntToken("{seriesposter3width}", (int)eScraperIT::seriesposter3width); + tokenContainer->DefineIntToken("{seriesposter3height}", (int)eScraperIT::seriesposter3height); + tokenContainer->DefineIntToken("{seriesfanart1width}", (int)eScraperIT::seriesfanart1width); + tokenContainer->DefineIntToken("{seriesfanart1height}", (int)eScraperIT::seriesfanart1height); + tokenContainer->DefineIntToken("{seriesfanart2width}", (int)eScraperIT::seriesfanart2width); + tokenContainer->DefineIntToken("{seriesfanart2height}", (int)eScraperIT::seriesfanart2height); + tokenContainer->DefineIntToken("{seriesfanart3width}", (int)eScraperIT::seriesfanart3width); + tokenContainer->DefineIntToken("{seriesfanart3height}", (int)eScraperIT::seriesfanart3height); + tokenContainer->DefineIntToken("{seriesbanner1width}", (int)eScraperIT::seriesbanner1width); + tokenContainer->DefineIntToken("{seriesbanner1height}", (int)eScraperIT::seriesbanner1height); + tokenContainer->DefineIntToken("{seriesbanner2width}", (int)eScraperIT::seriesbanner2width); + tokenContainer->DefineIntToken("{seriesbanner2height}", (int)eScraperIT::seriesbanner2height); + tokenContainer->DefineIntToken("{seriesbanner3width}", (int)eScraperIT::seriesbanner3width); + tokenContainer->DefineIntToken("{seriesbanner3height}", (int)eScraperIT::seriesbanner3height); + tokenContainer->DefineLoopToken("{actors[name]}", (int)eScraperLT::name); + tokenContainer->DefineLoopToken("{actors[role]}", (int)eScraperLT::role); + tokenContainer->DefineLoopToken("{actors[thumb]}", (int)eScraperLT::thumb); + tokenContainer->DefineLoopToken("{actors[thumbwidth]}", (int)eScraperLT::thumbwidth); + tokenContainer->DefineLoopToken("{actors[thumbheight]}", (int)eScraperLT::thumbheight); + actorsIndex = tokenContainer->LoopIndex("actors"); + InheritTokenContainer(); +} + +void cVeDcChannelDetail::Set(const cChannel *c) { + channel = c; +} + +bool cVeDcChannelDetail::Parse(bool forced) { + if (!cViewElement::Parse(forced)) + return false; + if (!channel) + return false; + + SetDirty(); + tokenContainer->Clear(); + tokenContainer->AddIntToken((int)eDCChannelDetailIT::channelnumber, channel->Number()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::channelname, channel->Name()); + +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_SCHEDULES_READ; + const cSchedules* schedules = Schedules; +#else + cSchedulesLock schedulesLock; + const cSchedules* schedules = (cSchedules*)cSchedules::Schedules(schedulesLock); +#endif + const cSchedule *schedule = schedules->GetSchedule(channel); + if (schedule) { + const cEvent *presentEvent = schedule->GetPresentEvent(); + if (presentEvent) { + tokenContainer->AddStringToken((int)eDCChannelDetailST::currenttitle, presentEvent->Title()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::currentshorttext, presentEvent->ShortText()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::currentdescription, presentEvent->Description()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::currentstart, *presentEvent->GetTimeString()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::currentstop, *presentEvent->GetEndTimeString()); + tokenContainer->AddIntToken((int)eDCChannelDetailIT::currentduration, presentEvent->Duration()/60); + tokenContainer->AddIntToken((int)eDCChannelDetailIT::currentelapsed, (time(0) - presentEvent->StartTime())/60); + tokenContainer->AddIntToken((int)eDCChannelDetailIT::currentremaining, presentEvent->Duration()/60 - (time(0) - presentEvent->StartTime())/60); + tokenContainer->AddIntToken((int)eDCChannelDetailIT::currentdurationhours, presentEvent->Duration() / 3600); + tokenContainer->AddStringToken((int)eDCChannelDetailST::currentdurationminutes, *cString::sprintf("%.2d", (presentEvent->Duration() / 60)%60)); + vector<int> loopInfo; + bool scrapInfoAvailable = LoadFullScrapInfo(presentEvent, NULL); + int numActors = NumActors(); + loopInfo.push_back(numActors); + tokenContainer->CreateLoopTokenContainer(&loopInfo); + if (scrapInfoAvailable) { + SetFullScrapInfo(tokenContainer, actorsIndex); + } + } + const cList<cEvent> *events = schedule->Events(); + if (events && presentEvent) { + const cEvent *nextEvent = events->Next(presentEvent); + if (nextEvent) { + tokenContainer->AddStringToken((int)eDCChannelDetailST::nexttitle, nextEvent->Title()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::nextshorttext, nextEvent->ShortText()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::nextdescription, nextEvent->Description()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::nextstart, *nextEvent->GetTimeString()); + tokenContainer->AddStringToken((int)eDCChannelDetailST::nextstop, *nextEvent->GetEndTimeString()); + tokenContainer->AddIntToken((int)eDCChannelDetailIT::nextduration, nextEvent->Duration() / 60); + tokenContainer->AddIntToken((int)eDCChannelDetailIT::nextdurationhours, nextEvent->Duration() / 3600); + tokenContainer->AddStringToken((int)eDCChannelDetailST::nextdurationminutes, *cString::sprintf("%.2d", (nextEvent->Duration() / 60)%60)); + } + } + } + return true; +} diff --git a/coreengine/viewelementsdisplaychannel.h b/coreengine/viewelementsdisplaychannel.h index 799456d..b1a7691 100644 --- a/coreengine/viewelementsdisplaychannel.h +++ b/coreengine/viewelementsdisplaychannel.h @@ -150,4 +150,53 @@ public: bool Parse(bool forced = false); }; +/****************************************************************** +* cVeDcChannelHints +******************************************************************/ +class cVeDcChannelHints : public cViewElement { +private: + const cChannel **hints; + int numHints; + int current; + int hintsIndex; + bool active; +public: + cVeDcChannelHints(void); + virtual ~cVeDcChannelHints(void); + void Close(void); + void SetTokenContainer(void); + void SetNumHints(int num); + void SetHint(const cChannel *c); + bool Parse(bool forced = false); + bool Active(void) { return active; }; +}; + + +/****************************************************************** +* cVeDcChannelDetail +******************************************************************/ +class cVeDcChannelDetail : public cViewElement, public cScrapManager { +private: + const cChannel *channel; + int actorsIndex; +public: + cVeDcChannelDetail(void); + virtual ~cVeDcChannelDetail(void); + void Close(void); + void SetTokenContainer(void); + void Set(const cChannel *c); + bool Parse(bool forced = false); +}; + +class cVeDcChannelListDetail : public cVeDcChannelDetail { +public: + cVeDcChannelListDetail(void) {}; + virtual ~cVeDcChannelListDetail(void) {}; +}; + +class cVeDcGroupChannelListDetail : public cVeDcChannelDetail { +public: + cVeDcGroupChannelListDetail(void) {}; + virtual ~cVeDcGroupChannelListDetail(void) {}; +}; #endif //__VIEWELEMENTSDC_H
\ No newline at end of file diff --git a/coreengine/viewelementsdisplaymenu.c b/coreengine/viewelementsdisplaymenu.c index 4397ffa..8e8599f 100644 --- a/coreengine/viewelementsdisplaymenu.c +++ b/coreengine/viewelementsdisplaymenu.c @@ -411,10 +411,10 @@ bool cVeDmTimers::Parse(bool forced) { } bool isRecording = Timer->Recording(); if (!isRecording) { - if (cEpgTimer_Interface_V1* epgTimer = dynamic_cast<cEpgTimer_Interface_V1*>((cTimer*)Timer)) { - if (epgTimer->State() == 'R') - isRecording = true; - } + if (cEpgTimer_Interface_V1* epgTimer = dynamic_cast<cEpgTimer_Interface_V1*>((cTimer*)Timer)) { + if (epgTimer->State() == 'R') + isRecording = true; + } } tokenContainer->AddLoopToken(timerIndex, i, (int)eDMTimersLT::recording, isRecording ? "1" : "0"); diff --git a/coreengine/viewlist.c b/coreengine/viewlist.c index 83e75f8..1ed5432 100644 --- a/coreengine/viewlist.c +++ b/coreengine/viewlist.c @@ -9,6 +9,8 @@ cViewList::cViewList(void) { listElements = NULL; plugId = -1; plugMenuId = -1; + fader = NULL; + shifter = NULL; } cViewList::~cViewList(void) { @@ -25,6 +27,8 @@ cViewList::~cViewList(void) { } delete[] listElements; delete tokenContainer; + delete fader; + delete shifter; } void cViewList::SetGlobals(cGlobals *globals) { @@ -66,6 +70,12 @@ cViewList *cViewList::CreateViewList(const char *name) { l = new cViewListAudioTracks(); else if (startswith(name, "menuplugin")) l = new cViewListPlugin(); + else if (startswith(name, "channellist")) + l = new cViewListChannelList(); + else if (startswith(name, "grouplist")) + l = new cViewListGroupList(); + else if (startswith(name, "groupchannellist")) + l = new cViewListChannelList(); else esyslog("skindesigner: unknown viewlist %s", name); return l; @@ -91,6 +101,12 @@ cViewElement *cViewList::CreateListElement(const char *name) { le = new cLeAudioTracks(); else if (startswith(name, "menuplugin")) le = new cLeMenuPlugin(); + else if (startswith(name, "channellist")) + le = new cLeChannelList(); + else if (startswith(name, "grouplist")) + le = new cLeGroupList(); + else if (startswith(name, "groupchannellist")) + le = new cLeChannelList(); else esyslog("skindesigner: unknown viewlist %s", name); return le; @@ -207,21 +223,85 @@ void cViewList::Clear(void) { } void cViewList::Close(void) { + delete fader; + fader = NULL; + delete shifter; + shifter = NULL; if (!listElements) return; for (int i = 0; i < numElements; i++) { listElements[i]->StopBlinking(); listElements[i]->StopScrolling(); } - for (int i = 0; i < numElements; i++) { + for (int i = 0; i < numElements; i++) listElements[i]->Close(); +} + +void cViewList::SetTransparency(int transparency, bool force) { + for (int i = 0; i < numElements; i++) { + if (listElements[i]) + listElements[i]->SetTransparency(transparency, force); } } -void cViewList::SetTransparency(int transparency) { +cRect cViewList::CoveredArea(void) { + cRect unionArea; for (int i = 0; i < numElements; i++) { + if (listElements[i]) + unionArea.Combine(listElements[i]->CoveredArea()); + } + return unionArea; +} + +void cViewList::SetPosition(cPoint &position, cPoint &reference, bool force) { + for (int i = 0; i < numElements; i++) { + if (listElements[i]) + listElements[i]->SetPosition(position, reference, force); + } +} + +void cViewList::RegisterAnimation(void) { + for (int i = 0; i < numElements; i++) { if (listElements[i]) { - listElements[i]->SetTransparency(transparency); + listElements[i]->RegisterAnimation(); + break; + } + } +} + +void cViewList::UnregisterAnimation(void) { + for (int i = 0; i < numElements; i++) { + if (listElements[i]) { + listElements[i]->UnregisterAnimation(); + break; + } + } +} + +void cViewList::StartAnimation(void) { + if (ShiftTime() > 0) { + cRect shiftbox = CoveredArea(); + cPoint ref = cPoint(shiftbox.X(), shiftbox.Y()); + cPoint start = ShiftStart(shiftbox); + SetPosition(start, ref); + Flush(false); + delete shifter; + shifter = new cAnimation((cShiftable*)this, start, ref, true); + shifter->Start(); + } else if (FadeTime() > 0) { + SetTransparency(100); + Flush(false); + delete fader; + fader = new cAnimation((cFadable*)this, true); + fader->Start(); + } +} + +void cViewList::Flush(bool animFlush) { + for (int i = 0; i < numElements; i++) { + if (listElements[i]) { + listElements[i]->Flush(animFlush); + break; } } } @@ -231,6 +311,27 @@ void cViewList::Debug(void) { attribs->Debug(); } +cPoint cViewList::ShiftStart(cRect &shiftbox) { + eShiftType type = (eShiftType)attribs->ShiftType(); + cPoint start; + if (type == eShiftType::none) { + start = attribs->ShiftStartpoint(); + } else if (type == eShiftType::left) { + start.SetX(-shiftbox.Width()); + start.SetY(shiftbox.Y()); + } else if (type == eShiftType::right) { + start.SetX(cOsd::OsdWidth()); + start.SetY(shiftbox.Y()); + } else if (type == eShiftType::top) { + start.SetX(shiftbox.X()); + start.SetY(-shiftbox.Height()); + } else if (type == eShiftType::bottom) { + start.SetX(shiftbox.X()); + start.SetY(cOsd::OsdHeight()); + } + return start; +} + /****************************************************************** * cViewListDefault ******************************************************************/ @@ -927,3 +1028,117 @@ void cViewListAudioTracks::Draw(void) { } } } + +/****************************************************************** +* cViewListChannelList +******************************************************************/ +cViewListChannelList::cViewListChannelList(void) { + listChannelList = NULL; +} + +cViewListChannelList::~cViewListChannelList(void) { + delete[] listChannelList; +} + +void cViewListChannelList::Prepare(int start, int step) { + if (!listElement) + return; + + cLeChannelList *tpl = dynamic_cast<cLeChannelList*>(listElement); + if (!tpl) return; + + listChannelList = new cLeChannelList*[numElements]; + listElements = new cListElement*[numElements]; + int pos = start; + + for (int i = 0; i < numElements; i++) { + listChannelList[i] = new cLeChannelList(*tpl); + listElements[i] = listChannelList[i]; + listChannelList[i]->SetNumber(i); + listChannelList[i]->SetTokenContainer(); + int x, y, width, height; + if (orientation == eOrientation::vertical) { + x = attribs->X(); + y = pos; + width = attribs->Width(); + height = step; + listChannelList[i]->SetAreaHeight(height); + } else { + x = pos; + y = attribs->Y(); + width = step; + height = attribs->Height(); + listChannelList[i]->SetAreaWidth(width); + } + listChannelList[i]->SetContainer(x, y, width, height); + listChannelList[i]->Cache(); + pos += step; + } +} + +void cViewListChannelList::Set(const cChannel *channel, int index, bool current) { + if (index < 0 || index >= numElements) + return; + if (!current) + listChannelList[index]->StopScrolling(); + listChannelList[index]->SetCurrent(current); + listChannelList[index]->SetSelectable(true); + listChannelList[index]->Set(channel); +} + +/****************************************************************** +* cViewListGroupList +******************************************************************/ +cViewListGroupList::cViewListGroupList(void) { + listGroupList = NULL; +} + +cViewListGroupList::~cViewListGroupList(void) { + delete[] listGroupList; +} + +void cViewListGroupList::Prepare(int start, int step) { + if (!listElement) + return; + + cLeGroupList *tpl = dynamic_cast<cLeGroupList*>(listElement); + if (!tpl) return; + + listGroupList = new cLeGroupList*[numElements]; + listElements = new cListElement*[numElements]; + int pos = start; + + for (int i = 0; i < numElements; i++) { + listGroupList[i] = new cLeGroupList(*tpl); + listElements[i] = listGroupList[i]; + listGroupList[i]->SetNumber(i); + listGroupList[i]->SetTokenContainer(); + int x, y, width, height; + if (orientation == eOrientation::vertical) { + x = attribs->X(); + y = pos; + width = attribs->Width(); + height = step; + listGroupList[i]->SetAreaHeight(height); + } else { + x = pos; + y = attribs->Y(); + width = step; + height = attribs->Height(); + listGroupList[i]->SetAreaWidth(width); + } + listGroupList[i]->SetContainer(x, y, width, height); + listGroupList[i]->Cache(); + pos += step; + } +} + +void cViewListGroupList::Set(const char *group, int numChannels, int index, bool current) { + if (index < 0 || index >= numElements) + return; + if (!current) + listGroupList[index]->StopScrolling(); + listGroupList[index]->SetCurrent(current); + listGroupList[index]->SetSelectable(true); + listGroupList[index]->Set(group, numChannels); +} diff --git a/coreengine/viewlist.h b/coreengine/viewlist.h index 6c14d03..b72123e 100644 --- a/coreengine/viewlist.h +++ b/coreengine/viewlist.h @@ -6,7 +6,7 @@ #include "listelements.h" #include "area.h" -class cViewList { +class cViewList : public cFadable, public cShiftable { protected: int plugId; int plugMenuId; @@ -19,7 +19,10 @@ protected: cViewElement *listElement; cViewElement *currentElement; cListElement **listElements; + cAnimation *fader; + cAnimation *shifter; virtual void Prepare(int start, int step) {}; + cPoint ShiftStart(cRect &shiftbox); public: cViewList(void); virtual ~cViewList(void); @@ -40,7 +43,22 @@ public: void Draw(eMenuCategory menuCat); void Clear(void); virtual void Close(void); - void SetTransparency(int transparency); + //Fadable + bool Detached(void) { return false; }; + int Delay(void) { return 0; }; + int FadeTime(void) { return attribs->FadeTime(); }; + void SetTransparency(int transparency, bool force = false); + //Shiftable + int ShiftTime(void) { return attribs->ShiftTime(); }; + int ShiftMode(void) { return attribs->ShiftMode(); }; + void SetPosition(cPoint &position, cPoint &reference, bool force = false); + void SetStartShifting(void) { }; + void SetEndShifting(void) { }; + void RegisterAnimation(void); + void UnregisterAnimation(void); + cRect CoveredArea(void); + void StartAnimation(void); + void Flush(bool animFlush); void Debug(void); }; @@ -154,4 +172,26 @@ public: void SetCurrentTrack(int index); void Draw(void); }; + +class cViewListChannelList : public cViewList { +private: + cLeChannelList **listChannelList; +protected: + void Prepare(int start, int step); +public: + cViewListChannelList(void); + virtual ~cViewListChannelList(void); + void Set(const cChannel *channel, int index, bool current); +}; + +class cViewListGroupList : public cViewList { +private: + cLeGroupList **listGroupList; +protected: + void Prepare(int start, int step); +public: + cViewListGroupList(void); + virtual ~cViewListGroupList(void); + void Set(const char *group, int numChannels, int index, bool current); +}; #endif //__VIEWLIST_H
\ No newline at end of file diff --git a/coreengine/xmlparser.c b/coreengine/xmlparser.c index 617313a..aa7be10 100644 --- a/coreengine/xmlparser.c +++ b/coreengine/xmlparser.c @@ -40,6 +40,7 @@ bool cXmlParser::ParseView(void) { view->SetAttributes(rootAttribs); cViewMenu *menuView = dynamic_cast<cViewMenu*>(view); + cViewChannel *channelView = dynamic_cast<cViewChannel*>(view); cViewTracks *tracksView = dynamic_cast<cViewTracks*>(view); if (!LevelDown()) @@ -48,6 +49,13 @@ bool cXmlParser::ParseView(void) { do { if (view->ValidViewElement(NodeName())) { ParseViewElement(NodeName()); + } else if (channelView) { + if (view->ValidViewList(NodeName())) { + ParseViewList(NULL, NodeName()); + } else { + esyslog("skindesigner: unknown node %s", NodeName()); + return false; + } } else if (menuView) { if (menuView->ValidSubView(NodeName())) { ParseSubView(NodeName()); @@ -334,7 +342,7 @@ void cXmlParser::ParsePluginViewElement(bool isScrollbar, bool isTabLabels) { } } -void cXmlParser::ParseViewList(cView *subView) { +void cXmlParser::ParseViewList(cView *subView, const char *listName) { if (!view) return; @@ -345,7 +353,11 @@ void cXmlParser::ParseViewList(cView *subView) { name = view->GetViewName(); vector<stringpair> attribs = ParseAttributes(); - cViewList *viewList = cViewList::CreateViewList(name); + cViewList *viewList = NULL; + if (!listName) + viewList = cViewList::CreateViewList(name); + else + viewList = cViewList::CreateViewList(listName); viewList->SetAttributes(attribs); if (!LevelDown()) @@ -353,7 +365,11 @@ void cXmlParser::ParseViewList(cView *subView) { do { if (CheckNodeName("currentelement")) { - cViewElement *currentElement = cViewList::CreateCurrentElement(name); + cViewElement *currentElement = NULL; + if (!listName) + currentElement = cViewList::CreateCurrentElement(name); + else + currentElement = cViewList::CreateCurrentElement(listName); currentElement->SetOsd(sdOsd); vector<stringpair> attribsList = ParseAttributes(); currentElement->SetAttributes(attribsList); @@ -375,7 +391,11 @@ void cXmlParser::ParseViewList(cView *subView) { LevelUp(); viewList->AddCurrentElement(currentElement); } else if (CheckNodeName("listelement")) { - cViewElement *listElement = cViewList::CreateListElement(name); + cViewElement *listElement = NULL; + if (!listName) + listElement = cViewList::CreateListElement(name); + else + listElement = cViewList::CreateListElement(listName); listElement->SetOsd(sdOsd); vector<stringpair> attribsList = ParseAttributes(); listElement->SetAttributes(attribsList); @@ -402,8 +422,12 @@ void cXmlParser::ParseViewList(cView *subView) { if (subView) subView->AddViewList(viewList); - else - view->AddViewList(viewList); + else if (listName) { + cViewChannel *channelView = dynamic_cast<cViewChannel*>(view); + channelView->AddChannelViewList(listName, viewList); + } else { + view->AddViewList(viewList); + } } diff --git a/coreengine/xmlparser.h b/coreengine/xmlparser.h index 398700e..85bb22a 100644 --- a/coreengine/xmlparser.h +++ b/coreengine/xmlparser.h @@ -29,7 +29,7 @@ private: bool ParseSubView(string name); void ParseViewElement(string name, cView *subView = NULL); void ParsePluginViewElement(bool isScrollbar = false, bool isTabLabels = false); - void ParseViewList(cView *subView = NULL); + void ParseViewList(cView *subView = NULL, const char *listName = NULL); void ParseViewTab(cView *subView); void ParseViewTabPlugin(void); void ParseGrid(void); |