mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
CMenuForwarder: Use std::string (not pointer to std::string or char) for option
This commit is contained in:
@@ -1598,8 +1598,7 @@ int CMenuOptionLanguageChooser::paint( bool selected )
|
||||
//-------------------------------------------------------------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
option = Option;
|
||||
option_string = NULL;
|
||||
option = (Option != NULL) ? (std::string)Option : "";
|
||||
text=Text;
|
||||
active = Active;
|
||||
jumpTarget = Target;
|
||||
@@ -1611,8 +1610,7 @@ CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active,
|
||||
|
||||
CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right)
|
||||
{
|
||||
option = NULL;
|
||||
option_string = &Option;
|
||||
option = Option;
|
||||
text=Text;
|
||||
active = Active;
|
||||
jumpTarget = Target;
|
||||
@@ -1652,10 +1650,8 @@ int CMenuForwarder::getWidth(void)
|
||||
int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(text), true);
|
||||
const char * option_text = NULL;
|
||||
|
||||
if (option)
|
||||
option_text = option;
|
||||
else if (option_string)
|
||||
option_text = option_string->c_str();
|
||||
if (!option.empty())
|
||||
option_text = option.c_str();
|
||||
|
||||
|
||||
if (option_text != NULL)
|
||||
@@ -1678,13 +1674,10 @@ int CMenuForwarder::exec(CMenuTarget* parent)
|
||||
|
||||
const char * CMenuForwarder::getOption(void)
|
||||
{
|
||||
if (option)
|
||||
return option;
|
||||
if (!option.empty())
|
||||
return option.c_str();
|
||||
else
|
||||
if (option_string)
|
||||
return option_string->c_str();
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * CMenuForwarder::getName(void)
|
||||
@@ -1756,10 +1749,8 @@ int CMenuForwarderNonLocalized::getWidth(void)
|
||||
{
|
||||
int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(the_text, true);
|
||||
const char * option_text = NULL;
|
||||
if (option)
|
||||
option_text = option;
|
||||
else if (option_string)
|
||||
option_text = option_string->c_str();
|
||||
if (!option.empty())
|
||||
option_text = option.c_str();
|
||||
|
||||
if (option_text != NULL)
|
||||
tw += 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_text, true);
|
||||
|
Reference in New Issue
Block a user