Use KAboutApplicationDialog instead of my version
This commit is contained in:
parent
ee41fd44f6
commit
ec7f6181c2
5 changed files with 25 additions and 87 deletions
|
@ -32,11 +32,10 @@ find_package(Qt5 ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS
|
|||
Gui
|
||||
Widgets
|
||||
Concurrent)
|
||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n)
|
||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons XmlGui I18n)
|
||||
|
||||
add_executable(Redai)
|
||||
target_sources(Redai PRIVATE
|
||||
src/aboutwindow.cpp
|
||||
src/artconfigwindow.h
|
||||
src/artconfigwindow.cpp
|
||||
src/artconfigwindow.h
|
||||
|
@ -56,7 +55,9 @@ target_link_libraries(Redai
|
|||
Qt5::Gui
|
||||
Qt5::Widgets
|
||||
Qt5::Concurrent
|
||||
KF5::I18n)
|
||||
KF5::I18n
|
||||
KF5::CoreAddons
|
||||
KF5::XmlGui)
|
||||
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
};
|
12
src/main.cpp
12
src/main.cpp
|
@ -2,6 +2,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <KAboutData>
|
||||
#include <KLocalizedString>
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
@ -18,6 +19,17 @@ int main(int argc, char *argv[])
|
|||
|
||||
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;
|
||||
parser.addPositionalArgument(QStringLiteral("site-path"), i18nc("@info", "Site directory."));
|
||||
|
||||
|
|
|
@ -4,14 +4,16 @@
|
|||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <KAboutApplicationDialog>
|
||||
#include <KAboutData>
|
||||
#include <KLocalizedString>
|
||||
#include <QApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QHeaderView>
|
||||
#include <QMenuBar>
|
||||
#include <QPointer>
|
||||
#include <QTableView>
|
||||
|
||||
#include "aboutwindow.h"
|
||||
#include "artconfigwindow.h"
|
||||
#include "artdetailwindow.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"));
|
||||
aboutNovusAction->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
|
||||
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
||||
auto window = new AboutWindow(this);
|
||||
window->show();
|
||||
static QPointer<QDialog> dialog;
|
||||
if (!dialog) {
|
||||
dialog = new KAboutApplicationDialog(KAboutData::applicationData(), nullptr);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
}
|
||||
dialog->show();
|
||||
});
|
||||
|
||||
auto aboutQtAction = helpMenu->addAction(i18nc("@action:inmenu", "About Qt"));
|
||||
|
|
Loading…
Add table
Reference in a new issue