lcd4l-setup: move type setup into own submenu to get different options for different types

Origin commit data
------------------
Commit: fe85a1fa27
Author: vanhofen <vanhofen@gmx.de>
Date: 2019-01-05 (Sat, 05 Jan 2019)

Origin message was:
------------------
- lcd4l-setup: move type setup into own submenu to get different options for different types
This commit is contained in:
vanhofen
2019-01-05 01:13:46 +01:00
parent aee9beb0a4
commit ffadd85818
6 changed files with 105 additions and 33 deletions

View File

@@ -1038,6 +1038,7 @@ lcd4l_brightness_standby Helligkeit im Standby-Modus
lcd4l_clock_a Analog-Uhr im Standby-Modus
lcd4l_convert Konvertiere Umlaute
lcd4l_display_type Display-Typ
lcd4l_display_type_setup Display-Typ einstellen
lcd4l_logodir Senderlogo-Verzeichnis
lcd4l_skin Display-Style
lcd4l_skin_0 Standard
@@ -1388,9 +1389,10 @@ menu.hint_lcd4l_brightness Regelt die Helligkeit des externen Displays im Normal
menu.hint_lcd4l_brightness_standby Regelt die Helligkeit des externen Displays im Standby-Modus
menu.hint_lcd4l_clock_a Zeigt im Standby-Betrieb eine Analog-Uhr anstatt einer Digital-Uhr
menu.hint_lcd4l_convert Konvertiert Umlaute für die eingebaute LCD4Linux-Schriftart
menu.hint_lcd4l_display_type Wählen Sie den Typ den externen Displays
menu.hint_lcd4l_display_type Wählen Sie den Typ des externen Displays
menu.hint_lcd4l_display_type_setup Einstellungen für den Typ des externen Displays
menu.hint_lcd4l_logodir Verzeichnis für eigene Senderlogos. Bei ungültigem Eintrag werden die Standard-Logos benutzt.
menu.hint_lcd4l_skin Auswahl der verfügbaren Darstellungsarten\nStandard, Groß, SysInfo, d-box2, Benutzerdefiniert
menu.hint_lcd4l_skin Auswahl der verfügbaren Darstellungsarten\nStandard, Benutzerdefiniert, etc.
menu.hint_lcd4l_skin_radio Wechselt die Darstellungsart, wenn der Radio-Modus aktiviert wird
menu.hint_lcd4l_support LCD4Linux aktivieren/deaktivieren\nUnterstützte Displays: Pearl DPF, Samsung SPF
menu.hint_lcd4l_weather Zeigt im Standby-Betrieb die entsprechenden Daten des ersten Favoriteneintrags von tuxwetter auf dem Display an

View File

@@ -1037,7 +1037,8 @@ lcd4l_brightness Brightness
lcd4l_brightness_standby Brightness in standby
lcd4l_clock_a Analog clock in standby mode
lcd4l_convert Convert umlauts
lcd4l_display_type Display Type
lcd4l_display_type Display type
lcd4l_display_type_setup Display type setup
lcd4l_logodir Channellogo directory
lcd4l_skin Display style
lcd4l_skin_0 Standard
@@ -1389,9 +1390,10 @@ menu.hint_lcd4l_brightness_standby Adjusts the brightness of external display in
menu.hint_lcd4l_clock_a Shows an analog clock instead of a digital clock on display at standby
menu.hint_lcd4l_convert Convert umlauts for the built-in LCD4Linux font
menu.hint_lcd4l_display_type Choose type of external display
menu.hint_lcd4l_display_type_setup Settings for the type of external display
menu.hint_lcd4l_logodir Directory for own channel logos. Fallback to default logos when entry is invalid.
menu.hint_lcd4l_skin Switch between modes\nDefault, Big, SysInfo, d-box2, User Defined
menu.hint_lcd4l_skin_radio Switch the mode, when Radio-Mode is activated
menu.hint_lcd4l_skin Switch between styles\nDefault, User defined, etc.
menu.hint_lcd4l_skin_radio Switch style when Radio-Mode is activated
menu.hint_lcd4l_support Activate/deactivate LCD4Linux\nSupported displays: Pearl DPF, Samsung SPF
menu.hint_lcd4l_weather Shows first tuxwetter favorite on display at standby
menu.hint_leds_blink Blinking LEDs in deep-standby

