diff options
| author | louis <louis.braun@gmx.de> | 2015-01-14 14:20:22 +0100 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2015-01-14 14:20:22 +0100 |
| commit | 3de7f8f13d2cef164b52a8dc1f5b09b3d4e12278 (patch) | |
| tree | 9618d7f34091562f332a49e9396d24d1e21874fa /views | |
| parent | 645f625d79f8181e043fffc5bcbf4ad2a86f036a (diff) | |
| download | vdr-plugin-skindesigner-3de7f8f13d2cef164b52a8dc1f5b09b3d4e12278.tar.gz vdr-plugin-skindesigner-3de7f8f13d2cef164b52a8dc1f5b09b3d4e12278.tar.bz2 | |
added weather viewelement to metrix main menu
Diffstat (limited to 'views')
| -rw-r--r-- | views/displaychannelview.c | 5 | ||||
| -rw-r--r-- | views/displaymenuview.c | 16 | ||||
| -rw-r--r-- | views/displaymenuview.h | 1 | ||||
| -rw-r--r-- | views/viewhelpers.c | 7 | ||||
| -rw-r--r-- | views/viewhelpers.h | 2 |
5 files changed, 26 insertions, 5 deletions
diff --git a/views/displaychannelview.c b/views/displaychannelview.c index 6526530..83e7ef3 100644 --- a/views/displaychannelview.c +++ b/views/displaychannelview.c @@ -545,7 +545,10 @@ void cDisplayChannelView::DrawCurrentWeather(void) { } map < string, string > stringTokens; map < string, int > intTokens; - SetCurrentWeatherTokens(stringTokens, intTokens); + if (!SetCurrentWeatherTokens(stringTokens, intTokens)){ + ClearViewElement(veCurrentWeather); + return; + } ClearViewElement(veCurrentWeather); DrawViewElement(veCurrentWeather, &stringTokens, &intTokens); diff --git a/views/displaymenuview.c b/views/displaymenuview.c index 1f6c69f..0b9c5a8 100644 --- a/views/displaymenuview.c +++ b/views/displaymenuview.c @@ -237,6 +237,7 @@ void cDisplayMenuMainView::DrawStaticViewElements(void) { DrawDiscUsage(); DrawTemperatures(); DrawCurrentSchedule(); + DrawCurrentWeather(); DrawCustomTokens(); } @@ -581,6 +582,21 @@ void cDisplayMenuMainView::DrawCurrentSchedule(void) { DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens); } +void cDisplayMenuMainView::DrawCurrentWeather(void) { + if (!ViewElementImplemented(veCurrentWeather)) { + return; + } + map < string, string > stringTokens; + map < string, int > intTokens; + if (!SetCurrentWeatherTokens(stringTokens, intTokens)){ + ClearViewElement(veCurrentWeather); + return; + } + + ClearViewElement(veCurrentWeather); + DrawViewElement(veCurrentWeather, &stringTokens, &intTokens); +} + void cDisplayMenuMainView::DrawCustomTokens(void) { if (!ViewElementImplemented(veCustomTokens)) { return; diff --git a/views/displaymenuview.h b/views/displaymenuview.h index 8463301..c7aa7eb 100644 --- a/views/displaymenuview.h +++ b/views/displaymenuview.h @@ -44,6 +44,7 @@ private: void DrawTemperatures(void); bool DrawDevices(void); void DrawCurrentSchedule(void); + void DrawCurrentWeather(void); void DrawCustomTokens(void); public: cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit); diff --git a/views/viewhelpers.c b/views/viewhelpers.c index 8fdffaf..e10798f 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -427,13 +427,13 @@ bool cViewHelpers::SetDate(map < string, string > &stringTokens, map < string, i return true; } -void cViewHelpers::SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens) { +bool cViewHelpers::SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens) { static cPlugin *pWeatherForecast = cPluginManager::GetPlugin("weatherforecast"); if (!pWeatherForecast) - return; + return false; cServiceCurrentWeather currentWeather; if (!pWeatherForecast->Service("GetCurrentWeather", ¤tWeather)) { - return; + return false; } stringTokens.insert(pair<string,string>("timestamp", currentWeather.timeStamp)); stringTokens.insert(pair<string,string>("temperature", currentWeather.temperature)); @@ -453,4 +453,5 @@ void cViewHelpers::SetCurrentWeatherTokens(map < string, string > &stringTokens, intTokens.insert(pair<string,int>("cloudcover", currentWeather.cloudCover)); stringTokens.insert(pair<string,string>("pressure", currentWeather.pressure)); stringTokens.insert(pair<string,string>("ozone", currentWeather.ozone)); + return true; } diff --git a/views/viewhelpers.h b/views/viewhelpers.h index 82dd7c9..8e49554 100644 --- a/views/viewhelpers.h +++ b/views/viewhelpers.h @@ -16,7 +16,7 @@ protected: void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens); bool SetTime(map < string, string > &stringTokens, map < string, int > &intTokens); bool SetDate(map < string, string > &stringTokens, map < string, int > &intTokens); - void SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens); + bool SetCurrentWeatherTokens(map < string, string > &stringTokens, map < string, int > &intTokens); public: cViewHelpers(void); virtual ~cViewHelpers(void); |
