summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-10-25 00:07:14 +0200
committerGitHub <noreply@github.com>2018-10-25 00:07:14 +0200
commit3a6e76e9b56db63f3f444c13e97d62124b94f31d (patch)
tree4b1b12418a6023edc829cd44ad463d749e7464b8
parentMerge pull request #1565 from lioncash/audio (diff)
parentyuzu/configuration/config: Use a std::unique_ptr for qt_config instead of a raw pointer (diff)
downloadyuzu-3a6e76e9b56db63f3f444c13e97d62124b94f31d.tar
yuzu-3a6e76e9b56db63f3f444c13e97d62124b94f31d.tar.gz
yuzu-3a6e76e9b56db63f3f444c13e97d62124b94f31d.tar.bz2
yuzu-3a6e76e9b56db63f3f444c13e97d62124b94f31d.tar.lz
yuzu-3a6e76e9b56db63f3f444c13e97d62124b94f31d.tar.xz
yuzu-3a6e76e9b56db63f3f444c13e97d62124b94f31d.tar.zst
yuzu-3a6e76e9b56db63f3f444c13e97d62124b94f31d.zip
-rw-r--r--src/yuzu/configuration/config.cpp13
-rw-r--r--src/yuzu/configuration/config.h14
2 files changed, 14 insertions, 13 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;
};