From 6a32d7330129063327bb5ab57746e34a6ce340a4 Mon Sep 17 00:00:00 2001 From: redstrate Date: Wed, 10 Nov 2021 04:30:01 -0500 Subject: [PATCH] Reload wine path when wine version combo changes --- src/settingswindow.cpp | 10 +------- src/xivlauncher.cpp | 52 +++++++++++++++++++++++------------------- src/xivlauncher.h | 1 + 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index 7871bb6..d667576 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -177,11 +177,9 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window connect(wineVersionCombo, &QComboBox::currentIndexChanged, [this](int index) { getCurrentProfile().wineVersion = index; + this->window.readWineInfo(getCurrentProfile()); this->window.saveSettings(); this->reloadControls(); - - // TODO: figure out the purpose of calling this before 1.0 - // this->window.readInitialInformation(); }); connect(selectWineButton, &QPushButton::pressed, [this] { @@ -189,9 +187,6 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window this->window.saveSettings(); this->reloadControls(); - - // TODO: figure out the purpose of calling this before 2.0 - //this->window.readInitialInformation(); }); winePrefixDirectory = new QLabel(window.currentProfile().winePrefixPath); @@ -204,9 +199,6 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window this->window.saveSettings(); this->reloadControls(); - - // TODO: figure out the purpose of calling this before 3.0 - //this->window.readInitialInformation(); }); wineBoxLayout->addWidget(selectPrefixButton); diff --git a/src/xivlauncher.cpp b/src/xivlauncher.cpp index 4042d82..f913e2d 100755 --- a/src/xivlauncher.cpp +++ b/src/xivlauncher.cpp @@ -219,30 +219,7 @@ void LauncherWindow::readInitialInformation() { profile.name = settings.value("name", "Default").toString(); profile.wineVersion = settings.value("wineVersion", 0).toInt(); -#if defined(Q_OS_MAC) - switch(profile.wineVersion) { - case 0: // system wine - profile.winePath = "/usr/local/bin/wine64"; - break; - case 1: // custom path - profile.winePath = settings.value("winePath").toString(); - break; - case 2: // ffxiv built-in (for mac users) - profile.winePath = "/Applications/FINAL FANTASY XIV ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine"; - break; - } -#endif - -#if defined(Q_OS_LINUX) - switch(profile.wineVersion) { - case 0: // system wine (should be in $PATH) - profile.winePath = "wine"; - break; - case 1: // custom pth - profile.winePath = settings.value("winePath").toString(); - break; - } -#endif + readWineInfo(profile); if(settings.contains("gamePath") && settings.value("gamePath").canConvert() && !settings.value("gamePath").toString().isEmpty()) { profile.gamePath = settings.value("gamePath").toString(); @@ -293,6 +270,33 @@ void LauncherWindow::readInitialInformation() { readGameVersion(); } +void LauncherWindow::readWineInfo(ProfileSettings& profile) { +#if defined(Q_OS_MAC) + switch(profile.wineVersion) { + case 0: // system wine + profile.winePath = "/usr/local/bin/wine64"; + break; + case 1: // custom path + profile.winePath = profile.winePath; + break; + case 2: // ffxiv built-in (for mac users) + profile.winePath = "/Applications/FINAL FANTASY XIV ONLINE.app/Contents/SharedSupport/finalfantasyxiv/FINAL FANTASY XIV ONLINE/wine"; + break; + } +#endif + +#if defined(Q_OS_LINUX) + switch(profile.wineVersion) { + case 0: // system wine (should be in $PATH) + profile.winePath = "wine"; + break; + case 1: // custom pth + profile.winePath = profile.winePath; + break; + } +#endif +} + void LauncherWindow::readGameVersion() { for(auto& profile : profileSettings) { profile.bootVersion = readVersion(profile.gamePath + "/boot/ffxivboot.ver"); diff --git a/src/xivlauncher.h b/src/xivlauncher.h index 999b325..a23e8bb 100755 --- a/src/xivlauncher.h +++ b/src/xivlauncher.h @@ -77,6 +77,7 @@ public: QString readVersion(QString path); void readInitialInformation(); void readGameVersion(); + void readWineInfo(ProfileSettings& settings); void saveSettings(); QSettings settings;