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
committed by Mat Sutcliffe
parent 83edec5a90
commit c8da0e49d6
5 changed files with 4 additions and 112 deletions

View File

@@ -59,11 +59,6 @@ namespace BlackCore::Data
"https://swift.fir-berlin.de/shared"
};
m_newsUrls = CUrlList
{
"https://blog.swift-project.net/?__print__=1",
"https://dev.swift-project.org/phame/blog/view/1/?__print__=1"
};
m_onlineHelpUrls = CUrlList
{
"https://datastore.swift-project.org/page/swifthelpdispatcher.html",
@@ -262,11 +257,6 @@ namespace BlackCore::Data
return setup;
}
const CUrlList &CGlobalSetup::getSwiftLatestNewsUrls() const
{
return m_newsUrls;
}
CServerList CGlobalSetup::getPredefinedServersPlusHardcodedServers() const
{
static const CServerList hardcoded(
@@ -320,9 +310,6 @@ namespace BlackCore::Data
% u"Bootstrap URLs: "
% getSwiftBootstrapFileUrls().toQString(i18n)
% separator
% u"News URLs: "
% getSwiftLatestNewsUrls().toQString(i18n)
% separator
% u"Help URLs: "
% m_onlineHelpUrls.toQString(i18n)
% separator;
@@ -388,7 +375,6 @@ namespace BlackCore::Data
case IndexBootstrapFileUrls: return QVariant::fromValue(this->getSwiftBootstrapFileUrls());
case IndexUpdateInfoFileUrls: return QVariant::fromValue(this->getSwiftUpdateInfoFileUrls());
case IndexSharedUrls: return QVariant::fromValue(m_sharedUrls);
case IndexNewsUrls: return QVariant::fromValue(m_newsUrls);
case IndexOnlineHelpUrls: return QVariant::fromValue(m_onlineHelpUrls);
case IndexCrashReportServerUrl: return QVariant::fromValue(m_crashReportServerUrl);
case IndexWasLoadedFromWeb: return QVariant::fromValue(m_wasLoadedFromWeb);
@@ -420,7 +406,6 @@ namespace BlackCore::Data
case IndexVatsimBookings: m_vatsimBookingsUrl.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexVatsimMetars: m_vatsimMetarsUrls = variant.value<CUrlList>(); break;
case IndexSharedUrls: m_sharedUrls = variant.value<CUrlList>(); break;
case IndexNewsUrls: m_newsUrls = variant.value<CUrlList>(); break;
case IndexOnlineHelpUrls: m_onlineHelpUrls = variant.value<CUrlList>(); break;
case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value<CUrl>(); break;
case IndexWasLoadedFromWeb: m_wasLoadedFromWeb = variant.toBool(); break;

View File

@@ -53,7 +53,6 @@ namespace BlackCore::Data
IndexSwiftDbFiles,
IndexBootstrapFileUrls,
IndexUpdateInfoFileUrls,
IndexNewsUrls,
IndexOnlineHelpUrls,
IndexCrashReportServerUrl,
IndexWasLoadedFromWeb,
@@ -182,9 +181,6 @@ namespace BlackCore::Data
//! VATSIM data file URLs
const BlackMisc::Network::CUrlList &getVatsimDataFileUrls() const { return m_vatsimDataFileUrls; }
//! Locations of swift DB news
const BlackMisc::Network::CUrlList &getSwiftLatestNewsUrls() const;
//! Help page URL
//! \remark working URL evaluated at runtime, based on getOnlineHelpUrls
BlackMisc::Network::CUrl getHelpPageUrl(const QString &context = {}) const;
@@ -254,7 +250,6 @@ namespace BlackCore::Data
BlackMisc::Network::CUrlList m_vatsimStatusFileUrls; //!< Status file, where to find the VATSIM files (METAR, data, ATIS, other status files)
BlackMisc::Network::CUrlList m_vatsimDataFileUrls; //!< Overall VATSIM data file / merely for bootstrapping the first time
BlackMisc::Network::CUrlList m_sharedUrls; //!< where we can obtain shared info files such as bootstrap, ..
BlackMisc::Network::CUrlList m_newsUrls; //!< where we can obtain latest news
BlackMisc::Network::CUrlList m_onlineHelpUrls; //!< online help URLs
BlackMisc::Network::CServerList m_predefinedServers; //!< Predefined servers loaded from setup file
BlackMisc::Network::CUrl m_ncepGlobalForecastSystemUrl; //!< NCEP GFS url 0.5 degree resolution
@@ -281,7 +276,6 @@ namespace BlackCore::Data
BLACK_METAMEMBER(vatsimBookingsUrl),
BLACK_METAMEMBER(vatsimMetarsUrls),
BLACK_METAMEMBER(sharedUrls),
BLACK_METAMEMBER(newsUrls),
BLACK_METAMEMBER(onlineHelpUrls),
BLACK_METAMEMBER(predefinedServers),
BLACK_METAMEMBER(development),

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>