mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #883, display of news/about
* use QTextBrowser, external links will be opened in browser * display about in credits tabs * added shortcuts for tabs Remark: Gives us a first (not perfect) version of news/about in launcher
This commit is contained in:
committed by
Mathew Sutcliffe
parent
8df2fa462f
commit
c5b4b01a90
@@ -116,7 +116,7 @@ void CSwiftLauncher::ps_displayLatestNews(QNetworkReply *reply)
|
||||
{
|
||||
const QString html = nwReply->readAll().trimmed();
|
||||
if (html.isEmpty()) { return; }
|
||||
ui->te_LatestNews->setHtml(html);
|
||||
ui->tbr_LatestNews->setHtml(html);
|
||||
constexpr qint64 newNews = 72 * 3600 * 1000;
|
||||
const qint64 deltaT = CNetworkUtils::lastModifiedSinceNow(nwReply.data());
|
||||
if (deltaT > 0 && deltaT < newNews)
|
||||
@@ -175,6 +175,19 @@ void CSwiftLauncher::loadLatestNews()
|
||||
sGui->getFromNetwork(newsUrl, { this, &CSwiftLauncher::ps_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(CBuildConfig::getAboutFileLocation());
|
||||
static const QString legalDir = sGui->getGlobalSetup().getLegalDirectoryUrl().getFullUrl();
|
||||
// make links absolute
|
||||
static const QString htmlFixed = QString(html).
|
||||
replace(QLatin1Literal("href=\"./"), "href=\"" + legalDir);
|
||||
ui->tbr_About->setHtml(htmlFixed);
|
||||
}
|
||||
|
||||
void CSwiftLauncher::initDBusGui()
|
||||
{
|
||||
ui->cb_DBusServerAddress->addItem("127.0.0.1");
|
||||
@@ -348,6 +361,7 @@ void CSwiftLauncher::ps_loadedUpdateInfo(bool success)
|
||||
}
|
||||
|
||||
this->loadLatestNews();
|
||||
this->loadAbout();
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_changedUpdateInfoCache()
|
||||
|
||||
Reference in New Issue
Block a user