AdvancedPane: Add a button to restore default settings
This commit is contained in:
11 files changed
+139
-34
No files matched your search
@@ -17,6 +17,9 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <cmath>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/Config/Enums.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
@@ -28,10 +31,15 @@
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigFloatSlider.h"
|
||||
#include "DolphinQt/Config/ConfigControls/ConfigSlider.h"
|
||||
#include "DolphinQt/QtUtils/AnalyticsPrompt.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
#include "UICommon/UICommon.h"
|
||||
|
||||
static const std::map<PowerPC::CPUCore, const char*> CPU_CORE_NAMES = {
|
||||
{PowerPC::CPUCore::Interpreter, QT_TR_NOOP("Interpreter (slowest)")},
|
||||
{PowerPC::CPUCore::CachedInterpreter, QT_TR_NOOP("Cached Interpreter (slower)")},
|
||||
@@ -284,6 +292,15 @@ void AdvancedPane::CreateLayout()
|
||||
"your current system time."
|
||||
"<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>"));
|
||||
|
||||
auto* reset_group = new QGroupBox(tr("Reset Dolphin Settings"));
|
||||
reset_group->setLayout(new QVBoxLayout());
|
||||
main_layout->addWidget(reset_group);
|
||||
|
||||
m_reset_button = new NonDefaultQPushButton(tr("Reset All Settings"));
|
||||
connect(m_reset_button, &QPushButton::clicked, this, &AdvancedPane::OnResetButtonClicked);
|
||||
|
||||
reset_group->layout()->addWidget(m_reset_button);
|
||||
|
||||
main_layout->addStretch(1);
|
||||
}
|
||||
|
||||
@@ -366,4 +383,30 @@ void AdvancedPane::Update()
|
||||
initial_date_time.setSecsSinceEpoch(Config::Get(Config::MAIN_CUSTOM_RTC_VALUE));
|
||||
m_custom_rtc_datetime->setEnabled(enable_custom_rtc_widgets);
|
||||
SignalBlocking(m_custom_rtc_datetime)->setDateTime(initial_date_time);
|
||||
|
||||
m_reset_button->setEnabled(is_uninitialized);
|
||||
}
|
||||
|
||||
void AdvancedPane::OnResetButtonClicked()
|
||||
{
|
||||
if (ModalMessageBox::question(
|
||||
this, tr("Reset Dolphin Settings"),
|
||||
tr("Are you sure you want to restore all Dolphin settings to their default "
|
||||
"values? This action cannot be undone!\n"
|
||||
"All customizations or changes you have made will be lost.\n\n"
|
||||
"Do you want to proceed?"),
|
||||
ModalMessageBox::StandardButtons(ModalMessageBox::Yes | ModalMessageBox::No),
|
||||
ModalMessageBox::No, Qt::WindowModality::WindowModal) == ModalMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SConfig::ResetAllSettings();
|
||||
UICommon::SetUserDirectory(File::GetUserPath(D_USER_IDX));
|
||||
|
||||
emit Settings::Instance().ConfigChanged();
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
ShowAnalyticsPrompt(this);
|
||||
#endif
|
||||
}
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
class ConfigBool;
|
||||
@@ -34,6 +33,8 @@ private:
|
||||
void ConnectLayout();
|
||||
void Update();
|
||||
|
||||
void OnResetButtonClicked();
|
||||
|
||||
QComboBox* m_cpu_emulation_engine_combobox;
|
||||
ConfigBool* m_enable_mmu_checkbox;
|
||||
ConfigBool* m_pause_on_panic_checkbox;
|
||||
@@ -54,4 +55,6 @@ private:
|
||||
QLabel* m_mem1_label;
|
||||
ConfigSliderU32* m_mem2_override_slider;
|
||||
QLabel* m_mem2_label;
|
||||
|
||||
QPushButton* m_reset_button;
|
||||
};
|
||||
Reference in new issue
Block a user