From 1dba4a7a83cbf1612c8d9f7ad90d785cf4e92aff Mon Sep 17 00:00:00 2001 From: giomba Date: Mon, 21 Sep 2020 09:58:53 +0200 Subject: [PATCH] added "About" action --- argento/AboutWindow.cpp | 31 ++++++++++++++ argento/AboutWindow.h | 22 ++++++++++ argento/AboutWindow.ui | 45 +++++++++++++++++++++ argento/MainWindow.cpp | 9 +++++ argento/MainWindow.h | 1 + argento/MainWindow.ui | 6 +++ argento/argento.pro | 14 +++++-- argento/logo.svg | 89 +++++++++++++++++++++++++++++++++++++++++ argento/resources.qrc | 5 +++ 9 files changed, 219 insertions(+), 3 deletions(-) create mode 100644 argento/AboutWindow.cpp create mode 100644 argento/AboutWindow.h create mode 100644 argento/AboutWindow.ui create mode 100644 argento/logo.svg create mode 100644 argento/resources.qrc diff --git a/argento/AboutWindow.cpp b/argento/AboutWindow.cpp new file mode 100644 index 0000000..c951aa0 --- /dev/null +++ b/argento/AboutWindow.cpp @@ -0,0 +1,31 @@ +#include "AboutWindow.h" +#include "ui_AboutWindow.h" + +AboutWindow::AboutWindow(QWidget* parent) : + QDialog(parent), + ui(new Ui::AboutWindow) +{ + ui->setupUi(this); + + ui->text->setText( + QString("\ + Argento - Un gestionale da paura, scritto per\n\ + GOLEM - Gruppo Operativo Linux Empoli\n\ + \n\ + Questo programma รจ software libero rilasciato sotto GPL 3\n\ + presso git.golem.linux.it\n\ + \n\ + QT Version: %1\n\ + git commit: %2\n\ + data di compilazione: %3\n\ + ") + .arg(QT_VERSION_STR) + .arg(GOLEM_CURRENT_COMMIT) + .arg(QDate::currentDate().toString()) + ); +} + +AboutWindow::~AboutWindow() +{ + delete ui; +} diff --git a/argento/AboutWindow.h b/argento/AboutWindow.h new file mode 100644 index 0000000..a19432c --- /dev/null +++ b/argento/AboutWindow.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include + +namespace Ui { + class AboutWindow; +} + +class AboutWindow : public QDialog { + Q_OBJECT + +public: + explicit AboutWindow(QWidget* parent = nullptr); + ~AboutWindow(); + +private slots: + +private: + Ui::AboutWindow *ui; +}; diff --git a/argento/AboutWindow.ui b/argento/AboutWindow.ui new file mode 100644 index 0000000..cf741c7 --- /dev/null +++ b/argento/AboutWindow.ui @@ -0,0 +1,45 @@ + + + AboutWindow + + + + 0 + 0 + 360 + 300 + + + + A proposito... + + + + + + <html><head/><body><p><img src=":/logo.svg"/></p></body></html> + + + + + + + GOLEM - Gruppo Operativo Linux Empoli + + + + + + + Exit + + + + + About + + + + + + diff --git a/argento/MainWindow.cpp b/argento/MainWindow.cpp index 4e5863b..29c2bf9 100644 --- a/argento/MainWindow.cpp +++ b/argento/MainWindow.cpp @@ -15,4 +15,13 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi } else { status(Ui::ERROR, "Cannot connect to database: " + db.lastError().text()); } + + connect (ui->actionExit, &QAction::triggered, [=]() { + close(); + }); + + connect(ui->actionAbout, &QAction::triggered, [=]() { + AboutWindow window; + window.exec(); + }); } diff --git a/argento/MainWindow.h b/argento/MainWindow.h index 28810aa..11a9fd0 100644 --- a/argento/MainWindow.h +++ b/argento/MainWindow.h @@ -7,6 +7,7 @@ #include "SociListTab.h" #include "EditWindow.h" +#include "AboutWindow.h" namespace Ui { class MainWindow; diff --git a/argento/MainWindow.ui b/argento/MainWindow.ui index b68ebc9..65188e8 100644 --- a/argento/MainWindow.ui +++ b/argento/MainWindow.ui @@ -58,6 +58,7 @@ File + @@ -67,6 +68,11 @@ Exit + + + About + + diff --git a/argento/argento.pro b/argento/argento.pro index b76bb15..ab3d72d 100644 --- a/argento/argento.pro +++ b/argento/argento.pro @@ -21,6 +21,8 @@ DEFINES += QT_DEPRECATED_WARNINGS # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +DEFINES += GOLEM_CURRENT_COMMIT="\\\"$(shell git rev-parse --short=16 HEAD)\\\"" + CONFIG += c++11 SOURCES += \ @@ -30,7 +32,8 @@ SOURCES += \ status.cpp \ fullQuery.cpp \ SociListTab.cpp \ - RenewalTab.cpp + RenewalTab.cpp \ + AboutWindow.cpp HEADERS += \ @@ -39,14 +42,19 @@ HEADERS += \ status.h \ fullQuery.h \ SociListTab.h \ - RenewalTab.h + RenewalTab.h \ + AboutWindow.h FORMS += \ MainWindow.ui \ EditWindow.ui \ SociListTab.ui \ - RenewalTab.ui + RenewalTab.ui \ + AboutWindow.ui + +RESOURCES += \ + resources.qrc # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/argento/logo.svg b/argento/logo.svg new file mode 100644 index 0000000..a46f6b4 --- /dev/null +++ b/argento/logo.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/argento/resources.qrc b/argento/resources.qrc new file mode 100644 index 0000000..ea98e12 --- /dev/null +++ b/argento/resources.qrc @@ -0,0 +1,5 @@ + + + logo.svg + +