From 4a929233998fbee35a1c54ab970e474eb5d58b3d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 10 Sep 2018 00:15:22 +0200 Subject: [PATCH] lcd4l: use better readable enumeration to handle g_settings.lcd4l_display_type Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3598a95c3d567a1cb72b8da2397eba70f949ac6c Author: vanhofen Date: 2018-09-10 (Mon, 10 Sep 2018) Origin message was: ------------------ - lcd4l: use better readable enumeration to handle g_settings.lcd4l_display_type ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/lcd4l.cpp | 32 +++++++++++++++++--------------- src/driver/lcd4l.h | 7 +++++++ src/gui/lcd4l_setup.cpp | 4 ++-- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/driver/lcd4l.cpp b/src/driver/lcd4l.cpp index 545c2335a..b7f58a1f4 100644 --- a/src/driver/lcd4l.cpp +++ b/src/driver/lcd4l.cpp @@ -665,45 +665,47 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) /* --- */ - std::string Layout; + std::string DisplayType; - std::string DISPLAY_Type; - switch (g_settings.lcd4l_display_type) { - case 1: - DISPLAY_Type = "Samsung_"; + switch (g_settings.lcd4l_display_type) + { + case SAMSUNG: + DisplayType = "Samsung_"; break; - case 0: + case PEARL: default: - DISPLAY_Type = "Pearl_"; + DisplayType = "Pearl_"; break; } + std::string Layout; + if (ModeStandby) { - Layout = DISPLAY_Type + "standby"; + Layout = DisplayType + "standby"; } else if ((g_settings.lcd4l_skin_radio) && (m_Mode == NeutrinoModes::mode_radio || m_Mode == NeutrinoModes::mode_webradio)) { - Layout = DISPLAY_Type + "radio"; + Layout = DisplayType + "radio"; } else { switch (g_settings.lcd4l_skin) { case 4: - Layout = DISPLAY_Type + "user"; + Layout = DisplayType + "user"; break; case 3: - Layout = DISPLAY_Type + "d-box2"; + Layout = DisplayType + "d-box2"; break; case 2: - Layout = DISPLAY_Type + "small"; + Layout = DisplayType + "small"; break; case 1: - Layout = DISPLAY_Type + "large"; + Layout = DisplayType + "large"; break; default: - Layout = DISPLAY_Type + "standard"; + Layout = DisplayType + "standard"; } } @@ -935,7 +937,7 @@ bool CLCD4l::WriteFile(const char *file, std::string content, bool convert) strReplace(content, "Ä", "\xc4\0"); strReplace(content, "Ö", "\xd6\0"); strReplace(content, "Ü", "\xdc\0"); - if (g_settings.lcd4l_display_type == 0) strReplace(content, "ß", "\xe2\0"); + if (g_settings.lcd4l_display_type == PEARL) strReplace(content, "ß", "\xe2\0"); strReplace(content, "é", "e"); } diff --git a/src/driver/lcd4l.h b/src/driver/lcd4l.h index 16ee24f17..efb6f5758 100644 --- a/src/driver/lcd4l.h +++ b/src/driver/lcd4l.h @@ -38,6 +38,13 @@ class CLCD4l CLCD4l(); ~CLCD4l(); + // Displays + enum + { + PEARL = 0, + SAMSUNG = 1 + }; + // Functions void InitLCD4l(); void StartLCD4l(); diff --git a/src/gui/lcd4l_setup.cpp b/src/gui/lcd4l_setup.cpp index c7e48bf66..9da6fcd18 100644 --- a/src/gui/lcd4l_setup.cpp +++ b/src/gui/lcd4l_setup.cpp @@ -65,8 +65,8 @@ const CMenuOptionChooser::keyval LCD4L_SUPPORT_OPTIONS[] = const CMenuOptionChooser::keyval_ext LCD4L_DISPLAY_TYPE_OPTIONS[] = { - { 0, NONEXISTANT_LOCALE, "Pearl"}, - { 1, NONEXISTANT_LOCALE, "Samsung"} + { CLCD4l::PEARL, NONEXISTANT_LOCALE, "Pearl"}, + { CLCD4l::SAMSUNG, NONEXISTANT_LOCALE, "Samsung"} }; #define LCD4L_DISPLAY_TYPE_OPTION_COUNT (sizeof(LCD4L_DISPLAY_TYPE_OPTIONS)/sizeof(CMenuOptionChooser::keyval_ext))