diff --git a/CMakeLists.txt b/CMakeLists.txt index 37b591b..32dc45e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ ecm_setup_version(${PROJECT_VERSION} ) 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(glm REQUIRED) diff --git a/armoury/src/main.cpp b/armoury/src/main.cpp index 663c721..46d0b67 100644 --- a/armoury/src/main.cpp +++ b/armoury/src/main.cpp @@ -4,12 +4,16 @@ #include #include +#include "aboutdata.h" #include "mainwindow.h" #include "settings.h" int main(int argc, char* argv[]) { QApplication app(argc, argv); + customizeAboutData( + QStringLiteral("armoury"), QStringLiteral("Armoury"), QStringLiteral("Program to view FFXIV gear.")); + physis_initialize_logging(); const QString gameDir{getGameDirectory()}; diff --git a/armoury/src/mainwindow.cpp b/armoury/src/mainwindow.cpp index 57c7e58..a0e36a1 100644 --- a/armoury/src/mainwindow.cpp +++ b/armoury/src/mainwindow.cpp @@ -9,6 +9,8 @@ #include #include +#include +#include #include #include #include @@ -20,10 +22,9 @@ #include #include -#include "aboutwindow.h" #include "cmpeditor.h" -#include "gearlistwidget.h" #include "filecache.h" +#include "gearlistwidget.h" MainWindow::MainWindow(GameData* in_data) : data(*in_data), cache(FileCache{*in_data}) { 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"); aboutNovusAction->setIcon(QIcon::fromTheme("help-about")); connect(aboutNovusAction, &QAction::triggered, this, [this] { - auto window = new AboutWindow(this); + auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this); window->show(); }); diff --git a/cmake/license.h.in b/cmake/license.h.in deleted file mode 100644 index bad1ec7..0000000 --- a/cmake/license.h.in +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Joshua Goins -// SPDX-License-Identifier: CC0-1.0 - -#pragma once - -const QString license = QStringLiteral("@LICENSE_TXT@"); \ No newline at end of file diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5b3c230..7061bd9 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -3,22 +3,14 @@ add_library(NovusCommon STATIC) target_sources(NovusCommon PRIVATE - include/aboutwindow.h + include/aboutdata.h include/filecache.h include/settings.h - src/aboutwindow.cpp + src/aboutdata.cpp src/filecache.cpp src/settings.cpp) target_include_directories(NovusCommon PUBLIC include PRIVATE ${CMAKE_BINARY_DIR}) -target_link_libraries(NovusCommon PUBLIC Qt5::Core Qt5::Widgets KF5::ConfigCore 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) +target_link_libraries(NovusCommon PUBLIC Qt5::Core Qt5::Widgets KF5::ConfigCore KF5::XmlGui physis) diff --git a/common/include/aboutdata.h b/common/include/aboutdata.h new file mode 100644 index 0000000..b4df82f --- /dev/null +++ b/common/include/aboutdata.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +void customizeAboutData( + const QString& componentName, + const QString& applicationTitle, + const QString& applicationDescription); \ No newline at end of file diff --git a/common/include/aboutwindow.h b/common/include/aboutwindow.h deleted file mode 100644 index fad1e6d..0000000 --- a/common/include/aboutwindow.h +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Joshua Goins -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -class AboutWindow : public QDialog { -public: - explicit AboutWindow(QWidget* widget = nullptr); -}; \ No newline at end of file diff --git a/common/src/aboutdata.cpp b/common/src/aboutdata.cpp new file mode 100644 index 0000000..3ff1c55 --- /dev/null +++ b/common/src/aboutdata.cpp @@ -0,0 +1,40 @@ +#include "aboutdata.h" + +#include + +#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); +} \ No newline at end of file diff --git a/common/src/aboutwindow.cpp b/common/src/aboutwindow.cpp deleted file mode 100644 index 98d5060..0000000 --- a/common/src/aboutwindow.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Joshua Goins -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "aboutwindow.h" - -#include -#include -#include -#include -#include - -#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("

%1

