Ref T705, use model set for reverse lookup

* allow finding model string from set, for NON DB models
* pass model set as parameter
This commit is contained in:
Klaus Basan
2019-07-20 14:23:46 +02:00
committed by Mat Sutcliffe
parent 1f148cf7f8
commit b87d0f5f15
6 changed files with 149 additions and 42 deletions

View File

@@ -165,7 +165,9 @@ namespace BlackGui
if (ui->cb_withReverseLookup->isChecked())
{
const QString liveryString(ui->comp_LiverySelector->getRawCombinedCode());
const CAircraftModel reverseModel = CAircraftMatcher::reverseLookupModelMs(remoteAircraft.getModel(), liveryString, m_matcher.getSetup(), &msgs);
const CAircraftModelList modelSet = m_matcher.getModelSet();
const CAircraftMatcherSetup setup = m_matcher.getSetup();
const CAircraftModel reverseModel = CAircraftMatcher::reverseLookupModelMs(remoteAircraft.getModel(), liveryString, setup, modelSet, &msgs);
remoteAircraft.setModel(reverseModel); // current model
}
@@ -187,10 +189,11 @@ namespace BlackGui
CStatusMessageList msgs;
m_matcher.setDefaultModel(CModelMatcherComponent::defaultModel());
const CAircraftModelList modelSet = m_matcher.getModelSet();
const CAircraftMatcherSetup setup = m_matcher.getSetup();
const CSimulatedAircraft remoteAircraft(createAircraft());
const QString livery(ui->comp_LiverySelector->getRawCombinedCode());
const CAircraftModel matched = CAircraftMatcher::reverseLookupModelMs(remoteAircraft.getModel(), livery, setup, &msgs);
const CAircraftModel matched = CAircraftMatcher::reverseLookupModelMs(remoteAircraft.getModel(), livery, setup, modelSet, &msgs);
ui->te_Results->setText(matched.toQString(true));
ui->tvp_ResultMessages->updateContainer(msgs);
}
@@ -275,12 +278,12 @@ namespace BlackGui
return model;
}
MatchingScriptReturnValues CModelMatcherComponent::matchingScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, CStatusMessageList &msgs)
MatchingScriptReturnValues CModelMatcherComponent::matchingScript(const CAircraftModel &inModel, const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, CStatusMessageList &msgs)
{
// Script
if (setup.doRunMsReverseLookupScript())
{
const MatchingScriptReturnValues rv = CAircraftMatcher::reverseLookupScript(inModel, setup, &msgs);
const MatchingScriptReturnValues rv = CAircraftMatcher::reverseLookupScript(inModel, setup, modelSet, &msgs);
if (rv.runScriptAndModified())
{
return rv;

View File

@@ -11,8 +11,8 @@
#ifndef BLACKGUI_COMPONENT_MODELMATCHERCOMPONENT_H
#define BLACKGUI_COMPONENT_MODELMATCHERCOMPONENT_H
#include "blackcore/aircraftmatcher.h"
#include "blackgui/blackguiexport.h"
#include "blackcore/aircraftmatcher.h"
#include "blackmisc/simulation/settings/modelmatchersettings.h"
#include "blackmisc/simulation/aircraftmodel.h"
#include "blackmisc/simulation/simulatedaircraft.h"
@@ -95,7 +95,7 @@ namespace BlackGui
BlackMisc::Simulation::CAircraftModel defaultModel() const;
//! Run matching script
static BlackMisc::Simulation::MatchingScriptReturnValues matchingScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, BlackMisc::CStatusMessageList &msgs);
static BlackMisc::Simulation::MatchingScriptReturnValues matchingScript(const BlackMisc::Simulation::CAircraftModel &inModel, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CAircraftModelList &modelSet, BlackMisc::CStatusMessageList &msgs);
QScopedPointer<Ui::CModelMatcherComponent> ui;
QPointer<Views::CAircraftModelView> m_workbenchView; //!< an external workbenc