Gui: Add privacy policy to About (#13987)
This commit is contained in:
@@ -290,5 +290,6 @@
|
||||
</qresource>
|
||||
<qresource prefix="/doc">
|
||||
<file alias="CONTRIBUTORS">../../Doc/CONTRIBUTORS</file>
|
||||
<file alias="PRIVACY_POLICY">../../../PRIVACY_POLICY.md</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -107,6 +107,7 @@ protected:
|
||||
QString getAdditionalLicenseInformation() const;
|
||||
void showLibraryInformation();
|
||||
void showCollectionInformation();
|
||||
void showPrivacyPolicy();
|
||||
void showOrHideImage(const QRect& rect);
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user