2021-11-01 13:14:00 -04:00
|
|
|
#include "settingswindow.h"
|
|
|
|
|
|
|
|
#include <QFormLayout>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QDesktopServices>
|
2021-11-01 13:35:27 -04:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QFileDialog>
|
2021-11-01 14:35:32 -04:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QGroupBox>
|
2021-11-02 08:27:00 -04:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QProcess>
|
2021-11-02 08:49:06 -04:00
|
|
|
#include <QComboBox>
|
2021-11-01 13:14:00 -04:00
|
|
|
|
|
|
|
#include "xivlauncher.h"
|
|
|
|
|
|
|
|
SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window(window), QWidget(parent) {
|
|
|
|
setWindowTitle("Settings");
|
|
|
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
|
|
|
|
|
|
|
auto layout = new QFormLayout(this);
|
|
|
|
setLayout(layout);
|
|
|
|
|
2021-11-02 08:49:06 -04:00
|
|
|
auto directXCombo = new QComboBox();
|
|
|
|
directXCombo->setCurrentIndex(window.settings.value("directx", 0).toInt());
|
|
|
|
directXCombo->addItem("DirectX 11");
|
|
|
|
directXCombo->addItem("DirectX 9");
|
|
|
|
layout->addRow("DirectX Version", directXCombo);
|
|
|
|
|
|
|
|
connect(directXCombo, &QComboBox::currentIndexChanged, [=](int index) {
|
|
|
|
this->window.settings.setValue("directx", directXCombo->currentIndex());
|
|
|
|
this->window.useDX9 = directXCombo->currentIndex() == 1;
|
|
|
|
});
|
|
|
|
|
2021-11-01 14:35:32 -04:00
|
|
|
#if defined(Q_OS_LINUX)
|
|
|
|
auto wineBox = new QGroupBox("Wine Options");
|
|
|
|
auto wineBoxLayout = new QFormLayout();
|
|
|
|
wineBox->setLayout(wineBoxLayout);
|
|
|
|
|
|
|
|
auto infoLabel = new QLabel("This is a list of possible enhancements you can make to your Wine gaming experience.\n"
|
|
|
|
"This is all stuff you can do outside of the launcher, but we can take care of it for you.");
|
|
|
|
wineBoxLayout->addWidget(infoLabel);
|
|
|
|
|
|
|
|
auto useEsync = new QCheckBox("Use Esync");
|
|
|
|
useEsync->setChecked(window.settings.value("useEsync", false).toBool());
|
|
|
|
wineBoxLayout->addWidget(useEsync);
|
|
|
|
|
|
|
|
auto esyncLabel = new QLabel("Improves general game performance, but requires a Wine built with the Esync patches.\n"
|
|
|
|
"If you use the latest Wine staging, it should work.");
|
|
|
|
wineBoxLayout->addWidget(esyncLabel);
|
|
|
|
|
|
|
|
connect(useEsync, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
this->window.useEsync = state;
|
|
|
|
this->window.settings.setValue("useEsync", static_cast<bool>(state));
|
|
|
|
});
|
|
|
|
|
|
|
|
auto useGamescope = new QCheckBox("Use Gamescope");
|
|
|
|
useGamescope->setChecked(window.settings.value("useGamescope", false).toBool());
|
|
|
|
wineBoxLayout->addWidget( useGamescope);
|
|
|
|
|
|
|
|
auto gamescopeLabel = new QLabel("Use the SteamOS compositor that uses Wayland.\n"
|
|
|
|
"If you are experiencing input issues on XWayland, try this option if you have it installed.");
|
|
|
|
wineBoxLayout->addWidget(gamescopeLabel);
|
|
|
|
|
|
|
|
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
this->window.useGamescope = state;
|
|
|
|
this->window.settings.setValue("useGamescope", static_cast<bool>(state));
|
|
|
|
});
|
|
|
|
|
|
|
|
auto useGamemode = new QCheckBox("Use Gamemode");
|
|
|
|
useGamemode->setChecked(window.settings.value("useGamemode", false).toBool());
|
|
|
|
wineBoxLayout->addWidget(useGamemode);
|
|
|
|
|
|
|
|
auto gamemodeLabel = new QLabel("Use Feral Interactive's GameMode, which applies a couple of performance enhancements.\n"
|
|
|
|
"May give a slight performance boost, but requires GameMode to be installed.\n");
|
|
|
|
wineBoxLayout->addWidget(gamemodeLabel);
|
|
|
|
|
|
|
|
connect(useGamemode, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
this->window.useGamemode = state;
|
|
|
|
this->window.settings.setValue("useGamemode", static_cast<bool>(state));
|
|
|
|
});
|
|
|
|
|
|
|
|
layout->addRow(wineBox);
|
|
|
|
#endif
|
|
|
|
|
2021-11-01 13:35:27 -04:00
|
|
|
auto currentGameDirectory = new QLabel(window.gamePath);
|
|
|
|
layout->addRow("Game Directory", currentGameDirectory);
|
|
|
|
|
|
|
|
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
|
|
|
connect(selectDirectoryButton, &QPushButton::pressed, [this, currentGameDirectory] {
|
|
|
|
this->window.gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
|
|
|
currentGameDirectory->setText(this->window.gamePath);
|
2021-11-02 08:27:00 -04:00
|
|
|
|
|
|
|
this->window.readInitialInformation();
|
2021-11-01 13:35:27 -04:00
|
|
|
});
|
|
|
|
layout->addWidget(selectDirectoryButton);
|
|
|
|
|
2021-11-01 13:14:00 -04:00
|
|
|
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
|
|
|
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
2021-11-02 08:27:11 -04:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
// for some reason, windows requires special treatment (what else is new?)
|
|
|
|
const QFileInfo fileInfo(this->window.gamePath);
|
|
|
|
|
|
|
|
QProcess::startDetached("explorer.exe", QStringList(QDir::toNativeSeparators(fileInfo.canonicalFilePath())));
|
|
|
|
#else
|
2021-11-01 13:14:00 -04:00
|
|
|
QDesktopServices::openUrl("file://" + this->window.gamePath);
|
2021-11-02 08:27:11 -04:00
|
|
|
#endif
|
2021-11-01 13:14:00 -04:00
|
|
|
});
|
2021-11-01 13:35:27 -04:00
|
|
|
layout->addWidget(gameDirectoryButton);
|
2021-11-01 13:14:00 -04:00
|
|
|
}
|