mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 15:02:56 +02:00
CStringInput: unify init handler inside constructors, fix message title
Alternative solution for: remove possible display of NONEXISTANT_LOCALE
4e853d98c2
Locales are used for setting keys and passed with notifies for
observer objects. It seems this is not really a good idea in some
constellations.
This commit is contained in:
@@ -47,38 +47,14 @@
|
||||
|
||||
CStringInput::CStringInput(const neutrino_locale_t Name, std::string* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||
{
|
||||
name = Name;
|
||||
head = g_Locale->getText(Name);
|
||||
valueString = Value;
|
||||
lower_bound = -1;
|
||||
upper_bound = -1;
|
||||
size = Size;
|
||||
|
||||
hint_1 = Hint_1;
|
||||
hint_2 = Hint_2;
|
||||
validchars = Valid_Chars;
|
||||
iconfile = Icon ? Icon : "";
|
||||
|
||||
observ = Observ;
|
||||
init();
|
||||
name = Name;
|
||||
init(g_Locale->getText(name), Value, Size, Hint_1, Hint_2, Valid_Chars, Observ, Icon);
|
||||
}
|
||||
|
||||
CStringInput::CStringInput(const std::string &Name, std::string *Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||
{
|
||||
name = NONEXISTANT_LOCALE;
|
||||
head = Name;
|
||||
valueString = Value;
|
||||
lower_bound = -1;
|
||||
upper_bound = -1;
|
||||
size = Size;
|
||||
|
||||
hint_1 = Hint_1;
|
||||
hint_2 = Hint_2;
|
||||
validchars = Valid_Chars;
|
||||
iconfile = Icon ? Icon : "";
|
||||
|
||||
observ = Observ;
|
||||
init();
|
||||
init(Name, Value, Size, Hint_1, Hint_2, Valid_Chars, Observ, Icon);
|
||||
}
|
||||
|
||||
CStringInput::~CStringInput()
|
||||
@@ -99,10 +75,23 @@ const struct button_label CStringInputSMSButtons[CStringInputSMSButtonsCount] =
|
||||
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_STRINGINPUT_CLEAR }
|
||||
};
|
||||
|
||||
void CStringInput::init()
|
||||
void CStringInput::init(const std::string &Name, std::string *Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
|
||||
{
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
|
||||
head = Name;
|
||||
valueString = Value;
|
||||
lower_bound = -1;
|
||||
upper_bound = -1;
|
||||
size = Size;
|
||||
|
||||
hint_1 = Hint_1;
|
||||
hint_2 = Hint_2;
|
||||
validchars = Valid_Chars;
|
||||
iconfile = Icon ? Icon : "";
|
||||
|
||||
observ = Observ;
|
||||
|
||||
#ifdef DEBUG_STRINGINPUT
|
||||
printf("HEAD: %s (len: %d)\n", head, strlen(head));
|
||||
#endif
|
||||
@@ -496,8 +485,9 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
|
||||
}
|
||||
else if ( (msg==CRCInput::RC_home) || (msg==CRCInput::RC_timeout) )
|
||||
{
|
||||
string tmp_name = name == NONEXISTANT_LOCALE ? head : g_Locale->getText(name);
|
||||
if ((trim (*valueString) != trim(oldval)) &&
|
||||
(ShowMsg(name, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) {
|
||||
(ShowMsg(tmp_name, 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;
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ class CStringInput : public CMenuTarget
|
||||
bool force_saveScreen;
|
||||
fb_pixel_t *pixBuf;
|
||||
|
||||
virtual void init();
|
||||
virtual void init(const std::string &Name, std::string *Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon);
|
||||
|
||||
virtual void paint(bool sms = false);
|
||||
virtual void paintChar(int pos, char c);
|
||||
|
Reference in New Issue
Block a user