From 7ec40b5d2389d31ec06d55996f4b646b77e848e1 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 8 Jun 2022 11:33:18 -0400 Subject: [PATCH] Overhaul profile settings to use tabs instead of group boxes This makes the settings window usable on small screens, finally. --- include/settingswindow.h | 6 + src/settingswindow.cpp | 701 ++++++++++++++++++++------------------- 2 files changed, 373 insertions(+), 334 deletions(-) diff --git a/include/settingswindow.h b/include/settingswindow.h index 02f55ac..f247972 100644 --- a/include/settingswindow.h +++ b/include/settingswindow.h @@ -7,6 +7,7 @@ #include #include #include +#include class LauncherCore; class LauncherWindow; @@ -20,6 +21,11 @@ public slots: void reloadControls(); private: + void setupGameTab(QFormLayout& layout); + void setupLoginTab(QFormLayout& layout); + void setupWineTab(QFormLayout& layout); + void setupDalamudTab(QFormLayout& layout); + ProfileSettings& getCurrentProfile(); QListWidget* profileWidget = nullptr; diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index 3d6bad7..7594b86 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -69,6 +69,9 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC auto profileLayout = new QGridLayout(); profileTabWidget->setLayout(profileLayout); + auto profileTabs = new QTabWidget(); + profileLayout->addWidget(profileTabs, 1, 1, 3, 3); + profileWidget = new QListWidget(); profileWidget->addItem("INVALID *DEBUG*"); profileWidget->setCurrentRow(0); @@ -104,352 +107,51 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC }); profileLayout->addWidget(nameEdit, 0, 1); - auto gameBox = new QGroupBox("Game Options"); - auto gameBoxLayout = new QFormLayout(); - gameBox->setLayout(gameBoxLayout); + // game options + { + auto gameTabWidget = new QWidget(); + profileTabs->addTab(gameTabWidget, "Game"); - profileLayout->addWidget(gameBox, 1, 1); + auto gameBoxLayout = new QFormLayout(); + gameTabWidget->setLayout(gameBoxLayout); - directXCombo = new QComboBox(); - directXCombo->addItem("DirectX 11"); - directXCombo->addItem("DirectX 9"); - gameBoxLayout->addRow("DirectX Version", directXCombo); + setupGameTab(*gameBoxLayout); + } - connect(directXCombo, - static_cast( - &QComboBox::currentIndexChanged), - [=](int index) { - getCurrentProfile().useDX9 = - directXCombo->currentIndex() == 1; - this->core.saveSettings(); - }); + // login options + { + auto loginTabWidget = new QWidget(); + profileTabs->addTab(loginTabWidget, "Login"); - currentGameDirectory = new QLineEdit(); - currentGameDirectory->setReadOnly(true); - gameBoxLayout->addRow("Game Directory", currentGameDirectory); + auto loginBoxLayout = new QFormLayout(); + loginTabWidget->setLayout(loginBoxLayout); - auto gameDirButtonLayout = new QHBoxLayout(); - auto gameDirButtonContainer = new QWidget(); - gameDirButtonContainer->setLayout(gameDirButtonLayout); - gameBoxLayout->addWidget(gameDirButtonContainer); - - 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); - - gameDirectoryButton = new QPushButton("Open Game Directory"); - connect(gameDirectoryButton, &QPushButton::pressed, - [&window, this] { window.openPath(getCurrentProfile().gamePath); }); - 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); - gameBoxLayout->addRow("Game Version", expansionVersionLabel); - - auto loginBox = new QGroupBox("Login Options"); - auto loginBoxLayout = new QFormLayout(); - loginBox->setLayout(loginBoxLayout); - - profileLayout->addWidget(loginBox, 2, 1); - - encryptArgumentsBox = new QCheckBox(); - connect(encryptArgumentsBox, &QCheckBox::stateChanged, [=](int) { - getCurrentProfile().encryptArguments = - encryptArgumentsBox->isChecked(); - - this->core.saveSettings(); - }); - loginBoxLayout->addRow("Encrypt Game Arguments", encryptArgumentsBox); - - serverType = new QComboBox(); - serverType->insertItem(0, "Square Enix"); - serverType->insertItem(1, "Sapphire"); - - connect(serverType, - static_cast( - &QComboBox::currentIndexChanged), - [=](int index) { - getCurrentProfile().isSapphire = index == 1; - - reloadControls(); - this->core.saveSettings(); - }); - - loginBoxLayout->addRow("Server Lobby", serverType); - - lobbyServerURL = new QLineEdit(); - connect(lobbyServerURL, &QLineEdit::editingFinished, [=] { - getCurrentProfile().lobbyURL = lobbyServerURL->text(); - this->core.saveSettings(); - }); - loginBoxLayout->addRow("Lobby URL", lobbyServerURL); - - gameLicenseBox = new QComboBox(); - gameLicenseBox->insertItem(0, "Windows (Standalone)"); - gameLicenseBox->insertItem(1, "Windows (Steam)"); - gameLicenseBox->insertItem(2, "macOS"); - - connect(gameLicenseBox, - static_cast( - &QComboBox::currentIndexChanged), - [=](int index) { - getCurrentProfile().license = (GameLicense)index; - - this->core.saveSettings(); - }); - - loginBoxLayout->addRow("Game License", gameLicenseBox); - - freeTrialBox = new QCheckBox(); - connect(freeTrialBox, &QCheckBox::stateChanged, [=](int) { - getCurrentProfile().isFreeTrial = - freeTrialBox->isChecked(); - - this->core.saveSettings(); - }); - loginBoxLayout->addRow("Is Free Trial", freeTrialBox); - - rememberUsernameBox = new QCheckBox(); - connect(rememberUsernameBox, &QCheckBox::stateChanged, [=](int) { - getCurrentProfile().rememberUsername = - rememberUsernameBox->isChecked(); - - this->core.saveSettings(); - }); - loginBoxLayout->addRow("Remember Username", rememberUsernameBox); - - rememberPasswordBox = new QCheckBox(); - connect(rememberPasswordBox, &QCheckBox::stateChanged, [=](int) { - getCurrentProfile().rememberPassword = - rememberPasswordBox->isChecked(); - - this->core.saveSettings(); - }); - loginBoxLayout->addRow("Remember Password", rememberPasswordBox); - - useOneTimePassword = new QCheckBox(); - connect(useOneTimePassword, &QCheckBox::stateChanged, [=](int) { - getCurrentProfile().useOneTimePassword = - useOneTimePassword->isChecked(); - - this->core.saveSettings(); - this->window.reloadControls(); - }); - loginBoxLayout->addRow("Use One-time Password", useOneTimePassword); + setupLoginTab(*loginBoxLayout); + } #if defined(Q_OS_MAC) || defined(Q_OS_LINUX) - auto wineBox = new QGroupBox("Wine Options"); - auto wineBoxLayout = new QFormLayout(); - wineBox->setLayout(wineBoxLayout); + // wine options + { + auto wineTabWidget = new QWidget(); + profileTabs->addTab(wineTabWidget, "Wine"); - profileLayout->addWidget(wineBox, 1, 2, 1, 1); + auto wineBoxLayout = new QFormLayout(); + wineTabWidget->setLayout(wineBoxLayout); - winePathLabel = new QLineEdit(); - winePathLabel->setReadOnly(true); - wineBoxLayout->addRow("Wine Executable", winePathLabel); - - wineTypeCombo = new QComboBox(); - -#if defined(Q_OS_MAC) - wineTypeCombo->insertItem(2, "FFXIV for Mac"); - wineTypeCombo->insertItem(3, "XIV on Mac"); + setupWineTab(*wineBoxLayout); + } #endif - wineTypeCombo->insertItem(0, "System Wine"); + // dalamud options + { + auto dalamudTabWidget = new QWidget(); + profileTabs->addTab(dalamudTabWidget, "Dalamud"); - // custom wine selection is broken under flatpak -#ifndef FLATPAK - wineTypeCombo->insertItem(1, "Custom Wine"); -#endif + auto dalamudBoxLayout = new QFormLayout(); + dalamudTabWidget->setLayout(dalamudBoxLayout); - wineBoxLayout->addWidget(wineTypeCombo); - - selectWineButton = new QPushButton("Select Wine Executable"); - -#ifndef FLATPAK - wineBoxLayout->addWidget(selectWineButton); -#endif - - connect(wineTypeCombo, - static_cast( - &QComboBox::currentIndexChanged), - [this](int index) { - getCurrentProfile().wineType = (WineType)index; - - this->core.readWineInfo(getCurrentProfile()); - this->core.saveSettings(); - this->reloadControls(); - }); - - connect(selectWineButton, &QPushButton::pressed, [this] { - getCurrentProfile().winePath = - QFileDialog::getOpenFileName(this, "Open Wine Executable"); - - this->core.saveSettings(); - this->reloadControls(); - }); - - // wine version is reported incorrectly under flatpak too - wineVersionLabel = new QLabel(); -#ifndef FLATPAK - wineVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse); - wineBoxLayout->addRow("Wine Version", wineVersionLabel); -#endif - - winePrefixDirectory = new QLineEdit(); - winePrefixDirectory->setReadOnly(true); - wineBoxLayout->addRow("Wine Prefix", winePrefixDirectory); - - auto winePrefixButtonLayout = new QHBoxLayout(); - auto winePrefixButtonContainer = new QWidget(); - winePrefixButtonContainer->setLayout(winePrefixButtonLayout); - wineBoxLayout->addWidget(winePrefixButtonContainer); - - auto selectPrefixButton = new QPushButton("Select Wine Prefix"); - connect(selectPrefixButton, &QPushButton::pressed, [this] { - getCurrentProfile().winePrefixPath = - QFileDialog::getExistingDirectory(this, "Open Wine Prefix"); - - this->core.saveSettings(); - this->reloadControls(); - }); - winePrefixButtonLayout->addWidget(selectPrefixButton); - - auto openPrefixButton = new QPushButton("Open Wine Prefix"); - connect(openPrefixButton, &QPushButton::pressed, - [&window, this] { window.openPath(getCurrentProfile().winePrefixPath); }); - winePrefixButtonLayout->addWidget(openPrefixButton); - - auto enableDXVKhud = new QCheckBox("Enable DXVK HUD"); - wineBoxLayout->addRow("Wine Tweaks", enableDXVKhud); - - connect(enableDXVKhud, &QCheckBox::stateChanged, [this](int state) { - getCurrentProfile().enableDXVKhud = state; - this->core.settings.setValue("enableDXVKhud", - static_cast(state)); - }); -#endif - -#if defined(Q_OS_LINUX) - useEsync = new QCheckBox( - "Use Better Sync Primitives (Esync, Fsync, and Futex2)"); - wineBoxLayout->addWidget(useEsync); - - useEsync->setToolTip("This may improve game performance, but requires a Wine and kernel with the patches included."); - - connect(useEsync, &QCheckBox::stateChanged, [this](int state) { - getCurrentProfile().useEsync = state; - - this->core.saveSettings(); - }); - - useGamescope = new QCheckBox("Use Gamescope"); - wineBoxLayout->addWidget(useGamescope); - - 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."); - - auto gamescopeButtonLayout = new QHBoxLayout(); - auto gamescopeButtonContainer = new QWidget(); - gamescopeButtonContainer->setLayout(gamescopeButtonLayout); - wineBoxLayout->addWidget(gamescopeButtonContainer); - - configureGamescopeButton = new QPushButton("Configure..."); - connect(configureGamescopeButton, &QPushButton::pressed, [&] { - auto gamescopeSettingsWindow = new GamescopeSettingsWindow( - getCurrentProfile(), this->core, this); - 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"); - wineBoxLayout->addWidget(useGamemode); - - useGamemode->setToolTip("A special game performance enhancer, which automatically tunes your CPU scheduler among other things. This may improve game performance."); - - connect(useGamemode, &QCheckBox::stateChanged, [this](int state) { - getCurrentProfile().useGamemode = state; - - this->core.saveSettings(); - }); -#endif - - auto dalamudBox = new QGroupBox("Dalamud Options"); - auto dalamudBoxLayout = new QFormLayout(); - dalamudBox->setLayout(dalamudBoxLayout); - - profileLayout->addWidget(dalamudBox, 2, 2, 1, 1); - - enableDalamudBox = new QCheckBox(); - connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) { - getCurrentProfile().dalamud.enabled = enableDalamudBox->isChecked(); - - this->core.saveSettings(); - }); - dalamudBoxLayout->addRow("Enable Dalamud Plugins", enableDalamudBox); - - dalamudOptOutBox = new QCheckBox(); - connect(dalamudOptOutBox, &QCheckBox::stateChanged, [=](int) { - getCurrentProfile().dalamud.optOutOfMbCollection = dalamudOptOutBox->isChecked(); - - this->core.saveSettings(); - }); - dalamudBoxLayout->addRow("Opt Out of Automatic Marketboard Collection", dalamudOptOutBox); - - dalamudChannel = new QComboBox(); - dalamudChannel->insertItem(0, "Stable"); - dalamudChannel->insertItem(1, "Staging"); - dalamudChannel->insertItem(2, ".NET 5"); - - connect(dalamudChannel, - static_cast( - &QComboBox::currentIndexChanged), - [=](int index) { - getCurrentProfile().dalamud.channel = (DalamudChannel)index; - - this->core.saveSettings(); - }); - - dalamudBoxLayout->addRow("Dalamud Update Channel", dalamudChannel); - - dalamudVersionLabel = new QLabel(); - dalamudVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse); - dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel); - - dalamudAssetVersionLabel = new QLabel(); - dalamudAssetVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse); - dalamudBoxLayout->addRow("Dalamud Asset Version", dalamudAssetVersionLabel); - - nativeLauncherVersionLabel = new QLabel(); - nativeLauncherVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse); - dalamudBoxLayout->addRow("Native Launcher Version", nativeLauncherVersionLabel); + setupDalamudTab(*dalamudBoxLayout); + } } tabWidget->setCurrentIndex(defaultTab); @@ -596,4 +298,335 @@ void SettingsWindow::reloadControls() { ProfileSettings& SettingsWindow::getCurrentProfile() { return this->core.getProfile(profileWidget->currentRow()); -} \ No newline at end of file +} + +void SettingsWindow::setupGameTab(QFormLayout& layout) { + directXCombo = new QComboBox(); + directXCombo->addItem("DirectX 11"); + directXCombo->addItem("DirectX 9"); + layout.addRow("DirectX Version", directXCombo); + + connect(directXCombo, + static_cast( + &QComboBox::currentIndexChanged), + [=](int index) { + getCurrentProfile().useDX9 = + directXCombo->currentIndex() == 1; + this->core.saveSettings(); + }); + + currentGameDirectory = new QLineEdit(); + currentGameDirectory->setReadOnly(true); + 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] { + getCurrentProfile().gamePath = + QFileDialog::getExistingDirectory(this, "Open Game Directory"); + + this->reloadControls(); + this->core.saveSettings(); + + this->core.readGameVersion(); + }); + gameDirButtonLayout->addWidget(selectDirectoryButton); + + gameDirectoryButton = new QPushButton("Open Game Directory"); + connect(gameDirectoryButton, &QPushButton::pressed, + [this] { window.openPath(getCurrentProfile().gamePath); }); + 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) { + getCurrentProfile().encryptArguments = + encryptArgumentsBox->isChecked(); + + this->core.saveSettings(); + }); + layout.addRow("Encrypt Game Arguments", encryptArgumentsBox); + + serverType = new QComboBox(); + serverType->insertItem(0, "Square Enix"); + serverType->insertItem(1, "Sapphire"); + + connect(serverType, + static_cast( + &QComboBox::currentIndexChanged), + [=](int index) { + getCurrentProfile().isSapphire = index == 1; + + reloadControls(); + this->core.saveSettings(); + }); + + 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"); + + connect(gameLicenseBox, + static_cast( + &QComboBox::currentIndexChanged), + [=](int index) { + getCurrentProfile().license = (GameLicense)index; + + this->core.saveSettings(); + }); + + layout.addRow("Game License", gameLicenseBox); + + freeTrialBox = new QCheckBox(); + connect(freeTrialBox, &QCheckBox::stateChanged, [=](int) { + getCurrentProfile().isFreeTrial = + freeTrialBox->isChecked(); + + this->core.saveSettings(); + }); + layout.addRow("Is Free Trial", freeTrialBox); + + rememberUsernameBox = new QCheckBox(); + connect(rememberUsernameBox, &QCheckBox::stateChanged, [=](int) { + getCurrentProfile().rememberUsername = + rememberUsernameBox->isChecked(); + + this->core.saveSettings(); + }); + layout.addRow("Remember Username", rememberUsernameBox); + + rememberPasswordBox = new QCheckBox(); + connect(rememberPasswordBox, &QCheckBox::stateChanged, [=](int) { + getCurrentProfile().rememberPassword = + rememberPasswordBox->isChecked(); + + this->core.saveSettings(); + }); + layout.addRow("Remember Password", rememberPasswordBox); + + useOneTimePassword = new QCheckBox(); + connect(useOneTimePassword, &QCheckBox::stateChanged, [=](int) { + getCurrentProfile().useOneTimePassword = + useOneTimePassword->isChecked(); + + this->core.saveSettings(); + this->window.reloadControls(); + }); + layout.addRow("Use One-time Password", useOneTimePassword); +} + +void SettingsWindow::setupWineTab(QFormLayout& layout) { +#if defined(Q_OS_MAC) || defined(Q_OS_LINUX) + winePathLabel = new QLineEdit(); + winePathLabel->setReadOnly(true); + layout.addRow("Wine Executable", winePathLabel); + + wineTypeCombo = new QComboBox(); + +#if defined(Q_OS_MAC) + wineTypeCombo->insertItem(2, "FFXIV for Mac"); + wineTypeCombo->insertItem(3, "XIV on Mac"); +#endif + + wineTypeCombo->insertItem(0, "System Wine"); + + // custom wine selection is broken under flatpak +#ifndef FLATPAK + wineTypeCombo->insertItem(1, "Custom Wine"); +#endif + + layout.addWidget(wineTypeCombo); + + selectWineButton = new QPushButton("Select Wine Executable"); + +#ifndef FLATPAK + layout.addWidget(selectWineButton); +#endif + + connect(wineTypeCombo, + static_cast( + &QComboBox::currentIndexChanged), + [this](int index) { + getCurrentProfile().wineType = (WineType)index; + + this->core.readWineInfo(getCurrentProfile()); + this->core.saveSettings(); + this->reloadControls(); + }); + + connect(selectWineButton, &QPushButton::pressed, [this] { + getCurrentProfile().winePath = + QFileDialog::getOpenFileName(this, "Open Wine Executable"); + + this->core.saveSettings(); + this->reloadControls(); + }); + + // wine version is reported incorrectly under flatpak too + wineVersionLabel = new QLabel(); +#ifndef FLATPAK + wineVersionLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextSelectableByMouse); + layout.addRow("Wine Version", wineVersionLabel); +#endif + + winePrefixDirectory = new QLineEdit(); + winePrefixDirectory->setReadOnly(true); + 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] { + getCurrentProfile().winePrefixPath = + QFileDialog::getExistingDirectory(this, "Open Wine Prefix"); + + this->core.saveSettings(); + this->reloadControls(); + }); + winePrefixButtonLayout->addWidget(selectPrefixButton); + + auto openPrefixButton = new QPushButton("Open Wine Prefix"); + connect(openPrefixButton, &QPushButton::pressed, + [this] { window.openPath(getCurrentProfile().winePrefixPath); }); + 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; + this->core.settings.setValue("enableDXVKhud", + static_cast(state)); + }); +#endif + +#if defined(Q_OS_LINUX) + useEsync = new QCheckBox( + "Use Better Sync Primitives (Esync, Fsync, and Futex2)"); + layout.addWidget(useEsync); + + useEsync->setToolTip("This may improve game performance, but requires a Wine and kernel with the patches included."); + + connect(useEsync, &QCheckBox::stateChanged, [this](int state) { + getCurrentProfile().useEsync = state; + + this->core.saveSettings(); + }); + + useGamescope = new QCheckBox("Use Gamescope"); + layout.addWidget(useGamescope); + + 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."); + + auto gamescopeButtonLayout = new QHBoxLayout(); + auto gamescopeButtonContainer = new QWidget(); + gamescopeButtonContainer->setLayout(gamescopeButtonLayout); + layout.addWidget(gamescopeButtonContainer); + + configureGamescopeButton = new QPushButton("Configure..."); + connect(configureGamescopeButton, &QPushButton::pressed, [&] { + auto gamescopeSettingsWindow = new GamescopeSettingsWindow( + getCurrentProfile(), this->core, this); + 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); + + useGamemode->setToolTip("A special game performance enhancer, which automatically tunes your CPU scheduler among other things. This may improve game performance."); + + 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"); + + connect(dalamudChannel, + static_cast( + &QComboBox::currentIndexChanged), + [=](int index) { + getCurrentProfile().dalamud.channel = (DalamudChannel)index; + + this->core.saveSettings(); + }); + + 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); +}