Use KAboutApplicationDialog instead of my version

This commit is contained in:
Joshua Goins 2023-11-29 23:16:18 -05:00
parent ee41fd44f6
commit ec7f6181c2
5 changed files with 25 additions and 87 deletions

View file

@ -32,11 +32,10 @@ find_package(Qt5 ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS
Gui Gui
Widgets Widgets
Concurrent) Concurrent)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons XmlGui I18n)
add_executable(Redai) add_executable(Redai)
target_sources(Redai PRIVATE target_sources(Redai PRIVATE
src/aboutwindow.cpp
src/artconfigwindow.h src/artconfigwindow.h
src/artconfigwindow.cpp src/artconfigwindow.cpp
src/artconfigwindow.h src/artconfigwindow.h
@ -56,7 +55,9 @@ target_link_libraries(Redai
Qt5::Gui Qt5::Gui
Qt5::Widgets Qt5::Widgets
Qt5::Concurrent Qt5::Concurrent
KF5::I18n) KF5::I18n
KF5::CoreAddons
KF5::XmlGui)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

View file

@ -1,68 +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>
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("Tool manage website galleries.");
aboutLayout->addWidget(aboutLabel);
auto websiteLabel = new QLabel();
websiteLabel->setText("<a href='https://git.sr.ht/~redstrate/redai'>https://git.sr.ht/~redstrate/redai</a>");
websiteLabel->setOpenExternalLinks(true);
aboutLayout->addWidget(websiteLabel);
auto licenseLabel = new QLabel();
licenseLabel->setText("License: GNU General Public License Version 3");
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);
}

View file

@ -1,13 +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);
};

View file

@ -2,6 +2,7 @@
// //
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
#include <KAboutData>
#include <KLocalizedString> #include <KLocalizedString>
#include <QApplication> #include <QApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
@ -18,6 +19,17 @@ int main(int argc, char *argv[])
KLocalizedString::setApplicationDomain("redai"); KLocalizedString::setApplicationDomain("redai");
KAboutData about(QStringLiteral("redai"),
i18n("Redai"),
QStringLiteral("1.0"),
i18n("Website gallery manager"),
KAboutLicense::GPL_V3,
i18n("© 2023 Joshua Goins"));
about.addAuthor(i18n("Joshua Goins"), i18n("Maintainer"), QStringLiteral("josh@redstrate.com"), QStringLiteral("https://redstrate.com/"));
about.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails"));
KAboutData::setApplicationData(about);
QCommandLineParser parser; QCommandLineParser parser;
parser.addPositionalArgument(QStringLiteral("site-path"), i18nc("@info", "Site directory.")); parser.addPositionalArgument(QStringLiteral("site-path"), i18nc("@info", "Site directory."));

View file

@ -4,14 +4,16 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <KAboutApplicationDialog>
#include <KAboutData>
#include <KLocalizedString> #include <KLocalizedString>
#include <QApplication> #include <QApplication>
#include <QDesktopServices> #include <QDesktopServices>
#include <QHeaderView> #include <QHeaderView>
#include <QMenuBar> #include <QMenuBar>
#include <QPointer>
#include <QTableView> #include <QTableView>
#include "aboutwindow.h"
#include "artconfigwindow.h" #include "artconfigwindow.h"
#include "artdetailwindow.h" #include "artdetailwindow.h"
#include "artmodel.h" #include "artmodel.h"
@ -56,8 +58,12 @@ MainWindow::MainWindow(const QDir &definitionDirectory, const QDir &assetDirecto
auto aboutNovusAction = helpMenu->addAction(i18nc("@action:inmenu", "About Redai")); auto aboutNovusAction = helpMenu->addAction(i18nc("@action:inmenu", "About Redai"));
aboutNovusAction->setIcon(QIcon::fromTheme(QStringLiteral("help-about"))); aboutNovusAction->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
connect(aboutNovusAction, &QAction::triggered, this, [this] { connect(aboutNovusAction, &QAction::triggered, this, [this] {
auto window = new AboutWindow(this); static QPointer<QDialog> dialog;
window->show(); if (!dialog) {
dialog = new KAboutApplicationDialog(KAboutData::applicationData(), nullptr);
dialog->setAttribute(Qt::WA_DeleteOnClose);
}
dialog->show();
}); });
auto aboutQtAction = helpMenu->addAction(i18nc("@action:inmenu", "About Qt")); auto aboutQtAction = helpMenu->addAction(i18nc("@action:inmenu", "About Qt"));