mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 12:57:45 +00:00
Improve about window
Now it looks much, much nicer and will eventually include more fields, such as a place to report bugs etc.
This commit is contained in:
parent
6699ebc076
commit
5d9671af9f
5 changed files with 104 additions and 7 deletions
|
@ -37,7 +37,9 @@ set(SRC
|
||||||
include/config.h
|
include/config.h
|
||||||
include/gameinstaller.h
|
include/gameinstaller.h
|
||||||
src/gameinstaller.cpp
|
src/gameinstaller.cpp
|
||||||
src/encryptedarg.cpp)
|
src/encryptedarg.cpp
|
||||||
|
src/aboutwindow.cpp
|
||||||
|
include/aboutwindow.h)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
|
@ -146,12 +148,20 @@ add_executable(astra ${SRC})
|
||||||
|
|
||||||
target_link_libraries(astra PUBLIC ${LIBRARIES} libxiv)
|
target_link_libraries(astra PUBLIC ${LIBRARIES} libxiv)
|
||||||
|
|
||||||
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE LICENSE_TXT)
|
||||||
|
STRING(REPLACE "\n" " \\n" LICENSE_TXT ${LICENSE_TXT})
|
||||||
|
STRING(REPLACE "\"" "\"\"" LICENSE_TXT ${LICENSE_TXT})
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/license.h.in
|
||||||
|
${CMAKE_BINARY_DIR}/license.h)
|
||||||
|
|
||||||
target_include_directories(astra
|
target_include_directories(astra
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${KEYCHAIN_INCLUDE_DIRS}
|
${KEYCHAIN_INCLUDE_DIRS}
|
||||||
${QUAZIP_INCLUDE_DIRS})
|
${QUAZIP_INCLUDE_DIRS}
|
||||||
|
${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
if(ENABLE_WATCHDOG)
|
if(ENABLE_WATCHDOG)
|
||||||
target_include_directories(astra PRIVATE ${TESSERACT_INCLUDE_DIRS} ${LEPTONICA_INCLUDE_DIRS})
|
target_include_directories(astra PRIVATE ${TESSERACT_INCLUDE_DIRS} ${LEPTONICA_INCLUDE_DIRS})
|
||||||
|
|
3
cmake/license.h.in
Normal file
3
cmake/license.h.in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
const QString license = QStringLiteral("@LICENSE_TXT@");
|
8
include/aboutwindow.h
Normal file
8
include/aboutwindow.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class AboutWindow : public QDialog {
|
||||||
|
public:
|
||||||
|
AboutWindow(QWidget* widget = nullptr);
|
||||||
|
};
|
78
src/aboutwindow.cpp
Normal file
78
src/aboutwindow.cpp
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
#include "aboutwindow.h"
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
|
#include "license.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
AboutWindow::AboutWindow(QWidget* widget) : QDialog(widget) {
|
||||||
|
setWindowTitle("About");
|
||||||
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
|
||||||
|
auto mainLayout = new QVBoxLayout(this);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
auto mainLabel = new QLabel();
|
||||||
|
mainLabel->setText(QString("<h2>Astra</h2>\nVersion %1").arg(version));
|
||||||
|
mainLayout->addWidget(mainLabel);
|
||||||
|
|
||||||
|
auto aboutWidget = new QWidget();
|
||||||
|
auto aboutLayout = new QVBoxLayout();
|
||||||
|
aboutWidget->setLayout(aboutLayout);
|
||||||
|
|
||||||
|
auto aboutLabel = new QLabel();
|
||||||
|
aboutLabel->setText("Cross-platform FFXIV launcher");
|
||||||
|
aboutLayout->addWidget(aboutLabel);
|
||||||
|
|
||||||
|
auto websiteLabel = new QLabel();
|
||||||
|
websiteLabel->setText("<a href='https://xiv.zone/astra'>https://xiv.zone/astra</a>");
|
||||||
|
websiteLabel->setOpenExternalLinks(true);
|
||||||
|
aboutLayout->addWidget(websiteLabel);
|
||||||
|
|
||||||
|
auto licenseLabel = new QLabel();
|
||||||
|
licenseLabel->setText("<a href='a'>License: GNU General Public License Version 3</a>");
|
||||||
|
connect(licenseLabel, &QLabel::linkActivated, [this] {
|
||||||
|
QDialog* licenseDialog = new QDialog(this);
|
||||||
|
licenseDialog->setWindowTitle("License Agreement");
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout();
|
||||||
|
licenseDialog->setLayout(layout);
|
||||||
|
|
||||||
|
QPlainTextEdit* licenseEdit = new QPlainTextEdit();
|
||||||
|
licenseEdit->setPlainText(license);
|
||||||
|
licenseEdit->setReadOnly(true);
|
||||||
|
layout->addWidget(licenseEdit);
|
||||||
|
|
||||||
|
licenseDialog->show();
|
||||||
|
});
|
||||||
|
aboutLayout->addWidget(licenseLabel);
|
||||||
|
|
||||||
|
aboutLayout->addStretch();
|
||||||
|
|
||||||
|
auto authorsWidget = new QWidget();
|
||||||
|
auto authorsLayout = new QVBoxLayout();
|
||||||
|
authorsWidget->setLayout(authorsLayout);
|
||||||
|
|
||||||
|
auto authorNameLabel = new QLabel();
|
||||||
|
authorNameLabel->setText("Joshua Goins");
|
||||||
|
|
||||||
|
QFont boldFont = authorNameLabel->font();
|
||||||
|
boldFont.setBold(true);
|
||||||
|
authorNameLabel->setFont(boldFont);
|
||||||
|
|
||||||
|
authorsLayout->addWidget(authorNameLabel);
|
||||||
|
|
||||||
|
auto authorRoleLabel = new QLabel();
|
||||||
|
authorRoleLabel->setText("Maintainer");
|
||||||
|
authorsLayout->addWidget(authorRoleLabel);
|
||||||
|
|
||||||
|
authorsLayout->addStretch();
|
||||||
|
|
||||||
|
auto tabWidget = new QTabWidget();
|
||||||
|
tabWidget->addTab(aboutWidget, "About");
|
||||||
|
tabWidget->addTab(authorsWidget, "Authors");
|
||||||
|
mainLayout->addWidget(tabWidget);
|
||||||
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
#include "assetupdater.h"
|
#include "assetupdater.h"
|
||||||
#include "headline.h"
|
#include "headline.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "aboutwindow.h"
|
||||||
|
|
||||||
LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindow(parent), core(core) {
|
LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindow(parent), core(core) {
|
||||||
setWindowTitle("Astra");
|
setWindowTitle("Astra");
|
||||||
|
@ -84,11 +85,8 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
QAction* showAbout = helpMenu->addAction("About Astra");
|
QAction* showAbout = helpMenu->addAction("About Astra");
|
||||||
showAbout->setIcon(QIcon::fromTheme("help-about"));
|
showAbout->setIcon(QIcon::fromTheme("help-about"));
|
||||||
connect(showAbout, &QAction::triggered, [=] {
|
connect(showAbout, &QAction::triggered, [=] {
|
||||||
QString aboutText;
|
auto window = new AboutWindow(this);
|
||||||
aboutText.append(QString("Version: %1\n").arg(version));
|
window->show();
|
||||||
aboutText.append("The source code is available at https://sr.ht/~redstrate/astra.");
|
|
||||||
|
|
||||||
QMessageBox::about(this, "About Astra", aboutText);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QAction* showAboutQt = helpMenu->addAction("About Qt");
|
QAction* showAboutQt = helpMenu->addAction("About Qt");
|
||||||
|
|
Loading…
Add table
Reference in a new issue