refs #610, VATSIM status file

* automatically load status file
* keep VATSIM data file locations
* use METAR/datafile locations from bootstrap or VATSIM status file
This commit is contained in:
Klaus Basan
2016-03-03 21:33:25 +01:00
committed by Mathew Sutcliffe
parent 06bcbe2a2f
commit 1eb65a873c
16 changed files with 429 additions and 68 deletions

View File

@@ -25,8 +25,9 @@ namespace BlackCore
ITimestampBased(0),
m_dbRootDirectoryUrl("http://ubuntu12/swiftdatastore/public"),
m_vatsimBookingsUrl("http://vatbook.euroutepro.com/xml2.php"),
m_vatsimMetarsUrl("http://metar.vatsim.net/metar.php"),
m_vatsimDataFileUrls(QStringList( { "http://info.vroute.net/vatsim-data.txt" })),
m_vatsimMetarsUrls( {"http://metar.vatsim.net/metar.php"}),
m_vatsimStatusFileUrls({ "https://status.vatsim.net" }),
m_vatsimDataFileUrls({ "http://info.vroute.net/vatsim-data.txt" }),
m_sharedUrls(CProject::swiftTeamDefaultServers()),
m_newsUrls(QStringList({ "http://swift-project.org/" }))
{ }
@@ -72,11 +73,6 @@ namespace BlackCore
return this->isDevelopment() == otherSetup.isDevelopment();
}
CUrl CGlobalSetup::vatsimMetarsUrl() const
{
return this->m_vatsimMetarsUrl.withAppendedQuery("id=all");
}
CUrlList CGlobalSetup::bootstrapFileUrls() const
{
CUrlList urls(m_sharedUrls);
@@ -179,7 +175,7 @@ namespace BlackCore
s.append(vatsimBookingsUrl().toQString(i18n));
s.append(separator);
s.append("VATSIM METARs: ");
s.append(vatsimMetarsUrl().toQString(i18n));
s.append(vatsimMetarsUrls().toQString(i18n));
s.append(separator);
s.append("VATSIM data file: ");
s.append(vatsimDataFileUrls().toQString(i18n));
@@ -206,12 +202,14 @@ namespace BlackCore
return CVariant::fromValue(this->m_dbHttpsPort);
case IndexDbLoginService:
return CVariant::fromValue(this->dbLoginServiceUrl());
case IndexVatsimStatus:
return CVariant::fromValue(this->m_vatsimStatusFileUrls);
case IndexVatsimData:
return CVariant::fromValue(this->m_vatsimDataFileUrls);
case IndexVatsimBookings:
return CVariant::fromValue(this->m_vatsimDataFileUrls);
case IndexVatsimMetars:
return CVariant::fromValue(this->m_vatsimMetarsUrl);
return CVariant::fromValue(this->m_vatsimMetarsUrls);
case IndexUpdateInfo:
return CVariant::fromValue(this->updateInfoFileUrls());
case IndexBootstrap:
@@ -257,7 +255,7 @@ namespace BlackCore
this->m_vatsimBookingsUrl.setPropertyByIndex(variant, index.copyFrontRemoved());
break;
case IndexVatsimMetars:
this->m_vatsimMetarsUrl.setPropertyByIndex(variant, index.copyFrontRemoved());
this->m_vatsimMetarsUrls = variant.value<CUrlList>();
break;
case IndexShared:
this->m_sharedUrls = variant.value<CUrlList>();
@@ -273,7 +271,7 @@ namespace BlackCore
const QString &CGlobalSetup::versionString()
{
static const QString v("0.6.1");
static const QString v("0.7.0");
return v;
}

View File

@@ -37,6 +37,7 @@ namespace BlackCore
IndexDbHttpPort,
IndexDbHttpsPort,
IndexDbLoginService,
IndexVatsimStatus,
IndexVatsimBookings,
IndexVatsimMetars,
IndexVatsimData,
@@ -93,7 +94,10 @@ namespace BlackCore
const BlackMisc::Network::CUrl &vatsimBookingsUrl() const { return m_vatsimBookingsUrl; }
//! VATSIM METAR URL
BlackMisc::Network::CUrl vatsimMetarsUrl() const;
const BlackMisc::Network::CUrlList &vatsimMetarsUrls() const { return this->m_vatsimMetarsUrls; }
//! VATSIM status file URLs
const BlackMisc::Network::CUrlList &vatsimStatusFileUrls() const { return m_vatsimStatusFileUrls; }
//! VATSIM data file URLs
const BlackMisc::Network::CUrlList &vatsimDataFileUrls() const { return m_vatsimDataFileUrls; }
@@ -149,7 +153,8 @@ namespace BlackCore
bool m_development = false; //!< dev. version?
BlackMisc::Network::CUrl m_dbRootDirectoryUrl; //!< Root directory of DB
BlackMisc::Network::CUrl m_vatsimBookingsUrl; //!< ATC bookings
BlackMisc::Network::CUrl m_vatsimMetarsUrl; //!< METAR data
BlackMisc::Network::CUrlList m_vatsimMetarsUrls; //!< METAR 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
@@ -183,9 +188,10 @@ BLACK_DECLARE_TUPLE_CONVERSION(BlackCore::Data::CGlobalSetup, (
attr(o.m_dbRootDirectoryUrl),
attr(o.m_dbHttpPort),
attr(o.m_dbHttpsPort),
attr(o.m_vatsimBookingsUrl),
attr(o.m_vatsimMetarsUrl),
attr(o.m_vatsimStatusFileUrls),
attr(o.m_vatsimDataFileUrls),
attr(o.m_vatsimBookingsUrl),
attr(o.m_vatsimMetarsUrls),
attr(o.m_sharedUrls),
attr(o.m_newsUrls),
attr(o.m_fsdTestServers),

View File

@@ -33,8 +33,12 @@ namespace BlackCore
//! Properties by index
enum ColumnIndex
{
IndexFsdServers = BlackMisc::CPropertyIndex::GlobalIndexCGlobalSetup + 50,
IndexDataFiles
IndexServerFiles = BlackMisc::CPropertyIndex::GlobalIndexCVatsimSetup,
IndexDataFiles,
IndexMetarFiles,
IndexFsdServers,
IndexCVoiceServers,
IndexLastLoginUser
};
//! Default constructor
@@ -49,6 +53,18 @@ namespace BlackCore
//! Set VATSIM data file URLs
void setDataFileUrls(const BlackMisc::Network::CUrlList &urls) { m_dataFileUrls = urls; }
//! Server file URLs (like data file, only servers)
const BlackMisc::Network::CUrlList &getServerFileUrls() const { return m_serverFileUrls; }
//! Set server file URLs (like data file, only servers)
void setServerFileUrls(const BlackMisc::Network::CUrlList &urls) { m_serverFileUrls = urls; }
//! METAR file URLs
const BlackMisc::Network::CUrlList &getMetarFileUrls() const { return m_metarFileUrls; }
//! METAR file URLs
void setMetarFileUrls(const BlackMisc::Network::CUrlList &urls) { m_metarFileUrls = urls; }
//! FSD test servers
const BlackMisc::Network::CServerList &getFsdServers() const { return m_fsdServers; }
@@ -82,7 +98,9 @@ namespace BlackCore
private:
BLACK_ENABLE_TUPLE_CONVERSION(BlackCore::Data::CVatsimSetup)
BlackMisc::Network::CUrlList m_dataFileUrls; //!< Overall VATSIM data file / merely for bootstrapping the first time
BlackMisc::Network::CUrlList m_serverFileUrls; //!< only the FSD servers
BlackMisc::Network::CUrlList m_dataFileUrls; //!< Full VATSIM files
BlackMisc::Network::CUrlList m_metarFileUrls; //!< METAR files
BlackMisc::Network::CServerList m_fsdServers; //!< FSD test servers
BlackMisc::Network::CServerList m_voiceServers; //!< voice servers
BlackMisc::Network::CUser m_lastLoginUser; //!< last login user
@@ -107,9 +125,12 @@ namespace BlackCore
Q_DECLARE_METATYPE(BlackCore::Data::CVatsimSetup)
BLACK_DECLARE_TUPLE_CONVERSION(BlackCore::Data::CVatsimSetup, (
attr(o.m_serverFileUrls),
attr(o.m_dataFileUrls),
attr(o.m_metarFileUrls),
attr(o.m_fsdServers),
attr(o.m_voiceServers),
attr(o.m_lastLoginUser),
attr(o.m_timestampMSecsSinceEpoch)
))
#endif // guard