mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
added weather viewelement to metrix main menu
This commit is contained in:
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user