From 17eb1b1a344ffcfc3a2e139fae7347f01cad3157 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 15 May 2025 10:58:43 -0500 Subject: [PATCH] DolphinQt/Mapping: Replace Motion Input "WARNING: " text with a warning icon. --- .../Mapping/WiimoteEmuExtensionMotionInput.cpp | 16 ++++++++-------- .../Mapping/WiimoteEmuMotionControlIMU.cpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtensionMotionInput.cpp b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtensionMotionInput.cpp index 4e004cd8b5..5edde14c1c 100644 --- a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtensionMotionInput.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuExtensionMotionInput.cpp @@ -14,6 +14,7 @@ #include "Core/HW/WiimoteEmu/WiimoteEmu.h" #include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h" +#include "DolphinQt/QtUtils/QtUtils.h" #include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "InputCommon/InputConfig.h" @@ -32,19 +33,18 @@ void WiimoteEmuExtensionMotionInput::CreateNunchukLayout() auto* warning_layout = new QHBoxLayout(); auto* warning_label = new QLabel( - tr("WARNING: These controls are designed to interface directly with motion " + tr("These controls are designed to interface directly with motion " "sensor hardware. They are not intended for mapping traditional buttons, triggers or " "axes. You might need to configure alternate input sources before using these controls.")); warning_label->setWordWrap(true); auto* warning_input_sources_button = new QPushButton(tr("Alternate Input Sources")); - warning_layout->addWidget(warning_label, 1); - warning_layout->addWidget(warning_input_sources_button, 0, Qt::AlignRight); + warning_layout->addWidget( + QtUtils::CreateIconWarning(this, QStyle::SP_MessageBoxWarning, warning_label), 1); + warning_layout->addWidget(warning_input_sources_button); connect(warning_input_sources_button, &QPushButton::clicked, this, [this] { - ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this); - window->setAttribute(Qt::WA_DeleteOnClose, true); - window->setWindowModality(Qt::WindowModality::WindowModal); - SetQWidgetWindowDecorations(window); - window->show(); + ControllerInterfaceWindow window{this}; + SetQWidgetWindowDecorations(&window); + window.exec(); }); layout->addLayout(warning_layout, 0, 0, 1, -1); diff --git a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.cpp b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.cpp index 9536b2ef9d..3152ebf8c5 100644 --- a/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.cpp @@ -15,6 +15,7 @@ #include "Core/HW/WiimoteEmu/WiimoteEmu.h" #include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h" +#include "DolphinQt/QtUtils/QtUtils.h" #include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "InputCommon/InputConfig.h" @@ -29,20 +30,19 @@ void WiimoteEmuMotionControlIMU::CreateMainLayout() { auto* warning_layout = new QHBoxLayout(); auto* warning_label = - new QLabel(tr("WARNING: The controls under Accelerometer and Gyroscope are designed to " + new QLabel(tr("The controls under Accelerometer and Gyroscope are designed to " "interface directly with motion sensor hardware. They are not intended for " "mapping traditional buttons, triggers or axes. You might need to configure " "alternate input sources before using these controls.")); warning_label->setWordWrap(true); auto* warning_input_sources_button = new QPushButton(tr("Alternate Input Sources")); - warning_layout->addWidget(warning_label, 1); - warning_layout->addWidget(warning_input_sources_button, 0, Qt::AlignRight); + warning_layout->addWidget( + QtUtils::CreateIconWarning(this, QStyle::SP_MessageBoxWarning, warning_label), 1); + warning_layout->addWidget(warning_input_sources_button); connect(warning_input_sources_button, &QPushButton::clicked, this, [this] { - ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this); - window->setAttribute(Qt::WA_DeleteOnClose, true); - window->setWindowModality(Qt::WindowModality::WindowModal); - SetQWidgetWindowDecorations(window); - window->show(); + ControllerInterfaceWindow window{this}; + SetQWidgetWindowDecorations(&window); + window.exec(); }); auto* groups_layout = new QHBoxLayout();