1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-06-07 22:47:46 +00:00

Implement saving profile settings

This commit is contained in:
redstrate 2021-11-09 12:16:14 -05:00
parent 48c4bd10c4
commit 30fed295e4
3 changed files with 14 additions and 0 deletions

View file

@ -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);

View file

@ -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();
}
}

View file

@ -64,6 +64,7 @@ public:
void setSSL(QNetworkRequest& request);
QString readVersion(QString path);
void readInitialInformation();
void saveSettings();
QSettings settings;