From 6dc2492d29814d14efa0671bb7c3e2204902a709 Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Thu, 2 Mar 2023 20:53:30 +0100 Subject: [PATCH] Bootstrap: Remove wasLoadedFromWeb flag --- .../share/shared/bootstrap/bootstrap.json | 1 - src/blackcore/data/globalsetup.cpp | 7 +---- src/blackcore/data/globalsetup.h | 8 ----- src/blackcore/db/networkwatchdog.cpp | 1 - src/blackcore/setupreader.cpp | 1 - .../components/setuploadingdialog.cpp | 30 ------------------- src/blackgui/components/setuploadingdialog.h | 3 -- 7 files changed, 1 insertion(+), 50 deletions(-) diff --git a/resources/share/shared/bootstrap/bootstrap.json b/resources/share/shared/bootstrap/bootstrap.json index 951dad0878..d4b4e41863 100644 --- a/resources/share/shared/bootstrap/bootstrap.json +++ b/resources/share/shared/bootstrap/bootstrap.json @@ -79,5 +79,4 @@ ] }, "wasLoadedFromFile": false, - "wasLoadedFromWeb": false } diff --git a/src/blackcore/data/globalsetup.cpp b/src/blackcore/data/globalsetup.cpp index a33611b727..c5760068b5 100644 --- a/src/blackcore/data/globalsetup.cpp +++ b/src/blackcore/data/globalsetup.cpp @@ -41,7 +41,7 @@ namespace BlackCore::Data bool CGlobalSetup::wasLoaded() const { - return this->wasLoadedFromWeb() || this->wasLoadedFromFile(); + return this->wasLoadedFromFile(); } void CGlobalSetup::initDefaultValues() @@ -272,7 +272,6 @@ namespace BlackCore::Data bool CGlobalSetup::isSwiftVersionMinimumMappingVersion() const { - if (!this->wasLoadedFromWeb()) { return false; } // only allowed from web if (m_mappingMinimumVersion.isEmpty()) { return false; } const QVersionNumber min = QVersionNumber::fromString(this->getMappingMinimumVersionString()); return CBuildConfig::getVersion() >= min; @@ -290,8 +289,6 @@ namespace BlackCore::Data % this->getFormattedUtcTimestampYmdhms() % separator % u"Global setup loaded: " - % boolToYesNo(this->wasLoadedFromWeb()) - % u'/' % boolToYesNo(this->wasLoadedFromFile()) % separator @@ -381,7 +378,6 @@ namespace BlackCore::Data case IndexSharedUrls: return QVariant::fromValue(m_sharedUrls); case IndexOnlineHelpUrls: return QVariant::fromValue(m_onlineHelpUrls); case IndexCrashReportServerUrl: return QVariant::fromValue(m_crashReportServerUrl); - case IndexWasLoadedFromWeb: return QVariant::fromValue(m_wasLoadedFromWeb); case IndexWasLoadedFromFile: return QVariant::fromValue(m_wasLoadedFromFile); case IndexMappingMinimumVersion: return QVariant::fromValue(m_mappingMinimumVersion); case IndexPredefinedServers: return QVariant::fromValue(m_predefinedServers); @@ -414,7 +410,6 @@ namespace BlackCore::Data case IndexSharedUrls: m_sharedUrls = variant.value(); break; case IndexOnlineHelpUrls: m_onlineHelpUrls = variant.value(); break; case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value(); break; - case IndexWasLoadedFromWeb: m_wasLoadedFromWeb = variant.toBool(); break; case IndexWasLoadedFromFile: m_wasLoadedFromFile = variant.toBool(); break; case IndexMappingMinimumVersion: m_mappingMinimumVersion = variant.toString(); break; case IndexPredefinedServers: m_predefinedServers = variant.value(); break; diff --git a/src/blackcore/data/globalsetup.h b/src/blackcore/data/globalsetup.h index cb1e7a7e25..f992c59382 100644 --- a/src/blackcore/data/globalsetup.h +++ b/src/blackcore/data/globalsetup.h @@ -78,18 +78,12 @@ namespace BlackCore::Data //! Default constructor CGlobalSetup(); - //! Has data loaded from web - bool wasLoadedFromWeb() const { return m_wasLoadedFromWeb; } - //! Has data loaded from file bool wasLoadedFromFile() const { return m_wasLoadedFromFile; } //! Loaded (web/file) bool wasLoaded() const; - //! Mark as loaded from web - void markAsLoadedFromWeb(bool loaded) { m_wasLoadedFromWeb = loaded; } - //! Mark as loaded from file void markAsLoadedFromFile(bool loaded) { m_wasLoadedFromFile = loaded; } @@ -244,7 +238,6 @@ namespace BlackCore::Data static CGlobalSetup fromJsonFile(const QString &fileNameAndPath, bool acceptCacheFormat); private: - bool m_wasLoadedFromWeb = false; //!< Loaded from web bool m_wasLoadedFromFile = false; //!< Loaded from local file int m_dbHttpPort = 80; //!< port int m_dbHttpsPort = 443; //!< SSL port @@ -273,7 +266,6 @@ namespace BlackCore::Data BLACK_METACLASS( CGlobalSetup, - BLACK_METAMEMBER(wasLoadedFromWeb), BLACK_METAMEMBER(wasLoadedFromFile), BLACK_METAMEMBER(timestampMSecsSinceEpoch), BLACK_METAMEMBER(crashReportServerUrl), diff --git a/src/blackcore/db/networkwatchdog.cpp b/src/blackcore/db/networkwatchdog.cpp index 376e355672..7be00df15a 100644 --- a/src/blackcore/db/networkwatchdog.cpp +++ b/src/blackcore/db/networkwatchdog.cpp @@ -286,7 +286,6 @@ namespace BlackCore::Db if (!sApp || sApp->isShuttingDown()) { return; } if (!force && !this->isSwiftDbAccessible()) { return; } const CGlobalSetup gs = sApp->getGlobalSetup(); - if (!gs.wasLoadedFromWeb()) { return; } const CUrl pingUrl = gs.getDbClientPingServiceUrl(type); sApp->getFromNetwork(pingUrl, { this, &CNetworkWatchdog::replyPingClientService }); } diff --git a/src/blackcore/setupreader.cpp b/src/blackcore/setupreader.cpp index 628aa1a487..2b6b366e6e 100644 --- a/src/blackcore/setupreader.cpp +++ b/src/blackcore/setupreader.cpp @@ -186,7 +186,6 @@ namespace BlackCore { CGlobalSetup s; s.convertFromJson(content); - s.markAsLoadedFromWeb(false); s.markAsLoadedFromFile(true); const CStatusMessage setMsg = m_setup.set(s); const CStatusMessage setInfo = CStatusMessage(this).info(u"Setup cache updated from local file '%1'") << fn; diff --git a/src/blackgui/components/setuploadingdialog.cpp b/src/blackgui/components/setuploadingdialog.cpp index f503d315bf..1bdc9c9be1 100644 --- a/src/blackgui/components/setuploadingdialog.cpp +++ b/src/blackgui/components/setuploadingdialog.cpp @@ -53,7 +53,6 @@ namespace BlackGui::Components this->displaySetupCacheInfo(); this->displayCmdBoostrapUrl(); - this->displayBootstrapUrls(); this->displayGlobalSetup(); this->displayOtherVersionsInfo(); @@ -77,35 +76,6 @@ namespace BlackGui::Components return sApp && sApp->hasSetupReader(); } - void CSetupLoadingDialog::displayBootstrapUrls() - { - if (!sApp || sApp->isShuttingDown()) { return; } - const CGlobalSetup setup = sApp->getGlobalSetup(); - if (setup.wasLoadedFromWeb()) - { - QPointer myself(this); - QTimer::singleShot(250, this, [ = ] - { - if (!myself) { return; } - const CUrlList bootstrapUrls = setup.getSwiftBootstrapFileUrls(); - for (const CUrl &url : bootstrapUrls) - { - const bool cc = CNetworkUtils::canConnect(url); - if (!myself) { return; } // because of CEventLoop::processEventsUntil - const CStatusMessage msg = cc ? - CStatusMessage(this).info(u"Can connect to '%1'") << url.getFullUrl() : - CStatusMessage(this).warning(u"Cannot connect to '%1'") << url.getFullUrl(); - ui->comp_Messages->appendStatusMessageToList(msg); - } - }); - } - else - { - const CStatusMessage msg = CStatusMessage(this).warning(u"No loaded bootstrap setup available, skipping URL test"); - ui->comp_Messages->appendStatusMessageToList(msg); - } - } - void CSetupLoadingDialog::displayCmdBoostrapUrl() { if (!sApp->hasSetupReader()) { return; } diff --git a/src/blackgui/components/setuploadingdialog.h b/src/blackgui/components/setuploadingdialog.h index af3205b6ef..b6d1252b8d 100644 --- a/src/blackgui/components/setuploadingdialog.h +++ b/src/blackgui/components/setuploadingdialog.h @@ -46,9 +46,6 @@ namespace BlackGui::Components //! Setup reader? bool hasSetupReader() const; - //! Set info fields - void displayBootstrapUrls(); - //! Display bootstrap URL void displayCmdBoostrapUrl();