Ref T213, using about component in launcher

This commit is contained in:
Klaus Basan
2018-05-23 23:10:45 +02:00
parent 407cca7c6b
commit fcd08e7918
3 changed files with 35 additions and 47 deletions

View File

@@ -30,6 +30,7 @@
#include <QStringBuilder> #include <QStringBuilder>
#include <QDesktopServices> #include <QDesktopServices>
#include <QShortcut> #include <QShortcut>
#include <QPointer>
#include <qcompilerdetection.h> #include <qcompilerdetection.h>
using namespace BlackConfig; using namespace BlackConfig;
@@ -82,7 +83,12 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
// auto launch wizard // auto launch wizard
if (sGui->isInstallerOptionSet()) if (sGui->isInstallerOptionSet())
{ {
QTimer::singleShot(2500, this, &CSwiftLauncher::startWizard); const QPointer<CSwiftLauncher> myself(this);
QTimer::singleShot(2500, this, [ = ]
{
if (!myself) { return; }
myself->startWizard();
});
} }
} }
@@ -149,7 +155,6 @@ void CSwiftLauncher::updateInfoAvailable()
{ {
this->setHeaderInfo(ui->comp_UpdateInfo->getLatestAvailablePilotClientArtifactForSelection()); this->setHeaderInfo(ui->comp_UpdateInfo->getLatestAvailablePilotClientArtifactForSelection());
this->loadLatestNews(); this->loadLatestNews();
this->loadAbout();
} }
void CSwiftLauncher::mousePressEvent(QMouseEvent *event) void CSwiftLauncher::mousePressEvent(QMouseEvent *event)
@@ -197,20 +202,6 @@ void CSwiftLauncher::loadLatestNews()
sGui->getFromNetwork(newsUrl, { this, &CSwiftLauncher::displayLatestNews}); sGui->getFromNetwork(newsUrl, { this, &CSwiftLauncher::displayLatestNews});
} }
void CSwiftLauncher::loadAbout()
{
// workaround:
// 1) Only reading as HTML gives proper formatting
// 2) Reading the file resource fails (likely because of the style sheet)
static const QString html = CFileUtils::readFileToString(CDirectoryUtils::aboutFilePath());
static const QString legalDir = sGui->getGlobalSetup().getLegalDirectoryUrl().getFullUrl();
// make links absolute
static const QString htmlFixed = QString(html).
replace(QLatin1String("href=\"./"), "href=\"" + legalDir);
ui->tbr_About->setHtml(htmlFixed);
}
void CSwiftLauncher::initLogDisplay() void CSwiftLauncher::initLogDisplay()
{ {
CLogHandler::instance()->install(true); CLogHandler::instance()->install(true);

View File

@@ -118,9 +118,6 @@ private:
//! \sa CSwiftLauncher::displayLatestNews //! \sa CSwiftLauncher::displayLatestNews
void loadLatestNews(); void loadLatestNews();
//! Load credits and legal info
void loadAbout();
//! Start the core //! Start the core
void startSwiftCore(); void startSwiftCore();

View File

@@ -88,7 +88,7 @@
<item> <item>
<widget class="QToolBox" name="tb_Launcher"> <widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>4</number>
</property> </property>
<property name="tabSpacing"> <property name="tabSpacing">
<number>6</number> <number>6</number>
@@ -99,7 +99,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>392</width> <width>392</width>
<height>305</height> <height>319</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -130,7 +130,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>392</width> <width>392</width>
<height>305</height> <height>319</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -195,7 +195,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>392</width> <width>392</width>
<height>305</height> <height>319</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -361,7 +361,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>392</width> <width>392</width>
<height>305</height> <height>319</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -442,8 +442,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>380</width> <width>376</width>
<height>151</height> <height>156</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="vl_DataUpdatesScrollArea"> <layout class="QVBoxLayout" name="vl_DataUpdatesScrollArea">
@@ -494,32 +494,27 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>392</width> <width>392</width>
<height>305</height> <height>319</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
<string>&amp;About (credits and license)</string> <string>&amp;About (credits and license)</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="vl_Credits"> <layout class="QVBoxLayout" name="vl_Credits">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item> <item>
<widget class="QTextBrowser" name="tbr_About"> <widget class="BlackGui::Components::CAboutHtmlComponent" name="comp_AboutHTML"/>
<property name="documentTitle">
<string>About swift</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;title&gt;About swift&lt;/title&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Credits will go here&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -548,7 +543,7 @@ p, li { white-space: pre-wrap; }
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>392</width> <width>392</width>
<height>113</height> <height>116</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@@ -777,6 +772,12 @@ p, li { white-space: pre-wrap; }
<header>blackgui/components/dbusserveraddressselector.h</header> <header>blackgui/components/dbusserveraddressselector.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>BlackGui::Components::CAboutHtmlComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/abouthtmlcomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>tbr_LatestNews</tabstop> <tabstop>tbr_LatestNews</tabstop>
@@ -786,7 +787,6 @@ p, li { white-space: pre-wrap; }
<tabstop>rb_SwiftCoreAudioOnGui</tabstop> <tabstop>rb_SwiftCoreAudioOnGui</tabstop>
<tabstop>rb_SwiftCoreAudioOnCore</tabstop> <tabstop>rb_SwiftCoreAudioOnCore</tabstop>
<tabstop>sa_DataUpdates</tabstop> <tabstop>sa_DataUpdates</tabstop>
<tabstop>tbr_About</tabstop>
<tabstop>tb_SwiftGui</tabstop> <tabstop>tb_SwiftGui</tabstop>
<tabstop>tb_SwiftCore</tabstop> <tabstop>tb_SwiftCore</tabstop>
<tabstop>tb_SwiftMappingTool</tabstop> <tabstop>tb_SwiftMappingTool</tabstop>