From 30fed295e4ba8cf9a4bbb2f736a357df66a29c7b Mon Sep 17 00:00:00 2001 From: redstrate Date: Tue, 9 Nov 2021 12:16:14 -0500 Subject: [PATCH] Implement saving profile settings --- src/settingswindow.cpp | 2 ++ src/xivlauncher.cpp | 11 +++++++++++ src/xivlauncher.h | 1 + 3 files changed, 14 insertions(+) diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index 91d895a..58e1df2 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -39,6 +39,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window getCurrentProfile().name = nameEdit->text(); reloadControls(); + this->window.saveSettings(); }); mainLayout->addWidget(nameEdit, 2, 0); @@ -55,6 +56,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window connect(directXCombo, &QComboBox::currentIndexChanged, [=](int index) { getCurrentProfile().useDX9 = directXCombo->currentIndex() == 1; + this->window.saveSettings(); }); auto currentGameDirectory = new QLabel(window.currentProfile().gamePath); diff --git a/src/xivlauncher.cpp b/src/xivlauncher.cpp index 49b37f7..72f125f 100755 --- a/src/xivlauncher.cpp +++ b/src/xivlauncher.cpp @@ -185,6 +185,7 @@ void LauncherWindow::readInitialInformation() { profile.bootVersion = readVersion(profile.gamePath + "/boot/ffxivboot.ver"); profile.gameVersion = readVersion(profile.gamePath + "/game/ffxivgame.ver"); + profile.useDX9 = settings.value("useDX9", false).toBool(); profile.useEsync = settings.value("useEsync", false).toBool(); profile.useGamemode = settings.value("useGamemode", false).toBool(); profile.useGamescope = settings.value("useGamescope", false).toBool(); @@ -396,4 +397,14 @@ int LauncherWindow::addProfile() { settingsChanged(); return profileSettings.size() - 1; +} + +void LauncherWindow::saveSettings() { + for(auto profile : profileSettings) { + settings.beginGroup(profile.name); + + settings.setValue("useDX9", profile.useDX9); + + settings.endGroup(); + } } \ No newline at end of file diff --git a/src/xivlauncher.h b/src/xivlauncher.h index 8f64f7f..ac5dcde 100755 --- a/src/xivlauncher.h +++ b/src/xivlauncher.h @@ -64,6 +64,7 @@ public: void setSSL(QNetworkRequest& request); QString readVersion(QString path); void readInitialInformation(); + void saveSettings(); QSettings settings;