Skip to content
Snippets Groups Projects
Verified Commit ca421623 authored by Tobias Triffterer's avatar Tobias Triffterer :house_with_garden:
Browse files

Update LegalStuff Class to use Resources

After the text has been moved to files added as resources, the class
needs code to load and assemble it.
parent c48db671
No related branches found
No related tags found
No related merge requests found
Pipeline #3136 passed with stage
in 49 seconds
......@@ -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());
}
......@@ -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);
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment