diff options
Diffstat (limited to 'src/yuzu/configuration')
-rw-r--r-- | src/yuzu/configuration/config.cpp | 13 | ||||
-rw-r--r-- | src/yuzu/configuration/config.h | 14 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 8 |
3 files changed, 18 insertions, 17 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 1fe9a7edd..d4fd60a73 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -13,11 +13,16 @@ Config::Config() { // TODO: Don't hardcode the path; let the frontend decide where to put the config files. qt_config_loc = FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini"; FileUtil::CreateFullPath(qt_config_loc); - qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat); + qt_config = + std::make_unique<QSettings>(QString::fromStdString(qt_config_loc), QSettings::IniFormat); Reload(); } +Config::~Config() { + Save(); +} + const std::array<int, Settings::NativeButton::NumButtons> Config::default_buttons = { Qt::Key_A, Qt::Key_S, Qt::Key_Z, Qt::Key_X, Qt::Key_3, Qt::Key_4, Qt::Key_Q, Qt::Key_W, Qt::Key_1, Qt::Key_2, Qt::Key_N, Qt::Key_M, Qt::Key_F, Qt::Key_T, @@ -342,9 +347,3 @@ void Config::Reload() { void Config::Save() { SaveValues(); } - -Config::~Config() { - Save(); - - delete qt_config; -} diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index cbf745ea2..9c99c1b75 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h @@ -5,6 +5,7 @@ #pragma once #include <array> +#include <memory> #include <string> #include <QVariant> #include "core/settings.h" @@ -12,12 +13,6 @@ class QSettings; class Config { - QSettings* qt_config; - std::string qt_config_loc; - - void ReadValues(); - void SaveValues(); - public: Config(); ~Config(); @@ -27,4 +22,11 @@ public: static const std::array<int, Settings::NativeButton::NumButtons> default_buttons; static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs; + +private: + void ReadValues(); + void SaveValues(); + + std::unique_ptr<QSettings> qt_config; + std::string qt_config_loc; }; diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 83cc49dfc..0bc307e99 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -153,7 +153,7 @@ void ConfigureSystem::UpdateCurrentUser() { ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS); const auto& current_user = profile_manager->GetUser(Settings::values.current_user); - ASSERT(current_user != boost::none); + ASSERT(current_user != std::nullopt); const auto username = GetAccountUsername(*current_user); scene->clear(); @@ -252,7 +252,7 @@ void ConfigureSystem::AddUser() { void ConfigureSystem::RenameUser() { const auto user = tree_view->currentIndex().row(); const auto uuid = profile_manager->GetUser(user); - ASSERT(uuid != boost::none); + ASSERT(uuid != std::nullopt); const auto username = GetAccountUsername(*uuid); Service::Account::ProfileBase profile; @@ -292,7 +292,7 @@ void ConfigureSystem::RenameUser() { void ConfigureSystem::DeleteUser() { const auto index = tree_view->currentIndex().row(); const auto uuid = profile_manager->GetUser(index); - ASSERT(uuid != boost::none); + ASSERT(uuid != std::nullopt); const auto username = GetAccountUsername(*uuid); const auto confirm = @@ -320,7 +320,7 @@ void ConfigureSystem::DeleteUser() { void ConfigureSystem::SetUserImage() { const auto index = tree_view->currentIndex().row(); const auto uuid = profile_manager->GetUser(index); - ASSERT(uuid != boost::none); + ASSERT(uuid != std::nullopt); const auto username = GetAccountUsername(*uuid); const auto file = QFileDialog::getOpenFileName(this, tr("Select User Image"), QString(), |