CMenuOptionStringChooser: clean up multiple code parts

This commit is contained in:
2017-06-18 00:04:40 +02:00
parent 8899660dad
commit 284dba8c25
2 changed files with 23 additions and 13 deletions

View File

@@ -2000,24 +2000,29 @@ int CMenuOptionChooser::getWidth(void)
//------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------
CMenuOptionStringChooser::CMenuOptionStringChooser(const neutrino_locale_t OptionName, std::string* OptionValue, bool Active, CChangeObserver* Observ, CMenuOptionStringChooser::CMenuOptionStringChooser( const neutrino_locale_t OptionName, std::string* OptionValue, bool Active, CChangeObserver* Observ,
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown) const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown)
: CMenuItem(Active, DirectKey, IconName) : CMenuItem(Active, DirectKey, IconName)
{ {
nameString = ""; init("", OptionName, OptionValue, Observ, Pulldown);
name = OptionName;
optionValuePtr = OptionValue ? OptionValue : &optionValue;
observ = Observ;
pulldown = Pulldown;
} }
CMenuOptionStringChooser::CMenuOptionStringChooser(const std::string &OptionName, std::string* OptionValue, bool Active, CChangeObserver* Observ, CMenuOptionStringChooser::CMenuOptionStringChooser( const std::string &OptionName, std::string* OptionValue, bool Active, CChangeObserver* Observ,
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown) const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown)
: CMenuItem(Active, DirectKey, IconName) : CMenuItem(Active, DirectKey, IconName)
{
init(OptionName, NONEXISTANT_LOCALE, OptionValue, Observ, Pulldown);
}
void CMenuOptionStringChooser::init( const std::string &OptionName,
const neutrino_locale_t Name,
std::string* pOptionValue,
CChangeObserver * const Observ,
bool Pulldown)
{ {
nameString = OptionName; nameString = OptionName;
name = NONEXISTANT_LOCALE; name = Name;
optionValuePtr = OptionValue ? OptionValue : &optionValue; optionValuePtr = pOptionValue ? pOptionValue : &optionValue;
observ = Observ; observ = Observ;
pulldown = Pulldown; pulldown = Pulldown;
} }

View File

@@ -453,6 +453,11 @@ class CMenuOptionStringChooser : public CMenuItem
std::vector<std::string> options; std::vector<std::string> options;
CChangeObserver * observ; CChangeObserver * observ;
bool pulldown; bool pulldown;
void init( const std::string &OptionName,
const neutrino_locale_t Name,
std::string* pOptionValue,
CChangeObserver * const Observ,
bool Pulldown );
public: public:
CMenuOptionStringChooser(const neutrino_locale_t Name, std::string* OptionValue, bool Active = false, CMenuOptionStringChooser(const neutrino_locale_t Name, std::string* OptionValue, bool Active = false,