Qt: Hide debug menu by default

This commit is contained in:
Connor McLaughlin 2020-08-19 00:01:57 +10:00
parent 6d75f42e12
commit 67fb9253cb
4 changed files with 24 additions and 1 deletions

View File

@ -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. "

View File

@ -207,7 +207,14 @@
<string>System Settings</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<item row="0" column="0">
<widget class="QCheckBox" name="showDebugMenu">
<property name="text">
<string>Show Debug Menu</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="gpuUseDebugDevice">
<property name="text">
<string>Use Debug Host GPU Device</string>

View File

@ -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<u32>(CPUExecutionMode::Count); i++)
{
const CPUExecutionMode mode = static_cast<CPUExecutionMode>(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())

View File

@ -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);