diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index e07f309cb..bcf073233 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -919,6 +919,7 @@ glcd.standby_digital_clock Digitale Uhr glcd.standby_lcd_clock LCD-Uhr glcd.standby_led_clock LED-Uhr glcd.standby_settings Standby-Einstellungen +glcd.standby_simple_clock Einfache Uhr glcd.standby_weather Wetter im Standby glcd.start_x_position Sendungsstart x-Position glcd.start_y_position Sendungsstart y-Position diff --git a/src/driver/glcd/Makefile.am b/src/driver/glcd/Makefile.am index 2f5307211..c52e477fa 100644 --- a/src/driver/glcd/Makefile.am +++ b/src/driver/glcd/Makefile.am @@ -18,8 +18,6 @@ noinst_LIBRARIES = libneutrino_driver_glcd.a libneutrino_driver_glcd_a_SOURCES = \ analogclock.cpp \ digitalclock.cpp \ - lcdclock.cpp \ - ledclock.cpp \ simpleclock.cpp \ weather.cpp \ glcd.cpp diff --git a/src/driver/glcd/glcd.cpp b/src/driver/glcd/glcd.cpp index 81d50dedd..8e51116fe 100644 --- a/src/driver/glcd/glcd.cpp +++ b/src/driver/glcd/glcd.cpp @@ -41,8 +41,6 @@ #include "glcd.h" #include "analogclock.h" #include "digitalclock.h" -#include "lcdclock.h" -#include "ledclock.h" #include "simpleclock.h" #include "weather.h" @@ -136,8 +134,6 @@ cGLCD::cGLCD() InitAnalogClock(); InitDigitalClock(); - InitLcdClock(); - InitLedClock(); InitSimpleClock(); InitWeather(); @@ -232,28 +228,18 @@ void cGLCD::Exec() if (doStandbyTime) { std::string Time; - if (g_settings.glcd_time_in_standby == 5) + if (g_settings.glcd_time_in_standby == CLOCK_ANALOG) { ShowAnalogClock(tm->tm_hour, tm->tm_min, tm->tm_sec, bitmap->Width()/2, bitmap->Height()/2); } - else if (g_settings.glcd_time_in_standby == 4) + else if (g_settings.glcd_time_in_standby == CLOCK_DIGITAL) { ShowDigitalClock(tm->tm_hour, tm->tm_min); } - else if (g_settings.glcd_time_in_standby == 3) + else if (g_settings.glcd_time_in_standby > CLOCK_OFF) { Time = strftime("%H:%M", tm); - ShowLcdClock(Time); - } - else if (g_settings.glcd_time_in_standby == 2) - { - Time = strftime("%H:%M", tm); - ShowLedClock(Time); - } - else - { - Time = strftime("%H:%M", tm); - ShowSimpleClock(Time); + ShowSimpleClock(Time, g_settings.glcd_time_in_standby); } if (g_settings.glcd_standby_weather == 1 && g_settings.glcd_time_in_standby != 5) { diff --git a/src/driver/glcd/glcd.h b/src/driver/glcd/glcd.h index f80326a15..a2d6e3feb 100644 --- a/src/driver/glcd/glcd.h +++ b/src/driver/glcd/glcd.h @@ -177,6 +177,14 @@ class cGLCD SUB = 7, CAM = 8, }; + enum { + CLOCK_OFF = 0, + CLOCK_SIMPLE = 1, + CLOCK_LED = 2, + CLOCK_LCD = 3, + CLOCK_DIGITAL = 4, + CLOCK_ANALOG = 5 + }; GLCD::cDriver * lcd; GLCD::cFont font_channel; GLCD::cFont font_epg; diff --git a/src/driver/glcd/lcdclock.cpp b/src/driver/glcd/lcdclock.cpp deleted file mode 100644 index 39162775e..000000000 --- a/src/driver/glcd/lcdclock.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - lcd clock - DBoxII-Project - - Copyright (C) 2018 redblue - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "lcdclock.h" - -static bool fonts_initialized = false; - -GLCD::cFont lcd_font_time_standby; - -void InitLcdClock(void) -{ - printf("[%s:%s] finish initialization\n", __file__, __func__); -} - -void LcdClockUpdateFonts(void) -{ - cGLCD *cglcd = cGLCD::getInstance(); - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - int fontsize_time_standby = 0; - int percent_time_standby = std::min(t.glcd_size_simple_clock, 100); - int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; - if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { - fontsize_time_standby = fontsize_time_standby_new; - if (!lcd_font_time_standby.LoadFT2(FONTDIR "/oled/lcd.ttf", "UTF-8", fontsize_time_standby)) { - lcd_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby); - } - } - fonts_initialized = true; -} - -void RenderLcdClock(std::string Time, int x, int y) -{ - (void) x; - cGLCD *cglcd = cGLCD::getInstance(); - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - LcdClockUpdateFonts(); - cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - lcd_font_time_standby.Width(Time))/2), - y, cglcd->bitmap->Width() - 1, Time, - &lcd_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); -} - -void ShowLcdClock(std::string Time) -{ - cGLCD *cglcd = cGLCD::getInstance(); - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - lcd_font_time_standby.Height(Time)) / 2; - RenderLcdClock(Time, 255, y); -} diff --git a/src/driver/glcd/lcdclock.h b/src/driver/glcd/lcdclock.h deleted file mode 100644 index 0965690ec..000000000 --- a/src/driver/glcd/lcdclock.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - LCD-Daemon - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#pragma GCC diagnostic warning "-Wunused-parameter" -#include "glcd.h" - -void InitLcdClock(); -void LcdClockUpdateFonts(); -void RenderLcdClock(std::string Time, int x, int y); -void ShowLcdClock(std::string Time); diff --git a/src/driver/glcd/ledclock.cpp b/src/driver/glcd/ledclock.cpp deleted file mode 100644 index 7d29b3111..000000000 --- a/src/driver/glcd/ledclock.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - led clock - DBoxII-Project - - Copyright (C) 2018 redblue - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "ledclock.h" - -static bool fonts_initialized = false; - -GLCD::cFont led_font_time_standby; - -void InitLedClock(void) -{ - printf("[%s:%s] finish initialization\n", __file__, __func__); -} - -void LedClockUpdateFonts(void) -{ - cGLCD *cglcd = cGLCD::getInstance(); - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - int fontsize_time_standby = 0; - int percent_time_standby = std::min(t.glcd_size_simple_clock, 100); - int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; - if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { - fontsize_time_standby = fontsize_time_standby_new; - if (!led_font_time_standby.LoadFT2(FONTDIR "/oled/led.ttf", "UTF-8", fontsize_time_standby)) { - led_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby); - } - } - fonts_initialized = true; -} - -void RenderLedClock(std::string Time, int x, int y) -{ - (void) x; - cGLCD *cglcd = cGLCD::getInstance(); - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - LedClockUpdateFonts(); - cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - led_font_time_standby.Width(Time))/2), - y, cglcd->bitmap->Width() - 1, Time, - &led_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); -} - -void ShowLedClock(std::string Time) -{ - cGLCD *cglcd = cGLCD::getInstance(); - SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - led_font_time_standby.Height(Time)) / 2; - RenderLedClock(Time, 255, y); -} diff --git a/src/driver/glcd/ledclock.h b/src/driver/glcd/ledclock.h deleted file mode 100644 index 8479fac8d..000000000 --- a/src/driver/glcd/ledclock.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - LCD-Daemon - DBoxII-Project - - Copyright (C) 2001 Steffen Hehn 'McClean' - Homepage: http://dbox.cyberphoria.org/ - - - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include -#pragma GCC diagnostic warning "-Wunused-parameter" -#include "glcd.h" - -void InitLedClock(); -void LedClockUpdateFonts(); -void RenderLedClock(std::string Time, int x, int y); -void ShowLedClock(std::string Time); diff --git a/src/driver/glcd/simpleclock.cpp b/src/driver/glcd/simpleclock.cpp index d29497b0b..5318f84d8 100644 --- a/src/driver/glcd/simpleclock.cpp +++ b/src/driver/glcd/simpleclock.cpp @@ -29,8 +29,6 @@ #include #include "simpleclock.h" -static bool fonts_initialized = false; - GLCD::cFont font_time_standby; void InitSimpleClock(void) @@ -38,37 +36,53 @@ void InitSimpleClock(void) printf("[%s:%s] finish initialization\n", __file__, __func__); } -void SimpleClockUpdateFonts(void) +void SimpleClockUpdateFonts(int mode) { cGLCD *cglcd = cGLCD::getInstance(); SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + + std::string font = t.glcd_font; + + switch (mode) + { + case cGLCD::CLOCK_LCD: + font = FONTDIR "/oled/lcd.ttf"; + break; + case cGLCD::CLOCK_LED: + font = FONTDIR "/oled/led.ttf"; + break; + case cGLCD::CLOCK_SIMPLE: + default: + font = t.glcd_font + ; + } + int fontsize_time_standby = 0; int percent_time_standby = std::min(t.glcd_size_simple_clock, 100); int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; - if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { + if (fontsize_time_standby_new != fontsize_time_standby) { fontsize_time_standby = fontsize_time_standby_new; - if (!font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby)) { - t.glcd_font = FONTDIR "/neutrino.ttf"; - font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby); + if (!font_time_standby.LoadFT2(font, "UTF-8", fontsize_time_standby)) { + font_time_standby.LoadFT2(g_settings.font_file, "UTF-8", fontsize_time_standby); } } - fonts_initialized = true; } -void RenderSimpleClock(std::string Time, int x, int y) +void RenderSimpleClock(std::string Time, int x, int y, int mode) { + (void) x; cGLCD *cglcd = cGLCD::getInstance(); SNeutrinoGlcdTheme &t = g_settings.glcd_theme; - SimpleClockUpdateFonts(); + SimpleClockUpdateFonts(mode); cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - font_time_standby.Width(Time))/2), y, cglcd->bitmap->Width() - 1, Time, &font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); } -void ShowSimpleClock(std::string Time) +void ShowSimpleClock(std::string Time, int mode) { cGLCD *cglcd = cGLCD::getInstance(); SNeutrinoGlcdTheme &t = g_settings.glcd_theme; int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - font_time_standby.Height(Time)) / 2; - RenderSimpleClock(Time, 255, y); + RenderSimpleClock(Time, 255, y, mode); } diff --git a/src/driver/glcd/simpleclock.h b/src/driver/glcd/simpleclock.h index 0767d5cf0..eeaa9aae7 100644 --- a/src/driver/glcd/simpleclock.h +++ b/src/driver/glcd/simpleclock.h @@ -29,6 +29,6 @@ #include "glcd.h" void InitSimpleClock(); -void SimpleClockUpdateFonts(); -void RenderSimpleClock(std::string Time, int x, int y); -void ShowSimpleClock(std::string Time); +void SimpleClockUpdateFonts(int mode); +void RenderSimpleClock(std::string Time, int x, int y, int mode); +void ShowSimpleClock(std::string Time, int mode = cGLCD::CLOCK_SIMPLE); diff --git a/src/gui/glcdsetup.cpp b/src/gui/glcdsetup.cpp index ffcd569ca..15d5ebb5c 100644 --- a/src/gui/glcdsetup.cpp +++ b/src/gui/glcdsetup.cpp @@ -41,12 +41,12 @@ #define ONOFFSEC_OPTION_COUNT 6 static const CMenuOptionChooser::keyval ONOFFSEC_OPTIONS[ONOFFSEC_OPTION_COUNT] = { - { 0, LOCALE_OPTIONS_OFF }, - { 1, LOCALE_OPTIONS_ON }, - { 2, LOCALE_GLCD_STANDBY_LED_CLOCK }, - { 3, LOCALE_GLCD_STANDBY_LCD_CLOCK }, - { 4, LOCALE_GLCD_STANDBY_DIGITAL_CLOCK }, - { 5, LOCALE_GLCD_STANDBY_ANALOG_CLOCK } + { cGLCD::CLOCK_OFF, LOCALE_OPTIONS_OFF }, + { cGLCD::CLOCK_SIMPLE, LOCALE_GLCD_STANDBY_SIMPLE_CLOCK }, + { cGLCD::CLOCK_LED, LOCALE_GLCD_STANDBY_LED_CLOCK }, + { cGLCD::CLOCK_LCD, LOCALE_GLCD_STANDBY_LCD_CLOCK }, + { cGLCD::CLOCK_DIGITAL, LOCALE_GLCD_STANDBY_DIGITAL_CLOCK }, + { cGLCD::CLOCK_ANALOG, LOCALE_GLCD_STANDBY_ANALOG_CLOCK } }; #define ONOFFPRI_OPTION_COUNT 4 diff --git a/src/system/locals.h b/src/system/locals.h index 822fd1ca2..52e514a2b 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -946,6 +946,7 @@ typedef enum LOCALE_GLCD_STANDBY_LCD_CLOCK, LOCALE_GLCD_STANDBY_LED_CLOCK, LOCALE_GLCD_STANDBY_SETTINGS, + LOCALE_GLCD_STANDBY_SIMPLE_CLOCK, LOCALE_GLCD_STANDBY_WEATHER, LOCALE_GLCD_START_X_POSITION, LOCALE_GLCD_START_Y_POSITION, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 927b1d944..ed74e2d90 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -946,6 +946,7 @@ const char * locale_real_names[] = "glcd.standby_lcd_clock", "glcd.standby_led_clock", "glcd.standby_settings", + "glcd.standby_simple_clock", "glcd.standby_weather", "glcd.start_x_position", "glcd.start_y_position",