mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
				synced 2023-10-19 15:58:31 +00:00 
			
		
		
		
	fixed bug that datetime was not drawn correctly in menus
This commit is contained in:
		
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							@@ -286,5 +286,5 @@ Version 0.4.1
 | 
			
		||||
 | 
			
		||||
Version 0.4.2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- fixed bug that datetime was not drawn correctly in menus
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ void cDisplayChannelView::DrawDate(void) {
 | 
			
		||||
        map < string, string > stringTokens;
 | 
			
		||||
        map < string, int > intTokens;
 | 
			
		||||
        
 | 
			
		||||
        if (!SetDate(stringTokens, intTokens)) {
 | 
			
		||||
        if (!SetDate(false, stringTokens, intTokens)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -104,7 +104,7 @@ void cDisplayChannelView::DrawTime(void) {
 | 
			
		||||
        map < string, string > stringTokens;
 | 
			
		||||
        map < string, int > intTokens;
 | 
			
		||||
 | 
			
		||||
        if (!SetTime(stringTokens, intTokens)) {
 | 
			
		||||
        if (!SetTime(false, stringTokens, intTokens)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }    
 | 
			
		||||
        ClearViewElement(veTime);
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(root
 | 
			
		||||
    viewType = svUndefined;
 | 
			
		||||
    subView = NULL;
 | 
			
		||||
    subViewAvailable = false;
 | 
			
		||||
    subViewInit = true;
 | 
			
		||||
    pluginName = "";
 | 
			
		||||
    pluginMenu = -1;
 | 
			
		||||
    pluginMenuType = mtUnknown;
 | 
			
		||||
@@ -102,6 +103,7 @@ bool cDisplayMenuRootView::createOsd(void) {
 | 
			
		||||
void cDisplayMenuRootView::SetMenu(eMenuCategory menuCat, bool menuInit) {
 | 
			
		||||
    eSubView newViewType = svUndefined;
 | 
			
		||||
    cat = menuCat;
 | 
			
		||||
    subViewInit = true;
 | 
			
		||||
    bool isListView = true;
 | 
			
		||||
    if (menuCat != mcPlugin) {
 | 
			
		||||
        pluginName = "";
 | 
			
		||||
@@ -473,19 +475,19 @@ bool cDisplayMenuRootView::RenderDynamicElements(void) {
 | 
			
		||||
        return false;
 | 
			
		||||
    bool updated = false;
 | 
			
		||||
    bool implemented = false;
 | 
			
		||||
    if (view->DrawTime(implemented)) {
 | 
			
		||||
    if (view->DrawTime(subViewInit, implemented)) {
 | 
			
		||||
        defaultTimeDrawn = false;
 | 
			
		||||
        updated = true;
 | 
			
		||||
    } else if (!implemented && DrawTime()) {
 | 
			
		||||
    } else if (!implemented && DrawTime(subViewInit)) {
 | 
			
		||||
        defaultTimeDrawn = true;
 | 
			
		||||
        updated = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    implemented = false;
 | 
			
		||||
    if (view->DrawDateTime(implemented)) {
 | 
			
		||||
    if (view->DrawDateTime(subViewInit, implemented)) {
 | 
			
		||||
        defaultDateTimeDrawn = false;
 | 
			
		||||
    } else if (!implemented) {
 | 
			
		||||
        DrawDateTime();
 | 
			
		||||
        DrawDateTime(subViewInit);
 | 
			
		||||
        defaultDateTimeDrawn = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -493,6 +495,11 @@ bool cDisplayMenuRootView::RenderDynamicElements(void) {
 | 
			
		||||
        updated = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (subViewInit) {
 | 
			
		||||
        subViewInit = false;
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    subViewInit = false;
 | 
			
		||||
    return updated;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -517,7 +524,7 @@ void cDisplayMenuRootView::DrawHeader(void) {
 | 
			
		||||
    DrawViewElement(veHeader, &stringTokens, &intTokens);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cDisplayMenuRootView::DrawDateTime(void) {
 | 
			
		||||
void cDisplayMenuRootView::DrawDateTime(bool forced) {
 | 
			
		||||
    if (!ExecuteViewElement(veDateTime)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -525,7 +532,7 @@ void cDisplayMenuRootView::DrawDateTime(void) {
 | 
			
		||||
    map < string, string > stringTokens;
 | 
			
		||||
    map < string, int > intTokens;
 | 
			
		||||
    
 | 
			
		||||
    if (!SetDate(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetDate(forced, stringTokens, intTokens)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -533,7 +540,7 @@ void cDisplayMenuRootView::DrawDateTime(void) {
 | 
			
		||||
    DrawViewElement(veDateTime, &stringTokens, &intTokens);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cDisplayMenuRootView::DrawTime(void) {
 | 
			
		||||
bool cDisplayMenuRootView::DrawTime(bool forced) {
 | 
			
		||||
    if (!ExecuteViewElement(veTime)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
@@ -541,7 +548,7 @@ bool cDisplayMenuRootView::DrawTime(void) {
 | 
			
		||||
    map < string, string > stringTokens;
 | 
			
		||||
    map < string, int > intTokens;
 | 
			
		||||
 | 
			
		||||
    if (!SetTime(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetTime(forced, stringTokens, intTokens)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,7 @@ private:
 | 
			
		||||
    eSubView viewType;
 | 
			
		||||
    cTemplateView *subView;
 | 
			
		||||
    bool subViewAvailable;
 | 
			
		||||
    bool subViewInit;
 | 
			
		||||
    string pluginName;
 | 
			
		||||
    int pluginMenu;
 | 
			
		||||
    ePluginMenuType pluginMenuType;
 | 
			
		||||
@@ -40,8 +41,8 @@ private:
 | 
			
		||||
    bool defaultSortmodeDrawn;
 | 
			
		||||
    void DrawBackground(void);
 | 
			
		||||
    void DrawHeader(void);
 | 
			
		||||
    void DrawDateTime(void);
 | 
			
		||||
    bool DrawTime(void);
 | 
			
		||||
    void DrawDateTime(bool forced);
 | 
			
		||||
    bool DrawTime(bool forced);
 | 
			
		||||
    void DrawSortMode(void);
 | 
			
		||||
    void DrawColorButtons(void);
 | 
			
		||||
    void DrawMessage(eMessageType type, const char *text);
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ bool cDisplayMenuView::DrawHeader(void) {
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cDisplayMenuView::DrawDateTime(bool &implemented) {
 | 
			
		||||
bool cDisplayMenuView::DrawDateTime(bool forced, bool &implemented) {
 | 
			
		||||
    if (!ExecuteViewElement(veDateTime)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
@@ -54,7 +54,7 @@ bool cDisplayMenuView::DrawDateTime(bool &implemented) {
 | 
			
		||||
    map < string, string > stringTokens;
 | 
			
		||||
    map < string, int > intTokens;
 | 
			
		||||
    
 | 
			
		||||
    if (!SetDate(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetDate(forced, stringTokens, intTokens)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -63,7 +63,7 @@ bool cDisplayMenuView::DrawDateTime(bool &implemented) {
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cDisplayMenuView::DrawTime(bool &implemented) {
 | 
			
		||||
bool cDisplayMenuView::DrawTime(bool forced, bool &implemented) {
 | 
			
		||||
    if (!ExecuteViewElement(veTime)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
@@ -71,7 +71,7 @@ bool cDisplayMenuView::DrawTime(bool &implemented) {
 | 
			
		||||
    map < string, string > stringTokens;
 | 
			
		||||
    map < string, int > intTokens;
 | 
			
		||||
 | 
			
		||||
    if (!SetTime(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetTime(forced, stringTokens, intTokens)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }    
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,8 +37,8 @@ public:
 | 
			
		||||
    void SetButtonTexts(string *buttonTexts) { this->buttonTexts = buttonTexts; };
 | 
			
		||||
    bool DrawBackground(void);
 | 
			
		||||
    virtual bool DrawHeader(void);
 | 
			
		||||
    bool DrawDateTime(bool &implemented);
 | 
			
		||||
    bool DrawTime(bool &implemented);
 | 
			
		||||
    bool DrawDateTime(bool forced, bool &implemented);
 | 
			
		||||
    bool DrawTime(bool forced, bool &implemented);
 | 
			
		||||
    bool DrawColorButtons(void);
 | 
			
		||||
    bool DrawMessage(eMessageType type, const char *text);
 | 
			
		||||
    void DrawScrollbar(int numMax, int numDisplayed, int offset);
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ void cDisplayReplayView::DrawDate(void) {
 | 
			
		||||
    map < string, string > stringTokens;
 | 
			
		||||
    map < string, int > intTokens;
 | 
			
		||||
    
 | 
			
		||||
    if (!SetDate(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetDate(false, stringTokens, intTokens)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    ClearViewElement(veDateTime);
 | 
			
		||||
@@ -67,7 +67,7 @@ void cDisplayReplayView::DrawTime(void) {
 | 
			
		||||
    map < string, string > stringTokens;
 | 
			
		||||
    map < string, int > intTokens;
 | 
			
		||||
 | 
			
		||||
    if (!SetTime(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetTime(false, stringTokens, intTokens)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }    
 | 
			
		||||
    ClearViewElement(veTime);
 | 
			
		||||
 
 | 
			
		||||
@@ -59,13 +59,15 @@ bool cViewElementWeather::Render(void) {
 | 
			
		||||
/********************************************************************************************************************/
 | 
			
		||||
 | 
			
		||||
cViewElementDate::cViewElementDate(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
 | 
			
		||||
    init = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cViewElementDate::Render(void) {
 | 
			
		||||
    ClearTokens();
 | 
			
		||||
    if (!SetDate(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetDate(init, stringTokens, intTokens)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    init = false;
 | 
			
		||||
    ClearViewElement(veDateTime);
 | 
			
		||||
    DrawViewElement(veDateTime, &stringTokens, &intTokens);
 | 
			
		||||
    return true;
 | 
			
		||||
@@ -74,13 +76,15 @@ bool cViewElementDate::Render(void) {
 | 
			
		||||
/********************************************************************************************************************/
 | 
			
		||||
 | 
			
		||||
cViewElementTime::cViewElementTime(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
 | 
			
		||||
    init = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cViewElementTime::Render(void) {
 | 
			
		||||
    ClearTokens();
 | 
			
		||||
    if (!SetTime(stringTokens, intTokens)) {
 | 
			
		||||
    if (!SetTime(init, stringTokens, intTokens)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }    
 | 
			
		||||
    init = false;
 | 
			
		||||
    ClearViewElement(veTime);
 | 
			
		||||
    DrawViewElement(veTime, &stringTokens, &intTokens);
 | 
			
		||||
    return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@ public:
 | 
			
		||||
 | 
			
		||||
class cViewElementDate : public cViewElement, public cViewHelpers {
 | 
			
		||||
private:
 | 
			
		||||
    bool init;
 | 
			
		||||
public:
 | 
			
		||||
    cViewElementDate(cTemplateViewElement *tmplViewElement);
 | 
			
		||||
    virtual ~cViewElementDate() {};
 | 
			
		||||
@@ -41,6 +42,7 @@ public:
 | 
			
		||||
 | 
			
		||||
class cViewElementTime : public cViewElement, public cViewHelpers {
 | 
			
		||||
private:
 | 
			
		||||
    bool init;
 | 
			
		||||
public:
 | 
			
		||||
    cViewElementTime(cTemplateViewElement *tmplViewElement);
 | 
			
		||||
    virtual ~cViewElementTime() {};
 | 
			
		||||
 
 | 
			
		||||
@@ -465,11 +465,11 @@ void cViewHelpers::SetPosterBanner(const cEvent *event, map < string, string > &
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cViewHelpers::SetTime(map < string, string > &stringTokens, map < string, int > &intTokens) {
 | 
			
		||||
bool cViewHelpers::SetTime(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens) {
 | 
			
		||||
    time_t t = time(0);   // get time now
 | 
			
		||||
    struct tm * now = localtime(&t);
 | 
			
		||||
    int sec = now->tm_sec;
 | 
			
		||||
    if (sec == lastSecond) {
 | 
			
		||||
    if (!forced && sec == lastSecond) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    int min = now->tm_min;
 | 
			
		||||
@@ -485,12 +485,13 @@ bool cViewHelpers::SetTime(map < string, string > &stringTokens, map < string, i
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cViewHelpers::SetDate(map < string, string > &stringTokens, map < string, int > &intTokens) {
 | 
			
		||||
bool cViewHelpers::SetDate(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens) {
 | 
			
		||||
    time_t t = time(0);   // get time now
 | 
			
		||||
    struct tm * now = localtime(&t);
 | 
			
		||||
    int min = now->tm_min;
 | 
			
		||||
    if (min == lastMinute)
 | 
			
		||||
    if (!forced && min == lastMinute) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    lastMinute = min;
 | 
			
		||||
 | 
			
		||||
    intTokens.insert(pair<string, int>("year", now->tm_year + 1900));
 | 
			
		||||
 
 | 
			
		||||
@@ -26,8 +26,8 @@ protected:
 | 
			
		||||
    bool CheckNewMails(void);
 | 
			
		||||
    void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens);
 | 
			
		||||
    void SetPosterBanner(const cEvent *event, map < string, string > &stringTokens, map < string, int > &intTokens);
 | 
			
		||||
    bool SetTime(map < string, string > &stringTokens, map < string, int > &intTokens);
 | 
			
		||||
    bool SetDate(map < string, string > &stringTokens, map < string, int > &intTokens);
 | 
			
		||||
    bool SetTime(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens);
 | 
			
		||||
    bool SetDate(bool forced, map < string, string > &stringTokens, map < string, int > &intTokens);
 | 
			
		||||
    bool SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens);
 | 
			
		||||
    void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers);
 | 
			
		||||
    void SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *lastRecordings);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user