From 3d6a0c381a1cebf88e48bfd477cf1cc0531fd5fb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 23 Dec 2016 21:05:15 +0100 Subject: [PATCH] CKeyboardInput: remove possible display of NONEXISTANT_LOCALE This should fix possible incorrect titles with content of NONEXISTANT_LOCALE with lua script handler --- src/gui/widget/keyboard_input.cpp | 17 +++++++---------- src/gui/widget/keyboard_input.h | 3 +-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gui/widget/keyboard_input.cpp b/src/gui/widget/keyboard_input.cpp index 92b5efaeb..7e910d618 100644 --- a/src/gui/widget/keyboard_input.cpp +++ b/src/gui/widget/keyboard_input.cpp @@ -181,8 +181,7 @@ const char* CInputString::c_str() CKeyboardInput::CKeyboardInput(const neutrino_locale_t Name, std::string* Value, int Size, CChangeObserver* Observ, const char * const Icon, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2) { - name = Name; - head = g_Locale->getText(Name); + title = g_Locale->getText(Name); valueString = Value; inputSize = Size; @@ -205,8 +204,7 @@ CKeyboardInput::CKeyboardInput(const neutrino_locale_t Name, std::string* Value, CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2) { - name = NONEXISTANT_LOCALE; - head = Name; + title = Name; valueString = Value; inputSize = Size; @@ -229,8 +227,7 @@ CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int CKeyboardInput::CKeyboardInput(const std::string &Name, std::string *Value, int Size, CChangeObserver* Observ, const char * const Icon, std::string HintText_1, std::string HintText_2) { - name = NONEXISTANT_LOCALE; - head = Name; + title = Name; valueString = Value; inputSize = Size; @@ -286,7 +283,7 @@ void CKeyboardInput::init() } inputString = new CInputString(inputSize); - int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(head); + int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(title); if (!(iconfile.empty())) { int icol_w, icol_h; @@ -637,7 +634,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout)) { if ((inputString->getValue() != oldval) && - (ShowMsg(name, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) { + (ShowMsg(title, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) { timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); continue; } @@ -675,7 +672,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) inputString = NULL; if ((observ) && (msg == CRCInput::RC_red)) - observ->changeNotify(name, (void *) valueString->c_str()); + observ->changeNotify(title, (void *) valueString->c_str()); return res; } @@ -709,7 +706,7 @@ void CKeyboardInput::paint() frameBuffer->paintBoxRel(x + OFFSET_SHADOW, y + OFFSET_SHADOW, width, height, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_ALL); //round frameBuffer->paintBoxRel(x, y + hheight, width, bheight, COL_MENUCONTENT_PLUS_0); - CComponentsHeader header(x, y, width, hheight, head, iconfile); + CComponentsHeader header(x, y, width, hheight, title, iconfile); header.paint(CC_SAVE_SCREEN_NO); key_y = y+ hheight+ offset+ input_h+ offset; diff --git a/src/gui/widget/keyboard_input.h b/src/gui/widget/keyboard_input.h index 7af5c1c17..23a3b3601 100644 --- a/src/gui/widget/keyboard_input.h +++ b/src/gui/widget/keyboard_input.h @@ -92,8 +92,7 @@ class CKeyboardInput : public CMenuTarget std::string (*keyboard)[KEY_COLUMNS]; CInputString * inputString; - std::string head; - neutrino_locale_t name; + std::string title; neutrino_locale_t hint_1, hint_2; std::string hintText_1, hintText_2; std::string iconfile;