mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 01:11:06 +02:00
CMenuOptionChooser: Add alphanumeric sort option
- default is false
- Activate by OptionsSort = true
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8832b803bd
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-01-04 (Sat, 04 Jan 2014)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -313,6 +313,26 @@ private:
|
||||
void setNumberFormat(std::string (*fun)(int)) { numberFormatFunction = fun; }
|
||||
};
|
||||
|
||||
class CMenuOptionChooserOptions
|
||||
{
|
||||
public:
|
||||
int key;
|
||||
std::string valname;
|
||||
};
|
||||
|
||||
struct CMenuOptionChooserCompareItem: public std::binary_function <const CMenuOptionChooserOptions * const, const CMenuOptionChooserOptions * const, bool>
|
||||
{
|
||||
static bool cmpToLower(const char a, const char b)
|
||||
{
|
||||
return tolower(a) < tolower(b);
|
||||
};
|
||||
|
||||
bool operator() (const CMenuOptionChooserOptions * const c1, CMenuOptionChooserOptions * const c2)
|
||||
{
|
||||
return std::lexicographical_compare(c1->valname.begin(), c1->valname.end(), c2->valname.begin(), c2->valname.end(), cmpToLower);
|
||||
};
|
||||
};
|
||||
|
||||
class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
{
|
||||
public:
|
||||
@@ -331,28 +351,32 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser
|
||||
|
||||
private:
|
||||
std::vector<keyval_ext> options;
|
||||
std::vector<CMenuOptionChooserOptions*> option_chooser_options_v;
|
||||
unsigned number_of_options;
|
||||
CChangeObserver * observ;
|
||||
std::string optionNameString;
|
||||
bool pulldown;
|
||||
bool pulldown;
|
||||
bool optionsSort;
|
||||
|
||||
void clearChooserOptions();
|
||||
|
||||
public:
|
||||
CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
|
||||
bool Pulldown = false);
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
|
||||
bool Pulldown = false);
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
|
||||
bool Pulldown = false);
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
CMenuOptionChooser(const char* OptionName, int * const OptionValue, const struct keyval_ext * const Options,
|
||||
const unsigned Number_Of_Options, const bool Active = false, CChangeObserver * const Observ = NULL,
|
||||
const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "",
|
||||
bool Pulldown = false);
|
||||
bool Pulldown = false, bool OptionsSort = false);
|
||||
~CMenuOptionChooser();
|
||||
|
||||
void setOptionValue(const int newvalue);
|
||||
|
Reference in New Issue
Block a user