mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
QTime timer;
|
||||
|
||||
Reference in New Issue
Block a user