").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("https://xiv.zone/novus"); - websiteLabel->setOpenExternalLinks(true); - aboutLayout->addWidget(websiteLabel); - - auto licenseLabel = new QLabel(); - licenseLabel->setText("License: GNU General Public License Version 3"); - 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); -} \ No newline at end of file diff --git a/exdviewer/src/main.cpp b/exdviewer/src/main.cpp index 5ab217b..ed2425e 100644 --- a/exdviewer/src/main.cpp +++ b/exdviewer/src/main.cpp @@ -4,12 +4,16 @@ #include #include +#include "aboutdata.h" #include "mainwindow.h" #include "settings.h" int main(int argc, char* argv[]) { QApplication app(argc, argv); + customizeAboutData( + QStringLiteral("exdviewer"), QStringLiteral("EXDViewer"), QStringLiteral("Program to view FFXIV Excel files.")); + const QString gameDir{getGameDirectory()}; const std::string gameDirStd{gameDir.toStdString()}; MainWindow w(physis_gamedata_initialize(gameDirStd.c_str())); diff --git a/exdviewer/src/mainwindow.cpp b/exdviewer/src/mainwindow.cpp index 80bf50e..8c21905 100644 --- a/exdviewer/src/mainwindow.cpp +++ b/exdviewer/src/mainwindow.cpp @@ -3,6 +3,8 @@ #include "mainwindow.h" +#include +#include #include #include #include @@ -14,7 +16,6 @@ #include #include "exdpart.h" -#include "aboutwindow.h" MainWindow::MainWindow(GameData* data) : data(data) { setWindowTitle("exdviewer"); @@ -39,7 +40,7 @@ MainWindow::MainWindow(GameData* data) : data(data) { auto aboutNovusAction = helpMenu->addAction("About exdviewer"); aboutNovusAction->setIcon(QIcon::fromTheme("help-about")); connect(aboutNovusAction, &QAction::triggered, this, [this] { - auto window = new AboutWindow(this); + auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this); window->show(); }); diff --git a/explorer/src/main.cpp b/explorer/src/main.cpp index 01923bb..05fd70c 100644 --- a/explorer/src/main.cpp +++ b/explorer/src/main.cpp @@ -6,12 +6,16 @@ #include #include +#include "aboutdata.h" #include "mainwindow.h" #include "settings.h" int main(int argc, char* argv[]) { QApplication app(argc, argv); + customizeAboutData( + QStringLiteral("explorer"), QStringLiteral("Explorer"), QStringLiteral("Program to explore FFXIV dat files.")); + physis_initialize_logging(); app.setStyle("Windows"); diff --git a/explorer/src/mainwindow.cpp b/explorer/src/mainwindow.cpp index 715362e..99965b2 100644 --- a/explorer/src/mainwindow.cpp +++ b/explorer/src/mainwindow.cpp @@ -3,6 +3,8 @@ #include "mainwindow.h" +#include +#include #include #include #include @@ -13,9 +15,8 @@ #include #include -#include "filetreewindow.h" #include "filepropertieswindow.h" -#include "aboutwindow.h" +#include "filetreewindow.h" MainWindow::MainWindow(GameData* data) : data(data) { setWindowTitle("explorer"); @@ -39,7 +40,7 @@ MainWindow::MainWindow(GameData* data) : data(data) { auto aboutNovusAction = helpMenu->addAction("About explorer"); aboutNovusAction->setIcon(QIcon::fromTheme("help-about")); connect(aboutNovusAction, &QAction::triggered, this, [this] { - auto window = new AboutWindow(this); + auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this); window->show(); }); diff --git a/mdlviewer/CMakeLists.txt b/mdlviewer/CMakeLists.txt index 4532bcb..94c85de 100644 --- a/mdlviewer/CMakeLists.txt +++ b/mdlviewer/CMakeLists.txt @@ -7,7 +7,7 @@ add_executable(mdlviewer target_include_directories(mdlviewer PUBLIC 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 DESTINATION "${INSTALL_BIN_PATH}") diff --git a/mdlviewer/src/main.cpp b/mdlviewer/src/main.cpp index 5ab217b..a73db76 100644 --- a/mdlviewer/src/main.cpp +++ b/mdlviewer/src/main.cpp @@ -4,12 +4,16 @@ #include #include +#include "aboutdata.h" #include "mainwindow.h" #include "settings.h" int main(int argc, char* argv[]) { QApplication app(argc, argv); + customizeAboutData( + QStringLiteral("mdlviewer"), QStringLiteral("MDLViewer"), QStringLiteral("Program to view FFXIV MDL files.")); + const QString gameDir{getGameDirectory()}; const std::string gameDirStd{gameDir.toStdString()}; MainWindow w(physis_gamedata_initialize(gameDirStd.c_str())); diff --git a/mdlviewer/src/mainwindow.cpp b/mdlviewer/src/mainwindow.cpp index 554139f..53666fe 100644 --- a/mdlviewer/src/mainwindow.cpp +++ b/mdlviewer/src/mainwindow.cpp @@ -3,6 +3,8 @@ #include "mainwindow.h" +#include +#include #include #include #include @@ -14,7 +16,6 @@ #include #include -#include "aboutwindow.h" #include "mdlpart.h" 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"); aboutNovusAction->setIcon(QIcon::fromTheme("help-about")); connect(aboutNovusAction, &QAction::triggered, this, [this] { - auto window = new AboutWindow(this); + auto window = new KAboutApplicationDialog(KAboutData::applicationData(), this); window->show(); });