View File

@@ -72,7 +72,7 @@ const CMenuOptionChooser::keyval_ext LCD4L_DISPLAY_TYPE_OPTIONS[] =
};
#define LCD4L_DISPLAY_TYPE_OPTION_COUNT (sizeof(LCD4L_DISPLAY_TYPE_OPTIONS)/sizeof(CMenuOptionChooser::keyval_ext))
const CMenuOptionChooser::keyval LCD4L_SKIN_OPTIONS[] =
const CMenuOptionChooser::keyval LCD4L_PEARL_SKIN_OPTIONS[] =
{
{ 0, LOCALE_LCD4L_SKIN_0 },
{ 1, LOCALE_LCD4L_SKIN_1 },
@@ -80,11 +80,20 @@ const CMenuOptionChooser::keyval LCD4L_SKIN_OPTIONS[] =
{ 3, LOCALE_LCD4L_SKIN_3 },
{ 4, LOCALE_LCD4L_SKIN_4 }
};
#define LCD4L_SKIN_OPTION_COUNT (sizeof(LCD4L_SKIN_OPTIONS)/sizeof(CMenuOptionChooser::keyval))
#define LCD4L_PEARL_SKIN_OPTION_COUNT (sizeof(LCD4L_PEARL_SKIN_OPTIONS)/sizeof(CMenuOptionChooser::keyval))
const CMenuOptionChooser::keyval LCD4L_SAMSUNG_SKIN_OPTIONS[] =
{
{ 0, LOCALE_LCD4L_SKIN_0 },
{ 4, LOCALE_LCD4L_SKIN_4 }
};
#define LCD4L_SAMSUNG_SKIN_OPTION_COUNT (sizeof(LCD4L_SAMSUNG_SKIN_OPTIONS)/sizeof(CMenuOptionChooser::keyval))
CLCD4lSetup::CLCD4lSetup()
{
width = 40;
lcd4l_display_type_changed = false;
}
CLCD4lSetup::~CLCD4lSetup()
@@ -115,6 +124,10 @@ int CLCD4lSetup::exec(CMenuTarget *parent, const std::string &actionkey)
chooserDir(g_settings.lcd4l_logodir, false, action_str);
return menu_return::RETURN_REPAINT;
}
else if (actionkey == "typeSetup")
{
return showTypeSetup();
}
res = show();
@@ -136,6 +149,11 @@ bool CLCD4lSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data
if (g_settings.lcd4l_support)
LCD4l->StartLCD4l();
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LCD4L_DISPLAY_TYPE))
{
g_settings.lcd4l_display_type = temp_lcd4l_display_type;
lcd4l_display_type_changed = true;
}
return false;
}
@@ -144,9 +162,12 @@ int CLCD4lSetup::show()
{
int shortcut = 1;
int temp_lcd4l_display_type = g_settings.lcd4l_display_type;
int temp_lcd4l_skin = g_settings.lcd4l_skin;
int temp_lcd4l_brightness = g_settings.lcd4l_brightness;
temp_lcd4l_display_type = g_settings.lcd4l_display_type;
temp_lcd4l_skin = g_settings.lcd4l_skin;
temp_lcd4l_brightness = g_settings.lcd4l_brightness;
CMenuOptionChooser *mc;
CMenuForwarder *mf;
// lcd4l setup
CMenuWidget *lcd4lSetup = new CMenuWidget(LOCALE_MISCSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_LCD4L_SETUP);
@@ -155,31 +176,24 @@ int CLCD4lSetup::show()
mc = new CMenuOptionChooser(LOCALE_LCD4L_SUPPORT, &g_settings.lcd4l_support, LCD4L_SUPPORT_OPTIONS, LCD4L_SUPPORT_OPTION_COUNT, true, this, CRCInput::RC_red);
mc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_SUPPORT);
lcd4lSetup->addItem(mc);
lcd4lSetup->addItem(GenericMenuSeparatorLine);
mc = new CMenuOptionChooser(LOCALE_LCD4L_DISPLAY_TYPE, &temp_lcd4l_display_type, LCD4L_DISPLAY_TYPE_OPTIONS, LCD4L_DISPLAY_TYPE_OPTION_COUNT, true, this, CRCInput::RC_green);
mc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_DISPLAY_TYPE);
lcd4lSetup->addItem(mc);
mf = new CMenuForwarder(LOCALE_LCD4L_DISPLAY_TYPE_SETUP, true, NULL, this, "typeSetup", CRCInput::RC_yellow);
mf->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_DISPLAY_TYPE_SETUP);
lcd4lSetup->addItem(mf);
lcd4lSetup->addItem(GenericMenuSeparatorLine);
mf = new CMenuForwarder(LOCALE_LCD4L_LOGODIR, true, g_settings.lcd4l_logodir, this, "lcd4l_logodir", CRCInput::convertDigitToKey(shortcut++));
mf->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_LOGODIR);
lcd4lSetup->addItem(mf);
mc = new CMenuOptionChooser(LOCALE_LCD4L_DISPLAY_TYPE, &temp_lcd4l_display_type, LCD4L_DISPLAY_TYPE_OPTIONS, LCD4L_DISPLAY_TYPE_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++));
mc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_DISPLAY_TYPE);
lcd4lSetup->addItem(mc);
mc = new CMenuOptionChooser(LOCALE_LCD4L_SKIN, &temp_lcd4l_skin, LCD4L_SKIN_OPTIONS, LCD4L_SKIN_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++));
mc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_SKIN);
lcd4lSetup->addItem(mc);
mc = new CMenuOptionChooser(LOCALE_LCD4L_SKIN_RADIO, &g_settings.lcd4l_skin_radio, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++));
mc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_SKIN_RADIO);
lcd4lSetup->addItem(mc);
nc = new CMenuOptionNumberChooser(LOCALE_LCD4L_BRIGHTNESS, (int *)&temp_lcd4l_brightness, true, 1, LCD4l->GetMaxBrightness(), this);
nc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_BRIGHTNESS);
lcd4lSetup->addItem(nc);
nc = new CMenuOptionNumberChooser(LOCALE_LCD4L_BRIGHTNESS_STANDBY, (int *)&g_settings.lcd4l_brightness_standby, true, 1, LCD4l->GetMaxBrightness(), this);
nc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_BRIGHTNESS_STANDBY);
lcd4lSetup->addItem(nc);
lcd4lSetup->addItem(GenericMenuSeparator);
const char *flag_lcd4l_weather = FLAGDIR "/.lcd-weather";
int fake_lcd4l_weather = file_exists(flag_lcd4l_weather);
@@ -212,9 +226,10 @@ int CLCD4lSetup::show()
bool initlcd4l = false;
if (g_settings.lcd4l_display_type != temp_lcd4l_display_type)
if ((g_settings.lcd4l_display_type != temp_lcd4l_display_type) || lcd4l_display_type_changed)
{
g_settings.lcd4l_display_type = temp_lcd4l_display_type;
lcd4l_display_type_changed = false;
initlcd4l = true;
}
@@ -235,3 +250,50 @@ int CLCD4lSetup::show()
return res;
}
int CLCD4lSetup::showTypeSetup()
{
if (temp_lcd4l_display_type == CLCD4l::PEARL320x240)
{
// fix brightness values for Pearl DPF
if (temp_lcd4l_brightness > 7)
temp_lcd4l_brightness = 7;
if (g_settings.lcd4l_brightness_standby > 7)
g_settings.lcd4l_brightness_standby = 7;
}
else
{
// fix skin value for Samsung SPF
if (temp_lcd4l_skin > 0 && temp_lcd4l_skin < 4)
temp_lcd4l_skin = 0;
}
int shortcut = 1;
CMenuOptionChooser *mc;
CMenuOptionNumberChooser *nc;
CMenuWidget *typeSetup = new CMenuWidget(LOCALE_LCD4L_DISPLAY_TYPE_SETUP, NEUTRINO_ICON_SETTINGS, width);
typeSetup->addIntroItems(); //FIXME: show lcd4l display type
if (temp_lcd4l_display_type == CLCD4l::PEARL320x240)
mc = new CMenuOptionChooser(LOCALE_LCD4L_SKIN, &temp_lcd4l_skin, LCD4L_PEARL_SKIN_OPTIONS, LCD4L_PEARL_SKIN_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++));
else
mc = new CMenuOptionChooser(LOCALE_LCD4L_SKIN, &temp_lcd4l_skin, LCD4L_SAMSUNG_SKIN_OPTIONS, LCD4L_SAMSUNG_SKIN_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++));
mc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_SKIN);
typeSetup->addItem(mc);
mc = new CMenuOptionChooser(LOCALE_LCD4L_SKIN_RADIO, &g_settings.lcd4l_skin_radio, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++));
mc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_SKIN_RADIO);
typeSetup->addItem(mc);
nc = new CMenuOptionNumberChooser(LOCALE_LCD4L_BRIGHTNESS, (int *)&temp_lcd4l_brightness, true, 1, LCD4l->GetMaxBrightness(), this);
nc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_BRIGHTNESS);
typeSetup->addItem(nc);
nc = new CMenuOptionNumberChooser(LOCALE_LCD4L_BRIGHTNESS_STANDBY, (int *)&g_settings.lcd4l_brightness_standby, true, 1, LCD4l->GetMaxBrightness(), this);
nc->setHint(NEUTRINO_ICON_HINT_LCD4LINUX, LOCALE_MENU_HINT_LCD4L_BRIGHTNESS_STANDBY);
typeSetup->addItem(nc);
return typeSetup->exec(NULL, "");
}

