mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 20:47:45 +00:00
Reorganize settings window
* Moves lobby options to the settings, along with game directory options to their own group
This commit is contained in:
parent
0675461999
commit
44ce6aa252
2 changed files with 48 additions and 41 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QListWidget>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "xivlauncher.h"
|
||||
|
||||
|
@ -29,17 +30,53 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
|
|||
profileWidget->addItem("Default");
|
||||
mainLayout->addWidget(profileWidget, 0, 0);
|
||||
|
||||
auto gameBox = new QGroupBox("Game Options");
|
||||
auto gameBoxLayout = new QFormLayout();
|
||||
gameBox->setLayout(gameBoxLayout);
|
||||
|
||||
layout->addRow(gameBox);
|
||||
|
||||
auto serverType = new QComboBox();
|
||||
serverType->insertItem(0, "Square Enix");
|
||||
serverType->insertItem(1, "Sapphire");
|
||||
//serverType->setCurrentIndex(savedServerType);
|
||||
|
||||
gameBoxLayout->addRow("Server Lobby", serverType);
|
||||
|
||||
auto lobbyServerURL = new QLineEdit();
|
||||
//lobbyServerURL->setText(savedLobbyURL);
|
||||
gameBoxLayout->addRow("Lobby URL", lobbyServerURL);
|
||||
|
||||
auto directXCombo = new QComboBox();
|
||||
directXCombo->setCurrentIndex(window.settings.value("directx", 0).toInt());
|
||||
directXCombo->addItem("DirectX 11");
|
||||
directXCombo->addItem("DirectX 9");
|
||||
layout->addRow("DirectX Version", directXCombo);
|
||||
gameBoxLayout->addRow("DirectX Version", directXCombo);
|
||||
|
||||
connect(directXCombo, &QComboBox::currentIndexChanged, [=](int index) {
|
||||
this->window.settings.setValue("directx", directXCombo->currentIndex());
|
||||
this->window.useDX9 = directXCombo->currentIndex() == 1;
|
||||
});
|
||||
|
||||
auto currentGameDirectory = new QLabel(window.gamePath);
|
||||
currentGameDirectory->setWordWrap(true);
|
||||
gameBoxLayout->addRow("Game Directory", currentGameDirectory);
|
||||
|
||||
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
||||
connect(selectDirectoryButton, &QPushButton::pressed, [this, currentGameDirectory] {
|
||||
this->window.gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
||||
currentGameDirectory->setText(this->window.gamePath);
|
||||
|
||||
this->window.readInitialInformation();
|
||||
});
|
||||
gameBoxLayout->addWidget(selectDirectoryButton);
|
||||
|
||||
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
||||
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
||||
openPath(this->window.gamePath);
|
||||
});
|
||||
gameBoxLayout->addWidget(gameDirectoryButton);
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||
auto wineBox = new QGroupBox("Wine Options");
|
||||
auto wineBoxLayout = new QFormLayout();
|
||||
|
@ -159,25 +196,6 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window
|
|||
this->window.settings.setValue("useGamemode", static_cast<bool>(state));
|
||||
});
|
||||
#endif
|
||||
|
||||
auto currentGameDirectory = new QLabel(window.gamePath);
|
||||
currentGameDirectory->setWordWrap(true);
|
||||
layout->addRow("Game Directory", currentGameDirectory);
|
||||
|
||||
auto selectDirectoryButton = new QPushButton("Select Game Directory");
|
||||
connect(selectDirectoryButton, &QPushButton::pressed, [this, currentGameDirectory] {
|
||||
this->window.gamePath = QFileDialog::getExistingDirectory(this, "Open Game Directory");
|
||||
currentGameDirectory->setText(this->window.gamePath);
|
||||
|
||||
this->window.readInitialInformation();
|
||||
});
|
||||
layout->addWidget(selectDirectoryButton);
|
||||
|
||||
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
||||
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
||||
openPath(this->window.gamePath);
|
||||
});
|
||||
layout->addWidget(gameDirectoryButton);
|
||||
}
|
||||
|
||||
void SettingsWindow::openPath(const QString path) {
|
||||
|
|
|
@ -240,17 +240,6 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
|
|||
profileSelect->addItem("Default");
|
||||
layout->addRow("Profile", profileSelect);
|
||||
|
||||
auto serverType = new QComboBox();
|
||||
serverType->insertItem(0, "Square Enix");
|
||||
serverType->insertItem(1, "Sapphire");
|
||||
serverType->setCurrentIndex(savedServerType);
|
||||
|
||||
layout->addRow("Server Lobby", serverType);
|
||||
|
||||
auto lobbyServerURL = new QLineEdit();
|
||||
lobbyServerURL->setText(savedLobbyURL);
|
||||
layout->addRow("Lobby URL", lobbyServerURL);
|
||||
|
||||
auto usernameEdit = new QLineEdit();
|
||||
layout->addRow("Username", usernameEdit);
|
||||
|
||||
|
@ -295,7 +284,7 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
|
|||
auto registerButton = new QPushButton("Register");
|
||||
layout->addRow(registerButton);
|
||||
|
||||
const auto refreshControls = [=](int index) {
|
||||
/*const auto refreshControls = [=](int index) {
|
||||
lobbyServerURL->setEnabled(index == 1);
|
||||
registerButton->setEnabled(index == 1);
|
||||
otpEdit->setEnabled(index == 0);
|
||||
|
@ -304,7 +293,7 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
|
|||
|
||||
connect(serverType, &QComboBox::currentIndexChanged, [=](int index) {
|
||||
refreshControls(index);
|
||||
});
|
||||
});*/
|
||||
|
||||
auto emptyWidget = new QWidget();
|
||||
emptyWidget->setLayout(layout);
|
||||
|
@ -334,23 +323,23 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
|
|||
job->start();
|
||||
}
|
||||
|
||||
settings.setValue("serverType", serverType->currentIndex());
|
||||
settings.setValue("lobbyURL", lobbyServerURL->text());
|
||||
//settings.setValue("serverType", serverType->currentIndex());
|
||||
//settings.setValue("lobbyURL", lobbyServerURL->text());
|
||||
|
||||
if(serverType->currentIndex() == 0) {
|
||||
//if(serverType->currentIndex() == 0) {
|
||||
// begin se's booting process
|
||||
squareBoot->bootCheck(info);
|
||||
} else {
|
||||
sapphireLauncher->login(lobbyServerURL->text(), info);
|
||||
}
|
||||
//} else {
|
||||
// sapphireLauncher->login(lobbyServerURL->text(), info);
|
||||
//}
|
||||
});
|
||||
|
||||
connect(registerButton, &QPushButton::released, [=] {
|
||||
/*connect(registerButton, &QPushButton::released, [=] {
|
||||
if(serverType->currentIndex() == 1) {
|
||||
auto info = LoginInformation{usernameEdit->text(), passwordEdit->text(), otpEdit->text()};
|
||||
sapphireLauncher->registerAccount(lobbyServerURL->text(), info);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
LauncherWindow::~LauncherWindow() = default;
|
||||
|
|
Loading…
Add table
Reference in a new issue