mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Ref T150, Ref T156 cleaned up setup reader
* grouped functions together if they are based on the same URLs * renamed functions * Doxygen comments
This commit is contained in:
committed by
Mathew Sutcliffe
parent
b20c44a9f3
commit
fdfa2233fb
@@ -79,6 +79,22 @@ namespace BlackCore
|
|||||||
return this->m_sharedUrls;
|
return this->m_sharedUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CUrl CGlobalSetup::getCorrespondingSharedUrl(const CUrl &candidate) const
|
||||||
|
{
|
||||||
|
CUrlList sameHosts = this->getSwiftSharedUrls().findByHost(candidate.getHost());
|
||||||
|
return sameHosts.frontOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
CUrlList CGlobalSetup::getSwiftBootstrapFileUrls() const
|
||||||
|
{
|
||||||
|
return getSwiftSharedUrls().withAppendedPath(CGlobalSetup::versionString() + "/bootstrap/bootstrap.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
CUrlList CGlobalSetup::getSwiftDistributionFileUrls() const
|
||||||
|
{
|
||||||
|
return getSwiftSharedUrls().withAppendedPath(CGlobalSetup::versionString() + "/updateinfo/distribution.json");
|
||||||
|
}
|
||||||
|
|
||||||
CUrl CGlobalSetup::getDbHomePageUrl() const
|
CUrl CGlobalSetup::getDbHomePageUrl() const
|
||||||
{
|
{
|
||||||
return getDbRootDirectoryUrl().withAppendedPath("/page/index.php");
|
return getDbRootDirectoryUrl().withAppendedPath("/page/index.php");
|
||||||
@@ -134,14 +150,9 @@ namespace BlackCore
|
|||||||
return this->isDevelopment() == otherSetup.isDevelopment();
|
return this->isDevelopment() == otherSetup.isDevelopment();
|
||||||
}
|
}
|
||||||
|
|
||||||
CUrlList CGlobalSetup::getBootstrapFileUrls() const
|
|
||||||
{
|
|
||||||
CUrlList urls(m_sharedUrls);
|
|
||||||
return urls.appendPath(CGlobalSetup::versionString() + "/bootstrap/bootstrap.json");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CGlobalSetup::buildBootstrapFileUrl(const QString &candidate)
|
QString CGlobalSetup::buildBootstrapFileUrl(const QString &candidate)
|
||||||
{
|
{
|
||||||
|
if (candidate.isEmpty()) return ""; // not possible
|
||||||
static const QString version(QString(CGlobalSetup::versionString()).append("/"));
|
static const QString version(QString(CGlobalSetup::versionString()).append("/"));
|
||||||
if (candidate.endsWith("bootstrap.json")) { return candidate; }
|
if (candidate.endsWith("bootstrap.json")) { return candidate; }
|
||||||
CUrl url(candidate);
|
CUrl url(candidate);
|
||||||
@@ -164,8 +175,9 @@ namespace BlackCore
|
|||||||
return url.getFullUrl();
|
return url.getFullUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
CUrl CGlobalSetup::buildDbDataDirectory(const CUrl &candidate)
|
CUrl CGlobalSetup::buildDbDataDirectoryUrl(const CUrl &candidate)
|
||||||
{
|
{
|
||||||
|
if (candidate.isEmpty()) return CUrl(); // not possible
|
||||||
static const QString version(QString(versionString()).append("/"));
|
static const QString version(QString(versionString()).append("/"));
|
||||||
if (candidate.pathEndsWith("dbdata") || candidate.pathEndsWith("dbdata/")) { return candidate; }
|
if (candidate.pathEndsWith("dbdata") || candidate.pathEndsWith("dbdata/")) { return candidate; }
|
||||||
CUrl url(candidate);
|
CUrl url(candidate);
|
||||||
@@ -191,18 +203,6 @@ namespace BlackCore
|
|||||||
return setup;
|
return setup;
|
||||||
}
|
}
|
||||||
|
|
||||||
CUrlList CGlobalSetup::getDistributionUrls() const
|
|
||||||
{
|
|
||||||
const CUrlList urls(m_sharedUrls);
|
|
||||||
return urls.appendPath(CGlobalSetup::versionString() + "/updateinfo/distribution.json");
|
|
||||||
}
|
|
||||||
|
|
||||||
CUrlList CGlobalSetup::getSwiftDbDataFileLocationUrls() const
|
|
||||||
{
|
|
||||||
const CUrlList urls(m_sharedUrls);
|
|
||||||
return urls.appendPath(CGlobalSetup::versionString() + "/dbdata/");
|
|
||||||
}
|
|
||||||
|
|
||||||
const CUrlList &CGlobalSetup::getSwiftLatestNewsUrls() const
|
const CUrlList &CGlobalSetup::getSwiftLatestNewsUrls() const
|
||||||
{
|
{
|
||||||
return m_newsUrls;
|
return m_newsUrls;
|
||||||
@@ -246,10 +246,10 @@ namespace BlackCore
|
|||||||
% separator
|
% separator
|
||||||
|
|
||||||
% "Distribution URLs: "
|
% "Distribution URLs: "
|
||||||
% getDistributionUrls().toQString(i18n)
|
% getSwiftDistributionFileUrls().toQString(i18n)
|
||||||
% separator
|
% separator
|
||||||
% "Bootstrap URLs: "
|
% "Bootstrap URLs: "
|
||||||
% getBootstrapFileUrls().toQString(i18n)
|
% getSwiftBootstrapFileUrls().toQString(i18n)
|
||||||
% separator
|
% separator
|
||||||
% "News URLs: "
|
% "News URLs: "
|
||||||
% getSwiftLatestNewsUrls().toQString(i18n)
|
% getSwiftLatestNewsUrls().toQString(i18n)
|
||||||
@@ -277,11 +277,7 @@ namespace BlackCore
|
|||||||
% getDbHomePageUrl().toQString(i18n)
|
% getDbHomePageUrl().toQString(i18n)
|
||||||
% separator
|
% separator
|
||||||
% "DB login service: "
|
% "DB login service: "
|
||||||
% getDbLoginServiceUrl().toQString(i18n)
|
% getDbLoginServiceUrl().toQString(i18n);
|
||||||
% separator
|
|
||||||
% "swift DB datafile locations: "
|
|
||||||
% getSwiftDbDataFileLocationUrls().toQString(i18n)
|
|
||||||
% separator;
|
|
||||||
s +=
|
s +=
|
||||||
"VATSIM bookings: "
|
"VATSIM bookings: "
|
||||||
% getVatsimBookingsUrl().toQString(i18n)
|
% getVatsimBookingsUrl().toQString(i18n)
|
||||||
@@ -327,12 +323,10 @@ namespace BlackCore
|
|||||||
return CVariant::fromValue(this->m_vatsimDataFileUrls);
|
return CVariant::fromValue(this->m_vatsimDataFileUrls);
|
||||||
case IndexVatsimMetars:
|
case IndexVatsimMetars:
|
||||||
return CVariant::fromValue(this->m_vatsimMetarsUrls);
|
return CVariant::fromValue(this->m_vatsimMetarsUrls);
|
||||||
case IndexUpdateInfo:
|
|
||||||
return CVariant::fromValue(this->getDistributionUrls());
|
|
||||||
case IndexBootstrapFileUrls:
|
case IndexBootstrapFileUrls:
|
||||||
return CVariant::fromValue(this->getBootstrapFileUrls());
|
return CVariant::fromValue(this->getSwiftBootstrapFileUrls());
|
||||||
case IndexSwiftDbFiles:
|
case IndexDistributionFileUrls:
|
||||||
return CVariant::fromValue(this->getSwiftDbDataFileLocationUrls());
|
return CVariant::fromValue(this->getSwiftDistributionFileUrls());
|
||||||
case IndexSharedUrls:
|
case IndexSharedUrls:
|
||||||
return CVariant::fromValue(this->m_sharedUrls);
|
return CVariant::fromValue(this->m_sharedUrls);
|
||||||
case IndexNewsUrls:
|
case IndexNewsUrls:
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ namespace BlackCore
|
|||||||
IndexSwiftDbFiles,
|
IndexSwiftDbFiles,
|
||||||
IndexSwiftMapUrls,
|
IndexSwiftMapUrls,
|
||||||
IndexBootstrapFileUrls,
|
IndexBootstrapFileUrls,
|
||||||
|
IndexDistributionFileUrls,
|
||||||
IndexNewsUrls,
|
IndexNewsUrls,
|
||||||
IndexOnlineHelpUrls,
|
IndexOnlineHelpUrls,
|
||||||
IndexCrashReportServerUrl,
|
IndexCrashReportServerUrl,
|
||||||
IndexUpdateInfo,
|
|
||||||
IndexWasLoaded,
|
IndexWasLoaded,
|
||||||
IndexSharedUrls
|
IndexSharedUrls
|
||||||
};
|
};
|
||||||
@@ -89,39 +89,55 @@ namespace BlackCore
|
|||||||
//! Crash report server url
|
//! Crash report server url
|
||||||
BlackMisc::Network::CUrl getCrashReportServerUrl() const { return m_crashReportServerUrl; }
|
BlackMisc::Network::CUrl getCrashReportServerUrl() const { return m_crashReportServerUrl; }
|
||||||
|
|
||||||
|
//! Root directory of DB
|
||||||
|
const BlackMisc::Network::CUrl &getDbRootDirectoryUrl() const { return m_dbRootDirectoryUrl; }
|
||||||
|
|
||||||
|
//! ICAO reader URL
|
||||||
|
//! \remark based on getDbRootDirectoryUrl
|
||||||
|
BlackMisc::Network::CUrl getDbIcaoReaderUrl() const;
|
||||||
|
|
||||||
|
//! Model reader URL
|
||||||
|
//! \remark based on getDbRootDirectoryUrl
|
||||||
|
BlackMisc::Network::CUrl getDbModelReaderUrl() const;
|
||||||
|
|
||||||
|
//! Airport reader URL
|
||||||
|
//! \remark based on getDbRootDirectoryUrl
|
||||||
|
BlackMisc::Network::CUrl getDbAirportReaderUrl() const;
|
||||||
|
|
||||||
|
//! Info data reader URL
|
||||||
|
//! \remark based on getDbRootDirectoryUrl
|
||||||
|
BlackMisc::Network::CUrl getDbInfoReaderUrl() const;
|
||||||
|
|
||||||
//! Home page url
|
//! Home page url
|
||||||
|
//! \remark based on getDbRootDirectoryUrl
|
||||||
BlackMisc::Network::CUrl getDbHomePageUrl() const;
|
BlackMisc::Network::CUrl getDbHomePageUrl() const;
|
||||||
|
|
||||||
//! Help page URL
|
|
||||||
BlackMisc::Network::CUrl getHelpPageUrl() const;
|
|
||||||
|
|
||||||
//! Legal directory URL
|
//! Legal directory URL
|
||||||
|
//! \remark based on getDbRootDirectoryUrl
|
||||||
BlackMisc::Network::CUrl getLegalDirectoryUrl() const;
|
BlackMisc::Network::CUrl getLegalDirectoryUrl() const;
|
||||||
|
|
||||||
//! Login service
|
//! Login service
|
||||||
|
//! \remark based on getDbRootDirectoryUrl
|
||||||
BlackMisc::Network::CUrl getDbLoginServiceUrl() const;
|
BlackMisc::Network::CUrl getDbLoginServiceUrl() const;
|
||||||
|
|
||||||
//! alpha XSwiftBus files available
|
//! alpha XSwiftBus files available
|
||||||
BlackMisc::Network::CUrl getAlphaXSwiftBusFilesServiceUrl() const;
|
BlackMisc::Network::CUrl getAlphaXSwiftBusFilesServiceUrl() const;
|
||||||
|
|
||||||
//! Root directory of DB
|
|
||||||
const BlackMisc::Network::CUrl &getDbRootDirectoryUrl() const { return m_dbRootDirectoryUrl; }
|
|
||||||
|
|
||||||
//! ICAO reader URL
|
|
||||||
BlackMisc::Network::CUrl getDbIcaoReaderUrl() const;
|
|
||||||
|
|
||||||
//! Model reader URL
|
|
||||||
BlackMisc::Network::CUrl getDbModelReaderUrl() const;
|
|
||||||
|
|
||||||
//! Airport reader URL
|
|
||||||
BlackMisc::Network::CUrl getDbAirportReaderUrl() const;
|
|
||||||
|
|
||||||
//! Info data reader URL
|
|
||||||
BlackMisc::Network::CUrl getDbInfoReaderUrl() const;
|
|
||||||
|
|
||||||
//! Shared URLs
|
//! Shared URLs
|
||||||
const BlackMisc::Network::CUrlList &getSwiftSharedUrls() const;
|
const BlackMisc::Network::CUrlList &getSwiftSharedUrls() const;
|
||||||
|
|
||||||
|
//! Get pure shared URL as in getSwiftSharedUrls from bootstrap, distribution or other shared URL
|
||||||
|
//! \remark normally based on one of the getSwiftSharedUrls
|
||||||
|
BlackMisc::Network::CUrl getCorrespondingSharedUrl(const BlackMisc::Network::CUrl &candidate) const;
|
||||||
|
|
||||||
|
//! Bootstrap URLs
|
||||||
|
//! \remark based on getSwiftSharedUrls
|
||||||
|
BlackMisc::Network::CUrlList getSwiftBootstrapFileUrls() const;
|
||||||
|
|
||||||
|
//! Distribution URLs
|
||||||
|
//! \remark based on getSwiftSharedUrls
|
||||||
|
BlackMisc::Network::CUrlList getSwiftDistributionFileUrls() const;
|
||||||
|
|
||||||
//! URL to read VATSIM bookings
|
//! URL to read VATSIM bookings
|
||||||
const BlackMisc::Network::CUrl &getVatsimBookingsUrl() const { return m_vatsimBookingsUrl; }
|
const BlackMisc::Network::CUrl &getVatsimBookingsUrl() const { return m_vatsimBookingsUrl; }
|
||||||
|
|
||||||
@@ -134,21 +150,16 @@ namespace BlackCore
|
|||||||
//! VATSIM data file URLs
|
//! VATSIM data file URLs
|
||||||
const BlackMisc::Network::CUrlList &getVatsimDataFileUrls() const { return m_vatsimDataFileUrls; }
|
const BlackMisc::Network::CUrlList &getVatsimDataFileUrls() const { return m_vatsimDataFileUrls; }
|
||||||
|
|
||||||
//! Bootstrap URLs (where the data for the setup itself can be downloaded)
|
|
||||||
BlackMisc::Network::CUrlList getBootstrapFileUrls() const;
|
|
||||||
|
|
||||||
//! Version and download locations
|
|
||||||
BlackMisc::Network::CUrlList getDistributionUrls() const;
|
|
||||||
|
|
||||||
//! Alternative locations of swift DB data files
|
|
||||||
BlackMisc::Network::CUrlList getSwiftDbDataFileLocationUrls() const;
|
|
||||||
|
|
||||||
//! Locations of swift DB news
|
//! Locations of swift DB news
|
||||||
const BlackMisc::Network::CUrlList &getSwiftLatestNewsUrls() const;
|
const BlackMisc::Network::CUrlList &getSwiftLatestNewsUrls() const;
|
||||||
|
|
||||||
//! Online help URLs
|
//! Online help URLs
|
||||||
const BlackMisc::Network::CUrlList &getOnlineHelpUrls() const;
|
const BlackMisc::Network::CUrlList &getOnlineHelpUrls() const;
|
||||||
|
|
||||||
|
//! Help page URL
|
||||||
|
//! \remark working URL evaluated at runtime, based on getOnlineHelpUrls
|
||||||
|
BlackMisc::Network::CUrl getHelpPageUrl() const;
|
||||||
|
|
||||||
//! swift map URLs
|
//! swift map URLs
|
||||||
const BlackMisc::Network::CUrlList &getSwiftMapUrls() const;
|
const BlackMisc::Network::CUrlList &getSwiftMapUrls() const;
|
||||||
|
|
||||||
@@ -179,11 +190,11 @@ namespace BlackCore
|
|||||||
//! Schema version
|
//! Schema version
|
||||||
static const QString &versionString();
|
static const QString &versionString();
|
||||||
|
|
||||||
//! Build bootstrap file URL
|
//! Build bootstrap file URL from shared URL
|
||||||
static QString buildBootstrapFileUrl(const QString &candidate);
|
static QString buildBootstrapFileUrl(const QString &candidate);
|
||||||
|
|
||||||
//! Build the full dbdata directory URL
|
//! Build the full dbdata directory URL from shared URL
|
||||||
static BlackMisc::Network::CUrl buildDbDataDirectory(const BlackMisc::Network::CUrl &candidate);
|
static BlackMisc::Network::CUrl buildDbDataDirectoryUrl(const BlackMisc::Network::CUrl &candidate);
|
||||||
|
|
||||||
//! Object initialized by JSON file
|
//! Object initialized by JSON file
|
||||||
static CGlobalSetup fromJsonFile(const QString &fileNameAndPath);
|
static CGlobalSetup fromJsonFile(const QString &fileNameAndPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user