add more information to about

This commit is contained in:
Yannik Schmidt
2020-09-04 12:59:33 +02:00
parent 41c29d43ce
commit 916005ddea
2 changed files with 24 additions and 5 deletions

View File

@@ -9,6 +9,8 @@
#define Y_POS_VERSION 0 #define Y_POS_VERSION 0
#define Y_POS_SERVER_INFO 1 #define Y_POS_SERVER_INFO 1
#define Y_POS_BUILD_DATE 2
#define Y_POS_BUILD_HOST 3
About::About(QWidget *parent, QSettings *settings) : QMainWindow(parent) { About::About(QWidget *parent, QSettings *settings) : QMainWindow(parent) {
@@ -19,7 +21,9 @@ About::About(QWidget *parent, QSettings *settings) : QMainWindow(parent) {
QGridLayout *layoutLegal = new QGridLayout(); QGridLayout *layoutLegal = new QGridLayout();
QGroupBox *legalGroup = new QGroupBox(); QGroupBox *legalGroup = new QGroupBox();
legalGroup->setTitle("Rechtliches"); legalGroup->setTitle("Rechtliches");
QLabel *licenseLabel = new QLabel("Diese Software wird unter der<a href=\"https://www.gnu.org/licenses/gpl-3.0-standalone.html\">GPLv3</a>verbreitet.<br>Code und Kompelierungsinstruktionen sind konform zur Lizenz<a href=\"https://github.com/FAUSheppy/speech-server-client-qt\">hier</a> zugänglich."); QLabel *licenseLabel = new QLabel("Diese Software wird unter der <a href=\"https://www.gnu.org/licenses/gpl-3.0-standalone.html\">GPLv3</a> verbreitet."
"<br>Code und Kompelierungsinstruktionen sind konform zur Lizenz <a href=\"https://github.com/FAUSheppy/speech-server-client-qt\">hier</a> "
"zugänglich.");
licenseLabel->setOpenExternalLinks(true); licenseLabel->setOpenExternalLinks(true);
layoutLegal->addWidget(licenseLabel, 0, 0); layoutLegal->addWidget(licenseLabel, 0, 0);
layoutLegal->addWidget(new QLabel("Author: Yannik Schmidt"), 1, 0); layoutLegal->addWidget(new QLabel("Author: Yannik Schmidt"), 1, 0);
@@ -29,15 +33,25 @@ About::About(QWidget *parent, QSettings *settings) : QMainWindow(parent) {
layoutSoftwareinfo = new QGridLayout(); layoutSoftwareinfo = new QGridLayout();
softwareInfoGroup = new QGroupBox(); softwareInfoGroup = new QGroupBox();
QString *version = getCurrentVersion(); QString *version = getCurrentVersion();
QLabel *versionLabelIdent = new QLabel("Version:"); QLabel *versionLabelIdent = new QLabel("GUI Version:");
QLabel *versionLabel = new QLabel(); QLabel *versionLabel = new QLabel();
serverInfo = new QLabel("Wird ermittelt.."); serverInfo = new QLabel("Wird ermittelt..");
versionLabel->setText(*version); versionLabel->setText(*version);
QLabel *buildDateLabelIdent = new QLabel("Version gebaut:");
QLabel *buildDateLabel = new QLabel(BUILD_DATE);
layoutSoftwareinfo->addWidget(buildDateLabelIdent, Y_POS_BUILD_DATE, 0);
layoutSoftwareinfo->addWidget(buildDateLabel, Y_POS_BUILD_DATE, 1);
QLabel *buildHostLabelIdent = new QLabel("Kompilations Host:");
QLabel *buildHostLabel = new QLabel(BUILD_HOST);
layoutSoftwareinfo->addWidget(buildHostLabelIdent, Y_POS_BUILD_HOST, 0);
layoutSoftwareinfo->addWidget(buildHostLabel, Y_POS_BUILD_HOST, 1);
softwareInfoGroup->setTitle("Software Information"); softwareInfoGroup->setTitle("Software Information");
layoutSoftwareinfo->addWidget(versionLabelIdent, Y_POS_VERSION, 0); layoutSoftwareinfo->addWidget(versionLabelIdent, Y_POS_VERSION, 0);
layoutSoftwareinfo->addWidget(versionLabel, Y_POS_VERSION, 1); layoutSoftwareinfo->addWidget(versionLabel, Y_POS_VERSION, 1);
layoutSoftwareinfo->addWidget(new QLabel("Server:"), Y_POS_SERVER_INFO, 0); layoutSoftwareinfo->addWidget(new QLabel("Server Version:"), Y_POS_SERVER_INFO, 0);
layoutSoftwareinfo->addWidget(serverInfo, Y_POS_SERVER_INFO, 1); layoutSoftwareinfo->addWidget(serverInfo, Y_POS_SERVER_INFO, 1);
softwareInfoGroup->setLayout(layoutSoftwareinfo); softwareInfoGroup->setLayout(layoutSoftwareinfo);
@@ -66,10 +80,11 @@ void About::handleServerVersion(QNetworkReply* reply){
}else { }else {
QJsonDocument json = QJsonDocument::fromJson(reply->readAll()); QJsonDocument json = QJsonDocument::fromJson(reply->readAll());
auto serverInfoValue = json["server-version"].toString(); auto serverInfoValue = json["server-version"].toString();
serverInfo->setText(serverInfoValue); serverInfo->setText(serverInfoValue + " (kompatibel)");
} }
} }
QString* About::getCurrentVersion(){ QString* About::getCurrentVersion(){
return new QString(GIT_VERSION); QString *string = new QString(GIT_VERSION);
return string;
} }

View File

@@ -5,6 +5,8 @@
#------------------------------------------------- #-------------------------------------------------
GIT_STR_VERSION = $$system(git describe) GIT_STR_VERSION = $$system(git describe)
DATE_STR = $$system(date)
HOSTNAME_STR = $$system(hostname)
QT += core gui network QT += core gui network
@@ -19,6 +21,8 @@ TEMPLATE = app
# deprecated API in order to know how to port your code away from it. # deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += "GIT_VERSION=\"\\\"$$GIT_STR_VERSION\\\"\"" DEFINES += "GIT_VERSION=\"\\\"$$GIT_STR_VERSION\\\"\""
DEFINES += "BUILD_DATE=\"\\\"$$DATE_STR\\\"\""
DEFINES += "BUILD_HOST=\"\\\"$$HOSTNAME_STR\\\"\""
# You can also make your code fail to compile if you use deprecated APIs. # You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.