mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 20:27:45 +00:00
Make Wine custom path, prefix and combo box work again
This commit is contained in:
parent
ec50af5f5f
commit
c88d5436f9
4 changed files with 62 additions and 26 deletions
|
@ -137,11 +137,11 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
|
|||
infoLabel->setWordWrap(true);
|
||||
wineBoxLayout->addWidget(infoLabel);
|
||||
|
||||
auto winePathLabel = new QLabel(window.currentProfile().winePath);
|
||||
winePathLabel = new QLabel(window.currentProfile().winePath);
|
||||
winePathLabel->setWordWrap(true);
|
||||
wineBoxLayout->addRow("Wine Executable", winePathLabel);
|
||||
|
||||
auto wineVersionCombo = new QComboBox();
|
||||
wineVersionCombo = new QComboBox();
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
wineVersionCombo->insertItem(2, "FFXIV Built-In");
|
||||
|
@ -149,45 +149,51 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
|
|||
|
||||
wineVersionCombo->insertItem(0, "System Wine");
|
||||
wineVersionCombo->insertItem(1, "Custom Path...");
|
||||
wineVersionCombo->setCurrentIndex(window.settings.value("wineVersion", 0).toInt());
|
||||
|
||||
wineBoxLayout->addWidget(wineVersionCombo);
|
||||
|
||||
auto selectWineButton = new QPushButton("Select Wine Executable");
|
||||
selectWineButton->setEnabled(window.settings.value("wineVersion", 0).toInt() == 2);
|
||||
selectWineButton = new QPushButton("Select Wine Executable");
|
||||
wineBoxLayout->addWidget(selectWineButton);
|
||||
|
||||
connect(wineVersionCombo, &QComboBox::currentIndexChanged, [this, selectWineButton, winePathLabel](int index) {
|
||||
this->window.settings.setValue("wineVersion", index);
|
||||
selectWineButton->setEnabled(index == 1);
|
||||
connect(wineVersionCombo, &QComboBox::currentIndexChanged, [this](int index) {
|
||||
getCurrentProfile().wineVersion = index;
|
||||
|
||||
this->window.readInitialInformation();
|
||||
winePathLabel->setText(this->window.currentProfile().winePath);
|
||||
this->window.saveSettings();
|
||||
this->reloadControls();
|
||||
|
||||
// TODO: figure out the purpose of calling this before 1.0
|
||||
// this->window.readInitialInformation();
|
||||
});
|
||||
|
||||
connect(selectWineButton, &QPushButton::pressed, [this, winePathLabel] {
|
||||
this->window.currentProfile().winePath = QFileDialog::getOpenFileName(this, "Open Wine Executable");
|
||||
this->window.settings.setValue("winePath", this->window.currentProfile().winePath);
|
||||
connect(selectWineButton, &QPushButton::pressed, [this] {
|
||||
getCurrentProfile().winePath = QFileDialog::getOpenFileName(this, "Open Wine Executable");
|
||||
|
||||
this->window.readInitialInformation();
|
||||
winePathLabel->setText(this->window.currentProfile().winePath);
|
||||
this->window.saveSettings();
|
||||
this->reloadControls();
|
||||
|
||||
// TODO: figure out the purpose of calling this before 2.0
|
||||
//this->window.readInitialInformation();
|
||||
});
|
||||
|
||||
auto winePrefixDirectory = new QLabel(window.currentProfile().winePrefixPath);
|
||||
winePrefixDirectory = new QLabel(window.currentProfile().winePrefixPath);
|
||||
winePrefixDirectory->setWordWrap(true);
|
||||
wineBoxLayout->addRow("Wine Prefix", winePrefixDirectory);
|
||||
|
||||
auto selectPrefixButton = new QPushButton("Select Wine Prefix");
|
||||
connect(selectPrefixButton, &QPushButton::pressed, [this, winePrefixDirectory] {
|
||||
this->window.currentProfile().winePrefixPath = QFileDialog::getExistingDirectory(this, "Open Wine Prefix");
|
||||
winePrefixDirectory->setText(this->window.currentProfile().winePrefixPath);
|
||||
connect(selectPrefixButton, &QPushButton::pressed, [this] {
|
||||
getCurrentProfile().winePrefixPath = QFileDialog::getExistingDirectory(this, "Open Wine Prefix");
|
||||
|
||||
this->window.readInitialInformation();
|
||||
this->window.saveSettings();
|
||||
this->reloadControls();
|
||||
|
||||
// TODO: figure out the purpose of calling this before 3.0
|
||||
//this->window.readInitialInformation();
|
||||
});
|
||||
wineBoxLayout->addWidget(selectPrefixButton);
|
||||
|
||||
auto openPrefixButton = new QPushButton("Open Wine Prefix");
|
||||
connect(openPrefixButton, &QPushButton::pressed, [this] {
|
||||
openPath(this->window.currentProfile().winePrefixPath);
|
||||
openPath(getCurrentProfile().winePrefixPath);
|
||||
});
|
||||
wineBoxLayout->addWidget(openPrefixButton);
|
||||
|
||||
|
@ -265,9 +271,18 @@ void SettingsWindow::reloadControls() {
|
|||
|
||||
ProfileSettings& profile = window.getProfile(profileWidget->currentRow());
|
||||
nameEdit->setText(profile.name);
|
||||
|
||||
// game
|
||||
directXCombo->setCurrentIndex(profile.useDX9 ? 1 : 0);
|
||||
currentGameDirectory->setText(profile.gamePath);
|
||||
|
||||
// wine
|
||||
wineVersionCombo->setCurrentIndex(profile.wineVersion);
|
||||
selectWineButton->setEnabled(profile.wineVersion == 1);
|
||||
winePathLabel->setText(profile.winePath);
|
||||
winePrefixDirectory->setText(profile.winePrefixPath);
|
||||
|
||||
// login
|
||||
serverType->setCurrentIndex(profile.isSapphire ? 1 : 0);
|
||||
lobbyServerURL->setText(profile.lobbyURL);
|
||||
rememberUsernameBox->setChecked(profile.rememberUsername);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
class LauncherWindow;
|
||||
struct ProfileSettings;
|
||||
|
@ -23,10 +24,18 @@ private:
|
|||
|
||||
QListWidget* profileWidget = nullptr;
|
||||
|
||||
// game
|
||||
QLineEdit* nameEdit = nullptr;
|
||||
QComboBox* directXCombo = nullptr;
|
||||
QLabel* currentGameDirectory = nullptr;
|
||||
|
||||
// wine
|
||||
QComboBox* wineVersionCombo;
|
||||
QPushButton* selectWineButton;
|
||||
QLabel* winePathLabel;
|
||||
QLabel* winePrefixDirectory;
|
||||
|
||||
// login
|
||||
QComboBox* serverType = nullptr;
|
||||
QLineEdit* lobbyServerURL = nullptr;
|
||||
QCheckBox* rememberUsernameBox = nullptr, *rememberPasswordBox = nullptr;
|
||||
|
|
|
@ -130,9 +130,9 @@ void LauncherWindow::readInitialInformation() {
|
|||
|
||||
settings.beginGroup(profile_name);
|
||||
|
||||
const int wineVersion = settings.value("wineVersion", 0).toInt();
|
||||
profile.wineVersion = settings.value("wineVersion", 0).toInt();
|
||||
#if defined(Q_OS_MAC)
|
||||
switch(wineVersion) {
|
||||
switch(profile.wineVersion) {
|
||||
case 0: // system wine
|
||||
profile.winePath = "/usr/local/bin/wine64";
|
||||
break;
|
||||
|
@ -146,7 +146,7 @@ void LauncherWindow::readInitialInformation() {
|
|||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
switch(wineVersion) {
|
||||
switch(profile.wineVersion) {
|
||||
case 0: // system wine (should be in $PATH)
|
||||
profile.winePath = "wine";
|
||||
break;
|
||||
|
@ -172,8 +172,8 @@ void LauncherWindow::readInitialInformation() {
|
|||
#endif
|
||||
}
|
||||
|
||||
if(settings.contains("winePrefix") && settings.value("winePrefix").canConvert<QString>() && !settings.value("winePrefix").toString().isEmpty()) {
|
||||
profile.winePrefixPath = settings.value("winePrefix").toString();
|
||||
if(settings.contains("winePrefixPath") && settings.value("winePrefixPath").canConvert<QString>() && !settings.value("winePrefixPath").toString().isEmpty()) {
|
||||
profile.winePrefixPath = settings.value("winePrefixPath").toString();
|
||||
} else {
|
||||
#if defined(Q_OS_MACOS)
|
||||
profile.winePrefixPath = QDir::homePath() + "/Library/Application Support/FINAL FANTASY XIV ONLINE/Bottles/published_Final_Fantasy";
|
||||
|
@ -385,9 +385,16 @@ void LauncherWindow::saveSettings() {
|
|||
for(auto profile : profileSettings) {
|
||||
settings.beginGroup(profile.name);
|
||||
|
||||
// game
|
||||
settings.setValue("useDX9", profile.useDX9);
|
||||
settings.setValue("gamePath", profile.gamePath);
|
||||
|
||||
// wine
|
||||
settings.setValue("wineVersion", profile.wineVersion);
|
||||
settings.setValue("winePath", profile.winePath);
|
||||
settings.setValue("winePrefixPath", profile.winePrefixPath);
|
||||
|
||||
// login
|
||||
settings.setValue("isSapphire", profile.isSapphire);
|
||||
settings.setValue("lobbyURL", profile.lobbyURL);
|
||||
settings.setValue("rememberUsername", profile.rememberUsername);
|
||||
|
|
|
@ -18,10 +18,15 @@ struct ProfileSettings {
|
|||
int language = 1; // 1 is english, thats all i know
|
||||
QString gamePath, winePath, winePrefixPath;
|
||||
QString bootVersion, gameVersion;
|
||||
|
||||
// 0 = system, 1 = custom, 2 = built-in (mac only)
|
||||
// TODO: yes, i know this should be an enum
|
||||
int wineVersion = 0;
|
||||
bool useEsync, useGamescope, useGamemode;
|
||||
bool useDX9 = false;
|
||||
bool enableDXVKhud = false;
|
||||
|
||||
|
||||
bool isSapphire = false;
|
||||
QString lobbyURL;
|
||||
bool rememberUsername, rememberPassword;
|
||||
|
|
Loading…
Add table
Reference in a new issue