Merge remote-tracking branch 'check/next-cc'

...only build-tested, needs fixes
This commit is contained in:
Stefan Seyfried
2014-02-15 20:22:07 +01:00
77 changed files with 1056 additions and 396 deletions

View File

@@ -139,7 +139,10 @@ int paintButtons( const int &x,
if (content[i].locale) {
buttontext[i] = g_Locale->getText(content[i].locale);
//text width
fwidth[i] = font->getRenderWidth(buttontext[i], true);
if (alt_buttontext != NULL && i == buttontext_id)
fwidth[i] = font->getRenderWidth(alt_buttontext, true); //...with an alternate buttontext
else
fwidth[i] = font->getRenderWidth(buttontext[i], true);
w_text += fwidth[i];
count_labels++;
} else {

View File

@@ -75,6 +75,7 @@
#define NEUTRINO_ICON_BUTTON_PLUS "plus"
#define NEUTRINO_ICON_BUTTON_MINUS "minus"
#define NEUTRINO_ICON_BLUE "icon_blue"
#define NEUTRINO_ICON_GREEN "icon_green"
#define NEUTRINO_ICON_RED "icon_red"
#define NEUTRINO_ICON_YELLOW "icon_yellow"

View File

@@ -53,7 +53,7 @@ public:
keyvalue = k;
};
virtual const char * getString(void)
virtual const char * getName(void)
{
the_text = g_Locale->getText(LOCALE_KEYCHOOSERMENU_CURRENTKEY);
the_text += ": ";

View File

@@ -818,7 +818,7 @@ void CMenuWidget::checkHints()
{
GenericMenuBack->setHint("", NONEXISTANT_LOCALE);
for (unsigned int i= 0; i< items.size(); i++) {
if(!items[i]->hintIcon.empty() || items[i]->hint != NONEXISTANT_LOCALE) {
if(!items[i]->hintIcon.empty() || items[i]->hint != NONEXISTANT_LOCALE || !items[i]->hintText.empty()) {
has_hints = true;
break;
}
@@ -1133,7 +1133,7 @@ void CMenuWidget::paintHint(int pos)
CMenuItem* item = items[pos];
if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) {
if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE && item->hintText.empty()) {
if (info_box) {
savescreen ? info_box->hide(false) : info_box->kill();
hint_painted = false;
@@ -1141,7 +1141,7 @@ void CMenuWidget::paintHint(int pos)
return;
}
if (item->hint == NONEXISTANT_LOCALE)
if (item->hint == NONEXISTANT_LOCALE && item->hintText.empty())
return;
int iheight = item->getHeight();
@@ -1168,7 +1168,7 @@ void CMenuWidget::paintHint(int pos)
}
//init infobox
std::string str = g_Locale->getText(item->hint);
std::string str = item->hintText.empty() ? g_Locale->getText(item->hint) : item->hintText;
if (info_box){
info_box->setDimensionsAll(x, ypos2, iwidth, hint_height);
info_box->setFrameThickness(2);
@@ -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)
{
option_string_ptr = &Option;
option_string = &Option;
option = NULL;
name = Text;
nameString = "";
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)
{
option_string_ptr = &Option;
option_string = &Option;
option = NULL;
name = NONEXISTANT_LOCALE;
nameString = Text;
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)
{
option_string = Option ? Option : "";
option_string_ptr = &option_string;
option_string = NULL;
option = Option;
name = Text;
nameString = "";
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)
{
option_string = Option ? Option : "";
option_string_ptr = &option_string;
option_string = NULL;
option = Option;
name = NONEXISTANT_LOCALE;
nameString = Text;
active = Active;
@@ -1882,9 +1884,20 @@ void CMenuForwarder::setName(const neutrino_locale_t t)
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)
{
option_string = Option;
option = NULL;
option_string = &Option;
if (used && x != -1)
paint();
}
int CMenuForwarder::getHeight(void) const
@@ -1924,9 +1937,11 @@ int CMenuForwarder::exec(CMenuTarget* parent)
std::string CMenuForwarder::getOption(void)
{
if (!option_string_ptr->empty())
return *option_string_ptr;
if (jumpTarget)
if (option)
return (std::string)option;
else if (option_string)
return *option_string;
else if (jumpTarget)
return jumpTarget->getValue();
return "";
}

View File

@@ -210,8 +210,8 @@ class CMenuForwarder : public CMenuItem
std::string actionKey;
protected:
std::string option_string;
const std::string * option_string_ptr;
const char * option;
const std::string * option_string;
CMenuTarget * jumpTarget;
virtual std::string getOption(void);
@@ -243,6 +243,7 @@ class CMenuForwarder : public CMenuItem
int exec(CMenuTarget* parent);
bool isSelectable(void) const { return active; }
void setOption(const std::string &Option);
void setOption(const char * const Option);
void setName(const std::string& text);
void setName(const neutrino_locale_t text);
};