1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +00:00
astra/src/settingswindow.cpp

33 lines
1.2 KiB
C++
Raw Normal View History

2021-11-01 13:14:00 -04:00
#include "settingswindow.h"
#include <QFormLayout>
#include <QPushButton>
#include <QDesktopServices>
2021-11-01 13:35:27 -04:00
#include <QLabel>
#include <QFileDialog>
2021-11-01 13:14:00 -04:00
#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);
2021-11-01 13:35:27 -04:00
auto currentGameDirectory = new QLabel(window.gamePath);
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);
});
layout->addWidget(selectDirectoryButton);
2021-11-01 13:14:00 -04:00
auto gameDirectoryButton = new QPushButton("Open Game Directory");
connect(gameDirectoryButton, &QPushButton::pressed, [this] {
QDesktopServices::openUrl("file://" + this->window.gamePath);
});
2021-11-01 13:35:27 -04:00
layout->addWidget(gameDirectoryButton);
2021-11-01 13:14:00 -04:00
}