2021-11-01 13:14:00 -04:00
|
|
|
#include "settingswindow.h"
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <QCheckBox>
|
2021-11-01 13:14:00 -04:00
|
|
|
#include <QDesktopServices>
|
2021-11-01 13:35:27 -04:00
|
|
|
#include <QFileDialog>
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <QFormLayout>
|
|
|
|
#include <QGridLayout>
|
2021-11-01 14:35:32 -04:00
|
|
|
#include <QGroupBox>
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <QLabel>
|
2021-11-02 08:27:00 -04:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QProcess>
|
2022-08-15 11:14:37 -04:00
|
|
|
#include <QPushButton>
|
2022-02-23 20:48:39 -05:00
|
|
|
#include <QToolTip>
|
2021-11-01 13:14:00 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
#include "gamescopesettingswindow.h"
|
2021-11-23 15:34:23 -05:00
|
|
|
#include "launchercore.h"
|
|
|
|
#include "launcherwindow.h"
|
2021-11-01 13:14:00 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherCore& core, QWidget* parent)
|
|
|
|
: core(core), window(window), QDialog(parent) {
|
2021-11-01 13:14:00 -04:00
|
|
|
setWindowTitle("Settings");
|
|
|
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
|
|
|
|
2022-02-24 08:48:14 -05:00
|
|
|
auto mainLayout = new QVBoxLayout(this);
|
2021-11-09 10:37:48 -05:00
|
|
|
setLayout(mainLayout);
|
|
|
|
|
2022-02-24 08:48:14 -05:00
|
|
|
auto tabWidget = new QTabWidget();
|
|
|
|
mainLayout->addWidget(tabWidget);
|
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
// general tab
|
|
|
|
{
|
|
|
|
auto generalTabWidget = new QWidget();
|
|
|
|
tabWidget->addTab(generalTabWidget, "General");
|
2022-02-24 08:48:14 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
auto layout = new QFormLayout();
|
|
|
|
generalTabWidget->setLayout(layout);
|
2022-02-24 08:48:14 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
closeWhenLaunched = new QCheckBox("Close Astra when game is launched");
|
|
|
|
connect(closeWhenLaunched, &QCheckBox::stateChanged, [&](int state) {
|
|
|
|
core.appSettings.closeWhenLaunched = state;
|
2021-11-09 12:06:30 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
core.saveSettings();
|
|
|
|
});
|
|
|
|
layout->addWidget(closeWhenLaunched);
|
2022-04-10 16:58:29 -04:00
|
|
|
|
|
|
|
showBanner = new QCheckBox("Show news banners");
|
|
|
|
connect(showBanner, &QCheckBox::stateChanged, [&](int state) {
|
|
|
|
core.appSettings.showBanners = state;
|
|
|
|
|
|
|
|
core.saveSettings();
|
|
|
|
window.reloadControls();
|
|
|
|
});
|
|
|
|
layout->addWidget(showBanner);
|
|
|
|
|
|
|
|
showNewsList = new QCheckBox("Show news list");
|
|
|
|
connect(showNewsList, &QCheckBox::stateChanged, [&](int state) {
|
|
|
|
core.appSettings.showNewsList = state;
|
|
|
|
|
|
|
|
core.saveSettings();
|
|
|
|
window.reloadControls();
|
|
|
|
});
|
|
|
|
layout->addWidget(showNewsList);
|
2022-02-24 09:10:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// profile tab
|
|
|
|
{
|
|
|
|
auto profileTabWidget = new QWidget();
|
|
|
|
tabWidget->addTab(profileTabWidget, "Profiles");
|
|
|
|
|
|
|
|
auto profileLayout = new QGridLayout();
|
|
|
|
profileTabWidget->setLayout(profileLayout);
|
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
auto profileTabs = new QTabWidget();
|
|
|
|
profileLayout->addWidget(profileTabs, 1, 1, 3, 3);
|
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
profileWidget = new QListWidget();
|
|
|
|
profileWidget->addItem("INVALID *DEBUG*");
|
|
|
|
profileWidget->setCurrentRow(0);
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(profileWidget, &QListWidget::currentRowChanged, this, &SettingsWindow::reloadControls);
|
2021-11-09 12:06:30 -05:00
|
|
|
|
2022-03-09 08:05:41 -05:00
|
|
|
profileLayout->addWidget(profileWidget, 0, 0, 3, 1);
|
2021-11-01 13:14:00 -04:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
auto addProfileButton = new QPushButton("Add Profile");
|
|
|
|
connect(addProfileButton, &QPushButton::pressed, [=] {
|
|
|
|
profileWidget->setCurrentRow(this->core.addProfile());
|
2021-11-09 13:44:37 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
2022-03-09 08:05:41 -05:00
|
|
|
profileLayout->addWidget(addProfileButton, 3, 0);
|
2021-11-09 13:44:37 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
deleteProfileButton = new QPushButton("Delete Profile");
|
|
|
|
connect(deleteProfileButton, &QPushButton::pressed, [=] {
|
2022-08-15 11:14:37 -04:00
|
|
|
profileWidget->setCurrentRow(this->core.deleteProfile(getCurrentProfile().name));
|
2021-11-09 13:44:37 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
2022-03-09 08:05:41 -05:00
|
|
|
profileLayout->addWidget(deleteProfileButton, 0, 2);
|
2021-11-09 11:44:27 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
nameEdit = new QLineEdit();
|
|
|
|
connect(nameEdit, &QLineEdit::editingFinished, [=] {
|
|
|
|
getCurrentProfile().name = nameEdit->text();
|
2021-11-09 12:10:52 -05:00
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
reloadControls();
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
profileLayout->addWidget(nameEdit, 0, 1);
|
2021-11-09 12:10:52 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
// game options
|
|
|
|
{
|
|
|
|
auto gameTabWidget = new QWidget();
|
|
|
|
profileTabs->addTab(gameTabWidget, "Game");
|
2021-11-09 11:08:08 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
auto gameBoxLayout = new QFormLayout();
|
|
|
|
gameTabWidget->setLayout(gameBoxLayout);
|
2021-11-09 11:08:08 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
setupGameTab(*gameBoxLayout);
|
|
|
|
}
|
2021-11-09 11:06:42 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
// login options
|
|
|
|
{
|
|
|
|
auto loginTabWidget = new QWidget();
|
|
|
|
profileTabs->addTab(loginTabWidget, "Login");
|
2021-11-09 12:42:05 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
auto loginBoxLayout = new QFormLayout();
|
|
|
|
loginTabWidget->setLayout(loginBoxLayout);
|
2021-11-09 11:06:42 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
setupLoginTab(*loginBoxLayout);
|
|
|
|
}
|
2022-04-10 17:43:05 -04:00
|
|
|
|
2021-11-02 20:04:53 -04:00
|
|
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
2022-06-08 11:33:18 -04:00
|
|
|
// wine options
|
|
|
|
{
|
|
|
|
auto wineTabWidget = new QWidget();
|
|
|
|
profileTabs->addTab(wineTabWidget, "Wine");
|
2022-02-24 09:10:00 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
auto wineBoxLayout = new QFormLayout();
|
|
|
|
wineTabWidget->setLayout(wineBoxLayout);
|
2022-02-24 09:10:00 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
setupWineTab(*wineBoxLayout);
|
|
|
|
}
|
2021-11-01 14:35:32 -04:00
|
|
|
#endif
|
2021-11-09 11:44:27 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
// dalamud options
|
|
|
|
{
|
|
|
|
auto dalamudTabWidget = new QWidget();
|
|
|
|
profileTabs->addTab(dalamudTabWidget, "Dalamud");
|
2022-04-13 10:45:00 -04:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
auto dalamudBoxLayout = new QFormLayout();
|
|
|
|
dalamudTabWidget->setLayout(dalamudBoxLayout);
|
2022-02-25 18:08:57 -05:00
|
|
|
|
2022-06-08 11:33:18 -04:00
|
|
|
setupDalamudTab(*dalamudBoxLayout);
|
|
|
|
}
|
2022-02-24 09:10:00 -05:00
|
|
|
}
|
2022-02-23 21:22:56 -05:00
|
|
|
|
2022-06-09 09:51:50 -04:00
|
|
|
{
|
|
|
|
auto accountsTabWidget = new QWidget();
|
|
|
|
tabWidget->addTab(accountsTabWidget, "Accounts");
|
|
|
|
|
|
|
|
auto accountsLayout = new QGridLayout();
|
|
|
|
accountsTabWidget->setLayout(accountsLayout);
|
|
|
|
}
|
|
|
|
|
2022-03-09 08:08:03 -05:00
|
|
|
tabWidget->setCurrentIndex(defaultTab);
|
|
|
|
|
2021-11-09 11:44:27 -05:00
|
|
|
reloadControls();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::reloadControls() {
|
2022-08-15 11:14:37 -04:00
|
|
|
if (currentlyReloadingControls)
|
2021-11-09 12:06:30 -05:00
|
|
|
return;
|
|
|
|
|
|
|
|
currentlyReloadingControls = true;
|
|
|
|
|
|
|
|
auto oldRow = profileWidget->currentRow();
|
|
|
|
|
2021-11-09 11:44:27 -05:00
|
|
|
profileWidget->clear();
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
for (const auto& profile : core.profileList()) {
|
2021-11-09 11:44:27 -05:00
|
|
|
profileWidget->addItem(profile);
|
|
|
|
}
|
2021-11-09 12:06:30 -05:00
|
|
|
profileWidget->setCurrentRow(oldRow);
|
|
|
|
|
2022-02-24 09:10:00 -05:00
|
|
|
closeWhenLaunched->setChecked(core.appSettings.closeWhenLaunched);
|
2022-04-10 16:58:29 -04:00
|
|
|
showBanner->setChecked(core.appSettings.showBanners);
|
|
|
|
showNewsList->setChecked(core.appSettings.showNewsList);
|
2022-02-24 09:10:00 -05:00
|
|
|
|
2021-11-09 13:44:37 -05:00
|
|
|
// deleting the main profile is unsupported behavior
|
2022-04-14 16:52:36 -04:00
|
|
|
deleteProfileButton->setEnabled(profileWidget->currentRow() != 0);
|
2021-11-09 13:44:37 -05:00
|
|
|
|
2021-11-23 15:34:23 -05:00
|
|
|
ProfileSettings& profile = core.getProfile(profileWidget->currentRow());
|
2021-11-09 12:10:52 -05:00
|
|
|
nameEdit->setText(profile.name);
|
2021-11-09 13:04:22 -05:00
|
|
|
|
|
|
|
// game
|
2021-11-09 12:06:30 -05:00
|
|
|
directXCombo->setCurrentIndex(profile.useDX9 ? 1 : 0);
|
2021-11-09 12:46:27 -05:00
|
|
|
currentGameDirectory->setText(profile.gamePath);
|
2021-11-09 12:38:18 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!profile.isGameInstalled()) {
|
2021-12-02 15:02:59 -05:00
|
|
|
expansionVersionLabel->setText("No game installed.");
|
|
|
|
} else {
|
|
|
|
QString expacString;
|
2021-12-02 15:04:28 -05:00
|
|
|
|
|
|
|
expacString += "Boot";
|
|
|
|
expacString += QString(" (%1)\n").arg(profile.bootVersion);
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
for (int i = 0; i < profile.repositories.repositories_count; i++) {
|
2022-05-09 15:04:56 -04:00
|
|
|
QString expansionName = "Unknown Expansion";
|
2022-08-15 11:14:37 -04:00
|
|
|
if (i < core.expansionNames.size()) {
|
2022-05-09 15:04:56 -04:00
|
|
|
expansionName = core.expansionNames[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
expacString += expansionName;
|
2022-08-09 23:18:18 -04:00
|
|
|
expacString += QString(" (%1)\n").arg(profile.repositories.repositories[i].version);
|
2021-12-02 15:02:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
expansionVersionLabel->setText(expacString);
|
|
|
|
}
|
|
|
|
|
2021-11-09 13:04:22 -05:00
|
|
|
// wine
|
2022-03-27 21:08:27 -04:00
|
|
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!profile.isWineInstalled()) {
|
2022-04-09 17:33:37 -04:00
|
|
|
wineVersionLabel->setText("Wine is not installed.");
|
|
|
|
} else {
|
|
|
|
wineVersionLabel->setText(profile.wineVersion);
|
|
|
|
}
|
|
|
|
|
2022-04-09 17:28:24 -04:00
|
|
|
wineTypeCombo->setCurrentIndex((int)profile.wineType);
|
|
|
|
selectWineButton->setEnabled(profile.wineType == WineType::Custom);
|
2021-11-09 13:04:22 -05:00
|
|
|
winePathLabel->setText(profile.winePath);
|
|
|
|
winePrefixDirectory->setText(profile.winePrefixPath);
|
2022-03-27 21:08:27 -04:00
|
|
|
#endif
|
2021-11-09 13:04:22 -05:00
|
|
|
|
2021-11-09 14:17:04 -05:00
|
|
|
#if defined(Q_OS_LINUX)
|
2021-11-09 13:08:25 -05:00
|
|
|
useEsync->setChecked(profile.useEsync);
|
|
|
|
useGamescope->setChecked(profile.useGamescope);
|
|
|
|
useGamemode->setChecked(profile.useGamemode);
|
2022-02-24 08:35:31 -05:00
|
|
|
|
|
|
|
useGamemode->setEnabled(core.gamemodeAvailable);
|
|
|
|
useGamescope->setEnabled(core.gamescopeAvailable);
|
|
|
|
|
|
|
|
configureGamescopeButton->setEnabled(profile.useGamescope);
|
2022-01-27 09:25:23 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENABLE_WATCHDOG
|
2021-12-06 21:15:31 -05:00
|
|
|
enableWatchdog->setChecked(profile.enableWatchdog);
|
2021-11-09 14:17:04 -05:00
|
|
|
#endif
|
2021-11-09 13:08:25 -05:00
|
|
|
|
2021-11-09 13:04:22 -05:00
|
|
|
// login
|
2021-11-09 21:13:21 -05:00
|
|
|
encryptArgumentsBox->setChecked(profile.encryptArguments);
|
2021-11-09 12:38:18 -05:00
|
|
|
serverType->setCurrentIndex(profile.isSapphire ? 1 : 0);
|
2021-11-09 13:50:32 -05:00
|
|
|
lobbyServerURL->setEnabled(profile.isSapphire);
|
2022-08-15 11:14:37 -04:00
|
|
|
if (profile.isSapphire) {
|
2022-03-16 10:02:28 -04:00
|
|
|
lobbyServerURL->setText(profile.lobbyURL);
|
2022-04-14 16:42:53 -04:00
|
|
|
lobbyServerURL->setPlaceholderText("Required...");
|
2022-03-16 10:02:28 -04:00
|
|
|
} else {
|
|
|
|
lobbyServerURL->setText("neolobby0X.ffxiv.com");
|
|
|
|
}
|
2021-11-09 12:32:18 -05:00
|
|
|
rememberUsernameBox->setChecked(profile.rememberUsername);
|
|
|
|
rememberPasswordBox->setChecked(profile.rememberPassword);
|
2022-04-10 17:43:05 -04:00
|
|
|
useOneTimePassword->setChecked(profile.useOneTimePassword);
|
2022-04-14 16:45:29 -04:00
|
|
|
useOneTimePassword->setEnabled(!profile.isSapphire);
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!useOneTimePassword->isEnabled()) {
|
2022-04-14 16:45:29 -04:00
|
|
|
useOneTimePassword->setToolTip("OTP is not supported by Sapphire servers.");
|
|
|
|
} else {
|
|
|
|
useOneTimePassword->setToolTip("");
|
|
|
|
}
|
2022-04-14 16:49:13 -04:00
|
|
|
|
2022-03-16 09:59:27 -04:00
|
|
|
gameLicenseBox->setCurrentIndex((int)profile.license);
|
2022-04-14 16:49:13 -04:00
|
|
|
gameLicenseBox->setEnabled(!profile.isSapphire);
|
2022-08-15 11:14:37 -04:00
|
|
|
if (!gameLicenseBox->isEnabled()) {
|
2022-04-14 16:49:13 -04:00
|
|
|
gameLicenseBox->setToolTip("Game licenses only matter when logging into the official Square Enix servers.");
|
|
|
|
} else {
|
|
|
|
gameLicenseBox->setToolTip("");
|
|
|
|
}
|
2021-11-09 12:06:30 -05:00
|
|
|
|
2022-05-09 16:02:07 -04:00
|
|
|
freeTrialBox->setChecked(profile.isFreeTrial);
|
|
|
|
|
2022-02-23 21:28:56 -05:00
|
|
|
// dalamud
|
2022-03-13 19:58:58 -04:00
|
|
|
enableDalamudBox->setChecked(profile.dalamud.enabled);
|
2022-08-15 11:14:37 -04:00
|
|
|
if (core.dalamudVersion.isEmpty()) {
|
2022-02-23 21:28:56 -05:00
|
|
|
dalamudVersionLabel->setText("Dalamud is not installed.");
|
|
|
|
} else {
|
2022-02-25 22:25:21 -05:00
|
|
|
dalamudVersionLabel->setText(core.dalamudVersion);
|
2022-02-23 21:28:56 -05:00
|
|
|
}
|
2021-11-23 14:37:37 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (core.dalamudAssetVersion == -1) {
|
2022-02-25 18:08:57 -05:00
|
|
|
dalamudAssetVersionLabel->setText("Dalamud assets are not installed.");
|
|
|
|
} else {
|
2022-02-25 22:25:21 -05:00
|
|
|
dalamudAssetVersionLabel->setText(QString::number(core.dalamudAssetVersion));
|
2022-02-25 18:08:57 -05:00
|
|
|
}
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (core.nativeLauncherVersion.isEmpty()) {
|
2022-04-08 19:34:51 -04:00
|
|
|
nativeLauncherVersionLabel->setText("Native launcher is not installed.");
|
|
|
|
} else {
|
|
|
|
nativeLauncherVersionLabel->setText(core.nativeLauncherVersion);
|
|
|
|
}
|
|
|
|
|
2022-03-13 19:58:58 -04:00
|
|
|
dalamudOptOutBox->setChecked(profile.dalamud.optOutOfMbCollection);
|
2022-04-13 10:45:00 -04:00
|
|
|
dalamudChannel->setCurrentIndex((int)profile.dalamud.channel);
|
2022-03-13 19:58:58 -04:00
|
|
|
|
2021-11-09 12:39:28 -05:00
|
|
|
window.reloadControls();
|
|
|
|
|
2021-11-09 12:06:30 -05:00
|
|
|
currentlyReloadingControls = false;
|
2021-11-03 06:31:02 -04:00
|
|
|
}
|
|
|
|
|
2021-11-09 12:10:52 -05:00
|
|
|
ProfileSettings& SettingsWindow::getCurrentProfile() {
|
2021-11-23 15:34:23 -05:00
|
|
|
return this->core.getProfile(profileWidget->currentRow());
|
2022-06-08 11:33:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::setupGameTab(QFormLayout& layout) {
|
|
|
|
directXCombo = new QComboBox();
|
|
|
|
directXCombo->addItem("DirectX 11");
|
|
|
|
directXCombo->addItem("DirectX 9");
|
|
|
|
layout.addRow("DirectX Version", directXCombo);
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(directXCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index) {
|
|
|
|
getCurrentProfile().useDX9 = directXCombo->currentIndex() == 1;
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
2022-06-08 11:33:18 -04:00
|
|
|
|
2022-06-09 09:44:58 -04:00
|
|
|
currentGameDirectory = new QLabel();
|
|
|
|
currentGameDirectory->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
2022-06-08 11:33:18 -04:00
|
|
|
layout.addRow("Game Directory", currentGameDirectory);
|
|
|
|
|
|
|
|
auto gameDirButtonLayout = new QHBoxLayout();
|
|
|
|
auto gameDirButtonContainer = new QWidget();
|
|
|
|
gameDirButtonContainer->setLayout(gameDirButtonLayout);
|
|
|
|
layout.addWidget(gameDirButtonContainer);
|
|
|
|
|
|
|
|
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
|
|
|
connect(selectDirectoryButton, &QPushButton::pressed, [this] {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->reloadControls();
|
|
|
|
this->core.saveSettings();
|
|
|
|
|
|
|
|
this->core.readGameVersion();
|
|
|
|
});
|
|
|
|
gameDirButtonLayout->addWidget(selectDirectoryButton);
|
|
|
|
|
|
|
|
gameDirectoryButton = new QPushButton("Open Game Directory");
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
|
|
|
window.openPath(getCurrentProfile().gamePath);
|
|
|
|
});
|
2022-06-08 11:33:18 -04:00
|
|
|
gameDirButtonLayout->addWidget(gameDirectoryButton);
|
|
|
|
|
|
|
|
#ifdef ENABLE_WATCHDOG
|
|
|
|
enableWatchdog = new QCheckBox("Enable Watchdog (X11 only)");
|
|
|
|
gameBoxLayout->addWidget(enableWatchdog);
|
|
|
|
|
|
|
|
connect(enableWatchdog, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
getCurrentProfile().enableWatchdog = state;
|
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
#endif
|
|
|
|
|
|
|
|
gameDirectoryButton->setEnabled(getCurrentProfile().isGameInstalled());
|
|
|
|
|
|
|
|
expansionVersionLabel = new QLabel();
|
|
|
|
expansionVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
|
|
|
layout.addRow("Game Version", expansionVersionLabel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::setupLoginTab(QFormLayout& layout) {
|
|
|
|
encryptArgumentsBox = new QCheckBox();
|
|
|
|
connect(encryptArgumentsBox, &QCheckBox::stateChanged, [=](int) {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().encryptArguments = encryptArgumentsBox->isChecked();
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
layout.addRow("Encrypt Game Arguments", encryptArgumentsBox);
|
|
|
|
|
|
|
|
serverType = new QComboBox();
|
|
|
|
serverType->insertItem(0, "Square Enix");
|
|
|
|
serverType->insertItem(1, "Sapphire");
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(serverType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index) {
|
|
|
|
getCurrentProfile().isSapphire = index == 1;
|
2022-06-08 11:33:18 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
reloadControls();
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
layout.addRow("Server Lobby", serverType);
|
|
|
|
|
|
|
|
lobbyServerURL = new QLineEdit();
|
|
|
|
connect(lobbyServerURL, &QLineEdit::editingFinished, [=] {
|
|
|
|
getCurrentProfile().lobbyURL = lobbyServerURL->text();
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
layout.addRow("Lobby URL", lobbyServerURL);
|
|
|
|
|
|
|
|
gameLicenseBox = new QComboBox();
|
|
|
|
gameLicenseBox->insertItem(0, "Windows (Standalone)");
|
|
|
|
gameLicenseBox->insertItem(1, "Windows (Steam)");
|
|
|
|
gameLicenseBox->insertItem(2, "macOS");
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(gameLicenseBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index) {
|
|
|
|
getCurrentProfile().license = (GameLicense)index;
|
2022-06-08 11:33:18 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
layout.addRow("Game License", gameLicenseBox);
|
|
|
|
|
|
|
|
freeTrialBox = new QCheckBox();
|
|
|
|
connect(freeTrialBox, &QCheckBox::stateChanged, [=](int) {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().isFreeTrial = freeTrialBox->isChecked();
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
layout.addRow("Is Free Trial", freeTrialBox);
|
|
|
|
|
|
|
|
rememberUsernameBox = new QCheckBox();
|
|
|
|
connect(rememberUsernameBox, &QCheckBox::stateChanged, [=](int) {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().rememberUsername = rememberUsernameBox->isChecked();
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
layout.addRow("Remember Username", rememberUsernameBox);
|
|
|
|
|
|
|
|
rememberPasswordBox = new QCheckBox();
|
|
|
|
connect(rememberPasswordBox, &QCheckBox::stateChanged, [=](int) {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().rememberPassword = rememberPasswordBox->isChecked();
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
layout.addRow("Remember Password", rememberPasswordBox);
|
|
|
|
|
|
|
|
useOneTimePassword = new QCheckBox();
|
|
|
|
connect(useOneTimePassword, &QCheckBox::stateChanged, [=](int) {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().useOneTimePassword = useOneTimePassword->isChecked();
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
this->window.reloadControls();
|
|
|
|
});
|
2022-06-09 09:48:54 -04:00
|
|
|
layout.addRow("Use One-Time Password", useOneTimePassword);
|
2022-06-08 11:33:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::setupWineTab(QFormLayout& layout) {
|
|
|
|
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
2022-06-09 09:44:58 -04:00
|
|
|
winePathLabel = new QLabel();
|
|
|
|
winePathLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
2022-06-08 11:33:18 -04:00
|
|
|
layout.addRow("Wine Executable", winePathLabel);
|
|
|
|
|
|
|
|
wineTypeCombo = new QComboBox();
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
#if defined(Q_OS_MAC)
|
2022-06-09 09:47:50 -04:00
|
|
|
wineTypeCombo->insertItem(2, "FFXIV for Mac (Official)");
|
2022-06-08 11:33:18 -04:00
|
|
|
wineTypeCombo->insertItem(3, "XIV on Mac");
|
2022-08-15 11:14:37 -04:00
|
|
|
#endif
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
wineTypeCombo->insertItem(0, "System Wine");
|
|
|
|
|
|
|
|
// custom wine selection is broken under flatpak
|
2022-08-15 11:14:37 -04:00
|
|
|
#ifndef FLATPAK
|
2022-06-08 11:33:18 -04:00
|
|
|
wineTypeCombo->insertItem(1, "Custom Wine");
|
2022-08-15 11:14:37 -04:00
|
|
|
#endif
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
layout.addWidget(wineTypeCombo);
|
|
|
|
|
|
|
|
selectWineButton = new QPushButton("Select Wine Executable");
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
#ifndef FLATPAK
|
2022-06-08 11:33:18 -04:00
|
|
|
layout.addWidget(selectWineButton);
|
2022-08-15 11:14:37 -04:00
|
|
|
#endif
|
2022-06-08 11:33:18 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(wineTypeCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index) {
|
|
|
|
getCurrentProfile().wineType = (WineType)index;
|
2022-06-08 11:33:18 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
this->core.readWineInfo(getCurrentProfile());
|
|
|
|
this->core.saveSettings();
|
|
|
|
this->reloadControls();
|
|
|
|
});
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
connect(selectWineButton, &QPushButton::pressed, [this] {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().winePath = QFileDialog::getOpenFileName(this, "Open Wine Executable");
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
this->reloadControls();
|
|
|
|
});
|
|
|
|
|
|
|
|
// wine version is reported incorrectly under flatpak too
|
|
|
|
wineVersionLabel = new QLabel();
|
2022-08-15 11:14:37 -04:00
|
|
|
#ifndef FLATPAK
|
2022-06-08 11:33:18 -04:00
|
|
|
wineVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
|
|
|
layout.addRow("Wine Version", wineVersionLabel);
|
2022-08-15 11:14:37 -04:00
|
|
|
#endif
|
2022-06-08 11:33:18 -04:00
|
|
|
|
2022-06-09 09:44:58 -04:00
|
|
|
winePrefixDirectory = new QLabel();
|
|
|
|
winePrefixDirectory->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
2022-06-08 11:33:18 -04:00
|
|
|
layout.addRow("Wine Prefix", winePrefixDirectory);
|
|
|
|
|
|
|
|
auto winePrefixButtonLayout = new QHBoxLayout();
|
|
|
|
auto winePrefixButtonContainer = new QWidget();
|
|
|
|
winePrefixButtonContainer->setLayout(winePrefixButtonLayout);
|
|
|
|
layout.addWidget(winePrefixButtonContainer);
|
|
|
|
|
|
|
|
auto selectPrefixButton = new QPushButton("Select Wine Prefix");
|
|
|
|
connect(selectPrefixButton, &QPushButton::pressed, [this] {
|
2022-08-15 11:14:37 -04:00
|
|
|
getCurrentProfile().winePrefixPath = QFileDialog::getExistingDirectory(this, "Open Wine Prefix");
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
this->reloadControls();
|
|
|
|
});
|
|
|
|
winePrefixButtonLayout->addWidget(selectPrefixButton);
|
|
|
|
|
|
|
|
auto openPrefixButton = new QPushButton("Open Wine Prefix");
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(openPrefixButton, &QPushButton::pressed, [this] {
|
|
|
|
window.openPath(getCurrentProfile().winePrefixPath);
|
|
|
|
});
|
2022-06-08 11:33:18 -04:00
|
|
|
winePrefixButtonLayout->addWidget(openPrefixButton);
|
|
|
|
|
|
|
|
auto enableDXVKhud = new QCheckBox("Enable DXVK HUD");
|
|
|
|
layout.addRow("Wine Tweaks", enableDXVKhud);
|
|
|
|
|
|
|
|
connect(enableDXVKhud, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
getCurrentProfile().enableDXVKhud = state;
|
2022-08-15 11:14:37 -04:00
|
|
|
this->core.settings.setValue("enableDXVKhud", static_cast<bool>(state));
|
2022-06-08 11:33:18 -04:00
|
|
|
});
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(Q_OS_LINUX)
|
2022-08-15 11:14:37 -04:00
|
|
|
useEsync = new QCheckBox("Use Better Sync Primitives (Esync, Fsync, and Futex2)");
|
2022-06-08 11:33:18 -04:00
|
|
|
layout.addWidget(useEsync);
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
useEsync->setToolTip(
|
|
|
|
"This may improve game performance, but requires a Wine and kernel with the patches included.");
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
connect(useEsync, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
getCurrentProfile().useEsync = state;
|
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
|
|
|
|
useGamescope = new QCheckBox("Use Gamescope");
|
|
|
|
layout.addWidget(useGamescope);
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
useGamescope->setToolTip(
|
|
|
|
"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.");
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
auto gamescopeButtonLayout = new QHBoxLayout();
|
|
|
|
auto gamescopeButtonContainer = new QWidget();
|
|
|
|
gamescopeButtonContainer->setLayout(gamescopeButtonLayout);
|
|
|
|
layout.addWidget(gamescopeButtonContainer);
|
|
|
|
|
|
|
|
configureGamescopeButton = new QPushButton("Configure...");
|
|
|
|
connect(configureGamescopeButton, &QPushButton::pressed, [&] {
|
2022-08-15 11:14:37 -04:00
|
|
|
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
|
2022-06-08 11:33:18 -04:00
|
|
|
gamescopeSettingsWindow->show();
|
|
|
|
});
|
|
|
|
gamescopeButtonLayout->addWidget(configureGamescopeButton);
|
|
|
|
|
|
|
|
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
getCurrentProfile().useGamescope = state;
|
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
this->reloadControls();
|
|
|
|
});
|
|
|
|
|
|
|
|
useGamemode = new QCheckBox("Use GameMode");
|
|
|
|
layout.addWidget(useGamemode);
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
useGamemode->setToolTip("A special game performance enhancer, which automatically tunes your CPU scheduler among "
|
|
|
|
"other things. This may improve game performance.");
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
connect(useGamemode, &QCheckBox::stateChanged, [this](int state) {
|
|
|
|
getCurrentProfile().useGamemode = state;
|
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::setupDalamudTab(QFormLayout& layout) {
|
|
|
|
enableDalamudBox = new QCheckBox();
|
|
|
|
connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) {
|
|
|
|
getCurrentProfile().dalamud.enabled = enableDalamudBox->isChecked();
|
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
layout.addRow("Enable Dalamud Plugins", enableDalamudBox);
|
|
|
|
|
|
|
|
dalamudOptOutBox = new QCheckBox();
|
|
|
|
connect(dalamudOptOutBox, &QCheckBox::stateChanged, [=](int) {
|
|
|
|
getCurrentProfile().dalamud.optOutOfMbCollection = dalamudOptOutBox->isChecked();
|
|
|
|
|
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
|
|
|
layout.addRow("Opt Out of Automatic Marketboard Collection", dalamudOptOutBox);
|
|
|
|
|
|
|
|
dalamudChannel = new QComboBox();
|
|
|
|
dalamudChannel->insertItem(0, "Stable");
|
|
|
|
dalamudChannel->insertItem(1, "Staging");
|
|
|
|
dalamudChannel->insertItem(2, ".NET 5");
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
connect(dalamudChannel, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int index) {
|
|
|
|
getCurrentProfile().dalamud.channel = (DalamudChannel)index;
|
2022-06-08 11:33:18 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
this->core.saveSettings();
|
|
|
|
});
|
2022-06-08 11:33:18 -04:00
|
|
|
|
|
|
|
layout.addRow("Dalamud Update Channel", dalamudChannel);
|
|
|
|
|
|
|
|
dalamudVersionLabel = new QLabel();
|
|
|
|
dalamudVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
|
|
|
layout.addRow("Dalamud Version", dalamudVersionLabel);
|
|
|
|
|
|
|
|
dalamudAssetVersionLabel = new QLabel();
|
|
|
|
dalamudAssetVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
|
|
|
layout.addRow("Dalamud Asset Version", dalamudAssetVersionLabel);
|
|
|
|
|
|
|
|
nativeLauncherVersionLabel = new QLabel();
|
|
|
|
nativeLauncherVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse);
|
|
|
|
layout.addRow("Native Launcher Version", nativeLauncherVersionLabel);
|
|
|
|
}
|
2022-06-09 09:51:50 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
void SettingsWindow::setupAccountsTab(QFormLayout& layout) {}
|