diff --git a/src/legalstuff.cpp b/src/legalstuff.cpp index 58be51a73861d7afd55679b824cb1590be33e5c0..0df30dbccb5e855f5ff1f3eebe6c10f8d0760e2c 100644 --- a/src/legalstuff.cpp +++ b/src/legalstuff.cpp @@ -24,6 +24,7 @@ * **/ +#include <QFile> #include <QtGlobal> #include <TROOT.h> @@ -40,11 +41,30 @@ LegalStuff::LegalStuff(QWidget* const parent) _ui.setupUi(this); connect(_ui.bbLeave, &QDialogButtonBox::accepted, this, &QDialog::close); - _ui.lblInformation->setText( - _ui.lblInformation->text() + QString legalText = QStringLiteral("<html>\n<body>\n"); + legalText.append( + getResourceContent(QStringLiteral(":/legal/legal-infos.htmlpart")) .arg(QString::fromUtf8(Fp311OnlineClientVersion.c_str())) .arg(QString::fromUtf8(LibFp311OnlineVersion.c_str())) .arg(QString::fromUtf8(qVersion())) .arg(QString::fromUtf8(gROOT->GetVersion())) ); + legalText.append(QStringLiteral("<hr />\n")); + legalText.append(getResourceContent(QStringLiteral(":/legal/gpl3.htmlpart"))); + legalText.append(QStringLiteral("<hr />\n")); + legalText.append(getResourceContent(QStringLiteral(":/legal/lgpl3.htmlpart"))); + legalText.append(QStringLiteral("<hr />\n")); + legalText.append(getResourceContent(QStringLiteral(":/legal/lgpl2.1.htmlpart"))); + legalText.append(QStringLiteral("</body>\n</html>\n")); + + _ui.lblInformation->setText(legalText); +} + +QString LegalStuff::getResourceContent(const QString& fileName) +{ + QFile resource(fileName); + resource.open(QFile::ReadOnly); + if (!resource.isOpen()) + return QString(); + return QString::fromUtf8(resource.readAll()); } diff --git a/src/legalstuff.h b/src/legalstuff.h index 6ce55fefa962c43c2e4d07bbe7f1a75a7b0c67da..5dd7ceb2e982e2ea635aa51bafde6b5ed2609a9a 100644 --- a/src/legalstuff.h +++ b/src/legalstuff.h @@ -28,6 +28,7 @@ #define LEGALSTUFF_H #include <QDialog> +#include <QString> #include "ui_legalstuff.h" @@ -47,6 +48,8 @@ public: LegalStuff& operator=(LegalStuff&& other) = delete; private: Ui::Fp311OnlineClientLegalStuff _ui {}; + + static QString getResourceContent(const QString& fileName); }; }