diff options
author | Lioncash <mathew1800@gmail.com> | 2018-10-24 03:49:50 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-10-24 06:24:02 +0200 |
commit | 6949f73149644820c678c1ffb57d18f21259740d (patch) | |
tree | e797473be95cfe31205e61f02160e6d28521733e | |
parent | yuzu/configuration/config: Reorganize member variable and function layout (diff) | |
download | yuzu-6949f73149644820c678c1ffb57d18f21259740d.tar yuzu-6949f73149644820c678c1ffb57d18f21259740d.tar.gz yuzu-6949f73149644820c678c1ffb57d18f21259740d.tar.bz2 yuzu-6949f73149644820c678c1ffb57d18f21259740d.tar.lz yuzu-6949f73149644820c678c1ffb57d18f21259740d.tar.xz yuzu-6949f73149644820c678c1ffb57d18f21259740d.tar.zst yuzu-6949f73149644820c678c1ffb57d18f21259740d.zip |
-rw-r--r-- | src/yuzu/configuration/config.cpp | 13 | ||||
-rw-r--r-- | src/yuzu/configuration/config.h | 3 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index d029590ff..a1e13ed8f 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -12,11 +12,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, @@ -337,9 +342,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 a1d0fbe7e..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" @@ -26,6 +27,6 @@ private: void ReadValues(); void SaveValues(); - QSettings* qt_config; + std::unique_ptr<QSettings> qt_config; std::string qt_config_loc; }; |