mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 16:15:39 +00:00
Fixed an issue where abbreviated system names would get displayed in the UI settings selector window.
This commit is contained in:
parent
20760c1b43
commit
f2e033c383
|
@ -102,31 +102,15 @@ void GuiMenu::openUIOptions()
|
||||||
auto startup_system = std::make_shared<OptionListComponent<std::string>>(
|
auto startup_system = std::make_shared<OptionListComponent<std::string>>(
|
||||||
mWindow, getHelpStyle(), "GAMELIST ON STARTUP", false);
|
mWindow, getHelpStyle(), "GAMELIST ON STARTUP", false);
|
||||||
startup_system->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
startup_system->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
||||||
float dotsSize = Font::get(FONT_SIZE_MEDIUM)->sizeText("...").x;
|
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||||
for (auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend();
|
it != SystemData::sSystemVector.cend(); it++) {
|
||||||
it++) {
|
|
||||||
if ((*it)->getName() != "retropie") {
|
if ((*it)->getName() != "retropie") {
|
||||||
// If required, abbreviate the system name so it doesn't overlap the setting name.
|
// If required, abbreviate the system name so it doesn't overlap the setting name.
|
||||||
std::string abbreviatedString =
|
float maxNameLength = mSize.x * 0.55f;
|
||||||
Font::get(FONT_SIZE_MEDIUM)->getTextMaxWidth((*it)->getFullName(), mSize.x * 0.47f);
|
startup_system->add((*it)->getFullName(), (*it)->getName(),
|
||||||
float sizeDifference = Font::get(FONT_SIZE_MEDIUM)->sizeText((*it)->getFullName()).x -
|
|
||||||
Font::get(FONT_SIZE_MEDIUM)->sizeText(abbreviatedString).x;
|
|
||||||
if (sizeDifference > 0.0f) {
|
|
||||||
// It doesn't make sense to abbreviate if the number of pixels removed by
|
|
||||||
// the abbreviation is less or equal to the size of the three dots that
|
|
||||||
// would be appended to the string.
|
|
||||||
if (sizeDifference <= dotsSize) {
|
|
||||||
abbreviatedString = (*it)->getFullName();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (abbreviatedString.back() == ' ')
|
|
||||||
abbreviatedString.pop_back();
|
|
||||||
abbreviatedString += "...";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
startup_system->add(abbreviatedString, (*it)->getName(),
|
|
||||||
Settings::getInstance()->getString("StartupSystem") ==
|
Settings::getInstance()->getString("StartupSystem") ==
|
||||||
(*it)->getName());
|
(*it)->getName(),
|
||||||
|
maxNameLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->addWithLabel("GAMELIST ON STARTUP", startup_system);
|
s->addWithLabel("GAMELIST ON STARTUP", startup_system);
|
||||||
|
@ -190,8 +174,11 @@ void GuiMenu::openUIOptions()
|
||||||
selectedSet = themeSets.cbegin();
|
selectedSet = themeSets.cbegin();
|
||||||
auto theme_set = std::make_shared<OptionListComponent<std::string>>(mWindow, getHelpStyle(),
|
auto theme_set = std::make_shared<OptionListComponent<std::string>>(mWindow, getHelpStyle(),
|
||||||
"THEME SET", false);
|
"THEME SET", false);
|
||||||
for (auto it = themeSets.cbegin(); it != themeSets.cend(); it++)
|
for (auto it = themeSets.cbegin(); it != themeSets.cend(); it++) {
|
||||||
theme_set->add(it->first, it->first, it == selectedSet);
|
// If required, abbreviate the theme set name so it doesn't overlap the setting name.
|
||||||
|
float maxNameLength = mSize.x * 0.62f;
|
||||||
|
theme_set->add(it->first, it->first, it == selectedSet, maxNameLength);
|
||||||
|
}
|
||||||
s->addWithLabel("THEME SET", theme_set);
|
s->addWithLabel("THEME SET", theme_set);
|
||||||
s->addSaveFunc([this, theme_set, s] {
|
s->addSaveFunc([this, theme_set, s] {
|
||||||
if (theme_set->getSelected() != Settings::getInstance()->getString("ThemeSet")) {
|
if (theme_set->getSelected() != Settings::getInstance()->getString("ThemeSet")) {
|
||||||
|
|
Loading…
Reference in a new issue