mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
glcd: merge led/lcd/simple clock into a single source file
Origin commit data
------------------
Branch: ni/coolstream
Commit: f20ce17314
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-06-21 (Sun, 21 Jun 2020)
Origin message was:
------------------
- glcd: merge led/lcd/simple clock into a single source file
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -975,6 +975,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
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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;
|
||||
|
@@ -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 <config.h>
|
||||
#endif
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <cstdio>
|
||||
#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);
|
||||
}
|
@@ -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 <glcdgraphics/bitmap.h>
|
||||
#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);
|
@@ -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 <config.h>
|
||||
#endif
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <cstdio>
|
||||
#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);
|
||||
}
|
@@ -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 <glcdgraphics/bitmap.h>
|
||||
#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);
|
@@ -29,8 +29,6 @@
|
||||
#include <cstdio>
|
||||
#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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -1002,6 +1002,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,
|
||||
|
@@ -1002,6 +1002,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",
|
||||
|
Reference in New Issue
Block a user