mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CMenuOptionChooser: clean up multiple code parts
This commit is contained in:
@@ -1703,89 +1703,44 @@ int CMenuOptionNumberChooser::getWidth(void)
|
||||
return width;
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options,
|
||||
const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
nameString = "";
|
||||
name = OptionName;
|
||||
optionValue = OptionValue;
|
||||
number_of_options = Number_Of_Options;
|
||||
observ = Observ;
|
||||
pulldown = Pulldown;
|
||||
optionsSort = OptionsSort;
|
||||
for (unsigned int i = 0; i < number_of_options; i++)
|
||||
{
|
||||
struct keyval_ext opt;
|
||||
opt = Options[i];
|
||||
options.push_back(opt);
|
||||
}
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options,
|
||||
const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
nameString = OptionName;
|
||||
name = NONEXISTANT_LOCALE;
|
||||
optionValue = OptionValue;
|
||||
number_of_options = Number_Of_Options;
|
||||
observ = Observ;
|
||||
pulldown = Pulldown;
|
||||
optionsSort = OptionsSort;
|
||||
for (unsigned int i = 0; i < number_of_options; i++)
|
||||
{
|
||||
struct keyval_ext opt;
|
||||
opt = Options[i];
|
||||
options.push_back(opt);
|
||||
}
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ,
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
nameString = "";
|
||||
name = OptionName;
|
||||
optionValue = OptionValue;
|
||||
number_of_options = Number_Of_Options;
|
||||
observ = Observ;
|
||||
pulldown = Pulldown;
|
||||
optionsSort = OptionsSort;
|
||||
for (unsigned int i = 0; i < number_of_options; i++)
|
||||
options.push_back(Options[i]);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ,
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
nameString = OptionName;
|
||||
name = NONEXISTANT_LOCALE;
|
||||
optionValue = OptionValue;
|
||||
number_of_options = Number_Of_Options;
|
||||
observ = Observ;
|
||||
pulldown = Pulldown;
|
||||
optionsSort = OptionsSort;
|
||||
for (unsigned int i = 0; i < number_of_options; i++)
|
||||
options.push_back(Options[i]);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, std::vector<keyval_ext> &Options,
|
||||
CMenuOptionChooser::CMenuOptionChooser( const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const size_t Number_Of_Options,
|
||||
const bool Active, CChangeObserver * const Observ,
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
nameString = "";
|
||||
name = OptionName;
|
||||
optionValue = OptionValue;
|
||||
options = Options;
|
||||
number_of_options = options.size();
|
||||
observ = Observ;
|
||||
pulldown = Pulldown;
|
||||
optionsSort = OptionsSort;
|
||||
init("", OptionName, OptionValue, Options, NULL, NULL, Number_Of_Options, Observ, Pulldown, OptionsSort);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser( const std::string &OptionName, int * const OptionValue, const struct keyval * const Options, const size_t Number_Of_Options,
|
||||
const bool Active, CChangeObserver * const Observ,
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
init(OptionName, NONEXISTANT_LOCALE, OptionValue, Options, NULL, NULL, Number_Of_Options, Observ, Pulldown, OptionsSort);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser( const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval_ext * const Options, const size_t Number_Of_Options,
|
||||
const bool Active, CChangeObserver * const Observ,
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
init("", OptionName, OptionValue, NULL, Options, NULL, Number_Of_Options, Observ, Pulldown, OptionsSort);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser( const std::string &OptionName, int * const OptionValue, const struct keyval_ext * const Options, const size_t Number_Of_Options,
|
||||
const bool Active, CChangeObserver * const Observ,
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
init(OptionName, NONEXISTANT_LOCALE, OptionValue, NULL, Options, NULL, Number_Of_Options, Observ, Pulldown, OptionsSort);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser( const neutrino_locale_t OptionName, int * const OptionValue, std::vector<keyval_ext> &Options,
|
||||
const bool Active, CChangeObserver * const Observ,
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
init("", OptionName, OptionValue, NULL, NULL, &Options, Options.size(), Observ, Pulldown, OptionsSort);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * const OptionValue, std::vector<keyval_ext> &Options,
|
||||
@@ -1793,14 +1748,7 @@ CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * cons
|
||||
const neutrino_msg_t DirectKey, const char * const IconName, bool Pulldown, bool OptionsSort)
|
||||
: CAbstractMenuOptionChooser(Active, DirectKey, IconName)
|
||||
{
|
||||
nameString = OptionName;
|
||||
name = NONEXISTANT_LOCALE;
|
||||
optionValue = OptionValue;
|
||||
options = Options;
|
||||
number_of_options = options.size();
|
||||
observ = Observ;
|
||||
pulldown = Pulldown;
|
||||
optionsSort = OptionsSort;
|
||||
init(OptionName, NONEXISTANT_LOCALE, OptionValue, NULL, NULL, &Options, Options.size(), Observ, Pulldown, OptionsSort);
|
||||
}
|
||||
|
||||
CMenuOptionChooser::~CMenuOptionChooser()
|
||||
@@ -1808,13 +1756,14 @@ CMenuOptionChooser::~CMenuOptionChooser()
|
||||
clearChooserOptions();
|
||||
}
|
||||
|
||||
void CMenuOptionChooser::initVarOptionChooser( const std::string &OptionName,
|
||||
void CMenuOptionChooser::init( const std::string &OptionName,
|
||||
const neutrino_locale_t Name,
|
||||
int * const OptionValue,
|
||||
const bool Active,
|
||||
const struct keyval * const Options,
|
||||
const struct keyval_ext * const OptionsExt,
|
||||
std::vector<keyval_ext> * v_Options,
|
||||
const size_t Number_Of_Options,
|
||||
CChangeObserver * const Observ,
|
||||
neutrino_msg_t DirectKey,
|
||||
const char * IconName,
|
||||
bool Pulldown,
|
||||
bool OptionsSort)
|
||||
{
|
||||
@@ -1822,12 +1771,33 @@ void CMenuOptionChooser::initVarOptionChooser( const std::string &OptionName,
|
||||
nameString = OptionName;
|
||||
name = Name;
|
||||
optionValue = OptionValue;
|
||||
active = Active;
|
||||
number_of_options = Number_Of_Options;
|
||||
observ = Observ;
|
||||
directKey = DirectKey;
|
||||
iconName = IconName;
|
||||
pulldown = Pulldown;
|
||||
optionsSort = OptionsSort;
|
||||
|
||||
if (Options || OptionsExt)
|
||||
{
|
||||
if (Options)
|
||||
{
|
||||
for (unsigned int i = 0; i < number_of_options; i++)
|
||||
{
|
||||
struct keyval_ext opt;
|
||||
opt = Options[i];
|
||||
options.push_back(opt);
|
||||
}
|
||||
}
|
||||
|
||||
if (OptionsExt)
|
||||
{
|
||||
for (unsigned int i = 0; i < number_of_options; i++)
|
||||
options.push_back(OptionsExt[i]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (v_Options)
|
||||
options = *v_Options;
|
||||
}
|
||||
}
|
||||
|
||||
void CMenuOptionChooser::clearChooserOptions()
|
||||
|
@@ -386,19 +386,20 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
private:
|
||||
std::vector<keyval_ext> options;
|
||||
std::vector<CMenuOptionChooserOptions*> option_chooser_options_v;
|
||||
unsigned number_of_options;
|
||||
size_t number_of_options;
|
||||
CChangeObserver * observ;
|
||||
bool pulldown;
|
||||
bool optionsSort;
|
||||
|
||||
void clearChooserOptions();
|
||||
void initVarOptionChooser( const std::string &OptionName,
|
||||
void init( const std::string &OptionName,
|
||||
const neutrino_locale_t Name,
|
||||
int * const OptionValue,
|
||||
const bool Active,
|
||||
const struct keyval * const Options,
|
||||
const struct keyval_ext * const OptionsExt,
|
||||
std::vector<keyval_ext> * v_Options,
|
||||
const size_t Number_Of_Options,
|
||||
CChangeObserver * const Observ,
|
||||
neutrino_msg_t DirectKey,
|
||||
const char * IconName,
|
||||
bool Pulldown,
|
||||
bool OptionsSort
|
||||
);
|
||||
@@ -406,19 +407,19 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
|
||||
public:
|
||||
CMenuOptionChooser(const neutrino_locale_t Name, int * const OptionValue, const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const size_t Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const neutrino_locale_t Name, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const size_t Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const std::string &Name, int * const OptionValue, const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const size_t Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
bool size_t = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const std::string &Name, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const size_t Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const neutrino_locale_t Name, int * const OptionValue, std::vector<keyval_ext> &Options,
|
||||
@@ -429,6 +430,7 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL,
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
|
||||
~CMenuOptionChooser();
|
||||
|
||||
void setOption(const int newvalue);
|
||||
|
Reference in New Issue
Block a user