mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
gui/widget/menue.cpp: simplify CMenuOptionLanguageChooser - we have one option for every instance
This commit is contained in:
@@ -1437,38 +1437,14 @@ CMenuOptionLanguageChooser::CMenuOptionLanguageChooser(char* OptionValue, CChang
|
||||
|
||||
CMenuOptionLanguageChooser::~CMenuOptionLanguageChooser()
|
||||
{
|
||||
options.clear();
|
||||
}
|
||||
|
||||
void CMenuOptionLanguageChooser::addOption(const char * const value)
|
||||
{
|
||||
options.push_back(std::string(value));
|
||||
}
|
||||
|
||||
int CMenuOptionLanguageChooser::exec(CMenuTarget*)
|
||||
{
|
||||
bool wantsRepaint = false;
|
||||
|
||||
//select value
|
||||
for(unsigned int count = 0; count < options.size(); count++)
|
||||
{
|
||||
if (strcmp(options[count].c_str(), optionValue) == 0)
|
||||
{
|
||||
strcpy(g_settings.language, options[(count + 1) % options.size()].c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
paint(true);
|
||||
strncpy(g_settings.language, optionValue.c_str(), sizeof(g_settings.language));
|
||||
if(observ)
|
||||
{
|
||||
wantsRepaint = observ->changeNotify(LOCALE_LANGUAGESETUP_SELECT, optionValue);
|
||||
}
|
||||
observ->changeNotify(LOCALE_LANGUAGESETUP_SELECT, (void *) optionValue.c_str());
|
||||
return menu_return::RETURN_EXIT;
|
||||
if ( wantsRepaint )
|
||||
return menu_return::RETURN_REPAINT;
|
||||
else
|
||||
return menu_return::RETURN_NONE;
|
||||
}
|
||||
|
||||
int CMenuOptionLanguageChooser::paint( bool selected )
|
||||
@@ -1481,20 +1457,15 @@ int CMenuOptionLanguageChooser::paint( bool selected )
|
||||
paintItemButton(selected, height, iconName);
|
||||
|
||||
//convert first letter to large
|
||||
string s_optionValue = static_cast<std::string> (optionValue);
|
||||
string ts = s_optionValue.substr(0, 1);
|
||||
string s(ts);
|
||||
s = toupper(s_optionValue[0]);
|
||||
s_optionValue.replace(0, 1, s);
|
||||
|
||||
std::string s_optionValue = optionValue;
|
||||
if(!s_optionValue.empty())
|
||||
s_optionValue[0] = toupper(s_optionValue[0]);
|
||||
//paint text
|
||||
paintItemCaption(selected, height , s_optionValue.c_str());
|
||||
|
||||
return y+height;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right)
|
||||
{
|
||||
|
Reference in New Issue
Block a user