mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 12:47:44 +00:00
Add option to close automatically when game is launched
This commit is contained in:
parent
d10525a24f
commit
5e1fc20276
5 changed files with 294 additions and 217 deletions
|
@ -197,7 +197,14 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
|
||||||
arguments.append(argJoined);
|
arguments.append(argJoined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(gameProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||||
|
[=](int exitCode, QProcess::ExitStatus exitStatus){
|
||||||
|
gameClosed();
|
||||||
|
});
|
||||||
|
|
||||||
launchExecutable(profile, gameProcess, arguments);
|
launchExecutable(profile, gameProcess, arguments);
|
||||||
|
|
||||||
|
successfulLaunch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::launchExecutable(const ProfileSettings& profile, const QStringList args) {
|
void LauncherCore::launchExecutable(const ProfileSettings& profile, const QStringList args) {
|
||||||
|
@ -269,6 +276,8 @@ QString LauncherCore::readVersion(QString path) {
|
||||||
void LauncherCore::readInitialInformation() {
|
void LauncherCore::readInitialInformation() {
|
||||||
defaultProfileIndex = settings.value("defaultProfile", 0).toInt();
|
defaultProfileIndex = settings.value("defaultProfile", 0).toInt();
|
||||||
|
|
||||||
|
appSettings.closeWhenLaunched = settings.value("closeWhenLaunched", true).toBool();
|
||||||
|
|
||||||
gamescopeAvailable = checkIfInPath("gamescope");
|
gamescopeAvailable = checkIfInPath("gamescope");
|
||||||
gamemodeAvailable = checkIfInPath("gamemoderun");
|
gamemodeAvailable = checkIfInPath("gamemoderun");
|
||||||
|
|
||||||
|
@ -512,6 +521,7 @@ int LauncherCore::deleteProfile(QString name) {
|
||||||
|
|
||||||
void LauncherCore::saveSettings() {
|
void LauncherCore::saveSettings() {
|
||||||
settings.setValue("defaultProfile", defaultProfileIndex);
|
settings.setValue("defaultProfile", defaultProfileIndex);
|
||||||
|
settings.setValue("closeWhenLaunched", appSettings.closeWhenLaunched);
|
||||||
|
|
||||||
for(int i = 0; i < profileSettings.size(); i++) {
|
for(int i = 0; i < profileSettings.size(); i++) {
|
||||||
const auto& profile = profileSettings[i];
|
const auto& profile = profileSettings[i];
|
||||||
|
|
|
@ -57,6 +57,10 @@ struct ProfileSettings {
|
||||||
bool useSteam = false;
|
bool useSteam = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AppSettings {
|
||||||
|
bool closeWhenLaunched = true;
|
||||||
|
};
|
||||||
|
|
||||||
struct LoginInformation {
|
struct LoginInformation {
|
||||||
const ProfileSettings* settings = nullptr;
|
const ProfileSettings* settings = nullptr;
|
||||||
|
|
||||||
|
@ -112,9 +116,13 @@ public:
|
||||||
bool gamescopeAvailable = false;
|
bool gamescopeAvailable = false;
|
||||||
bool gamemodeAvailable = false;
|
bool gamemodeAvailable = false;
|
||||||
|
|
||||||
|
AppSettings appSettings;
|
||||||
|
|
||||||
int defaultProfileIndex = 0;
|
int defaultProfileIndex = 0;
|
||||||
signals:
|
signals:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
void successfulLaunch();
|
||||||
|
void gameClosed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readExpansionVersions(ProfileSettings& info, int max);
|
void readExpansionVersions(ProfileSettings& info, int max);
|
||||||
|
|
|
@ -146,6 +146,15 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(&core, &LauncherCore::successfulLaunch, [&] {
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(&core, &LauncherCore::gameClosed, [&] {
|
||||||
|
if(core.appSettings.closeWhenLaunched)
|
||||||
|
QCoreApplication::quit();
|
||||||
|
});
|
||||||
|
|
||||||
reloadControls();
|
reloadControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,308 +26,353 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
||||||
auto tabWidget = new QTabWidget();
|
auto tabWidget = new QTabWidget();
|
||||||
mainLayout->addWidget(tabWidget);
|
mainLayout->addWidget(tabWidget);
|
||||||
|
|
||||||
auto profileTabWidget = new QWidget();
|
// general tab
|
||||||
tabWidget->addTab(profileTabWidget, "Profiles");
|
{
|
||||||
|
auto generalTabWidget = new QWidget();
|
||||||
|
tabWidget->addTab(generalTabWidget, "General");
|
||||||
|
|
||||||
auto profileLayout = new QGridLayout();
|
auto layout = new QFormLayout();
|
||||||
profileTabWidget->setLayout(profileLayout);
|
generalTabWidget->setLayout(layout);
|
||||||
|
|
||||||
profileWidget = new QListWidget();
|
closeWhenLaunched = new QCheckBox("Close Astra when game is launched");
|
||||||
profileWidget->addItem("INVALID *DEBUG*");
|
connect(closeWhenLaunched, &QCheckBox::stateChanged, [&](int state) {
|
||||||
profileWidget->setCurrentRow(0);
|
core.appSettings.closeWhenLaunched = state;
|
||||||
|
|
||||||
connect(profileWidget, &QListWidget::currentRowChanged, this, &SettingsWindow::reloadControls);
|
core.saveSettings();
|
||||||
|
});
|
||||||
|
layout->addWidget(closeWhenLaunched);
|
||||||
|
}
|
||||||
|
|
||||||
profileLayout->addWidget(profileWidget, 0, 0, 0, 1);
|
// profile tab
|
||||||
|
{
|
||||||
|
auto profileTabWidget = new QWidget();
|
||||||
|
tabWidget->addTab(profileTabWidget, "Profiles");
|
||||||
|
|
||||||
auto addProfileButton = new QPushButton("Add Profile");
|
auto profileLayout = new QGridLayout();
|
||||||
connect(addProfileButton, &QPushButton::pressed, [=] {
|
profileTabWidget->setLayout(profileLayout);
|
||||||
profileWidget->setCurrentRow(this->core.addProfile());
|
|
||||||
|
|
||||||
this->core.saveSettings();
|
profileWidget = new QListWidget();
|
||||||
});
|
profileWidget->addItem("INVALID *DEBUG*");
|
||||||
profileLayout->addWidget(addProfileButton, 2, 0);
|
profileWidget->setCurrentRow(0);
|
||||||
|
|
||||||
deleteProfileButton = new QPushButton("Delete Profile");
|
connect(profileWidget, &QListWidget::currentRowChanged, this,
|
||||||
connect(deleteProfileButton, &QPushButton::pressed, [=] {
|
&SettingsWindow::reloadControls);
|
||||||
profileWidget->setCurrentRow(this->core.deleteProfile(getCurrentProfile().name));
|
|
||||||
|
|
||||||
this->core.saveSettings();
|
profileLayout->addWidget(profileWidget, 0, 0, 0, 1);
|
||||||
});
|
|
||||||
profileLayout->addWidget(deleteProfileButton, 3, 0);
|
|
||||||
|
|
||||||
nameEdit = new QLineEdit();
|
auto addProfileButton = new QPushButton("Add Profile");
|
||||||
connect(nameEdit, &QLineEdit::editingFinished, [=] {
|
connect(addProfileButton, &QPushButton::pressed, [=] {
|
||||||
getCurrentProfile().name = nameEdit->text();
|
profileWidget->setCurrentRow(this->core.addProfile());
|
||||||
|
|
||||||
reloadControls();
|
this->core.saveSettings();
|
||||||
this->core.saveSettings();
|
});
|
||||||
});
|
profileLayout->addWidget(addProfileButton, 2, 0);
|
||||||
profileLayout->addWidget(nameEdit, 0, 1);
|
|
||||||
|
|
||||||
auto gameBox = new QGroupBox("Game Options");
|
deleteProfileButton = new QPushButton("Delete Profile");
|
||||||
auto gameBoxLayout = new QFormLayout();
|
connect(deleteProfileButton, &QPushButton::pressed, [=] {
|
||||||
gameBox->setLayout(gameBoxLayout);
|
profileWidget->setCurrentRow(
|
||||||
|
this->core.deleteProfile(getCurrentProfile().name));
|
||||||
|
|
||||||
profileLayout->addWidget(gameBox, 1, 1);
|
this->core.saveSettings();
|
||||||
|
});
|
||||||
|
profileLayout->addWidget(deleteProfileButton, 3, 0);
|
||||||
|
|
||||||
directXCombo = new QComboBox();
|
nameEdit = new QLineEdit();
|
||||||
directXCombo->addItem("DirectX 11");
|
connect(nameEdit, &QLineEdit::editingFinished, [=] {
|
||||||
directXCombo->addItem("DirectX 9");
|
getCurrentProfile().name = nameEdit->text();
|
||||||
gameBoxLayout->addRow("DirectX Version", directXCombo);
|
|
||||||
|
|
||||||
connect(directXCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index) {
|
reloadControls();
|
||||||
getCurrentProfile().useDX9 = directXCombo->currentIndex() == 1;
|
this->core.saveSettings();
|
||||||
this->core.saveSettings();
|
});
|
||||||
});
|
profileLayout->addWidget(nameEdit, 0, 1);
|
||||||
|
|
||||||
currentGameDirectory = new QLineEdit();
|
auto gameBox = new QGroupBox("Game Options");
|
||||||
currentGameDirectory->setReadOnly(true);
|
auto gameBoxLayout = new QFormLayout();
|
||||||
gameBoxLayout->addRow("Game Directory", currentGameDirectory);
|
gameBox->setLayout(gameBoxLayout);
|
||||||
|
|
||||||
auto gameDirButtonLayout = new QHBoxLayout();
|
profileLayout->addWidget(gameBox, 1, 1);
|
||||||
auto gameDirButtonContainer = new QWidget();
|
|
||||||
gameDirButtonContainer->setLayout(gameDirButtonLayout);
|
|
||||||
gameBoxLayout->addWidget(gameDirButtonContainer);
|
|
||||||
|
|
||||||
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
directXCombo = new QComboBox();
|
||||||
connect(selectDirectoryButton, &QPushButton::pressed, [this] {
|
directXCombo->addItem("DirectX 11");
|
||||||
getCurrentProfile().gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
directXCombo->addItem("DirectX 9");
|
||||||
|
gameBoxLayout->addRow("DirectX Version", directXCombo);
|
||||||
|
|
||||||
this->reloadControls();
|
connect(directXCombo,
|
||||||
this->core.saveSettings();
|
static_cast<void (QComboBox::*)(int)>(
|
||||||
|
&QComboBox::currentIndexChanged),
|
||||||
|
[=](int index) {
|
||||||
|
getCurrentProfile().useDX9 =
|
||||||
|
directXCombo->currentIndex() == 1;
|
||||||
|
this->core.saveSettings();
|
||||||
|
});
|
||||||
|
|
||||||
this->core.readGameVersion();
|
currentGameDirectory = new QLineEdit();
|
||||||
});
|
currentGameDirectory->setReadOnly(true);
|
||||||
gameDirButtonLayout->addWidget(selectDirectoryButton);
|
gameBoxLayout->addRow("Game Directory", currentGameDirectory);
|
||||||
|
|
||||||
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
auto gameDirButtonLayout = new QHBoxLayout();
|
||||||
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
auto gameDirButtonContainer = new QWidget();
|
||||||
openPath(getCurrentProfile().gamePath);
|
gameDirButtonContainer->setLayout(gameDirButtonLayout);
|
||||||
});
|
gameBoxLayout->addWidget(gameDirButtonContainer);
|
||||||
gameDirButtonLayout->addWidget(gameDirectoryButton);
|
|
||||||
|
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
||||||
|
connect(selectDirectoryButton, &QPushButton::pressed, [this] {
|
||||||
|
getCurrentProfile().gamePath =
|
||||||
|
QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
||||||
|
|
||||||
|
this->reloadControls();
|
||||||
|
this->core.saveSettings();
|
||||||
|
|
||||||
|
this->core.readGameVersion();
|
||||||
|
});
|
||||||
|
gameDirButtonLayout->addWidget(selectDirectoryButton);
|
||||||
|
|
||||||
|
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
||||||
|
connect(gameDirectoryButton, &QPushButton::pressed,
|
||||||
|
[this] { openPath(getCurrentProfile().gamePath); });
|
||||||
|
gameDirButtonLayout->addWidget(gameDirectoryButton);
|
||||||
|
|
||||||
#ifdef ENABLE_WATCHDOG
|
#ifdef ENABLE_WATCHDOG
|
||||||
enableWatchdog = new QCheckBox("Enable Watchdog (X11 only)");
|
enableWatchdog = new QCheckBox("Enable Watchdog (X11 only)");
|
||||||
gameBoxLayout->addWidget(enableWatchdog);
|
gameBoxLayout->addWidget(enableWatchdog);
|
||||||
|
|
||||||
connect(enableWatchdog, &QCheckBox::stateChanged, [this](int state) {
|
connect(enableWatchdog, &QCheckBox::stateChanged, [this](int state) {
|
||||||
getCurrentProfile().enableWatchdog = state;
|
getCurrentProfile().enableWatchdog = state;
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
expansionVersionLabel = new QLabel();
|
expansionVersionLabel = new QLabel();
|
||||||
gameBoxLayout->addRow("Game Version", expansionVersionLabel);
|
gameBoxLayout->addRow("Game Version", expansionVersionLabel);
|
||||||
|
|
||||||
auto loginBox = new QGroupBox("Login Options");
|
auto loginBox = new QGroupBox("Login Options");
|
||||||
auto loginBoxLayout = new QFormLayout();
|
auto loginBoxLayout = new QFormLayout();
|
||||||
loginBox->setLayout(loginBoxLayout);
|
loginBox->setLayout(loginBoxLayout);
|
||||||
|
|
||||||
profileLayout->addWidget(loginBox, 2, 1);
|
profileLayout->addWidget(loginBox, 2, 1);
|
||||||
|
|
||||||
encryptArgumentsBox = new QCheckBox();
|
encryptArgumentsBox = new QCheckBox();
|
||||||
connect(encryptArgumentsBox, &QCheckBox::stateChanged, [=](int) {
|
connect(encryptArgumentsBox, &QCheckBox::stateChanged, [=](int) {
|
||||||
getCurrentProfile().encryptArguments = encryptArgumentsBox->isChecked();
|
getCurrentProfile().encryptArguments =
|
||||||
|
encryptArgumentsBox->isChecked();
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
loginBoxLayout->addRow("Encrypt Game Arguments", encryptArgumentsBox);
|
loginBoxLayout->addRow("Encrypt Game Arguments", encryptArgumentsBox);
|
||||||
|
|
||||||
serverType = new QComboBox();
|
serverType = new QComboBox();
|
||||||
serverType->insertItem(0, "Square Enix");
|
serverType->insertItem(0, "Square Enix");
|
||||||
serverType->insertItem(1, "Sapphire");
|
serverType->insertItem(1, "Sapphire");
|
||||||
|
|
||||||
connect(serverType, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index) {
|
connect(serverType,
|
||||||
getCurrentProfile().isSapphire = index == 1;
|
static_cast<void (QComboBox::*)(int)>(
|
||||||
|
&QComboBox::currentIndexChanged),
|
||||||
|
[=](int index) {
|
||||||
|
getCurrentProfile().isSapphire = index == 1;
|
||||||
|
|
||||||
reloadControls();
|
reloadControls();
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
loginBoxLayout->addRow("Server Lobby", serverType);
|
loginBoxLayout->addRow("Server Lobby", serverType);
|
||||||
|
|
||||||
lobbyServerURL = new QLineEdit();
|
lobbyServerURL = new QLineEdit();
|
||||||
connect(lobbyServerURL, &QLineEdit::editingFinished, [=] {
|
connect(lobbyServerURL, &QLineEdit::editingFinished, [=] {
|
||||||
getCurrentProfile().lobbyURL = lobbyServerURL->text();
|
getCurrentProfile().lobbyURL = lobbyServerURL->text();
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
loginBoxLayout->addRow("Lobby URL", lobbyServerURL);
|
loginBoxLayout->addRow("Lobby URL", lobbyServerURL);
|
||||||
|
|
||||||
rememberUsernameBox = new QCheckBox();
|
rememberUsernameBox = new QCheckBox();
|
||||||
connect(rememberUsernameBox, &QCheckBox::stateChanged, [=](int) {
|
connect(rememberUsernameBox, &QCheckBox::stateChanged, [=](int) {
|
||||||
getCurrentProfile().rememberUsername = rememberUsernameBox->isChecked();
|
getCurrentProfile().rememberUsername =
|
||||||
|
rememberUsernameBox->isChecked();
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
loginBoxLayout->addRow("Remember Username?", rememberUsernameBox);
|
loginBoxLayout->addRow("Remember Username?", rememberUsernameBox);
|
||||||
|
|
||||||
rememberPasswordBox = new QCheckBox();
|
rememberPasswordBox = new QCheckBox();
|
||||||
connect(rememberPasswordBox, &QCheckBox::stateChanged, [=](int) {
|
connect(rememberPasswordBox, &QCheckBox::stateChanged, [=](int) {
|
||||||
getCurrentProfile().rememberPassword = rememberPasswordBox->isChecked();
|
getCurrentProfile().rememberPassword =
|
||||||
|
rememberPasswordBox->isChecked();
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
loginBoxLayout->addRow("Remember Password?", rememberPasswordBox);
|
loginBoxLayout->addRow("Remember Password?", rememberPasswordBox);
|
||||||
|
|
||||||
useSteamBox = new QCheckBox();
|
useSteamBox = new QCheckBox();
|
||||||
connect(useSteamBox, &QCheckBox::stateChanged, [=](int) {
|
connect(useSteamBox, &QCheckBox::stateChanged, [=](int) {
|
||||||
getCurrentProfile().useSteam = useSteamBox->isChecked();
|
getCurrentProfile().useSteam = useSteamBox->isChecked();
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
loginBoxLayout->addRow("Use Steam?", useSteamBox);
|
loginBoxLayout->addRow("Use Steam?", useSteamBox);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||||
auto wineBox = new QGroupBox("Wine Options");
|
auto wineBox = new QGroupBox("Wine Options");
|
||||||
auto wineBoxLayout = new QFormLayout();
|
auto wineBoxLayout = new QFormLayout();
|
||||||
wineBox->setLayout(wineBoxLayout);
|
wineBox->setLayout(wineBoxLayout);
|
||||||
|
|
||||||
profileLayout->addWidget(wineBox, 1, 2, 1, 1);
|
profileLayout->addWidget(wineBox, 1, 2, 1, 1);
|
||||||
|
|
||||||
winePathLabel = new QLineEdit();
|
winePathLabel = new QLineEdit();
|
||||||
winePathLabel->setReadOnly(true);
|
winePathLabel->setReadOnly(true);
|
||||||
wineBoxLayout->addRow("Wine Executable", winePathLabel);
|
wineBoxLayout->addRow("Wine Executable", winePathLabel);
|
||||||
|
|
||||||
wineVersionCombo = new QComboBox();
|
wineVersionCombo = new QComboBox();
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
wineVersionCombo->insertItem(2, "FFXIV Built-In");
|
wineVersionCombo->insertItem(2, "FFXIV Built-In");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wineVersionCombo->insertItem(0, "System Wine");
|
wineVersionCombo->insertItem(0, "System Wine");
|
||||||
wineVersionCombo->insertItem(1, "Custom Path...");
|
wineVersionCombo->insertItem(1, "Custom Path...");
|
||||||
|
|
||||||
wineBoxLayout->addWidget(wineVersionCombo);
|
wineBoxLayout->addWidget(wineVersionCombo);
|
||||||
|
|
||||||
selectWineButton = new QPushButton("Select Wine Executable");
|
selectWineButton = new QPushButton("Select Wine Executable");
|
||||||
wineBoxLayout->addWidget(selectWineButton);
|
wineBoxLayout->addWidget(selectWineButton);
|
||||||
|
|
||||||
connect(wineVersionCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index) {
|
connect(wineVersionCombo,
|
||||||
getCurrentProfile().wineVersion = index;
|
static_cast<void (QComboBox::*)(int)>(
|
||||||
|
&QComboBox::currentIndexChanged),
|
||||||
|
[this](int index) {
|
||||||
|
getCurrentProfile().wineVersion = index;
|
||||||
|
|
||||||
this->core.readWineInfo(getCurrentProfile());
|
this->core.readWineInfo(getCurrentProfile());
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
this->reloadControls();
|
this->reloadControls();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(selectWineButton, &QPushButton::pressed, [this] {
|
connect(selectWineButton, &QPushButton::pressed, [this] {
|
||||||
getCurrentProfile().winePath = QFileDialog::getOpenFileName(this, "Open Wine Executable");
|
getCurrentProfile().winePath =
|
||||||
|
QFileDialog::getOpenFileName(this, "Open Wine Executable");
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
this->reloadControls();
|
this->reloadControls();
|
||||||
});
|
});
|
||||||
|
|
||||||
winePrefixDirectory = new QLineEdit();
|
winePrefixDirectory = new QLineEdit();
|
||||||
winePrefixDirectory->setReadOnly(true);
|
winePrefixDirectory->setReadOnly(true);
|
||||||
wineBoxLayout->addRow("Wine Prefix", winePrefixDirectory);
|
wineBoxLayout->addRow("Wine Prefix", winePrefixDirectory);
|
||||||
|
|
||||||
auto winePrefixButtonLayout = new QHBoxLayout();
|
auto winePrefixButtonLayout = new QHBoxLayout();
|
||||||
auto winePrefixButtonContainer = new QWidget();
|
auto winePrefixButtonContainer = new QWidget();
|
||||||
winePrefixButtonContainer->setLayout(winePrefixButtonLayout);
|
winePrefixButtonContainer->setLayout(winePrefixButtonLayout);
|
||||||
wineBoxLayout->addWidget(winePrefixButtonContainer);
|
wineBoxLayout->addWidget(winePrefixButtonContainer);
|
||||||
|
|
||||||
auto selectPrefixButton = new QPushButton("Select Wine Prefix");
|
auto selectPrefixButton = new QPushButton("Select Wine Prefix");
|
||||||
connect(selectPrefixButton, &QPushButton::pressed, [this] {
|
connect(selectPrefixButton, &QPushButton::pressed, [this] {
|
||||||
getCurrentProfile().winePrefixPath = QFileDialog::getExistingDirectory(this, "Open Wine Prefix");
|
getCurrentProfile().winePrefixPath =
|
||||||
|
QFileDialog::getExistingDirectory(this, "Open Wine Prefix");
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
this->reloadControls();
|
this->reloadControls();
|
||||||
});
|
});
|
||||||
winePrefixButtonLayout->addWidget(selectPrefixButton);
|
winePrefixButtonLayout->addWidget(selectPrefixButton);
|
||||||
|
|
||||||
auto openPrefixButton = new QPushButton("Open Wine Prefix");
|
auto openPrefixButton = new QPushButton("Open Wine Prefix");
|
||||||
connect(openPrefixButton, &QPushButton::pressed, [this] {
|
connect(openPrefixButton, &QPushButton::pressed,
|
||||||
openPath(getCurrentProfile().winePrefixPath);
|
[this] { openPath(getCurrentProfile().winePrefixPath); });
|
||||||
});
|
winePrefixButtonLayout->addWidget(openPrefixButton);
|
||||||
winePrefixButtonLayout->addWidget(openPrefixButton);
|
|
||||||
|
|
||||||
auto enableDXVKhud = new QCheckBox("Enable DXVK HUD");
|
auto enableDXVKhud = new QCheckBox("Enable DXVK HUD");
|
||||||
wineBoxLayout->addRow("Wine Tweaks", enableDXVKhud);
|
wineBoxLayout->addRow("Wine Tweaks", enableDXVKhud);
|
||||||
|
|
||||||
connect(enableDXVKhud, &QCheckBox::stateChanged, [this](int state) {
|
connect(enableDXVKhud, &QCheckBox::stateChanged, [this](int state) {
|
||||||
getCurrentProfile().enableDXVKhud = state;
|
getCurrentProfile().enableDXVKhud = state;
|
||||||
this->core.settings.setValue("enableDXVKhud", static_cast<bool>(state));
|
this->core.settings.setValue("enableDXVKhud",
|
||||||
});
|
static_cast<bool>(state));
|
||||||
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
useEsync = new QCheckBox("Use Better Sync Primitives (Esync, Fsync, and Futex2)");
|
useEsync = new QCheckBox(
|
||||||
wineBoxLayout->addWidget(useEsync);
|
"Use Better Sync Primitives (Esync, Fsync, and Futex2)");
|
||||||
|
wineBoxLayout->addWidget(useEsync);
|
||||||
|
|
||||||
auto esyncLabel = new QPushButton("?");
|
auto esyncLabel = new QPushButton("?");
|
||||||
connect(esyncLabel, &QPushButton::pressed, [esyncLabel] {
|
connect(esyncLabel, &QPushButton::pressed, [esyncLabel] {
|
||||||
QToolTip::showText(esyncLabel->mapToGlobal(QPoint()), "This may improve game performance, but requires a Wine and kernel with the patches included.");
|
QToolTip::showText(
|
||||||
});
|
esyncLabel->mapToGlobal(QPoint()),
|
||||||
wineBoxLayout->addWidget(esyncLabel);
|
"This may improve game performance, but requires a Wine and kernel with the patches included.");
|
||||||
|
});
|
||||||
|
wineBoxLayout->addWidget(esyncLabel);
|
||||||
|
|
||||||
connect(useEsync, &QCheckBox::stateChanged, [this](int state) {
|
connect(useEsync, &QCheckBox::stateChanged, [this](int state) {
|
||||||
getCurrentProfile().useEsync = state;
|
getCurrentProfile().useEsync = state;
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
useGamescope = new QCheckBox("Use Gamescope");
|
useGamescope = new QCheckBox("Use Gamescope");
|
||||||
wineBoxLayout->addWidget(useGamescope);
|
wineBoxLayout->addWidget(useGamescope);
|
||||||
|
|
||||||
auto gamescopeButtonLayout = new QHBoxLayout();
|
auto gamescopeButtonLayout = new QHBoxLayout();
|
||||||
auto gamescopeButtonContainer = new QWidget();
|
auto gamescopeButtonContainer = new QWidget();
|
||||||
gamescopeButtonContainer->setLayout(gamescopeButtonLayout);
|
gamescopeButtonContainer->setLayout(gamescopeButtonLayout);
|
||||||
wineBoxLayout->addWidget(gamescopeButtonContainer);
|
wineBoxLayout->addWidget(gamescopeButtonContainer);
|
||||||
|
|
||||||
auto gamescopeLabel = new QPushButton("?");
|
auto gamescopeLabel = new QPushButton("?");
|
||||||
connect(gamescopeLabel, &QPushButton::pressed, [gamescopeLabel] {
|
connect(gamescopeLabel, &QPushButton::pressed, [gamescopeLabel] {
|
||||||
QToolTip::showText(gamescopeLabel->mapToGlobal(QPoint()), "Use the micro-compositor compositor that uses Wayland and XWayland to create a nested session.\nIf you primarily use fullscreen mode, this may improve input handling especially on Wayland.");
|
QToolTip::showText(
|
||||||
});
|
gamescopeLabel->mapToGlobal(QPoint()),
|
||||||
gamescopeButtonLayout->addWidget(gamescopeLabel);
|
"Use the micro-compositor compositor that uses Wayland and XWayland to create a nested session.\nIf you primarily use fullscreen mode, this may improve input handling especially on Wayland.");
|
||||||
|
});
|
||||||
|
gamescopeButtonLayout->addWidget(gamescopeLabel);
|
||||||
|
|
||||||
configureGamescopeButton = new QPushButton("Configure...");
|
configureGamescopeButton = new QPushButton("Configure...");
|
||||||
connect(configureGamescopeButton, &QPushButton::pressed, [&] {
|
connect(configureGamescopeButton, &QPushButton::pressed, [&] {
|
||||||
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
|
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(
|
||||||
gamescopeSettingsWindow->show();
|
getCurrentProfile(), this->core, this);
|
||||||
});
|
gamescopeSettingsWindow->show();
|
||||||
gamescopeButtonLayout->addWidget(configureGamescopeButton);
|
});
|
||||||
|
gamescopeButtonLayout->addWidget(configureGamescopeButton);
|
||||||
|
|
||||||
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
|
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
|
||||||
getCurrentProfile().useGamescope = state;
|
getCurrentProfile().useGamescope = state;
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
this->reloadControls();
|
this->reloadControls();
|
||||||
});
|
});
|
||||||
|
|
||||||
useGamemode = new QCheckBox("Use GameMode");
|
useGamemode = new QCheckBox("Use GameMode");
|
||||||
wineBoxLayout->addWidget(useGamemode);
|
wineBoxLayout->addWidget(useGamemode);
|
||||||
|
|
||||||
auto gamemodeLabel = new QPushButton("?");
|
auto gamemodeLabel = new QPushButton("?");
|
||||||
connect(gamemodeLabel, &QPushButton::pressed, [gamemodeLabel] {
|
connect(gamemodeLabel, &QPushButton::pressed, [gamemodeLabel] {
|
||||||
QToolTip::showText(gamemodeLabel->mapToGlobal(QPoint()), "A special game performance enhancer, which automatically tunes your CPU scheduler among other things. This may improve game performance.");
|
QToolTip::showText(
|
||||||
});
|
gamemodeLabel->mapToGlobal(QPoint()),
|
||||||
wineBoxLayout->addWidget(gamemodeLabel);
|
"A special game performance enhancer, which automatically tunes your CPU scheduler among other things. This may improve game performance.");
|
||||||
|
});
|
||||||
|
wineBoxLayout->addWidget(gamemodeLabel);
|
||||||
|
|
||||||
connect(useGamemode, &QCheckBox::stateChanged, [this](int state) {
|
connect(useGamemode, &QCheckBox::stateChanged, [this](int state) {
|
||||||
getCurrentProfile().useGamemode = state;
|
getCurrentProfile().useGamemode = state;
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto dalamudBox = new QGroupBox("Dalamud Options");
|
auto dalamudBox = new QGroupBox("Dalamud Options");
|
||||||
auto dalamudBoxLayout = new QFormLayout();
|
auto dalamudBoxLayout = new QFormLayout();
|
||||||
dalamudBox->setLayout(dalamudBoxLayout);
|
dalamudBox->setLayout(dalamudBoxLayout);
|
||||||
|
|
||||||
profileLayout->addWidget(dalamudBox, 2, 2, 1, 1);
|
profileLayout->addWidget(dalamudBox, 2, 2, 1, 1);
|
||||||
|
|
||||||
enableDalamudBox = new QCheckBox();
|
enableDalamudBox = new QCheckBox();
|
||||||
connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) {
|
connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) {
|
||||||
getCurrentProfile().enableDalamud = enableDalamudBox->isChecked();
|
getCurrentProfile().enableDalamud = enableDalamudBox->isChecked();
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
});
|
});
|
||||||
dalamudBoxLayout->addRow("Enable Dalamud Injection", enableDalamudBox);
|
dalamudBoxLayout->addRow("Enable Dalamud Injection", enableDalamudBox);
|
||||||
|
|
||||||
dalamudVersionLabel = new QLabel();
|
dalamudVersionLabel = new QLabel();
|
||||||
dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel);
|
dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel);
|
||||||
|
}
|
||||||
|
|
||||||
reloadControls();
|
reloadControls();
|
||||||
}
|
}
|
||||||
|
@ -347,6 +392,8 @@ void SettingsWindow::reloadControls() {
|
||||||
}
|
}
|
||||||
profileWidget->setCurrentRow(oldRow);
|
profileWidget->setCurrentRow(oldRow);
|
||||||
|
|
||||||
|
closeWhenLaunched->setChecked(core.appSettings.closeWhenLaunched);
|
||||||
|
|
||||||
// deleting the main profile is unsupported behavior
|
// deleting the main profile is unsupported behavior
|
||||||
deleteProfileButton->setEnabled(core.profileList().size() > 1);
|
deleteProfileButton->setEnabled(core.profileList().size() > 1);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@ private:
|
||||||
QListWidget* profileWidget = nullptr;
|
QListWidget* profileWidget = nullptr;
|
||||||
QPushButton* deleteProfileButton = nullptr;
|
QPushButton* deleteProfileButton = nullptr;
|
||||||
|
|
||||||
|
// general
|
||||||
|
QCheckBox* closeWhenLaunched = nullptr;
|
||||||
|
|
||||||
// game
|
// game
|
||||||
QLineEdit* nameEdit = nullptr;
|
QLineEdit* nameEdit = nullptr;
|
||||||
QComboBox* directXCombo = nullptr;
|
QComboBox* directXCombo = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue