diff --git a/Common/UI/View.h b/Common/UI/View.h index 8a21c4bbb8..db524d6421 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -745,6 +745,9 @@ public: void SetImageScale(float scale) { imgScale_ = scale; } + void SetText(std::string_view text) { + text_ = text; + } protected: void ClickInternal() override; diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index e8febfa471..fecec9402c 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -572,7 +572,7 @@ void AnalogCalibrationScreen::CreateViews() { LinearLayout *scrollContents = scroll->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(300.0f, WRAP_CONTENT))); - scrollContents->Add(new ItemHeader(co->T("Analog Settings", "Analog Settings"))); + scrollContents->Add(new ItemHeader(co->T("Analog Settings"))); // TODO: Would be nicer if these didn't pop up... scrollContents->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogDeadzone, 0.0f, 0.5f, 0.15f, co->T("Deadzone radius"), 0.01f, screenManager(), "/ 1.0")); diff --git a/UI/MiscViews.cpp b/UI/MiscViews.cpp index 37bd522961..4f547fee16 100644 --- a/UI/MiscViews.cpp +++ b/UI/MiscViews.cpp @@ -4,6 +4,7 @@ #include "Common/System/Request.h" #include "Common/System/Display.h" #include "Common/TimeUtil.h" +#include "Common/Data/Text/I18n.h" #include "UI/MiscViews.h" TextWithImage::TextWithImage(ImageID imageID, std::string_view text, UI::LinearLayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) { @@ -37,7 +38,7 @@ CopyableText::CopyableText(ImageID imageID, std::string_view text, UI::LinearLay }); } -TopBar::TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) { +TopBar::TopBar(const UIContext &ctx, bool usePortraitLayout, std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) { using namespace UI; SetSpacing(10.0f); if (!layoutParams) { @@ -45,10 +46,14 @@ TopBar::TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *l layoutParams_->height = 64.0f; } + auto dlg = GetI18NCategory(I18NCat::DIALOG); backButton_ = Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams())); backButton_ ->OnClick.Add([](UI::EventParams &e) { e.bubbleResult = DR_BACK; }); + if (!usePortraitLayout) { + backButton_->SetText(dlg->T("Back")); + } if (!title.empty()) { TextView *titleView = Add(new TextView(title, ALIGN_VCENTER | FLAG_WRAP_TEXT, false, new LinearLayoutParams(1.0f, G_VCENTER))); diff --git a/UI/MiscViews.h b/UI/MiscViews.h index 39ab99dffd..c17aa477a2 100644 --- a/UI/MiscViews.h +++ b/UI/MiscViews.h @@ -18,7 +18,7 @@ public: class TopBar : public UI::LinearLayout { public: // The context is needed to get the theme for the background. - TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *layoutParams = nullptr); + TopBar(const UIContext &ctx, bool usePortraitLayout, std::string_view title, UI::LayoutParams *layoutParams = nullptr); UI::View *GetBackButton() const { return backButton_; } private: diff --git a/UI/SimpleDialogScreen.cpp b/UI/SimpleDialogScreen.cpp index 7425b472f2..ec44e8609a 100644 --- a/UI/SimpleDialogScreen.cpp +++ b/UI/SimpleDialogScreen.cpp @@ -11,7 +11,7 @@ void UISimpleBaseDialogScreen::CreateViews() { const bool portrait = UsePortraitLayout(); root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); - root_->Add(new TopBar(*screenManager()->getUIContext(), GetTitle())); + root_->Add(new TopBar(*screenManager()->getUIContext(), portrait, GetTitle())); if (canScroll) { ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f));