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

@@ -158,7 +158,8 @@ namespace BlackCore
// remark: Don't use QThread to run network operations in the background
// see http://qt-project.org/doc/qt-4.7/qnetworkaccessmanager.html
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing application");
const QUrl url(sApp->getGlobalSetup().vatsimDataFileUrls().getRandomUrl());
CFailoverUrlList urls(sApp->getVatsimDataFileUrls());
const QUrl url(urls.obtainNextWorkingUrl(true));
if (url.isEmpty()) { return; }
sApp->getFromNetwork(url, { this, &CVatsimDataFileReader::ps_parseVatsimFile});
@@ -239,7 +240,7 @@ namespace BlackCore
if (callsign.isEmpty()) { break; }
const BlackMisc::Network::CUser user(clientPartsMap["cid"], clientPartsMap["realname"], callsign);
const QString clientType = clientPartsMap["clienttype"].toLower();
if (clientType.isEmpty()) break; // sometimes type is empty
if (clientType.isEmpty()) { break; } // sometimes type is empty
const double lat = clientPartsMap["latitude"].toDouble();
const double lng = clientPartsMap["longitude"].toDouble();
const double alt = clientPartsMap["altitude"].toDouble();
@@ -384,8 +385,8 @@ namespace BlackCore
QMap<QString, QString> parts;
for (int i = 0; i < clientSectionAttributes.size(); i++)
{
Q_ASSERT(i < clientSectionAttributes.size());
Q_ASSERT(i < clientParts.size());
BLACK_VERIFY_X(i < clientSectionAttributes.size(), Q_FUNC_INFO, "Wrong section attribute size");
BLACK_VERIFY_X(i < clientParts.size(), Q_FUNC_INFO, "Wrong parts size");
parts.insert(clientSectionAttributes.at(i).toLower(), clientParts.at(i));
}
return parts;