diff --git a/src/blackcore/data/globalsetup.cpp b/src/blackcore/data/globalsetup.cpp index 67ee29cb3..e3d0bbd9c 100644 --- a/src/blackcore/data/globalsetup.cpp +++ b/src/blackcore/data/globalsetup.cpp @@ -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(); break; case IndexSharedUrls: m_sharedUrls = variant.value(); break; - case IndexNewsUrls: m_newsUrls = variant.value(); break; case IndexOnlineHelpUrls: m_onlineHelpUrls = variant.value(); break; case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value(); break; case IndexWasLoadedFromWeb: m_wasLoadedFromWeb = variant.toBool(); break; diff --git a/src/blackcore/data/globalsetup.h b/src/blackcore/data/globalsetup.h index 31a1290ec..85c6205e0 100644 --- a/src/blackcore/data/globalsetup.h +++ b/src/blackcore/data/globalsetup.h @@ -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), diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index 659b381fa..c65104e22 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -231,33 +231,9 @@ void CSwiftLauncher::mouseReleaseEvent(QMouseEvent *event) QDialog::mouseReleaseEvent(event); } -void CSwiftLauncher::displayLatestNews(QNetworkReply *reply) -{ - QScopedPointer 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); diff --git a/src/swiftlauncher/swiftlauncher.h b/src/swiftlauncher/swiftlauncher.h index 8839086a2..721dd2a1c 100644 --- a/src/swiftlauncher/swiftlauncher.h +++ b/src/swiftlauncher/swiftlauncher.h @@ -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(); diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index 6dcc76908..a742b407b 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -93,7 +93,7 @@ 6 - + 0 @@ -103,48 +103,11 @@ - Latest &news and about + About - + - - - 1 - - - - News - - - - - - Latest news - - - true - - - Latest news will go here - - - true - - - - - - - - About - - - - - - - - + @@ -928,8 +891,6 @@ pb_DumpDir pb_P3DConfigDirs pb_FSXConfigDirs - tw_LatestNewsAbout - tbr_LatestNews tb_BackToMain rb_WindowNormal rb_WindowFrameless