added "About" action

This commit is contained in:
giomba 2020-09-21 09:58:53 +02:00
parent f3f910b867
commit 1dba4a7a83
9 changed files with 219 additions and 3 deletions

31
argento/AboutWindow.cpp Normal file
View File

@ -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;
}

22
argento/AboutWindow.h Normal file
View File

@ -0,0 +1,22 @@
#pragma once
#include <QDebug>
#include <QDialog>
#include <QDate>
namespace Ui {
class AboutWindow;
}
class AboutWindow : public QDialog {
Q_OBJECT
public:
explicit AboutWindow(QWidget* parent = nullptr);
~AboutWindow();
private slots:
private:
Ui::AboutWindow *ui;
};

45
argento/AboutWindow.ui Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutWindow</class>
<widget class="QDialog" name="AboutWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>360</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>A proposito...</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/logo.svg&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="text">
<property name="text">
<string>GOLEM - Gruppo Operativo Linux Empoli</string>
</property>
</widget>
</item>
</layout>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -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();
});
}

View File

@ -7,6 +7,7 @@
#include "SociListTab.h"
#include "EditWindow.h"
#include "AboutWindow.h"
namespace Ui {
class MainWindow;

View File

@ -58,6 +58,7 @@
<property name="title">
<string>File</string>
</property>
<addaction name="actionAbout"/>
<addaction name="actionExit"/>
</widget>
<addaction name="menuwhat_s_this"/>
@ -67,6 +68,11 @@
<string>Exit</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -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

89
argento/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 23 KiB

5
argento/resources.qrc Normal file
View File

@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>logo.svg</file>
</qresource>
</RCC>