mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 04:37:46 +00:00
Make custom game directory function again
This commit is contained in:
parent
bb64bd5a72
commit
b4ee5d1a4d
3 changed files with 13 additions and 6 deletions
|
@ -59,22 +59,25 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
|
||||||
this->window.saveSettings();
|
this->window.saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto currentGameDirectory = new QLabel(window.currentProfile().gamePath);
|
currentGameDirectory = new QLabel(window.currentProfile().gamePath);
|
||||||
currentGameDirectory->setWordWrap(true);
|
currentGameDirectory->setWordWrap(true);
|
||||||
gameBoxLayout->addRow("Game Directory", currentGameDirectory);
|
gameBoxLayout->addRow("Game Directory", currentGameDirectory);
|
||||||
|
|
||||||
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
||||||
connect(selectDirectoryButton, &QPushButton::pressed, [this, currentGameDirectory] {
|
connect(selectDirectoryButton, &QPushButton::pressed, [this] {
|
||||||
this->window.currentProfile().gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
getCurrentProfile().gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
||||||
currentGameDirectory->setText(this->window.currentProfile().gamePath);
|
|
||||||
|
|
||||||
this->window.readInitialInformation();
|
this->reloadControls();
|
||||||
|
this->window.saveSettings();
|
||||||
|
|
||||||
|
// TODO: replace this call with a dedicated "read version information" call or something similar
|
||||||
|
//this->window.readInitialInformation();
|
||||||
});
|
});
|
||||||
gameBoxLayout->addWidget(selectDirectoryButton);
|
gameBoxLayout->addWidget(selectDirectoryButton);
|
||||||
|
|
||||||
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
||||||
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
||||||
openPath(this->window.currentProfile().gamePath);
|
openPath(getCurrentProfile().gamePath);
|
||||||
});
|
});
|
||||||
gameBoxLayout->addWidget(gameDirectoryButton);
|
gameBoxLayout->addWidget(gameDirectoryButton);
|
||||||
|
|
||||||
|
@ -260,6 +263,7 @@ void SettingsWindow::reloadControls() {
|
||||||
ProfileSettings& profile = window.getProfile(profileWidget->currentRow());
|
ProfileSettings& profile = window.getProfile(profileWidget->currentRow());
|
||||||
nameEdit->setText(profile.name);
|
nameEdit->setText(profile.name);
|
||||||
directXCombo->setCurrentIndex(profile.useDX9 ? 1 : 0);
|
directXCombo->setCurrentIndex(profile.useDX9 ? 1 : 0);
|
||||||
|
currentGameDirectory->setText(profile.gamePath);
|
||||||
|
|
||||||
serverType->setCurrentIndex(profile.isSapphire ? 1 : 0);
|
serverType->setCurrentIndex(profile.isSapphire ? 1 : 0);
|
||||||
rememberUsernameBox->setChecked(profile.rememberUsername);
|
rememberUsernameBox->setChecked(profile.rememberUsername);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
class LauncherWindow;
|
class LauncherWindow;
|
||||||
struct ProfileSettings;
|
struct ProfileSettings;
|
||||||
|
@ -24,6 +25,7 @@ private:
|
||||||
|
|
||||||
QLineEdit* nameEdit = nullptr;
|
QLineEdit* nameEdit = nullptr;
|
||||||
QComboBox* directXCombo = nullptr;
|
QComboBox* directXCombo = nullptr;
|
||||||
|
QLabel* currentGameDirectory = nullptr;
|
||||||
|
|
||||||
QComboBox* serverType = nullptr;
|
QComboBox* serverType = nullptr;
|
||||||
QCheckBox* rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr;
|
QCheckBox* rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr;
|
||||||
|
|
|
@ -385,6 +385,7 @@ void LauncherWindow::saveSettings() {
|
||||||
settings.beginGroup(profile.name);
|
settings.beginGroup(profile.name);
|
||||||
|
|
||||||
settings.setValue("useDX9", profile.useDX9);
|
settings.setValue("useDX9", profile.useDX9);
|
||||||
|
settings.setValue("gamePath", profile.gamePath);
|
||||||
|
|
||||||
settings.setValue("isSapphire", profile.isSapphire);
|
settings.setValue("isSapphire", profile.isSapphire);
|
||||||
settings.setValue("rememberUsername", profile.rememberUsername);
|
settings.setValue("rememberUsername", profile.rememberUsername);
|
||||||
|
|
Loading…
Add table
Reference in a new issue