From 194e5943e71e793f38fc0ab02dae888be566af00 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 20 May 2024 10:34:10 -0500 Subject: [PATCH] Gui: Add privacy policy to About (#13987) --- src/Gui/Icons/resource.qrc | 1 + src/Gui/Splashscreen.cpp | 26 ++++++++++++++++++++++++++ src/Gui/Splashscreen.h | 1 + 3 files changed, 28 insertions(+) diff --git a/src/Gui/Icons/resource.qrc b/src/Gui/Icons/resource.qrc index f6823e5069..19ea65f9b3 100644 --- a/src/Gui/Icons/resource.qrc +++ b/src/Gui/Icons/resource.qrc @@ -290,5 +290,6 @@ ../../Doc/CONTRIBUTORS + ../../../PRIVACY_POLICY.md diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index 54d2d8fb49..15e868b62c 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -341,6 +341,7 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent) showLicenseInformation(); showLibraryInformation(); showCollectionInformation(); + showPrivacyPolicy(); showOrHideImage(rect); } @@ -767,6 +768,31 @@ void AboutDialog::showCollectionInformation() textField->setSource(path); } +void AboutDialog::showPrivacyPolicy() +{ + auto policyFileURL = QLatin1String(":/doc/PRIVACY_POLICY"); + QFile policyFile(policyFileURL); + + if (!policyFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + return; + } + auto text = QString::fromUtf8(policyFile.readAll()); + auto tabPrivacyPolicy = new QWidget(); + tabPrivacyPolicy->setObjectName(QString::fromLatin1("tabPrivacyPolicy")); + ui->tabWidget->addTab(tabPrivacyPolicy, tr("Privacy Policy")); + auto hLayout = new QVBoxLayout(tabPrivacyPolicy); + auto textField = new QTextBrowser(tabPrivacyPolicy); + textField->setOpenExternalLinks(true); + hLayout->addWidget(textField); + +#if QT_VERSION < QT_VERSION_CHECK(5,15,0) + // We can't actually render the markdown, so just display it as text + textField->setText(text); +#else + textField->setMarkdown(text); +#endif +} + void AboutDialog::linkActivated(const QUrl& link) { auto licenseView = new LicenseView(); diff --git a/src/Gui/Splashscreen.h b/src/Gui/Splashscreen.h index d967c7f99b..9455cdb8e0 100644 --- a/src/Gui/Splashscreen.h +++ b/src/Gui/Splashscreen.h @@ -107,6 +107,7 @@ protected: QString getAdditionalLicenseInformation() const; void showLibraryInformation(); void showCollectionInformation(); + void showPrivacyPolicy(); void showOrHideImage(const QRect& rect); protected: