From 916005ddeae956283f0ba3c0b3b8f8d5cf8193d1 Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Fri, 4 Sep 2020 12:59:33 +0200 Subject: [PATCH] add more information to about --- about.cpp | 25 ++++++++++++++++++++----- untitled.pro | 4 ++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/about.cpp b/about.cpp index af98306..85599de 100644 --- a/about.cpp +++ b/about.cpp @@ -9,6 +9,8 @@ #define Y_POS_VERSION 0 #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) { @@ -19,7 +21,9 @@ About::About(QWidget *parent, QSettings *settings) : QMainWindow(parent) { QGridLayout *layoutLegal = new QGridLayout(); QGroupBox *legalGroup = new QGroupBox(); legalGroup->setTitle("Rechtliches"); - QLabel *licenseLabel = new QLabel("Diese Software wird unter derGPLv3verbreitet.
Code und Kompelierungsinstruktionen sind konform zur Lizenzhier zugänglich."); + QLabel *licenseLabel = new QLabel("Diese Software wird unter der GPLv3 verbreitet." + "
Code und Kompelierungsinstruktionen sind konform zur Lizenz hier " + "zugänglich."); licenseLabel->setOpenExternalLinks(true); layoutLegal->addWidget(licenseLabel, 0, 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(); softwareInfoGroup = new QGroupBox(); QString *version = getCurrentVersion(); - QLabel *versionLabelIdent = new QLabel("Version:"); + QLabel *versionLabelIdent = new QLabel("GUI Version:"); QLabel *versionLabel = new QLabel(); serverInfo = new QLabel("Wird ermittelt.."); 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"); layoutSoftwareinfo->addWidget(versionLabelIdent, Y_POS_VERSION, 0); 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); softwareInfoGroup->setLayout(layoutSoftwareinfo); @@ -66,10 +80,11 @@ void About::handleServerVersion(QNetworkReply* reply){ }else { QJsonDocument json = QJsonDocument::fromJson(reply->readAll()); auto serverInfoValue = json["server-version"].toString(); - serverInfo->setText(serverInfoValue); + serverInfo->setText(serverInfoValue + " (kompatibel)"); } } QString* About::getCurrentVersion(){ - return new QString(GIT_VERSION); + QString *string = new QString(GIT_VERSION); + return string; } diff --git a/untitled.pro b/untitled.pro index 2f64ce1..85674a9 100644 --- a/untitled.pro +++ b/untitled.pro @@ -5,6 +5,8 @@ #------------------------------------------------- GIT_STR_VERSION = $$system(git describe) +DATE_STR = $$system(date) +HOSTNAME_STR = $$system(hostname) QT += core gui network @@ -19,6 +21,8 @@ TEMPLATE = app # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS 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. # In order to do so, uncomment the following line.