mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 14:15:35 +08:00
refs #907, consolidation function
remark: kept with other consolidation functions although not DB related
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c5f89d0deb
commit
6640c84e63
@@ -101,6 +101,30 @@ namespace BlackCore
|
|||||||
return CDatabaseUtils::consolidateModelsWithDbDataAllowsGuiRefresh(models, force, false);
|
return CDatabaseUtils::consolidateModelsWithDbDataAllowsGuiRefresh(models, force, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAircraftModelList CDatabaseUtils::consolidateModelsWithSimulatorModelsAllowsGuiRefresh(const CAircraftModelList &models, const CAircraftModelList &simulatorModels, bool processEvents)
|
||||||
|
{
|
||||||
|
QTime timer;
|
||||||
|
timer.start();
|
||||||
|
if (models.isEmpty() || simulatorModels.isEmpty()) { return models; }
|
||||||
|
|
||||||
|
const QSet<QString> allOwnModelsModelStrings = simulatorModels.getModelStringSet();
|
||||||
|
CAircraftModelList consolidatedModels;
|
||||||
|
|
||||||
|
int c = 0;
|
||||||
|
for (const CAircraftModel &model : models)
|
||||||
|
{
|
||||||
|
c++;
|
||||||
|
if (processEvents && c % 125 == 0) { sApp->processEventsFor(25); }
|
||||||
|
|
||||||
|
const QString ms(model.getModelString());
|
||||||
|
if (ms.isEmpty()) { continue; }
|
||||||
|
if (!allOwnModelsModelStrings.contains(ms)) { continue; }
|
||||||
|
consolidatedModels.push_back(model);
|
||||||
|
}
|
||||||
|
CLogMessage().debug() << "Consolidated " << models.size() << " vs. " << simulatorModels.size() << " in " << timer.elapsed() << "ms";
|
||||||
|
return consolidatedModels;
|
||||||
|
}
|
||||||
|
|
||||||
int CDatabaseUtils::consolidateModelsWithDbDataAllowsGuiRefresh(CAircraftModelList &models, bool force, bool processEvents)
|
int CDatabaseUtils::consolidateModelsWithDbDataAllowsGuiRefresh(CAircraftModelList &models, bool force, bool processEvents)
|
||||||
{
|
{
|
||||||
QTime timer;
|
QTime timer;
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ namespace BlackCore
|
|||||||
//! Consolidate models with DB data
|
//! Consolidate models with DB data
|
||||||
static int consolidateModelsWithDbData(BlackMisc::Simulation::CAircraftModelList &models, bool force);
|
static int consolidateModelsWithDbData(BlackMisc::Simulation::CAircraftModelList &models, bool force);
|
||||||
|
|
||||||
|
//! Consolidate models with simulator model data (aka "models on disk")
|
||||||
|
//! \remark kept here with the other consolidate functions, but actually DB independent
|
||||||
|
static BlackMisc::Simulation::CAircraftModelList consolidateModelsWithSimulatorModelsAllowsGuiRefresh(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CAircraftModelList &simulatorModels, bool processEvents);
|
||||||
|
|
||||||
//! Consolidate models with DB data
|
//! Consolidate models with DB data
|
||||||
static int consolidateModelsWithDbDataAllowsGuiRefresh(BlackMisc::Simulation::CAircraftModelList &models, bool force, bool processEvents);
|
static int consolidateModelsWithDbDataAllowsGuiRefresh(BlackMisc::Simulation::CAircraftModelList &models, bool force, bool processEvents);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user