Skip to content

Commit

Permalink
Bootstrap: Remove wasLoadedFromWeb flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ltoenning committed Mar 3, 2023
1 parent acf8df9 commit 6dc2492
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 50 deletions.
1 change: 0 additions & 1 deletion resources/share/shared/bootstrap/bootstrap.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,4 @@
]
},
"wasLoadedFromFile": false,
"wasLoadedFromWeb": false
}
7 changes: 1 addition & 6 deletions src/blackcore/data/globalsetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace BlackCore::Data

bool CGlobalSetup::wasLoaded() const
{
return this->wasLoadedFromWeb() || this->wasLoadedFromFile();
return this->wasLoadedFromFile();
}

void CGlobalSetup::initDefaultValues()
Expand Down Expand Up @@ -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;
Expand All @@ -290,8 +289,6 @@ namespace BlackCore::Data
% this->getFormattedUtcTimestampYmdhms()
% separator
% u"Global setup loaded: "
% boolToYesNo(this->wasLoadedFromWeb())
% u'/'
% boolToYesNo(this->wasLoadedFromFile())
% separator

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -414,7 +410,6 @@ namespace BlackCore::Data
case IndexSharedUrls: m_sharedUrls = 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;
case IndexWasLoadedFromFile: m_wasLoadedFromFile = variant.toBool(); break;
case IndexMappingMinimumVersion: m_mappingMinimumVersion = variant.toString(); break;
case IndexPredefinedServers: m_predefinedServers = variant.value<CServerList>(); break;
Expand Down
8 changes: 0 additions & 8 deletions src/blackcore/data/globalsetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -273,7 +266,6 @@ namespace BlackCore::Data

BLACK_METACLASS(
CGlobalSetup,
BLACK_METAMEMBER(wasLoadedFromWeb),
BLACK_METAMEMBER(wasLoadedFromFile),
BLACK_METAMEMBER(timestampMSecsSinceEpoch),
BLACK_METAMEMBER(crashReportServerUrl),
Expand Down
1 change: 0 additions & 1 deletion src/blackcore/db/networkwatchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down
1 change: 0 additions & 1 deletion src/blackcore/setupreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 0 additions & 30 deletions src/blackgui/components/setuploadingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ namespace BlackGui::Components

this->displaySetupCacheInfo();
this->displayCmdBoostrapUrl();
this->displayBootstrapUrls();
this->displayGlobalSetup();
this->displayOtherVersionsInfo();

Expand All @@ -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<CSetupLoadingDialog> 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; }
Expand Down
3 changes: 0 additions & 3 deletions src/blackgui/components/setuploadingdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ namespace BlackGui::Components
//! Setup reader?
bool hasSetupReader() const;

//! Set info fields
void displayBootstrapUrls();

//! Display bootstrap URL
void displayCmdBoostrapUrl();

Expand Down

0 comments on commit 6dc2492

Please sign in to comment.