1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 21:07:45 +00:00

Reload wine path when wine version combo changes

This commit is contained in:
redstrate 2021-11-10 04:30:01 -05:00
parent 241b4b43e1
commit 6a32d73301
3 changed files with 30 additions and 33 deletions

View file

@ -177,11 +177,9 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
connect(wineVersionCombo, &QComboBox::currentIndexChanged, [this](int index) { connect(wineVersionCombo, &QComboBox::currentIndexChanged, [this](int index) {
getCurrentProfile().wineVersion = index; getCurrentProfile().wineVersion = index;
this->window.readWineInfo(getCurrentProfile());
this->window.saveSettings(); this->window.saveSettings();
this->reloadControls(); this->reloadControls();
// TODO: figure out the purpose of calling this before 1.0
// this->window.readInitialInformation();
}); });
connect(selectWineButton, &QPushButton::pressed, [this] { connect(selectWineButton, &QPushButton::pressed, [this] {
@ -189,9 +187,6 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
this->window.saveSettings(); this->window.saveSettings();
this->reloadControls(); this->reloadControls();
// TODO: figure out the purpose of calling this before 2.0
//this->window.readInitialInformation();
}); });
winePrefixDirectory = new QLabel(window.currentProfile().winePrefixPath); winePrefixDirectory = new QLabel(window.currentProfile().winePrefixPath);
@ -204,9 +199,6 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
this->window.saveSettings(); this->window.saveSettings();
this->reloadControls(); this->reloadControls();
// TODO: figure out the purpose of calling this before 3.0
//this->window.readInitialInformation();
}); });
wineBoxLayout->addWidget(selectPrefixButton); wineBoxLayout->addWidget(selectPrefixButton);

View file

@ -219,30 +219,7 @@ void LauncherWindow::readInitialInformation() {
profile.name = settings.value("name", "Default").toString(); profile.name = settings.value("name", "Default").toString();
profile.wineVersion = settings.value("wineVersion", 0).toInt(); profile.wineVersion = settings.value("wineVersion", 0).toInt();
#if defined(Q_OS_MAC) readWineInfo(profile);
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
if(settings.contains("gamePath") && settings.value("gamePath").canConvert<QString>() && !settings.value("gamePath").toString().isEmpty()) { if(settings.contains("gamePath") && settings.value("gamePath").canConvert<QString>() && !settings.value("gamePath").toString().isEmpty()) {
profile.gamePath = settings.value("gamePath").toString(); profile.gamePath = settings.value("gamePath").toString();
@ -293,6 +270,33 @@ void LauncherWindow::readInitialInformation() {
readGameVersion(); 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() { void LauncherWindow::readGameVersion() {
for(auto& profile : profileSettings) { for(auto& profile : profileSettings) {
profile.bootVersion = readVersion(profile.gamePath + "/boot/ffxivboot.ver"); profile.bootVersion = readVersion(profile.gamePath + "/boot/ffxivboot.ver");

View file

@ -77,6 +77,7 @@ public:
QString readVersion(QString path); QString readVersion(QString path);
void readInitialInformation(); void readInitialInformation();
void readGameVersion(); void readGameVersion();
void readWineInfo(ProfileSettings& settings);
void saveSettings(); void saveSettings();
QSettings settings; QSettings settings;