From 6a07ef99d9f98b1db4fad91b3cd69e6146c1f01e Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Fri, 5 Jan 2024 14:58:51 +0100 Subject: Implement about dialog --- CMakeLists.txt | 3 ++ src/aboutdialog.cpp | 20 +++++++++++ src/aboutdialog.h | 18 ++++++++++ src/aboutdialog.ui | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/mainwindow.cpp | 4 ++- 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/aboutdialog.cpp create mode 100644 src/aboutdialog.h create mode 100644 src/aboutdialog.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index c5daebf..83d8b99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,9 @@ set(PROJECT_SOURCES src/settingsdialog.cpp src/settingsdialog.h src/settingsdialog.ui + src/aboutdialog.cpp + src/aboutdialog.h + src/aboutdialog.ui src/settings_interface.cpp src/settings_interface.h src/widgets/status_info.cpp diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp new file mode 100644 index 0000000..0a96e59 --- /dev/null +++ b/src/aboutdialog.cpp @@ -0,0 +1,20 @@ +#include "aboutdialog.h" +#include + +AboutDialog::AboutDialog(QWidget* parent) + : QDialog(parent, Qt::Dialog), ui(new Ui::AboutDialog) +{ + ui->setupUi(this); + + // TODO: show version or git build in about text + //ui->label->setText(ui->label->text().arg("aaa")); + + // I have been saved by https://stackoverflow.com/a/22565649 + // It's not more complicated than that… thankfully + adjustSize(); + setFixedSize(sizeHint()); +} + +AboutDialog::~AboutDialog() { + delete ui; +} diff --git a/src/aboutdialog.h b/src/aboutdialog.h new file mode 100644 index 0000000..f37f0e9 --- /dev/null +++ b/src/aboutdialog.h @@ -0,0 +1,18 @@ +#pragma once +#include +#include "./ui_aboutdialog.h" + +QT_BEGIN_NAMESPACE +namespace Ui { class AboutDialog; } +QT_END_NAMESPACE + +class AboutDialog : public QDialog { + Q_OBJECT + +public: + AboutDialog(QWidget *parent = nullptr); + ~AboutDialog(); + +private: + Ui::AboutDialog* ui; +}; diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui new file mode 100644 index 0000000..dd31ae1 --- /dev/null +++ b/src/aboutdialog.ui @@ -0,0 +1,101 @@ + + + AboutDialog + + + + 0 + 0 + 400 + 300 + + + + + 0 + 0 + + + + + 400 + 300 + + + + + 1000 + 900 + + + + About + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">ActorViewer</span><span style=" font-weight:600;"> %1</span><br/></p><p>ActorViewer is an application that allow one to browse through Fediverse data exports via the help of a Qt-based user interface. It permits one to filter through different types of posts, search through them and view all embedded content related to an Activity.</p><p>This application is licensed under the GNU General Public License, version 3. Please see the LICENSE file, which lists your rights as a user, available in the source code repository's root directory.</p><p>The source code is available at the following web address: <a href="https://git.twilightsparkle.space/ActorViewer/about/"><span style=" text-decoration: underline; color:#ae82c1;">https://git.twilightsparkle.space/ActorViewer/</span></a></p></body></html> + + + true + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + AboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AboutDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b54a767..c2a9820 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3,6 +3,7 @@ #include "src/archive/base_archive.h" #include "src/command_line.h" #include "src/settingsdialog.h" +#include "src/aboutdialog.h" #include "src/widgets/tab_activity_list.h" #include @@ -105,7 +106,8 @@ void MainWindow::on_actionQuit_triggered(bool checked) { } void MainWindow::on_actionAbout_triggered(bool checked) { - QMessageBox::information(this, "title", "text"); + AboutDialog about_dialog(this); + about_dialog.exec(); } void MainWindow::open_file(const QString &filename) { -- cgit v1.2.3-54-g00ecf