mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-20 11:47:45 +00:00
Use KAboutApplicationWindow instead of our custom one
This commit is contained in:
parent
94758b35b4
commit
cfee6775f4
16 changed files with 84 additions and 121 deletions
|
@ -36,7 +36,7 @@ ecm_setup_version(${PROJECT_VERSION}
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(Qt5 ${QT_MIN_VERSION} COMPONENTS Core Widgets Concurrent CONFIG REQUIRED)
|
find_package(Qt5 ${QT_MIN_VERSION} COMPONENTS Core Widgets Concurrent CONFIG REQUIRED)
|
||||||
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Config)
|
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Config XmlGui)
|
||||||
find_package(Vulkan REQUIRED)
|
find_package(Vulkan REQUIRED)
|
||||||
find_package(glm REQUIRED)
|
find_package(glm REQUIRED)
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
|
#include "aboutdata.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
customizeAboutData(
|
||||||
|
QStringLiteral("armoury"), QStringLiteral("Armoury"), QStringLiteral("Program to view FFXIV gear."));
|
||||||
|
|
||||||
physis_initialize_logging();
|
physis_initialize_logging();
|
||||||
|
|
||||||
const QString gameDir{getGameDirectory()};
|
const QString gameDir{getGameDirectory()};
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include <KAboutApplicationDialog>
|
||||||
|
#include <KAboutData>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
@ -20,10 +22,9 @@
|
||||||
#include <magic_enum.hpp>
|
#include <magic_enum.hpp>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
#include "aboutwindow.h"
|
|
||||||
#include "cmpeditor.h"
|
#include "cmpeditor.h"
|
||||||
#include "gearlistwidget.h"
|
|
||||||
#include "filecache.h"
|
#include "filecache.h"
|
||||||
|
#include "gearlistwidget.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData* in_data) : data(*in_data), cache(FileCache{*in_data}) {
|
MainWindow::MainWindow(GameData* in_data) : data(*in_data), cache(FileCache{*in_data}) {
|
||||||
setWindowTitle("Armoury Editor");
|
setWindowTitle("Armoury Editor");
|
||||||
|
@ -57,7 +58,7 @@ MainWindow::MainWindow(GameData* in_data) : data(*in_data), cache(FileCache{*in_
|
||||||
auto aboutNovusAction = helpMenu->addAction("About Armoury Editor");
|
auto aboutNovusAction = helpMenu->addAction("About Armoury Editor");
|
||||||
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
||||||
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
||||||
auto window = new AboutWindow(this);
|
auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this);
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
||||||
// SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
const QString license = QStringLiteral("@LICENSE_TXT@");
|
|
|
@ -3,22 +3,14 @@
|
||||||
|
|
||||||
add_library(NovusCommon STATIC)
|
add_library(NovusCommon STATIC)
|
||||||
target_sources(NovusCommon PRIVATE
|
target_sources(NovusCommon PRIVATE
|
||||||
include/aboutwindow.h
|
include/aboutdata.h
|
||||||
include/filecache.h
|
include/filecache.h
|
||||||
include/settings.h
|
include/settings.h
|
||||||
src/aboutwindow.cpp
|
src/aboutdata.cpp
|
||||||
src/filecache.cpp
|
src/filecache.cpp
|
||||||
src/settings.cpp)
|
src/settings.cpp)
|
||||||
target_include_directories(NovusCommon PUBLIC
|
target_include_directories(NovusCommon PUBLIC
|
||||||
include
|
include
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CMAKE_BINARY_DIR})
|
${CMAKE_BINARY_DIR})
|
||||||
target_link_libraries(NovusCommon PUBLIC Qt5::Core Qt5::Widgets KF5::ConfigCore physis)
|
target_link_libraries(NovusCommon PUBLIC Qt5::Core Qt5::Widgets KF5::ConfigCore KF5::XmlGui physis)
|
||||||
|
|
||||||
# meant for including the license text
|
|
||||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../LICENSES/GPL-3.0-or-later.txt 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)
|
|
||||||
|
|
9
common/include/aboutdata.h
Normal file
9
common/include/aboutdata.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <KAboutData>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
void customizeAboutData(
|
||||||
|
const QString& componentName,
|
||||||
|
const QString& applicationTitle,
|
||||||
|
const QString& applicationDescription);
|
|
@ -1,11 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
class AboutWindow : public QDialog {
|
|
||||||
public:
|
|
||||||
explicit AboutWindow(QWidget* widget = nullptr);
|
|
||||||
};
|
|
40
common/src/aboutdata.cpp
Normal file
40
common/src/aboutdata.cpp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#include "aboutdata.h"
|
||||||
|
|
||||||
|
#include <physis.hpp>
|
||||||
|
|
||||||
|
#include "novus-version.h"
|
||||||
|
|
||||||
|
void customizeAboutData(
|
||||||
|
const QString& componentName,
|
||||||
|
const QString& applicationTitle,
|
||||||
|
const QString& applicationDescription) {
|
||||||
|
KAboutData about(
|
||||||
|
componentName,
|
||||||
|
applicationTitle,
|
||||||
|
QStringLiteral(NOVUS_VERSION_STRING),
|
||||||
|
applicationDescription,
|
||||||
|
KAboutLicense::GPL_V3,
|
||||||
|
QStringLiteral("© 2023 Joshua Goins"));
|
||||||
|
about.addAuthor(
|
||||||
|
QStringLiteral("Joshua Goins"),
|
||||||
|
QStringLiteral("Maintainer"),
|
||||||
|
QStringLiteral("josh@redstrate.com"),
|
||||||
|
QStringLiteral("https://redstrate.com/"));
|
||||||
|
about.setHomepage(QStringLiteral("https://xiv.zone/astra"));
|
||||||
|
about.addComponent(
|
||||||
|
QStringLiteral("physis"),
|
||||||
|
QStringLiteral("Library to access FFXIV data"),
|
||||||
|
physis_get_physis_version(),
|
||||||
|
QStringLiteral("https://xiv.zone/physis"),
|
||||||
|
KAboutLicense::GPL_V3);
|
||||||
|
about.addComponent(
|
||||||
|
QStringLiteral("libphysis"),
|
||||||
|
QStringLiteral("C bindings for physis"),
|
||||||
|
physis_get_libphysis_version(),
|
||||||
|
{},
|
||||||
|
KAboutLicense::GPL_V3);
|
||||||
|
about.setBugAddress(QByteArrayLiteral("https://lists.sr.ht/~redstrate/public-inbox"));
|
||||||
|
about.setComponentName(componentName);
|
||||||
|
|
||||||
|
KAboutData::setApplicationData(about);
|
||||||
|
}
|
|
@ -1,81 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#include "aboutwindow.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <QTabWidget>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
#include "license.h"
|
|
||||||
|
|
||||||
AboutWindow::AboutWindow(QWidget* widget) : QDialog(widget) {
|
|
||||||
setWindowTitle("About");
|
|
||||||
setWindowModality(Qt::WindowModality::ApplicationModal);
|
|
||||||
|
|
||||||
auto mainLayout = new QVBoxLayout();
|
|
||||||
setLayout(mainLayout);
|
|
||||||
|
|
||||||
auto mainLabel = new QLabel();
|
|
||||||
mainLabel->setText(QString("<h2>%1</h2>").arg(QCoreApplication::applicationName()));
|
|
||||||
mainLayout->addWidget(mainLabel);
|
|
||||||
|
|
||||||
auto aboutWidget = new QWidget();
|
|
||||||
auto aboutLayout = new QVBoxLayout();
|
|
||||||
aboutWidget->setLayout(aboutLayout);
|
|
||||||
|
|
||||||
auto aboutLabel = new QLabel();
|
|
||||||
aboutLabel->setText("Part of the Novus modding tool environment.");
|
|
||||||
aboutLayout->addWidget(aboutLabel);
|
|
||||||
|
|
||||||
auto websiteLabel = new QLabel();
|
|
||||||
websiteLabel->setText("<a href='https://xiv.zone/novus'>https://xiv.zone/novus</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] {
|
|
||||||
auto licenseDialog = new QDialog(this);
|
|
||||||
licenseDialog->setWindowTitle("License Agreement");
|
|
||||||
|
|
||||||
auto layout = new QVBoxLayout();
|
|
||||||
licenseDialog->setLayout(layout);
|
|
||||||
|
|
||||||
auto 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);
|
|
||||||
}
|
|
|
@ -4,12 +4,16 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
|
#include "aboutdata.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
customizeAboutData(
|
||||||
|
QStringLiteral("exdviewer"), QStringLiteral("EXDViewer"), QStringLiteral("Program to view FFXIV Excel files."));
|
||||||
|
|
||||||
const QString gameDir{getGameDirectory()};
|
const QString gameDir{getGameDirectory()};
|
||||||
const std::string gameDirStd{gameDir.toStdString()};
|
const std::string gameDirStd{gameDir.toStdString()};
|
||||||
MainWindow w(physis_gamedata_initialize(gameDirStd.c_str()));
|
MainWindow w(physis_gamedata_initialize(gameDirStd.c_str()));
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <KAboutApplicationDialog>
|
||||||
|
#include <KAboutData>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
@ -14,7 +16,6 @@
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
#include "exdpart.h"
|
#include "exdpart.h"
|
||||||
#include "aboutwindow.h"
|
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData* data) : data(data) {
|
MainWindow::MainWindow(GameData* data) : data(data) {
|
||||||
setWindowTitle("exdviewer");
|
setWindowTitle("exdviewer");
|
||||||
|
@ -39,7 +40,7 @@ MainWindow::MainWindow(GameData* data) : data(data) {
|
||||||
auto aboutNovusAction = helpMenu->addAction("About exdviewer");
|
auto aboutNovusAction = helpMenu->addAction("About exdviewer");
|
||||||
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
||||||
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
||||||
auto window = new AboutWindow(this);
|
auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this);
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,16 @@
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
|
#include "aboutdata.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
customizeAboutData(
|
||||||
|
QStringLiteral("explorer"), QStringLiteral("Explorer"), QStringLiteral("Program to explore FFXIV dat files."));
|
||||||
|
|
||||||
physis_initialize_logging();
|
physis_initialize_logging();
|
||||||
|
|
||||||
app.setStyle("Windows");
|
app.setStyle("Windows");
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <KAboutApplicationDialog>
|
||||||
|
#include <KAboutData>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -13,9 +15,8 @@
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "filetreewindow.h"
|
|
||||||
#include "filepropertieswindow.h"
|
#include "filepropertieswindow.h"
|
||||||
#include "aboutwindow.h"
|
#include "filetreewindow.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData* data) : data(data) {
|
MainWindow::MainWindow(GameData* data) : data(data) {
|
||||||
setWindowTitle("explorer");
|
setWindowTitle("explorer");
|
||||||
|
@ -39,7 +40,7 @@ MainWindow::MainWindow(GameData* data) : data(data) {
|
||||||
auto aboutNovusAction = helpMenu->addAction("About explorer");
|
auto aboutNovusAction = helpMenu->addAction("About explorer");
|
||||||
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
||||||
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
||||||
auto window = new AboutWindow(this);
|
auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this);
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ add_executable(mdlviewer
|
||||||
target_include_directories(mdlviewer
|
target_include_directories(mdlviewer
|
||||||
PUBLIC
|
PUBLIC
|
||||||
include)
|
include)
|
||||||
target_link_libraries(mdlviewer PUBLIC physis z ${LIBRARIES} Qt5::Core Qt5::Widgets mdlpart NovusCommon)
|
target_link_libraries(mdlviewer PUBLIC physis z ${LIBRARIES} Qt5::Core Qt5::Widgets KF5::XmlGui mdlpart NovusCommon)
|
||||||
|
|
||||||
install(TARGETS mdlviewer
|
install(TARGETS mdlviewer
|
||||||
DESTINATION "${INSTALL_BIN_PATH}")
|
DESTINATION "${INSTALL_BIN_PATH}")
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
|
#include "aboutdata.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
customizeAboutData(
|
||||||
|
QStringLiteral("mdlviewer"), QStringLiteral("MDLViewer"), QStringLiteral("Program to view FFXIV MDL files."));
|
||||||
|
|
||||||
const QString gameDir{getGameDirectory()};
|
const QString gameDir{getGameDirectory()};
|
||||||
const std::string gameDirStd{gameDir.toStdString()};
|
const std::string gameDirStd{gameDir.toStdString()};
|
||||||
MainWindow w(physis_gamedata_initialize(gameDirStd.c_str()));
|
MainWindow w(physis_gamedata_initialize(gameDirStd.c_str()));
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <KAboutApplicationDialog>
|
||||||
|
#include <KAboutData>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
@ -14,7 +16,6 @@
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <physis.hpp>
|
#include <physis.hpp>
|
||||||
|
|
||||||
#include "aboutwindow.h"
|
|
||||||
#include "mdlpart.h"
|
#include "mdlpart.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(GameData* data) : data(data), cache(FileCache{*data}) {
|
MainWindow::MainWindow(GameData* data) : data(data), cache(FileCache{*data}) {
|
||||||
|
@ -55,7 +56,7 @@ MainWindow::MainWindow(GameData* data) : data(data), cache(FileCache{*data}) {
|
||||||
auto aboutNovusAction = helpMenu->addAction("About Model Viewer");
|
auto aboutNovusAction = helpMenu->addAction("About Model Viewer");
|
||||||
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
||||||
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
||||||
auto window = new AboutWindow(this);
|
auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this);
|
||||||
window->show();
|
window->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue