mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
CMenuForwarder: Fix options handling
This commit is contained in:
committed by
Jacek Jendrzej
parent
86fca10909
commit
08130328a0
@@ -1814,7 +1814,8 @@ int CMenuOptionLanguageChooser::paint( bool selected )
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------
|
||||||
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, bool IsStatic)
|
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, bool IsStatic)
|
||||||
{
|
{
|
||||||
option_string_ptr = &Option;
|
option_string = &Option;
|
||||||
|
option = NULL;
|
||||||
name = Text;
|
name = Text;
|
||||||
nameString = "";
|
nameString = "";
|
||||||
active = Active;
|
active = Active;
|
||||||
@@ -1828,7 +1829,8 @@ CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active,
|
|||||||
|
|
||||||
CMenuForwarder::CMenuForwarder(const std::string& 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, bool IsStatic)
|
CMenuForwarder::CMenuForwarder(const std::string& 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, bool IsStatic)
|
||||||
{
|
{
|
||||||
option_string_ptr = &Option;
|
option_string = &Option;
|
||||||
|
option = NULL;
|
||||||
name = NONEXISTANT_LOCALE;
|
name = NONEXISTANT_LOCALE;
|
||||||
nameString = Text;
|
nameString = Text;
|
||||||
active = Active;
|
active = Active;
|
||||||
@@ -1842,8 +1844,8 @@ CMenuForwarder::CMenuForwarder(const std::string& Text, const bool Active, const
|
|||||||
|
|
||||||
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, bool IsStatic)
|
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, bool IsStatic)
|
||||||
{
|
{
|
||||||
option_string = Option ? Option : "";
|
option_string = NULL;
|
||||||
option_string_ptr = &option_string;
|
option = Option;
|
||||||
name = Text;
|
name = Text;
|
||||||
nameString = "";
|
nameString = "";
|
||||||
active = Active;
|
active = Active;
|
||||||
@@ -1857,8 +1859,8 @@ CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active,
|
|||||||
|
|
||||||
CMenuForwarder::CMenuForwarder(const std::string& 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, bool IsStatic)
|
CMenuForwarder::CMenuForwarder(const std::string& 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, bool IsStatic)
|
||||||
{
|
{
|
||||||
option_string = Option ? Option : "";
|
option_string = NULL;
|
||||||
option_string_ptr = &option_string;
|
option = Option;
|
||||||
name = NONEXISTANT_LOCALE;
|
name = NONEXISTANT_LOCALE;
|
||||||
nameString = Text;
|
nameString = Text;
|
||||||
active = Active;
|
active = Active;
|
||||||
@@ -1882,9 +1884,20 @@ void CMenuForwarder::setName(const neutrino_locale_t t)
|
|||||||
nameString = "";
|
nameString = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMenuForwarder::setOption(const char * const Option)
|
||||||
|
{
|
||||||
|
option = Option;
|
||||||
|
option_string = NULL;
|
||||||
|
if (used && x != -1)
|
||||||
|
paint();
|
||||||
|
}
|
||||||
|
|
||||||
void CMenuForwarder::setOption(const std::string &Option)
|
void CMenuForwarder::setOption(const std::string &Option)
|
||||||
{
|
{
|
||||||
option_string = Option;
|
option = NULL;
|
||||||
|
option_string = &Option;
|
||||||
|
if (used && x != -1)
|
||||||
|
paint();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMenuForwarder::getHeight(void) const
|
int CMenuForwarder::getHeight(void) const
|
||||||
@@ -1924,9 +1937,11 @@ int CMenuForwarder::exec(CMenuTarget* parent)
|
|||||||
|
|
||||||
std::string CMenuForwarder::getOption(void)
|
std::string CMenuForwarder::getOption(void)
|
||||||
{
|
{
|
||||||
if (!option_string_ptr->empty())
|
if (option)
|
||||||
return *option_string_ptr;
|
return (std::string)option;
|
||||||
if (jumpTarget)
|
else if (option_string)
|
||||||
|
return *option_string;
|
||||||
|
else if (jumpTarget)
|
||||||
return jumpTarget->getValue();
|
return jumpTarget->getValue();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@@ -217,8 +217,8 @@ class CMenuForwarder : public CMenuItem
|
|||||||
std::string actionKey;
|
std::string actionKey;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string option_string;
|
const char * option;
|
||||||
const std::string * option_string_ptr;
|
const std::string * option_string;
|
||||||
CMenuTarget * jumpTarget;
|
CMenuTarget * jumpTarget;
|
||||||
|
|
||||||
virtual std::string getOption(void);
|
virtual std::string getOption(void);
|
||||||
@@ -250,6 +250,7 @@ class CMenuForwarder : public CMenuItem
|
|||||||
int exec(CMenuTarget* parent);
|
int exec(CMenuTarget* parent);
|
||||||
bool isSelectable(void) const { return active; }
|
bool isSelectable(void) const { return active; }
|
||||||
void setOption(const std::string &Option);
|
void setOption(const std::string &Option);
|
||||||
|
void setOption(const char * const Option);
|
||||||
void setName(const std::string& text);
|
void setName(const std::string& text);
|
||||||
void setName(const neutrino_locale_t text);
|
void setName(const neutrino_locale_t text);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user