View File

@@ -36,12 +36,14 @@
class CLCD4lSetup : public CMenuTarget, CChangeObserver
{
private:
CMenuOptionNumberChooser *nc;
CMenuOptionChooser *mc;
CMenuForwarder *mf;
bool lcd4l_display_type_changed;
int temp_lcd4l_display_type;
int temp_lcd4l_skin;
int temp_lcd4l_brightness;
int width;
int show();
int showTypeSetup();
public:
static CLCD4lSetup* getInstance();

View File

@@ -1065,6 +1065,7 @@ typedef enum
LOCALE_LCD4L_CLOCK_A,
LOCALE_LCD4L_CONVERT,
LOCALE_LCD4L_DISPLAY_TYPE,
LOCALE_LCD4L_DISPLAY_TYPE_SETUP,
LOCALE_LCD4L_LOGODIR,
LOCALE_LCD4L_SKIN,
LOCALE_LCD4L_SKIN_0,
@@ -1416,6 +1417,7 @@ typedef enum
LOCALE_MENU_HINT_LCD4L_CLOCK_A,
LOCALE_MENU_HINT_LCD4L_CONVERT,
LOCALE_MENU_HINT_LCD4L_DISPLAY_TYPE,
LOCALE_MENU_HINT_LCD4L_DISPLAY_TYPE_SETUP,
LOCALE_MENU_HINT_LCD4L_LOGODIR,
LOCALE_MENU_HINT_LCD4L_SKIN,
LOCALE_MENU_HINT_LCD4L_SKIN_RADIO,

View File

@@ -1065,6 +1065,7 @@ const char * locale_real_names[] =
"lcd4l_clock_a",
"lcd4l_convert",
"lcd4l_display_type",
"lcd4l_display_type_setup",
"lcd4l_logodir",
"lcd4l_skin",
"lcd4l_skin_0",
@@ -1416,6 +1417,7 @@ const char * locale_real_names[] =
"menu.hint_lcd4l_clock_a",
"menu.hint_lcd4l_convert",
"menu.hint_lcd4l_display_type",
"menu.hint_lcd4l_display_type_setup",
"menu.hint_lcd4l_logodir",
"menu.hint_lcd4l_skin",
"menu.hint_lcd4l_skin_radio",