mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-24 21:37:46 +00:00
Add settings window
This commit is contained in:
parent
272a26330b
commit
e994adb5a7
4 changed files with 49 additions and 1 deletions
|
@ -15,7 +15,8 @@ add_executable(xivlauncher
|
||||||
src/xivlauncher.cpp
|
src/xivlauncher.cpp
|
||||||
src/sapphirelauncher.cpp
|
src/sapphirelauncher.cpp
|
||||||
src/squareboot.cpp
|
src/squareboot.cpp
|
||||||
src/squarelauncher.cpp)
|
src/squarelauncher.cpp
|
||||||
|
src/settingswindow.cpp)
|
||||||
|
|
||||||
target_link_libraries(xivlauncher Qt6::Core Qt6::Widgets Qt6::Network qt6keychain)
|
target_link_libraries(xivlauncher Qt6::Core Qt6::Widgets Qt6::Network qt6keychain)
|
||||||
|
|
||||||
|
|
21
src/settingswindow.cpp
Normal file
21
src/settingswindow.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include "settingswindow.h"
|
||||||
|
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
|
#include "xivlauncher.h"
|
||||||
|
|
||||||
|
SettingsWindow::SettingsWindow(LauncherWindow& window, QWidget* parent) : window(window), QWidget(parent) {
|
||||||
|
setWindowTitle("Settings");
|
||||||
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
|
||||||
|
auto layout = new QFormLayout(this);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
auto gameDirectoryButton = new QPushButton("Open Game Directory");
|
||||||
|
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
|
||||||
|
QDesktopServices::openUrl("file://" + this->window.gamePath);
|
||||||
|
});
|
||||||
|
layout->addRow(gameDirectoryButton);
|
||||||
|
}
|
13
src/settingswindow.h
Normal file
13
src/settingswindow.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class LauncherWindow;
|
||||||
|
|
||||||
|
class SettingsWindow : public QWidget {
|
||||||
|
public:
|
||||||
|
SettingsWindow(LauncherWindow& window, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
LauncherWindow& window;
|
||||||
|
};
|
|
@ -13,11 +13,13 @@
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <keychain.h>
|
#include <keychain.h>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QMenuBar>
|
||||||
|
|
||||||
#include "xivlauncher.h"
|
#include "xivlauncher.h"
|
||||||
#include "sapphirelauncher.h"
|
#include "sapphirelauncher.h"
|
||||||
#include "squarelauncher.h"
|
#include "squarelauncher.h"
|
||||||
#include "squareboot.h"
|
#include "squareboot.h"
|
||||||
|
#include "settingswindow.h"
|
||||||
|
|
||||||
void LauncherWindow::setSSL(QNetworkRequest& request) {
|
void LauncherWindow::setSSL(QNetworkRequest& request) {
|
||||||
QSslConfiguration config;
|
QSslConfiguration config;
|
||||||
|
@ -90,6 +92,9 @@ void LauncherWindow::launch(const LoginAuth auth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWine) {
|
if (isWine) {
|
||||||
|
QStringList env = QProcess::systemEnvironment();
|
||||||
|
//env << "DXVK_FILTER_DEVICE_NAME=AMD";
|
||||||
|
process->setEnvironment(env);
|
||||||
process->start(winePath, arguments);
|
process->start(winePath, arguments);
|
||||||
} else {
|
} else {
|
||||||
process->start(ffxivPath, arguments);
|
process->start(ffxivPath, arguments);
|
||||||
|
@ -128,6 +133,14 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
|
||||||
squareLauncher = new SquareLauncher(*this);
|
squareLauncher = new SquareLauncher(*this);
|
||||||
squareBoot = new SquareBoot(*this, *squareLauncher);
|
squareBoot = new SquareBoot(*this, *squareLauncher);
|
||||||
|
|
||||||
|
QMenu* fileMenu = menuBar()->addMenu("File");
|
||||||
|
|
||||||
|
QAction* settingsAction = fileMenu->addAction("Settings...");
|
||||||
|
connect(settingsAction, &QAction::triggered, [=] {
|
||||||
|
auto window = new SettingsWindow(*this);
|
||||||
|
window->show();
|
||||||
|
});
|
||||||
|
|
||||||
const auto savedServerType = settings.value("serverType", 0).toInt();
|
const auto savedServerType = settings.value("serverType", 0).toInt();
|
||||||
const auto savedLobbyURL = settings.value("lobbyURL", "127.0.0.1").toString();
|
const auto savedLobbyURL = settings.value("lobbyURL", "127.0.0.1").toString();
|
||||||
const auto shouldRememberUsername = settings.value("rememberUsername", false).toBool();
|
const auto shouldRememberUsername = settings.value("rememberUsername", false).toBool();
|
||||||
|
|
Loading…
Add table
Reference in a new issue