feat: Show license and third party licenses in about dialog

This commit is contained in:
Lars Toenning
2024-06-10 22:00:23 +02:00
parent 49d4bd12d1
commit 4a81fc400a
3 changed files with 53 additions and 2 deletions

View File

@@ -6,14 +6,26 @@
#include "blackgui/guiapplication.h"
#include "blackgui/guiutility.h"
#include "blackmisc/fileutils.h"
namespace BlackGui::Components
{
CAboutDialog::CAboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CAboutDialog)
{
ui->setupUi(this);
const QPointer<CAboutDialog> myself(this);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
this->init();
QTimer::singleShot(0, this, [=] {
if (!myself) { return; }
myself->loadSwiftLicense();
});
QTimer::singleShot(0, this, [=] {
if (!myself) { return; }
myself->loadThirdPartyLicenses();
});
}
CAboutDialog::~CAboutDialog()
@@ -29,4 +41,16 @@ namespace BlackGui::Components
ui->pte_Info->appendPlainText("\nScreen info follows:\n----");
ui->pte_Info->appendPlainText(CGuiUtility::screenInformation("\n"));
}
void CAboutDialog::loadSwiftLicense()
{
const QString html = BlackMisc::CFileUtils::readFileToString(BlackMisc::CSwiftDirectories::legalDirectory() + "/LicenseRef-swift-pilot-client-1.html");
ui->tbr_swiftLicense->setHtml(html);
}
void CAboutDialog::loadThirdPartyLicenses()
{
const QString html = BlackMisc::CFileUtils::readFileToString(BlackMisc::CSwiftDirectories::legalDirectory() + "/3rdparty.html");
ui->tbr_ThirdPartyLicenses->setHtml(html);
}
} // ns

View File

@@ -33,6 +33,9 @@ namespace BlackGui::Components
//! Init values
void init();
void loadSwiftLicense();
void loadThirdPartyLicenses();
QScopedPointer<Ui::CAboutDialog> ui;
};
} // ns

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>258</height>
<width>666</width>
<height>748</height>
</rect>
</property>
<property name="minimumSize">
@@ -61,6 +61,30 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_swiftLicense">
<property name="title">
<string>swift license</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="tbr_swiftLicense"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_ThirdPartyLicenses">
<property name="title">
<string>Third-Party licenses</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextBrowser" name="tbr_ThirdPartyLicenses"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="bb_AboutDialog">
<property name="orientation">