From 67fb9253cbbe72c48d4c88712c341e851b8dd630 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 19 Aug 2020 00:01:57 +1000 Subject: [PATCH] Qt: Hide debug menu by default --- src/duckstation-qt/advancedsettingswidget.cpp | 4 ++++ src/duckstation-qt/advancedsettingswidget.ui | 9 ++++++++- src/duckstation-qt/mainwindow.cpp | 8 ++++++++ src/duckstation-qt/mainwindow.h | 4 ++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index 4862b2fe1..40219cf56 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -1,6 +1,7 @@ #include "advancedsettingswidget.h" #include "settingsdialog.h" #include "settingwidgetbinder.h" +#include "mainwindow.h" AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog) : QWidget(parent), m_host_interface(host_interface) @@ -27,9 +28,12 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cpuRecompilerMemoryExceptions, "CPU", "RecompilerMemoryExceptions", false); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showDebugMenu, "Main", "ShowDebugMenu"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.gpuUseDebugDevice, "GPU", "UseDebugDevice"); connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &AdvancedSettingsWidget::onResetToDefaultClicked); + connect(m_ui.showDebugMenu, &QCheckBox::toggled, m_host_interface->getMainWindow(), + &MainWindow::updateDebugMenuVisibility, Qt::QueuedConnection); dialog->registerWidgetHelp(m_ui.gpuUseDebugDevice, tr("Use Debug Host GPU Device"), tr("Unchecked"), tr("Enables the usage of debug devices and shaders for rendering APIs which support them. " diff --git a/src/duckstation-qt/advancedsettingswidget.ui b/src/duckstation-qt/advancedsettingswidget.ui index 897aedfc2..d1ba75000 100644 --- a/src/duckstation-qt/advancedsettingswidget.ui +++ b/src/duckstation-qt/advancedsettingswidget.ui @@ -207,7 +207,14 @@ System Settings - + + + + Show Debug Menu + + + + Use Debug Host GPU Device diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index f32f55cc8..9d853c696 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -451,6 +451,8 @@ void MainWindow::setupAdditionalUi() m_status_frame_time_widget->setFixedSize(190, 16); m_status_frame_time_widget->hide(); + updateDebugMenuVisibility(); + for (u32 i = 0; i < static_cast(CPUExecutionMode::Count); i++) { const CPUExecutionMode mode = static_cast(i); @@ -847,6 +849,12 @@ void MainWindow::startupUpdateCheck() checkForUpdates(false); } +void MainWindow::updateDebugMenuVisibility() +{ + const bool visible = m_host_interface->GetBoolSettingValue("Main", "ShowDebugMenu", false); + m_ui.menuDebug->menuAction()->setVisible(visible); +} + void MainWindow::checkForUpdates(bool display_message) { if (!AutoUpdaterDialog::isSupported()) diff --git a/src/duckstation-qt/mainwindow.h b/src/duckstation-qt/mainwindow.h index 0e1d0c2d7..f5c0308d3 100644 --- a/src/duckstation-qt/mainwindow.h +++ b/src/duckstation-qt/mainwindow.h @@ -29,6 +29,10 @@ public: /// Performs update check if enabled in settings. void startupUpdateCheck(); +public Q_SLOTS: + /// Updates debug menu visibility (hides if disabled). + void updateDebugMenuVisibility(); + private Q_SLOTS: void reportError(const QString& message); void reportMessage(const QString& message);