mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-30 07:27:46 +00:00
Add about window to mdlviewer
This commit is contained in:
parent
5f2502b733
commit
0aff927279
5 changed files with 122 additions and 2 deletions
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@");
|
|
@ -13,10 +13,13 @@ add_executable(mdlviewer
|
|||
src/boneeditor.cpp
|
||||
src/cmpeditor.cpp
|
||||
src/gearlistwidget.cpp
|
||||
src/gearlistmodel.cpp)
|
||||
src/gearlistmodel.cpp
|
||||
src/aboutwindow.cpp)
|
||||
target_include_directories(mdlviewer
|
||||
PUBLIC
|
||||
include)
|
||||
include
|
||||
PRIVATE
|
||||
${CMAKE_BINARY_DIR})
|
||||
target_link_libraries(mdlviewer PUBLIC
|
||||
${LIBRARIES}
|
||||
Qt5::Core
|
||||
|
@ -43,3 +46,11 @@ if(WIN32)
|
|||
COMMAND "${WINDEPLOYQT_ENV_SETUP}" && "${WINDEPLOYQT_EXECUTABLE}" \"$<TARGET_FILE:mdlviewer>\"
|
||||
)
|
||||
endif()
|
||||
|
||||
# meant for including the license text
|
||||
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)
|
||||
|
|
8
mdlviewer/include/aboutwindow.h
Normal file
8
mdlviewer/include/aboutwindow.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class AboutWindow : public QDialog {
|
||||
public:
|
||||
explicit AboutWindow(QWidget* widget = nullptr);
|
||||
};
|
78
mdlviewer/src/aboutwindow.cpp
Normal file
78
mdlviewer/src/aboutwindow.cpp
Normal file
|
@ -0,0 +1,78 @@
|
|||
#include "aboutwindow.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#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);
|
||||
}
|
|
@ -14,7 +14,9 @@
|
|||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
#include <physis.hpp>
|
||||
#include <QApplication>
|
||||
|
||||
#include "aboutwindow.h"
|
||||
#include "cmpeditor.h"
|
||||
#include "gearlistwidget.h"
|
||||
|
||||
|
@ -47,6 +49,24 @@ MainWindow::MainWindow(GameData* in_data) : data(*in_data) {
|
|||
cmpEditor->show();
|
||||
});
|
||||
|
||||
auto helpMenu = menuBar()->addMenu("Help");
|
||||
|
||||
auto donateAction = helpMenu->addAction("Donate");
|
||||
donateAction->setIcon(QIcon::fromTheme("help-donate"));
|
||||
|
||||
helpMenu->addSeparator();
|
||||
|
||||
auto aboutNovusAction = helpMenu->addAction("About mdlviewer");
|
||||
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
||||
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
||||
auto window = new AboutWindow(this);
|
||||
window->show();
|
||||
});
|
||||
|
||||
auto aboutQtAction = helpMenu->addAction("About Qt");
|
||||
aboutQtAction->setIcon(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
|
||||
connect(aboutQtAction, &QAction::triggered, QApplication::instance(), &QApplication::aboutQt);
|
||||
|
||||
auto dummyWidget = new QWidget();
|
||||
setCentralWidget(dummyWidget);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue