From 2a708439d464a865daa159e00dd4953bb4fa1c3c Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 2 Jul 2020 00:33:31 +0200 Subject: [PATCH] - menue: simplifying lcd code Conflicts: src/gui/widget/menue.cpp --- src/gui/widget/menue.cpp | 42 ++++++++++++++-------------------------- src/gui/widget/menue.h | 7 +------ 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 860885f4d..70f2e841a 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -94,12 +94,7 @@ CMenuItem::CMenuItem(bool Active, neutrino_msg_t DirectKey, const char * const I actObserv = NULL; parent_widget = NULL; -#ifdef ENABLE_GRAPHLCD - graphlcd_text = ""; -#endif -#ifdef ENABLE_LCD4LINUX - lcd4l_text = ""; -#endif + lcd_text = ""; } void CMenuItem::init(const int X, const int Y, const int DX, const int OFFX) @@ -246,35 +241,21 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text char str[len]; snprintf(str, len, "%s %s", left_text, right_text); CVFD::getInstance()->showMenuText(0, str, -1, true); -#ifdef ENABLE_GRAPHLCD - if (g_settings.glcd_enable) - graphlcd_text = str; -#endif -#ifdef ENABLE_LCD4LINUX - if(g_settings.lcd4l_support) - lcd4l_text = str; -#endif + lcd_text = str; } else { CVFD::getInstance()->showMenuText(0, left_text, -1, true); -#ifdef ENABLE_GRAPHLCD - if (g_settings.glcd_enable) - graphlcd_text = left_text; -#endif -#ifdef ENABLE_LCD4LINUX - if (g_settings.lcd4l_support) - lcd4l_text = left_text; -#endif + lcd_text = left_text; } #ifdef ENABLE_GRAPHLCD if (g_settings.glcd_enable) - cGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), graphlcd_text, 0); + cGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), lcd_text, 0); #endif #ifdef ENABLE_LCD4LINUX if (g_settings.lcd4l_support) - LCD4l->CreateFile("/tmp/lcd/menu", lcd4l_text, g_settings.lcd4l_convert); + LCD4l->CreateFile("/tmp/lcd/menu", lcd_text, g_settings.lcd4l_convert); #endif } @@ -1067,11 +1048,11 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) #ifdef ENABLE_GRAPHLCD if (g_settings.glcd_enable) - cGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), item->graphlcd_text, 0); + cGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), item->lcd_text, 0); #endif #ifdef ENABLE_LCD4LINUX if (g_settings.lcd4l_support) - LCD4l->CreateFile("/tmp/lcd/menu", item->lcd4l_text, g_settings.lcd4l_convert); + LCD4l->CreateFile("/tmp/lcd/menu", item->lcd_text, g_settings.lcd4l_convert); #endif switch ( rv ) { @@ -2552,7 +2533,10 @@ int CMenuSeparator::paint(bool selected) name_start_x = x + (dx >> 1) - (stringwidth >> 1); frameBuffer->paintBoxRel(name_start_x-OFFSET_INNER_SMALL, y, stringwidth+2*OFFSET_INNER_SMALL, height, item_bgcolor); - +#if 0 + if ((type & LINE)) // use COL_MENUHEAD_TEXT for CMenuSeparators defined with LINE and STRING + item_color = COL_MENUHEAD_TEXT; +#endif paintItemCaption(selected); } } @@ -2581,6 +2565,7 @@ bool CZapProtection::check() hint = NONEXISTANT_LOCALE; int res; std::string cPIN; +// char systemstr[128]; do { cPIN = ""; @@ -2590,6 +2575,9 @@ bool CZapProtection::check() res = PINInput->exec(getParent(), ""); delete PINInput; PINInput = NULL; cPIN[4] = 0; +// strcpy(systemstr, CONFIGDIR "/pinentered.sh "); +// strcat(systemstr, cPIN.c_str()); +// system(systemstr); hint = LOCALE_PINPROTECTION_WRONGCODE; } while ( (cPIN != *validPIN) && !cPIN.empty() && diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 4637f7609..5f050cc7e 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -209,12 +209,7 @@ class CMenuItem : public CComponentsSignals void setInfoIconRight(const char * const IconName_Info_right); const char* getInfoIconRight(){return iconName_Info_right;} -#ifdef ENABLE_GRAPHLCD - std::string graphlcd_text; -#endif -#ifdef ENABLE_LCD4LINUX - std::string lcd4l_text; -#endif + std::string lcd_text; }; class CMenuSeparator : public CMenuItem