Remove broken launcher news widget

The links for news are broken.
As most announcements are published via Discord nowadays, remove it for now.
This commit is contained in:
Lars Toenning
2022-06-20 23:38:21 +02:00
parent 963c4ec495
commit 521859f9ac
5 changed files with 4 additions and 112 deletions

View File

@@ -231,33 +231,9 @@ void CSwiftLauncher::mouseReleaseEvent(QMouseEvent *event)
QDialog::mouseReleaseEvent(event);
}
void CSwiftLauncher::displayLatestNews(QNetworkReply *reply)
{
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> nwReply(reply);
if (nwReply->error() == QNetworkReply::NoError)
{
const QString html = nwReply->readAll().trimmed();
if (html.isEmpty()) { return; }
CLogMessage(this).info(u"Received news from '%1'") << nwReply->url().toString();
ui->tbr_LatestNews->setHtml(html); // causes QFSFileEngine::open: No file name specified
constexpr qint64 newNews = 72 * 3600 * 1000;
const qint64 deltaT = CNetworkUtils::lastModifiedSinceNow(nwReply.data());
if (deltaT > 0 && deltaT < newNews)
{
ui->tb_Launcher->setCurrentWidget(ui->pg_LatestNewsAndAbout);
ui->tw_LatestNewsAbout->setCurrentWidget(ui->tb_LatestNews);
}
}
else
{
CLogMessage(this).warning(u"Error received news from '%1'") << nwReply->url().toString();
}
}
void CSwiftLauncher::updateInfoAvailable()
{
this->setHeaderInfo(ui->comp_UpdateInfo->getLatestAvailablePilotClientArtifactForSelection());
this->loadLatestNews();
}
void CSwiftLauncher::init()
@@ -276,7 +252,6 @@ void CSwiftLauncher::init()
ui->lbl_HeaderInfo->setVisible(false);
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
ui->tb_Launcher->setCurrentWidget(ui->pg_CoreMode);
ui->tw_LatestNewsAbout->setCurrentWidget(ui->tb_LatestNews);
}
void CSwiftLauncher::initStyleSheet()
@@ -293,22 +268,6 @@ void CSwiftLauncher::initStyleSheet()
this->setStyleSheet(s);
}
void CSwiftLauncher::loadLatestNews()
{
if (!sGui || sGui->isShuttingDown()) { return; }
CFailoverUrlList newsUrls(sGui->getGlobalSetup().getSwiftLatestNewsUrls());
const CUrl newsUrl(newsUrls.obtainNextWorkingUrl(true, 10 * 1000));
// const CUrl newsUrl("https://dev.swift-project.org/phame/blog/view/1/?__print__=1");
if (newsUrl.isEmpty())
{
CLogMessage(this).warning(u"No working news URL in %1") << newsUrls.toQString();
return;
}
sGui->getFromNetwork(newsUrl, { this, &CSwiftLauncher::displayLatestNews});
}
void CSwiftLauncher::initLogDisplay()
{
CLogHandler::instance()->install(true);

View File

@@ -131,10 +131,6 @@ private:
//! Set header info
void setHeaderInfo(const BlackMisc::Db::CArtifact &latestArtifact);
//! Latest news
//! \sa CSwiftLauncher::displayLatestNews
void loadLatestNews();
//! Executaable for core
bool setSwiftCoreExecutable();
@@ -159,9 +155,6 @@ private:
//! Check for other swift applications, if so show message box
bool warnAboutOtherSwiftApplications();
//! Display latest news
void displayLatestNews(QNetworkReply *reply);
//! Distribution info is available
void updateInfoAvailable();

View File

@@ -93,7 +93,7 @@
<property name="tabSpacing">
<number>6</number>
</property>
<widget class="QWidget" name="pg_LatestNewsAndAbout">
<widget class="QWidget" name="pg_About">
<property name="geometry">
<rect>
<x>0</x>
@@ -103,48 +103,11 @@
</rect>
</property>
<attribute name="label">
<string>Latest &amp;news and about</string>
<string>About</string>
</attribute>
<layout class="QVBoxLayout" name="vl_LatestNewsAndAbout">
<layout class="QVBoxLayout" name="vl_About">
<item>
<widget class="QTabWidget" name="tw_LatestNewsAbout">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tb_LatestNews">
<attribute name="title">
<string>News</string>
</attribute>
<layout class="QVBoxLayout" name="vl_LatestNews">
<item>
<widget class="QTextBrowser" name="tbr_LatestNews">
<property name="documentTitle">
<string>Latest news</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Latest news will go here</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_About">
<attribute name="title">
<string>About</string>
</attribute>
<layout class="QVBoxLayout" name="vl_About">
<item>
<widget class="BlackGui::Components::CAboutHtmlComponent" name="comp_AboutHTML"/>
</item>
</layout>
</widget>
</widget>
<widget class="BlackGui::Components::CAboutHtmlComponent" name="comp_AboutHTML"/>
</item>
</layout>
</widget>
@@ -928,8 +891,6 @@
<tabstop>pb_DumpDir</tabstop>
<tabstop>pb_P3DConfigDirs</tabstop>
<tabstop>pb_FSXConfigDirs</tabstop>
<tabstop>tw_LatestNewsAbout</tabstop>
<tabstop>tbr_LatestNews</tabstop>
<tabstop>tb_BackToMain</tabstop>
<tabstop>rb_WindowNormal</tabstop>
<tabstop>rb_WindowFrameless</tabstop>