mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
convert most char[...] configuration values to std::string
Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>
This commit is contained in:
@@ -1505,6 +1505,23 @@ CMenuOptionStringChooser::CMenuOptionStringChooser(const char* OptionName, char*
|
||||
active = Active;
|
||||
optionValue = OptionValue;
|
||||
observ = Observ;
|
||||
optionValueString = NULL;
|
||||
|
||||
directKey = DirectKey;
|
||||
iconName = IconName;
|
||||
pulldown = Pulldown;
|
||||
}
|
||||
|
||||
CMenuOptionStringChooser::CMenuOptionStringChooser(const neutrino_locale_t OptionName, std::string* OptionValue, bool Active, CChangeObserver* Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown)
|
||||
{
|
||||
height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
|
||||
optionNameString = g_Locale->getText(OptionName);
|
||||
optionName = OptionName;
|
||||
active = Active;
|
||||
optionValue = (char *) OptionValue->c_str();
|
||||
optionValueString = OptionValue;
|
||||
observ = Observ;
|
||||
optionValueString = NULL;
|
||||
|
||||
directKey = DirectKey;
|
||||
iconName = IconName;
|
||||
@@ -1555,8 +1572,13 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
|
||||
}
|
||||
menu->exec(NULL, "");
|
||||
ret = menu_return::RETURN_REPAINT;
|
||||
if(select >= 0)
|
||||
strcpy(optionValue, options[select].c_str());
|
||||
if(select >= 0) {
|
||||
if (optionValueString) {
|
||||
*optionValueString = options[select];
|
||||
optionValue = (char *)optionValueString->c_str();
|
||||
} else
|
||||
strcpy(optionValue, options[select].c_str());
|
||||
}
|
||||
delete menu;
|
||||
delete selector;
|
||||
} else {
|
||||
@@ -1564,12 +1586,26 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
|
||||
for(unsigned int count = 0; count < options.size(); count++) {
|
||||
if (strcmp(options[count].c_str(), optionValue) == 0) {
|
||||
if(msg == CRCInput::RC_left) {
|
||||
if(count > 0)
|
||||
strcpy(optionValue, options[(count - 1) % options.size()].c_str());
|
||||
else
|
||||
strcpy(optionValue, options[options.size() - 1].c_str());
|
||||
} else
|
||||
strcpy(optionValue, options[(count + 1) % options.size()].c_str());
|
||||
if(count > 0) {
|
||||
if (optionValueString) {
|
||||
*optionValueString = options[(count - 1) % options.size()];
|
||||
optionValue = (char *)optionValueString->c_str();
|
||||
} else
|
||||
strcpy(optionValue, options[(count - 1) % options.size()].c_str());
|
||||
} else {
|
||||
if (optionValueString) {
|
||||
*optionValueString = options[options.size() - 1];
|
||||
optionValue = (char *)optionValueString->c_str();
|
||||
} else
|
||||
strcpy(optionValue, options[options.size() - 1].c_str());
|
||||
}
|
||||
} else {
|
||||
if (optionValueString) {
|
||||
*optionValueString = options[(count + 1) % options.size()];
|
||||
optionValue = (char *)optionValueString->c_str();
|
||||
} else
|
||||
strcpy(optionValue, options[(count + 1) % options.size()].c_str());
|
||||
}
|
||||
//wantsRepaint = true;
|
||||
break;
|
||||
}
|
||||
@@ -1621,7 +1657,7 @@ CMenuOptionLanguageChooser::~CMenuOptionLanguageChooser()
|
||||
|
||||
int CMenuOptionLanguageChooser::exec(CMenuTarget*)
|
||||
{
|
||||
strncpy(g_settings.language, optionValue.c_str(), sizeof(g_settings.language)-1);
|
||||
g_settings.language = optionValue;
|
||||
if(observ)
|
||||
observ->changeNotify(LOCALE_LANGUAGESETUP_SELECT, (void *) optionValue.c_str());
|
||||
return menu_return::RETURN_EXIT;
|
||||
|
Reference in New Issue
Block a user