mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
Bootstrap: Remove wasLoadedFromWeb flag
This commit is contained in:
@@ -79,5 +79,4 @@
|
||||
]
|
||||
},
|
||||
"wasLoadedFromFile": false,
|
||||
"wasLoadedFromWeb": false
|
||||
}
|
||||
|
||||
@@ -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<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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<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; }
|
||||
|
||||
@@ -46,9 +46,6 @@ namespace BlackGui::Components
|
||||
//! Setup reader?
|
||||
bool hasSetupReader() const;
|
||||
|
||||
//! Set info fields
|
||||
void displayBootstrapUrls();
|
||||
|
||||
//! Display bootstrap URL
|
||||
void displayCmdBoostrapUrl();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user