CKeyboardInput: remove possible display of NONEXISTANT_LOCALE

This should fix possible incorrect titles with content of
NONEXISTANT_LOCALE with lua script handler
This commit is contained in:
2016-12-23 21:05:15 +01:00
parent 4e853d98c2
commit 3d6a0c381a
2 changed files with 8 additions and 12 deletions

View File

@@ -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) 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; title = g_Locale->getText(Name);
head = g_Locale->getText(Name);
valueString = Value; valueString = Value;
inputSize = Size; 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) 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; title = Name;
head = Name;
valueString = Value; valueString = Value;
inputSize = Size; 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) 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; title = Name;
head = Name;
valueString = Value; valueString = Value;
inputSize = Size; inputSize = Size;
@@ -286,7 +283,7 @@ void CKeyboardInput::init()
} }
inputString = new CInputString(inputSize); 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())) if (!(iconfile.empty()))
{ {
int icol_w, icol_h; 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)) else if ((msg == CRCInput::RC_home) || (msg == CRCInput::RC_timeout))
{ {
if ((inputString->getValue() != oldval) && 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]); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
continue; continue;
} }
@@ -675,7 +672,7 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &)
inputString = NULL; inputString = NULL;
if ((observ) && (msg == CRCInput::RC_red)) if ((observ) && (msg == CRCInput::RC_red))
observ->changeNotify(name, (void *) valueString->c_str()); observ->changeNotify(title, (void *) valueString->c_str());
return res; 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 + 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); 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); header.paint(CC_SAVE_SCREEN_NO);
key_y = y+ hheight+ offset+ input_h+ offset; key_y = y+ hheight+ offset+ input_h+ offset;

View File

@@ -92,8 +92,7 @@ class CKeyboardInput : public CMenuTarget
std::string (*keyboard)[KEY_COLUMNS]; std::string (*keyboard)[KEY_COLUMNS];
CInputString * inputString; CInputString * inputString;
std::string head; std::string title;
neutrino_locale_t name;
neutrino_locale_t hint_1, hint_2; neutrino_locale_t hint_1, hint_2;
std::string hintText_1, hintText_2; std::string hintText_1, hintText_2;
std::string iconfile; std::string iconfile;