mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +08:00
refs #720, adjusted exposed functions to new naming
* some minor formatting * use the new condolidation functions
This commit is contained in:
committed by
Mathew Sutcliffe
parent
d9a35563e3
commit
1167735897
@@ -425,10 +425,6 @@ namespace BlackCore
|
|||||||
//! Async. start when setup is loaded
|
//! Async. start when setup is loaded
|
||||||
bool asyncWebAndContextStart();
|
bool asyncWebAndContextStart();
|
||||||
|
|
||||||
void initCrashHandler();
|
|
||||||
|
|
||||||
void crashDumpUploadEnabledChanged();
|
|
||||||
|
|
||||||
//! Implementation for getFromNetwork(), postToNetwork() and headerFromNetwork()
|
//! Implementation for getFromNetwork(), postToNetwork() and headerFromNetwork()
|
||||||
QNetworkReply *httpRequestImpl(const QNetworkRequest &request,
|
QNetworkReply *httpRequestImpl(const QNetworkRequest &request,
|
||||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback,
|
const BlackMisc::CSlot<void(QNetworkReply *)> &callback,
|
||||||
@@ -454,6 +450,10 @@ namespace BlackCore
|
|||||||
bool m_unitTest = false; //!< is UNIT test
|
bool m_unitTest = false; //!< is UNIT test
|
||||||
bool m_autoSaveSettings = true;//!< automatically saving all settings
|
bool m_autoSaveSettings = true;//!< automatically saving all settings
|
||||||
|
|
||||||
|
// -------------- crashpad -----------------
|
||||||
|
void initCrashHandler();
|
||||||
|
void crashDumpUploadEnabledChanged();
|
||||||
|
|
||||||
#ifdef BLACK_USE_CRASHPAD
|
#ifdef BLACK_USE_CRASHPAD
|
||||||
std::unique_ptr<crashpad::CrashpadClient> m_crashpadClient;
|
std::unique_ptr<crashpad::CrashpadClient> m_crashpadClient;
|
||||||
std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase;
|
std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace BlackCore
|
|||||||
CDatabaseReader::CDatabaseReader(QObject *owner, const CDatabaseReaderConfigList &config, const QString &name) :
|
CDatabaseReader::CDatabaseReader(QObject *owner, const CDatabaseReaderConfigList &config, const QString &name) :
|
||||||
BlackCore::CThreadedReader(owner, name), m_config(config)
|
BlackCore::CThreadedReader(owner, name), m_config(config)
|
||||||
{
|
{
|
||||||
getDbUrl(); // init
|
getDbUrl(); // init the cache
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities, const QDateTime &newerThan)
|
void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities, const QDateTime &newerThan)
|
||||||
@@ -314,7 +314,8 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CDatabaseReader::canPingSwiftServer()
|
bool CDatabaseReader::canPingSwiftServer()
|
||||||
{
|
{
|
||||||
return CNetworkUtils::canConnect(getDbUrl());
|
const CUrl url(getDbUrl());
|
||||||
|
return CNetworkUtils::canConnect(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDatabaseReader::JsonDatastoreResponse::setJsonArray(const QJsonArray &value)
|
void CDatabaseReader::JsonDatastoreResponse::setJsonArray(const QJsonArray &value)
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ namespace BlackCore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all or incremental set of distributor
|
// get all or incremental set
|
||||||
CDbInfoList infoObjects = CDbInfoList::fromDatabaseJson(res.getJsonArray());
|
CDbInfoList infoObjects = CDbInfoList::fromDatabaseJson(res.getJsonArray());
|
||||||
|
|
||||||
// this part needs to be synchronized
|
// this part needs to be synchronized
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ namespace BlackCore
|
|||||||
return liveries.findByCombinedCode(combinedCode);
|
return liveries.findByCombinedCode(combinedCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLivery CModelDataReader::getStdLiveryForAirlineCode(const CAirlineIcaoCode &icao) const
|
CLivery CModelDataReader::getStdLiveryForAirlineVDesignator(const CAirlineIcaoCode &icao) const
|
||||||
{
|
{
|
||||||
if (!icao.hasValidDesignator()) { return CLivery(); }
|
if (!icao.hasValidDesignator()) { return CLivery(); }
|
||||||
const CLiveryList liveries(getLiveries());
|
const CLiveryList liveries(getLiveries());
|
||||||
return liveries.findStdLiveryByAirlineIcaoDesignator(icao);
|
return liveries.findStdLiveryByAirlineIcaoVDesignator(icao);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLivery CModelDataReader::getLiveryForDbKey(int id) const
|
CLivery CModelDataReader::getLiveryForDbKey(int id) const
|
||||||
@@ -117,6 +117,12 @@ namespace BlackCore
|
|||||||
return distributors.smartDistributorSelector(distributorPattern);
|
return distributors.smartDistributorSelector(distributorPattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDistributor CModelDataReader::smartDistributorSelector(const CDistributor &distributorPattern, const CAircraftModel &model) const
|
||||||
|
{
|
||||||
|
const CDistributorList distributors(getDistributors()); // thread safe copy
|
||||||
|
return distributors.smartDistributorSelector(distributorPattern, model);
|
||||||
|
}
|
||||||
|
|
||||||
int CModelDataReader::getModelsCount() const
|
int CModelDataReader::getModelsCount() const
|
||||||
{
|
{
|
||||||
return this->getModels().size();
|
return this->getModels().size();
|
||||||
@@ -127,9 +133,9 @@ namespace BlackCore
|
|||||||
return this->getModels().toDbKeyList();
|
return this->getModels().toDbKeyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CModelDataReader::getModelStrings() const
|
QStringList CModelDataReader::getModelStringList() const
|
||||||
{
|
{
|
||||||
return this->getModels().getModelStrings(false);
|
return this->getModels().getModelStringList(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CModelDataReader::areAllDataRead() const
|
bool CModelDataReader::areAllDataRead() const
|
||||||
@@ -298,7 +304,7 @@ namespace BlackCore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all or incremental set of distributor
|
// get all or incremental set of distributors
|
||||||
CDistributorList distributors;
|
CDistributorList distributors;
|
||||||
if (res.isRestricted())
|
if (res.isRestricted())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Get aircraft livery for ICAO code
|
//! Get aircraft livery for ICAO code
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Aviation::CLivery getStdLiveryForAirlineCode(const BlackMisc::Aviation::CAirlineIcaoCode &icao) const;
|
BlackMisc::Aviation::CLivery getStdLiveryForAirlineVDesignator(const BlackMisc::Aviation::CAirlineIcaoCode &icao) const;
|
||||||
|
|
||||||
//! Get aircraft livery for id
|
//! Get aircraft livery for id
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -95,6 +95,10 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Simulation::CDistributor smartDistributorSelector(const BlackMisc::Simulation::CDistributor &distributorPattern) const;
|
BlackMisc::Simulation::CDistributor smartDistributorSelector(const BlackMisc::Simulation::CDistributor &distributorPattern) const;
|
||||||
|
|
||||||
|
//! Best match specified by distributor
|
||||||
|
//! \threadsafe
|
||||||
|
BlackMisc::Simulation::CDistributor smartDistributorSelector(const BlackMisc::Simulation::CDistributor &distributorPattern, const BlackMisc::Simulation::CAircraftModel &model) const;
|
||||||
|
|
||||||
//! Get models count
|
//! Get models count
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
int getModelsCount() const;
|
int getModelsCount() const;
|
||||||
@@ -105,7 +109,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Get model keys
|
//! Get model keys
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
QStringList getModelStrings() const;
|
QStringList getModelStringList() const;
|
||||||
|
|
||||||
//! All data read?
|
//! All data read?
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
|
|||||||
@@ -346,6 +346,12 @@ namespace BlackCore
|
|||||||
return CDistributor();
|
return CDistributor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDistributor CWebDataServices::smartDistributorSelector(const CDistributor &distributor, const CAircraftModel &model) const
|
||||||
|
{
|
||||||
|
if (m_modelDataReader) { return m_modelDataReader->smartDistributorSelector(distributor, model); }
|
||||||
|
return CDistributor();
|
||||||
|
}
|
||||||
|
|
||||||
CLiveryList CWebDataServices::getLiveries() const
|
CLiveryList CWebDataServices::getLiveries() const
|
||||||
{
|
{
|
||||||
if (m_modelDataReader) { return m_modelDataReader->getLiveries(); }
|
if (m_modelDataReader) { return m_modelDataReader->getLiveries(); }
|
||||||
@@ -366,7 +372,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
CLivery CWebDataServices::getStdLiveryForAirlineCode(const CAirlineIcaoCode &icao) const
|
CLivery CWebDataServices::getStdLiveryForAirlineCode(const CAirlineIcaoCode &icao) const
|
||||||
{
|
{
|
||||||
if (m_modelDataReader) { return m_modelDataReader->getStdLiveryForAirlineCode(icao); }
|
if (m_modelDataReader) { return m_modelDataReader->getStdLiveryForAirlineVDesignator(icao); }
|
||||||
return CLivery();
|
return CLivery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +408,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
QStringList CWebDataServices::getModelStrings() const
|
QStringList CWebDataServices::getModelStrings() const
|
||||||
{
|
{
|
||||||
if (m_modelDataReader) { return m_modelDataReader->getModelStrings(); }
|
if (m_modelDataReader) { return m_modelDataReader->getModelStringList(); }
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,14 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Simulation::CDistributor smartDistributorSelector(const BlackMisc::Simulation::CDistributor &distributor) const;
|
BlackMisc::Simulation::CDistributor smartDistributorSelector(const BlackMisc::Simulation::CDistributor &distributor) const;
|
||||||
|
|
||||||
|
//! Use distributor object to select the best complete distributor from DB
|
||||||
|
//! \threadsafe
|
||||||
|
BlackMisc::Simulation::CDistributor smartDistributorSelector() const;
|
||||||
|
|
||||||
|
//! Best match specified by distributor / model
|
||||||
|
//! \threadsafe
|
||||||
|
BlackMisc::Simulation::CDistributor smartDistributorSelector(const BlackMisc::Simulation::CDistributor &distributor, const BlackMisc::Simulation::CAircraftModel &model) const;
|
||||||
|
|
||||||
//! Liveries
|
//! Liveries
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Aviation::CLiveryList getLiveries() const;
|
BlackMisc::Aviation::CLiveryList getLiveries() const;
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ namespace BlackGui
|
|||||||
this->ui->tvp_AircraftModels->updateContainer(ml);
|
this->ui->tvp_AircraftModels->updateContainer(ml);
|
||||||
|
|
||||||
// model completer
|
// model completer
|
||||||
this->m_modelCompleter->setModel(new QStringListModel(ml.getModelStrings(), this->m_modelCompleter));
|
this->m_modelCompleter->setModel(new QStringListModel(ml.getModelStringList(), this->m_modelCompleter));
|
||||||
this->m_modelCompleter->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
|
this->m_modelCompleter->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
|
||||||
this->m_modelCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
this->m_modelCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
this->m_modelCompleter->setWrapAround(true);
|
this->m_modelCompleter->setWrapAround(true);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ namespace BlackGui
|
|||||||
if (!code.hasCompleteData()) { return; }
|
if (!code.hasCompleteData()) { return; }
|
||||||
if (!code.hasValidDbKey()) { return; }
|
if (!code.hasValidDbKey()) { return; }
|
||||||
|
|
||||||
const CLivery stdLivery(sGui->getWebDataServices()->getLiveries().findStdLiveryByAirlineIcaoDesignator(code));
|
const CLivery stdLivery(sGui->getWebDataServices()->getLiveries().findStdLiveryByAirlineIcaoVDesignator(code));
|
||||||
if (stdLivery.hasValidDbKey())
|
if (stdLivery.hasValidDbKey())
|
||||||
{
|
{
|
||||||
this->setValue(stdLivery);
|
this->setValue(stdLivery);
|
||||||
|
|||||||
@@ -171,14 +171,14 @@ namespace BlackGui
|
|||||||
QStringList CAircraftModelListModel::getModelStrings(bool sort) const
|
QStringList CAircraftModelListModel::getModelStrings(bool sort) const
|
||||||
{
|
{
|
||||||
if (this->isEmpty()) { return QStringList(); }
|
if (this->isEmpty()) { return QStringList(); }
|
||||||
return this->container().getModelStrings(sort);
|
return this->container().getModelStringList(sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAircraftModelListModel::replaceOrAddByModelString(const CAircraftModelList &models)
|
void CAircraftModelListModel::replaceOrAddByModelString(const CAircraftModelList &models)
|
||||||
{
|
{
|
||||||
if (models.isEmpty()) { return; }
|
if (models.isEmpty()) { return; }
|
||||||
CAircraftModelList currentModels(container());
|
CAircraftModelList currentModels(container());
|
||||||
currentModels.removeModelsWithString(models.getModelStrings(true), Qt::CaseInsensitive);
|
currentModels.removeModelsWithString(models.getModelStringList(true), Qt::CaseInsensitive);
|
||||||
currentModels.push_back(models);
|
currentModels.push_back(models);
|
||||||
this->updateContainerMaybeAsync(currentModels);
|
this->updateContainerMaybeAsync(currentModels);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,7 +474,6 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CViewBaseNonTemplate::ps_loadJsonAction()
|
void CViewBaseNonTemplate::ps_loadJsonAction()
|
||||||
{
|
{
|
||||||
if (this->isEmpty()) { return; }
|
|
||||||
if (!this->m_menus.testFlag(MenuLoad)) { return; }
|
if (!this->m_menus.testFlag(MenuLoad)) { return; }
|
||||||
this->ps_loadJson();
|
this->ps_loadJson();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user