Removed some forced uppercase conversions

This commit is contained in:
Leon Styhre 2024-07-04 18:47:26 +02:00
parent 661bb5d539
commit 1700bb195c
5 changed files with 22 additions and 22 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// ES-DE // ES-DE Frontend
// ButtonComponent.cpp // ButtonComponent.cpp
// //
// Basic on/off button. // Basic on/off button.

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// ES-DE // ES-DE Frontend
// ButtonComponent.h // ButtonComponent.h
// //
// Basic on/off button. // Basic on/off button.
@ -20,7 +20,7 @@ public:
ButtonComponent(const std::string& text = "", ButtonComponent(const std::string& text = "",
const std::string& helpText = "", const std::string& helpText = "",
const std::function<void()>& func = nullptr, const std::function<void()>& func = nullptr,
bool upperCase = true, bool upperCase = false,
bool flatStyle = false); bool flatStyle = false);
void onSizeChanged() override; void onSizeChanged() override;

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// ES-DE // ES-DE Frontend
// MenuComponent.cpp // MenuComponent.cpp
// //
// Basic component for building a menu. // Basic component for building a menu.
@ -10,6 +10,7 @@
#include "Settings.h" #include "Settings.h"
#include "components/ButtonComponent.h" #include "components/ButtonComponent.h"
#include "utils/LocalizationUtil.h"
#define BUTTON_GRID_VERT_PADDING Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.915f #define BUTTON_GRID_VERT_PADDING Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.915f
#define BUTTON_GRID_HORIZ_PADDING Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.283f #define BUTTON_GRID_HORIZ_PADDING Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.283f
@ -83,7 +84,7 @@ void MenuComponent::save()
void MenuComponent::setTitle(std::string title, const std::shared_ptr<Font>& font) void MenuComponent::setTitle(std::string title, const std::shared_ptr<Font>& font)
{ {
mTitle->setText(Utils::String::toUpper(title)); mTitle->setText(title);
mTitle->setFont(font); mTitle->setFont(font);
} }
@ -113,9 +114,12 @@ void MenuComponent::updateSize()
} }
} }
float width {std::min(mRenderer->getScreenHeight() * 1.05f, float width {std::min(
mRenderer->getScreenWidth() * mRenderer->getScreenHeight() * 1.05f * Utils::Localization::sMenuScaleFactor,
(mRenderer->getIsVerticalOrientation() ? 0.94f : 0.90f))}; mRenderer->getScreenWidth() * (mRenderer->getIsVerticalOrientation() ?
0.94f * Utils::Localization::sMenuScaleFactor :
0.90f * Utils::Localization::sMenuScaleFactor))};
setSize(width, height); setSize(width, height);
} }
@ -146,8 +150,7 @@ void MenuComponent::addButton(const std::string& name,
const std::string& helpText, const std::string& helpText,
const std::function<void()>& callback) const std::function<void()>& callback)
{ {
mButtons.push_back( mButtons.push_back(std::make_shared<ButtonComponent>(name, helpText, callback));
std::make_shared<ButtonComponent>(Utils::String::toUpper(name), helpText, callback));
updateGrid(); updateGrid();
updateSize(); updateSize();
} }

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// ES-DE // ES-DE Frontend
// MenuComponent.h // MenuComponent.h
// //
// Basic component for building a menu. // Basic component for building a menu.
@ -45,9 +45,8 @@ public:
bool invert_when_selected = true) bool invert_when_selected = true)
{ {
ComponentListRow row; ComponentListRow row;
row.addElement(std::make_shared<TextComponent>(Utils::String::toUpper(label), row.addElement(
Font::get(FONT_SIZE_MEDIUM), std::make_shared<TextComponent>(label, Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary),
mMenuColorPrimary),
true); true);
row.addElement(comp, false, invert_when_selected); row.addElement(comp, false, invert_when_selected);
addRow(row, setCursorHere); addRow(row, setCursorHere);

View file

@ -342,16 +342,14 @@ private:
for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it) { for (auto it = mEntries.cbegin(); it != mEntries.cend(); ++it) {
if (it->selected) { if (it->selected) {
if (it->maxNameLength > 0.0f && if (it->maxNameLength > 0.0f &&
Font::get(FONT_SIZE_MEDIUM)->sizeText(Utils::String::toUpper(it->name)).x > Font::get(FONT_SIZE_MEDIUM)->sizeText(it->name).x > it->maxNameLength) {
it->maxNameLength) {
// A maximum length parameter has been passed and the "name" size surpasses // A maximum length parameter has been passed and the "name" size surpasses
// this value, so abbreviate the string inside the arrows. // this value, so abbreviate the string inside the arrows.
auto font = Font::get(FONT_SIZE_MEDIUM); auto font = Font::get(FONT_SIZE_MEDIUM);
mText.setText(Utils::String::toUpper( mText.setText(font->wrapText(it->name, it->maxNameLength));
font->wrapText(Utils::String::toUpper(it->name), it->maxNameLength)));
} }
else { else {
mText.setText(Utils::String::toUpper(it->name)); mText.setText(it->name);
} }
mText.setSize(0.0f, mText.getSize().y); mText.setSize(0.0f, mText.getSize().y);
@ -433,8 +431,8 @@ private:
for (auto it = mParent->mEntries.begin(); it != mParent->mEntries.end(); ++it) { for (auto it = mParent->mEntries.begin(); it != mParent->mEntries.end(); ++it) {
row.elements.clear(); row.elements.clear();
auto textComponent = std::make_shared<TextComponent>( auto textComponent =
Utils::String::toUpper(it->name), font, mMenuColorPrimary); std::make_shared<TextComponent>(it->name, font, mMenuColorPrimary);
row.addElement(textComponent, true); row.addElement(textComponent, true);
if (mParent->mMultiExclusiveSelect && hasSelectedRow && !(*it).selected) { if (mParent->mMultiExclusiveSelect && hasSelectedRow && !(*it).selected) {