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