diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index b7e6e676a..0ed13211a 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1000,8 +1000,10 @@ glcd.standby_clock_led LED-Uhr glcd.standby_clock_simple Einfache Uhr glcd.standby_settings Standby-Einstellungen glcd.standby_weather Wetter im Standby -glcd.standby_weather_curr_x_position Wetter im Standby heute x-Position -glcd.standby_weather_next_x_position Wetter im Standby morgen x-Position +glcd.standby_weather_curr_icon_x_position Wetter-Icon heute x-Position +glcd.standby_weather_curr_temp_x_position Temperatur heute x-Position +glcd.standby_weather_next_icon_x_position Wetter-Icon morgen x-Position +glcd.standby_weather_next_temp_x_position Temperatur morgen x-Position glcd.standby_weather_percent Wetter Höhe glcd.standby_weather_y_position Wetter im Standby y-Position glcd.start_align Sendungsstart ausrichten @@ -1018,8 +1020,10 @@ glcd.time_size_standby Uhrzeit Höhe im Standby glcd.time_x_position Uhrzeit x-Position glcd.time_y_position Uhrzeit y-Position glcd.volume Lautstärke -glcd.weather_curr_x_position Wetter heute x-Position -glcd.weather_next_x_position Wetter morgen x-Position +glcd.weather_curr_icon_x_position Wetter-Icon heute x-Position +glcd.weather_curr_temp_x_position Temperatur heute x-Position +glcd.weather_next_icon_x_position Wetter-Icon morgen x-Position +glcd.weather_next_temp_x_position Temperatur morgen x-Position glcd.weather_percent Wetter Höhe glcd.weather_show Wetter anzeigen glcd.weather_y_position Wetter y-Position diff --git a/data/locale/english.locale b/data/locale/english.locale index cc5a0b2ac..263f1d60a 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1000,8 +1000,10 @@ glcd.standby_clock_led LED-clock glcd.standby_clock_simple Simple clock glcd.standby_settings Standby-settings glcd.standby_weather Weather in standby mode -glcd.standby_weather_curr_x_position Weather in standby mode current x-position -glcd.standby_weather_next_x_position Weather in standby mode next x-position +glcd.standby_weather_curr_icon_x_position Weather icon current x-position +glcd.standby_weather_curr_temp_x_position Temperature current x-position +glcd.standby_weather_next_icon_x_position Weather icon next x-position +glcd.standby_weather_next_temp_x_position Temperature next x-position glcd.standby_weather_percent Weather height glcd.standby_weather_y_position Weather in standby mode y-position glcd.start_align Event start arrangement @@ -1018,8 +1020,10 @@ glcd.time_size_standby Standby time height glcd.time_x_position Time x-position glcd.time_y_position Time y-position glcd.volume Volume -glcd.weather_curr_x_position Weather current x-position -glcd.weather_next_x_position Weather next x-position +glcd.weather_curr_icon_x_position Weather icon current x-position +glcd.weather_curr_temp_x_position Temperature current x-position +glcd.weather_next_icon_x_position Weather icon next x-position +glcd.weather_next_temp_x_position Temperature next x-position glcd.weather_percent Weather height glcd.weather_show Weather display glcd.weather_y_position Weather y-position diff --git a/src/driver/glcd/weather.cpp b/src/driver/glcd/weather.cpp index 16852eecd..0dc9b8e58 100644 --- a/src/driver/glcd/weather.cpp +++ b/src/driver/glcd/weather.cpp @@ -79,8 +79,29 @@ void WeatherUpdateFonts() fonts_initialized = true; } -void RenderWeather(int cx, int cy, int nx, int ny, bool standby) +void RenderWeather(bool standby) { + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + + int ctx, cix, ntx, nix, y; + + if (!standby) + { + ctx = t.glcd_weather_curr_temp_x_position; + cix = t.glcd_weather_curr_icon_x_position; + ntx = t.glcd_weather_next_temp_x_position; + nix = t.glcd_weather_next_icon_x_position; + y = t.glcd_weather_y_position; + } + else + { + ctx = t.glcd_standby_weather_curr_temp_x_position; + cix = t.glcd_standby_weather_curr_icon_x_position; + ntx = t.glcd_standby_weather_next_temp_x_position; + nix = t.glcd_standby_weather_next_icon_x_position; + y = t.glcd_standby_weather_y_position; + } + int forecast = 0; // 0 is current day std::string current_wcity = ""; @@ -96,7 +117,7 @@ void RenderWeather(int cx, int cy, int nx, int ny, bool standby) std::string next_wicon = ""; cGLCD *cglcd = cGLCD::getInstance(); - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + if (g_settings.weather_enabled) { if (CWeather::getInstance()->checkUpdate(ForceUpdate)) @@ -130,50 +151,63 @@ void RenderWeather(int cx, int cy, int nx, int ny, bool standby) next_wicon = st_next_wicon; } - if (current_wicon != "") { + if ((current_wicon != "") && cix) + { if (!standby) - cglcd->imageShow(current_wicon, cx, cy, weather_fontsize, weather_fontsize, false, false, false, false, false); + cglcd->imageShow(current_wicon, cix, y, weather_fontsize, weather_fontsize, false, false, false, false, false); else - cglcd->imageShow(current_wicon, cx, cy, standby_weather_fontsize, standby_weather_fontsize, false, false, false, false, false); + cglcd->imageShow(current_wicon, cix, y, standby_weather_fontsize, standby_weather_fontsize, false, false, false, false, false); } - if (current_wtemp != "") { + if ((current_wtemp != "") && ctx) + { //current_wtemp += "°"; + int current_width; WeatherUpdateFonts(); if (!standby) - cglcd->bitmap->DrawText(cx + 5 + weather_fontsize, cy + ((weather_fontsize - font_temperature.TotalHeight()) / 2 ), cglcd->bitmap->Width() - 1, current_wtemp, + { + current_width = font_temperature.Width(current_wtemp); + cglcd->bitmap->DrawText(ctx, y, cglcd->bitmap->Width() - 1, current_wtemp, &font_temperature, cglcd->ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent); + } else - cglcd->bitmap->DrawText(cx + 5 + standby_weather_fontsize, cy + ((standby_weather_fontsize - font_temperature_standby.TotalHeight()) / 2 ), cglcd->bitmap->Width() - 1, current_wtemp, + { + current_width = font_temperature_standby.Width(current_wtemp); + cglcd->bitmap->DrawText(ctx, y, cglcd->bitmap->Width() - 1, current_wtemp, &font_temperature_standby, cglcd->ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent); + } } - if (next_wicon != "") { + + if ((next_wicon != "") && nix) + { if (!standby) - cglcd->imageShow(next_wicon, nx, ny, weather_fontsize, weather_fontsize, false, false, false, false, false); + cglcd->imageShow(next_wicon, nix, y, weather_fontsize, weather_fontsize, false, false, false, false, false); else - cglcd->imageShow(next_wicon, nx, ny, standby_weather_fontsize, standby_weather_fontsize, false, false, false, false, false); + cglcd->imageShow(next_wicon, nix, y, standby_weather_fontsize, standby_weather_fontsize, false, false, false, false, false); } - if (next_wtemp != "") { + if ((next_wtemp != "") && ntx) + { //next_wtemp += "°"; + int next_width; WeatherUpdateFonts(); if (!standby) - cglcd->bitmap->DrawText(nx + 5 + weather_fontsize, ny + ((weather_fontsize - font_temperature.TotalHeight()) / 2 ), cglcd->bitmap->Width() - 1, next_wtemp, + { + next_width = font_temperature.Width(next_wtemp); + cglcd->bitmap->DrawText(ntx, y, cglcd->bitmap->Width() - 1, next_wtemp, &font_temperature, cglcd->ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent); + } else - cglcd->bitmap->DrawText(nx + 5 + standby_weather_fontsize, ny + ((standby_weather_fontsize - font_temperature_standby.TotalHeight()) / 2 ), cglcd->bitmap->Width() - 1, next_wtemp, + { + next_width = font_temperature_standby.Width(next_wtemp); + cglcd->bitmap->DrawText(ntx, y, cglcd->bitmap->Width() - 1, next_wtemp, &font_temperature_standby, cglcd->ColorConvert3to1(t.glcd_foreground_color_red, t.glcd_foreground_color_green, t.glcd_foreground_color_blue), GLCD::cColor::Transparent); + } } } } void ShowWeather(bool standby) { - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - - if (!standby) { - RenderWeather(t.glcd_weather_curr_x_position, t.glcd_weather_y_position, t.glcd_weather_next_x_position, t.glcd_weather_y_position, standby); - } else { - RenderWeather(t.glcd_standby_weather_curr_x_position, t.glcd_standby_weather_y_position, t.glcd_standby_weather_next_x_position, t.glcd_standby_weather_y_position, standby); - } + RenderWeather(standby); if (ForceUpdate) ForceUpdate = false; diff --git a/src/driver/glcd/weather.h b/src/driver/glcd/weather.h index 94e26bf6f..fe968d6e5 100644 --- a/src/driver/glcd/weather.h +++ b/src/driver/glcd/weather.h @@ -29,5 +29,5 @@ #include "glcd.h" void WeatherUpdateFonts(); -void RenderWeather(int cx, int cy, int nx, int ny, bool standby); +void RenderWeather(bool standby); void ShowWeather(bool standby); diff --git a/src/gui/glcdsetup.cpp b/src/gui/glcdsetup.cpp index cf13ef3d7..92b05e843 100644 --- a/src/gui/glcdsetup.cpp +++ b/src/gui/glcdsetup.cpp @@ -371,11 +371,19 @@ int GLCD_Menu::GLCD_Standby_Settings() gss->addItem(nc); WeatherSBActivate.Add(nc); - nc = new CMenuOptionNumberChooser(LOCALE_GLCD_STANDBY_WEATHER_CURR_X_POSITION, &t.glcd_standby_weather_curr_x_position, t.glcd_standby_weather, 0, oled_width, this); + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_STANDBY_WEATHER_CURR_TEMP_X_POSITION, &t.glcd_standby_weather_curr_temp_x_position, t.glcd_standby_weather, 0, oled_width, this); gss->addItem(nc); WeatherSBActivate.Add(nc); - nc = new CMenuOptionNumberChooser(LOCALE_GLCD_STANDBY_WEATHER_NEXT_X_POSITION, &t.glcd_standby_weather_next_x_position, t.glcd_standby_weather, 0, oled_width, this); + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_STANDBY_WEATHER_CURR_ICON_X_POSITION, &t.glcd_standby_weather_curr_icon_x_position, t.glcd_standby_weather, 0, oled_width, this); + gss->addItem(nc); + WeatherSBActivate.Add(nc); + + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_STANDBY_WEATHER_NEXT_TEMP_X_POSITION, &t.glcd_standby_weather_next_temp_x_position, t.glcd_standby_weather, 0, oled_width, this); + gss->addItem(nc); + WeatherSBActivate.Add(nc); + + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_STANDBY_WEATHER_NEXT_ICON_X_POSITION, &t.glcd_standby_weather_next_icon_x_position, t.glcd_standby_weather, 0, oled_width, this); gss->addItem(nc); WeatherSBActivate.Add(nc); @@ -652,11 +660,19 @@ int GLCD_Menu::GLCD_Theme_Settings() gts->addItem(nc); WeatherActivate.Add(nc); - nc = new CMenuOptionNumberChooser(LOCALE_GLCD_WEATHER_CURR_X_POSITION, &t.glcd_weather_curr_x_position, t.glcd_weather, 0, oled_width, this); + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_WEATHER_CURR_TEMP_X_POSITION, &t.glcd_weather_curr_temp_x_position, t.glcd_weather, 0, oled_width, this); gts->addItem(nc); WeatherActivate.Add(nc); - nc = new CMenuOptionNumberChooser(LOCALE_GLCD_WEATHER_NEXT_X_POSITION, &t.glcd_weather_next_x_position, t.glcd_weather, 0, oled_width, this); + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_WEATHER_CURR_ICON_X_POSITION, &t.glcd_weather_curr_icon_x_position, t.glcd_weather, 0, oled_width, this); + gts->addItem(nc); + WeatherActivate.Add(nc); + + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_WEATHER_NEXT_TEMP_X_POSITION, &t.glcd_weather_next_temp_x_position, t.glcd_weather, 0, oled_width, this); + gts->addItem(nc); + WeatherActivate.Add(nc); + + nc = new CMenuOptionNumberChooser(LOCALE_GLCD_WEATHER_NEXT_ICON_X_POSITION, &t.glcd_weather_next_icon_x_position, t.glcd_weather, 0, oled_width, this); gts->addItem(nc); WeatherActivate.Add(nc); diff --git a/src/gui/glcdthemes.cpp b/src/gui/glcdthemes.cpp index c7926a28e..259597108 100644 --- a/src/gui/glcdthemes.cpp +++ b/src/gui/glcdthemes.cpp @@ -349,13 +349,17 @@ void CGLCDThemes::setTheme(CConfigFile &configfile) configfile.setInt32("glcd_standby_clock_simple_y_position", t.glcd_standby_clock_simple_y_position); configfile.setBool("glcd_weather", t.glcd_weather); configfile.setInt32("glcd_weather_percent", t.glcd_weather_percent); - configfile.setInt32("glcd_weather_curr_x_position", t.glcd_weather_curr_x_position); - configfile.setInt32("glcd_weather_next_x_position", t.glcd_weather_next_x_position); + configfile.setInt32("glcd_weather_curr_temp_x_position", t.glcd_weather_curr_temp_x_position); + configfile.setInt32("glcd_weather_curr_icon_x_position", t.glcd_weather_curr_icon_x_position); + configfile.setInt32("glcd_weather_next_temp_x_position", t.glcd_weather_next_temp_x_position); + configfile.setInt32("glcd_weather_next_icon_x_position", t.glcd_weather_next_icon_x_position); configfile.setInt32("glcd_weather_y_position", t.glcd_weather_y_position); configfile.setInt32("glcd_standby_weather", t.glcd_standby_weather); configfile.setInt32("glcd_standby_weather_percent", t.glcd_standby_weather_percent); - configfile.setInt32("glcd_standby_weather_curr_x_position", t.glcd_standby_weather_curr_x_position); - configfile.setInt32("glcd_standby_weather_next_x_position", t.glcd_standby_weather_next_x_position); + configfile.setInt32("glcd_standby_weather_curr_temp_x_position", t.glcd_standby_weather_curr_temp_x_position); + configfile.setInt32("glcd_standby_weather_curr_icon_x_position", t.glcd_standby_weather_curr_icon_x_position); + configfile.setInt32("glcd_standby_weather_next_temp_x_position", t.glcd_standby_weather_next_temp_x_position); + configfile.setInt32("glcd_standby_weather_next_icon_x_position", t.glcd_standby_weather_next_icon_x_position); configfile.setInt32("glcd_standby_weather_y_position", t.glcd_standby_weather_y_position); configfile.setInt32("glcd_position_settings", t.glcd_position_settings); } @@ -427,13 +431,17 @@ void CGLCDThemes::getTheme(CConfigFile &configfile) t.glcd_standby_clock_simple_y_position = configfile.getInt32("glcd_standby_clock_simple_y_position", 0); t.glcd_weather = configfile.getBool("glcd_weather", false); t.glcd_weather_percent = configfile.getInt32("glcd_weather_percent", 15); - t.glcd_weather_curr_x_position = configfile.getInt32("glcd_weather_curr_x_position", 0); - t.glcd_weather_next_x_position = configfile.getInt32("glcd_weather_next_x_position", 0); + t.glcd_weather_curr_temp_x_position = configfile.getInt32("glcd_weather_curr_temp_x_position", 0); + t.glcd_weather_curr_icon_x_position = configfile.getInt32("glcd_weather_curr_icon_x_position", 0); + t.glcd_weather_next_temp_x_position = configfile.getInt32("glcd_weather_next_temp_x_position", 0); + t.glcd_weather_next_icon_x_position = configfile.getInt32("glcd_weather_next_icon_x_position", 0); t.glcd_weather_y_position = configfile.getInt32("glcd_weather_y_position", 0); t.glcd_standby_weather = configfile.getInt32("glcd_standby_weather", 1); t.glcd_standby_weather_percent = configfile.getInt32("glcd_standby_weather_percent", 40); - t.glcd_standby_weather_curr_x_position = configfile.getInt32("glcd_standby_weather_curr_x_position", 0); - t.glcd_standby_weather_next_x_position = configfile.getInt32("glcd_standby_weather_next_x_position", 0); + t.glcd_standby_weather_curr_temp_x_position = configfile.getInt32("glcd_standby_weather_curr_temp_x_position", 0); + t.glcd_standby_weather_curr_icon_x_position = configfile.getInt32("glcd_standby_weather_curr_icon_x_position", 0); + t.glcd_standby_weather_next_temp_x_position = configfile.getInt32("glcd_standby_weather_next_temp_x_position", 0); + t.glcd_standby_weather_next_icon_x_position = configfile.getInt32("glcd_standby_weather_next_icon_x_position", 0); t.glcd_standby_weather_y_position = configfile.getInt32("glcd_standby_weather_y_position", 0); t.glcd_position_settings = configfile.getInt32("glcd_position_settings", 1); diff --git a/src/system/locals.h b/src/system/locals.h index 385bf3c33..0f5d8db96 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1027,8 +1027,10 @@ typedef enum LOCALE_GLCD_STANDBY_CLOCK_SIMPLE, LOCALE_GLCD_STANDBY_SETTINGS, LOCALE_GLCD_STANDBY_WEATHER, - LOCALE_GLCD_STANDBY_WEATHER_CURR_X_POSITION, - LOCALE_GLCD_STANDBY_WEATHER_NEXT_X_POSITION, + LOCALE_GLCD_STANDBY_WEATHER_CURR_ICON_X_POSITION, + LOCALE_GLCD_STANDBY_WEATHER_CURR_TEMP_X_POSITION, + LOCALE_GLCD_STANDBY_WEATHER_NEXT_ICON_X_POSITION, + LOCALE_GLCD_STANDBY_WEATHER_NEXT_TEMP_X_POSITION, LOCALE_GLCD_STANDBY_WEATHER_PERCENT, LOCALE_GLCD_STANDBY_WEATHER_Y_POSITION, LOCALE_GLCD_START_ALIGN, @@ -1045,8 +1047,10 @@ typedef enum LOCALE_GLCD_TIME_X_POSITION, LOCALE_GLCD_TIME_Y_POSITION, LOCALE_GLCD_VOLUME, - LOCALE_GLCD_WEATHER_CURR_X_POSITION, - LOCALE_GLCD_WEATHER_NEXT_X_POSITION, + LOCALE_GLCD_WEATHER_CURR_ICON_X_POSITION, + LOCALE_GLCD_WEATHER_CURR_TEMP_X_POSITION, + LOCALE_GLCD_WEATHER_NEXT_ICON_X_POSITION, + LOCALE_GLCD_WEATHER_NEXT_TEMP_X_POSITION, LOCALE_GLCD_WEATHER_PERCENT, LOCALE_GLCD_WEATHER_SHOW, LOCALE_GLCD_WEATHER_Y_POSITION, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index fbf2d25b5..d42f7d022 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1027,8 +1027,10 @@ const char * locale_real_names[] = "glcd.standby_clock_simple", "glcd.standby_settings", "glcd.standby_weather", - "glcd.standby_weather_curr_x_position", - "glcd.standby_weather_next_x_position", + "glcd.standby_weather_curr_icon_x_position", + "glcd.standby_weather_curr_temp_x_position", + "glcd.standby_weather_next_icon_x_position", + "glcd.standby_weather_next_temp_x_position", "glcd.standby_weather_percent", "glcd.standby_weather_y_position", "glcd.start_align", @@ -1045,8 +1047,10 @@ const char * locale_real_names[] = "glcd.time_x_position", "glcd.time_y_position", "glcd.volume", - "glcd.weather_curr_x_position", - "glcd.weather_next_x_position", + "glcd.weather_curr_icon_x_position", + "glcd.weather_curr_temp_x_position", + "glcd.weather_next_icon_x_position", + "glcd.weather_next_temp_x_position", "glcd.weather_percent", "glcd.weather_show", "glcd.weather_y_position", diff --git a/src/system/settings.h b/src/system/settings.h index ac6d8cbd6..fe5ebf19a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -290,14 +290,18 @@ struct SNeutrinoGlcdTheme int glcd_weather; int glcd_weather_percent; - int glcd_weather_curr_x_position; - int glcd_weather_next_x_position; + int glcd_weather_curr_temp_x_position; + int glcd_weather_curr_icon_x_position; + int glcd_weather_next_temp_x_position; + int glcd_weather_next_icon_x_position; int glcd_weather_y_position; int glcd_standby_weather; int glcd_standby_weather_percent; - int glcd_standby_weather_curr_x_position; - int glcd_standby_weather_next_x_position; + int glcd_standby_weather_curr_temp_x_position; + int glcd_standby_weather_curr_icon_x_position; + int glcd_standby_weather_next_temp_x_position; + int glcd_standby_weather_next_icon_x_position; int glcd_standby_weather_y_position; int glcd_position_settings;