From c3db10952576c88f13c8cac0eb9ca99dc12eee3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 8 Nov 2026 09:08:48 +0100 Subject: [PATCH] Touch control layout: Confirm before resetting Co-Authored-By: Claude Opus 5.5 --- UI/TouchControlLayoutScreen.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index 62a6398423..82a139e440 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -591,14 +591,21 @@ ViewLayoutMode TouchControlLayoutScreen::LayoutMode() const { } void TouchControlLayoutScreen::OnReset(UI::EventParams &e) { - INFO_LOG(Log::G3D, "Resetting touch control layout to default."); + auto co = GetI18NCategory(I18NCat::CONTROLS); + auto di = GetI18NCategory(I18NCat::DIALOG); + screenManager()->push(new UI::MessagePopupScreen(di->T("Reset"), co->T("Are you sure you want to reset the touch control layout?"), di->T("Reset"), di->T("Cancel"), [this](bool yes) { + if (!yes) { + return; + } + INFO_LOG(Log::G3D, "Resetting touch control layout to default."); - const Bounds &bounds = GetLayoutBounds(*screenManager()->getUIContext()); - const DeviceOrientation orientation = GetDeviceOrientation(); - TouchControlConfig &touch = g_Config.GetTouchControlsConfig(orientation); - touch.ResetLayout(); - InitPadLayout(&touch, orientation, bounds.w, bounds.h); - RecreateViews(); + const Bounds &bounds = GetLayoutBounds(*screenManager()->getUIContext()); + const DeviceOrientation orientation = GetDeviceOrientation(); + TouchControlConfig &touch = g_Config.GetTouchControlsConfig(orientation); + touch.ResetLayout(); + InitPadLayout(&touch, orientation, bounds.w, bounds.h); + RecreateViews(); + })); }; void TouchControlLayoutScreen::dialogFinished(const Screen *dialog, DialogResult result) {