fixed bug that detached viewelements were not cleared correctly

This commit is contained in:
louis 2015-05-14 06:45:03 +02:00
parent 57999a442f
commit f33354ba5a
5 changed files with 19 additions and 2 deletions

View File

@ -316,3 +316,7 @@ Version 0.4.5
- added {numtimers} Token to lastrecordings viewelement - added {numtimers} Token to lastrecordings viewelement
- fixed time display bug in displaymenurecordings - fixed time display bug in displaymenurecordings
- added token {watched} to displaymenurecordings - added token {watched} to displaymenurecordings
- fixed bug that scrapercontent in displaychannel was not
updated if detached
- fixed bug that detached viewelements were not cleared
correctly

View File

@ -354,15 +354,17 @@ void cDisplayChannelView::DrawScraperContent(const cEvent *event) {
} }
if (DetachViewElement(veScraperContent)) { if (DetachViewElement(veScraperContent)) {
cViewElement *viewElement = GetViewElement(veScraperContent); cViewElementScraperContent *viewElement = dynamic_cast<cViewElementScraperContent*>(GetViewElement(veScraperContent));
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementScraperContent(event, ctPosterBanner, tmplView->GetViewElement(veScraperContent)); viewElement = new cViewElementScraperContent(event, ctPosterBanner, tmplView->GetViewElement(veScraperContent));
AddViewElement(veScraperContent, viewElement); AddViewElement(veScraperContent, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {
if (!viewElement->Starting()) if (!viewElement->Starting()) {
viewElement->SetEvent(event);
viewElement->Render(); viewElement->Render();
} }
}
} else { } else {
map < string, string > stringTokens; map < string, string > stringTokens;
map < string, int > intTokens; map < string, int > intTokens;

View File

@ -27,6 +27,7 @@ private:
public: public:
cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement); cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement);
virtual ~cViewElementScraperContent() {}; virtual ~cViewElementScraperContent() {};
void SetEvent(const cEvent *event) { this->event = event; };
bool Render(void); bool Render(void);
}; };

View File

@ -183,6 +183,11 @@ void cView::DrawViewElement(eViewElement ve, map <string,string> *stringTokens,
} }
void cView::ClearViewElement(eViewElement ve) { void cView::ClearViewElement(eViewElement ve) {
cViewElement *detachedVE = GetViewElement(ve);
if (detachedVE) {
detachedVE->Clear();
return;
}
cTemplateViewElement *viewElement = NULL; cTemplateViewElement *viewElement = NULL;
int currentAnimCat = ve; int currentAnimCat = ve;
if (tmplViewElement) { if (tmplViewElement) {
@ -1103,6 +1108,10 @@ bool cViewElement::Render(void) {
return true; return true;
} }
void cViewElement::Clear(void) {
ClearViewElement(ve);
}
void cViewElement::Action(void) { void cViewElement::Action(void) {
DoSleep(delay); DoSleep(delay);
if (!Running()) if (!Running())

View File

@ -95,6 +95,7 @@ public:
virtual ~cViewElement(); virtual ~cViewElement();
void SetCallback(eViewElement ve, bool (cViewHelpers::*SetTokens)(bool, stringmap&, intmap&)) { this->ve = ve; this->SetTokens = SetTokens; }; void SetCallback(eViewElement ve, bool (cViewHelpers::*SetTokens)(bool, stringmap&, intmap&)) { this->ve = ve; this->SetTokens = SetTokens; };
virtual bool Render(void); virtual bool Render(void);
void Clear(void);
bool Starting(void) { return Running(); }; bool Starting(void) { return Running(); };
}; };