mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 17:30:12 +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
|
||||
bool asyncWebAndContextStart();
|
||||
|
||||
void initCrashHandler();
|
||||
|
||||
void crashDumpUploadEnabledChanged();
|
||||
|
||||
//! Implementation for getFromNetwork(), postToNetwork() and headerFromNetwork()
|
||||
QNetworkReply *httpRequestImpl(const QNetworkRequest &request,
|
||||
const BlackMisc::CSlot<void(QNetworkReply *)> &callback,
|
||||
@@ -454,6 +450,10 @@ namespace BlackCore
|
||||
bool m_unitTest = false; //!< is UNIT test
|
||||
bool m_autoSaveSettings = true;//!< automatically saving all settings
|
||||
|
||||
// -------------- crashpad -----------------
|
||||
void initCrashHandler();
|
||||
void crashDumpUploadEnabledChanged();
|
||||
|
||||
#ifdef BLACK_USE_CRASHPAD
|
||||
std::unique_ptr<crashpad::CrashpadClient> m_crashpadClient;
|
||||
std::unique_ptr<crashpad::CrashReportDatabase> m_crashReportDatabase;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BlackCore
|
||||
CDatabaseReader::CDatabaseReader(QObject *owner, const CDatabaseReaderConfigList &config, const QString &name) :
|
||||
BlackCore::CThreadedReader(owner, name), m_config(config)
|
||||
{
|
||||
getDbUrl(); // init
|
||||
getDbUrl(); // init the cache
|
||||
}
|
||||
|
||||
void CDatabaseReader::readInBackgroundThread(CEntityFlags::Entity entities, const QDateTime &newerThan)
|
||||
@@ -314,7 +314,8 @@ namespace BlackCore
|
||||
|
||||
bool CDatabaseReader::canPingSwiftServer()
|
||||
{
|
||||
return CNetworkUtils::canConnect(getDbUrl());
|
||||
const CUrl url(getDbUrl());
|
||||
return CNetworkUtils::canConnect(url);
|
||||
}
|
||||
|
||||
void CDatabaseReader::JsonDatastoreResponse::setJsonArray(const QJsonArray &value)
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
// get all or incremental set of distributor
|
||||
// get all or incremental set
|
||||
CDbInfoList infoObjects = CDbInfoList::fromDatabaseJson(res.getJsonArray());
|
||||
|
||||
// this part needs to be synchronized
|
||||
|
||||
@@ -57,11 +57,11 @@ namespace BlackCore
|
||||
return liveries.findByCombinedCode(combinedCode);
|
||||
}
|
||||
|
||||
CLivery CModelDataReader::getStdLiveryForAirlineCode(const CAirlineIcaoCode &icao) const
|
||||
CLivery CModelDataReader::getStdLiveryForAirlineVDesignator(const CAirlineIcaoCode &icao) const
|
||||
{
|
||||
if (!icao.hasValidDesignator()) { return CLivery(); }
|
||||
const CLiveryList liveries(getLiveries());
|
||||
return liveries.findStdLiveryByAirlineIcaoDesignator(icao);
|
||||
return liveries.findStdLiveryByAirlineIcaoVDesignator(icao);
|
||||
}
|
||||
|
||||
CLivery CModelDataReader::getLiveryForDbKey(int id) const
|
||||
@@ -117,6 +117,12 @@ namespace BlackCore
|
||||
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
|
||||
{
|
||||
return this->getModels().size();
|
||||
@@ -127,9 +133,9 @@ namespace BlackCore
|
||||
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
|
||||
@@ -298,7 +304,7 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
// get all or incremental set of distributor
|
||||
// get all or incremental set of distributors
|
||||
CDistributorList distributors;
|
||||
if (res.isRestricted())
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace BlackCore
|
||||
|
||||
//! Get aircraft livery for ICAO code
|
||||
//! \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
|
||||
//! \threadsafe
|
||||
@@ -95,6 +95,10 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
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
|
||||
//! \threadsafe
|
||||
int getModelsCount() const;
|
||||
@@ -105,7 +109,7 @@ namespace BlackCore
|
||||
|
||||
//! Get model keys
|
||||
//! \threadsafe
|
||||
QStringList getModelStrings() const;
|
||||
QStringList getModelStringList() const;
|
||||
|
||||
//! All data read?
|
||||
//! \threadsafe
|
||||
|
||||
@@ -346,6 +346,12 @@ namespace BlackCore
|
||||
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
|
||||
{
|
||||
if (m_modelDataReader) { return m_modelDataReader->getLiveries(); }
|
||||
@@ -366,7 +372,7 @@ namespace BlackCore
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -402,7 +408,7 @@ namespace BlackCore
|
||||
|
||||
QStringList CWebDataServices::getModelStrings() const
|
||||
{
|
||||
if (m_modelDataReader) { return m_modelDataReader->getModelStrings(); }
|
||||
if (m_modelDataReader) { return m_modelDataReader->getModelStringList(); }
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
|
||||
@@ -161,6 +161,14 @@ namespace BlackCore
|
||||
//! \threadsafe
|
||||
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
|
||||
//! \threadsafe
|
||||
BlackMisc::Aviation::CLiveryList getLiveries() const;
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace BlackGui
|
||||
this->ui->tvp_AircraftModels->updateContainer(ml);
|
||||
|
||||
// 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->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
this->m_modelCompleter->setWrapAround(true);
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace BlackGui
|
||||
if (!code.hasCompleteData()) { return; }
|
||||
if (!code.hasValidDbKey()) { return; }
|
||||
|
||||
const CLivery stdLivery(sGui->getWebDataServices()->getLiveries().findStdLiveryByAirlineIcaoDesignator(code));
|
||||
const CLivery stdLivery(sGui->getWebDataServices()->getLiveries().findStdLiveryByAirlineIcaoVDesignator(code));
|
||||
if (stdLivery.hasValidDbKey())
|
||||
{
|
||||
this->setValue(stdLivery);
|
||||
|
||||
@@ -171,14 +171,14 @@ namespace BlackGui
|
||||
QStringList CAircraftModelListModel::getModelStrings(bool sort) const
|
||||
{
|
||||
if (this->isEmpty()) { return QStringList(); }
|
||||
return this->container().getModelStrings(sort);
|
||||
return this->container().getModelStringList(sort);
|
||||
}
|
||||
|
||||
void CAircraftModelListModel::replaceOrAddByModelString(const CAircraftModelList &models)
|
||||
{
|
||||
if (models.isEmpty()) { return; }
|
||||
CAircraftModelList currentModels(container());
|
||||
currentModels.removeModelsWithString(models.getModelStrings(true), Qt::CaseInsensitive);
|
||||
currentModels.removeModelsWithString(models.getModelStringList(true), Qt::CaseInsensitive);
|
||||
currentModels.push_back(models);
|
||||
this->updateContainerMaybeAsync(currentModels);
|
||||
}
|
||||
|
||||
@@ -474,7 +474,6 @@ namespace BlackGui
|
||||
|
||||
void CViewBaseNonTemplate::ps_loadJsonAction()
|
||||
{
|
||||
if (this->isEmpty()) { return; }
|
||||
if (!this->m_menus.testFlag(MenuLoad)) { return; }
|
||||
this->ps_loadJson();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user