6 #include <QDesktopServices>
11 #include "ui_abouthtmlcomponent.h"
22 CAboutHtmlComponent::CAboutHtmlComponent(QWidget *parent) : QFrame(parent), ui(new Ui::
CAboutHtmlComponent)
25 const QPointer<CAboutHtmlComponent> myself(
this);
26 connect(ui->tbr_About, &QTextBrowser::anchorClicked,
this, &CAboutHtmlComponent::onAnchorClicked,
27 Qt::QueuedConnection);
30 if (!myself) {
return; }
37 void CAboutHtmlComponent::loadAbout()
42 static const QString htmlFixed = [=] {
46 const QString html = CFileUtils::readFileToString(CSwiftDirectories::aboutFilePath());
54 ui->tbr_About->setHtml(htmlFixed);
55 ui->tbr_About->setOpenLinks(
false);
62 void CAboutHtmlComponent::onAnchorClicked(
const QUrl &url)
64 if (!url.isRelative())
66 QDesktopServices::openUrl(url);
69 const QString possibleLegalFile =
70 CFileUtils::appendFilePaths(CSwiftDirectories::legalDirectory(), url.fileName());
71 QFile f(possibleLegalFile);
72 if (f.exists()) { QDesktopServices::openUrl(QUrl::fromLocalFile(possibleLegalFile)); };
bool isShuttingDown() const
Is application shutting down?
Display the HTML info "about swift".
virtual ~CAboutHtmlComponent()
Destructor.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...