Ref T658, renamed to MsReverseLookupFile et.al.

This commit is contained in:
Klaus Basan
2019-06-02 01:31:26 +02:00
committed by Mat Sutcliffe
parent 4eb43476d6
commit ef2398f6a9
6 changed files with 56 additions and 57 deletions

View File

@@ -1,17 +0,0 @@
(
function() {
// networkObject
// reverseModel
// returnObject
returnObject.aircraftIcao = "C172";
returnObject.modified = true;
returnObject.logMessage = "Changed to C172";
return returnObject;
// string return is possible
// return "Changed ICAO to C172";
}
)

View File

@@ -0,0 +1,16 @@
(function() {
// inObject
// returnObject
// modelSet, not available in reverse lookup
returnObject.aircraftIcao = "C172";
returnObject.modified = true;
returnObject.rerun = true;
returnObject.logMessage = "Changed to C172";
return returnObject;
// string return is possible
// return "Changed ICAO to C172";
})

View File

@@ -30,7 +30,7 @@ namespace BlackGui
connect(ui->pb_ResetAlgorithm, &QPushButton::released, this, &CMatchingForm::resetByAlgorithm, Qt::QueuedConnection); connect(ui->pb_ResetAlgorithm, &QPushButton::released, this, &CMatchingForm::resetByAlgorithm, Qt::QueuedConnection);
connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection); connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection);
connect(ui->pb_MsNetwork, &QPushButton::released, this, &CMatchingForm::fileDialog, Qt::QueuedConnection); connect(ui->pb_MsReverseLookup, &QPushButton::released, this, &CMatchingForm::fileDialog, Qt::QueuedConnection);
connect(ui->pb_MsMatching, &QPushButton::released, this, &CMatchingForm::fileDialog, Qt::QueuedConnection); connect(ui->pb_MsMatching, &QPushButton::released, this, &CMatchingForm::fileDialog, Qt::QueuedConnection);
connect(ui->rb_ScoreAndReduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection); connect(ui->rb_ScoreAndReduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection);
@@ -75,9 +75,9 @@ namespace BlackGui
ui->rb_PickByOrder->setEnabled(enabled); ui->rb_PickByOrder->setEnabled(enabled);
ui->rb_PickRandom->setEnabled(enabled); ui->rb_PickRandom->setEnabled(enabled);
ui->le_MsNetwork->setEnabled(enabled); ui->le_MsReverseLookup->setEnabled(enabled);
ui->le_MsMatching->setEnabled(enabled); ui->le_MsMatching->setEnabled(enabled);
CGuiUtility::checkBoxReadOnly(ui->cb_MsNetwork, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_MsReverseLookup, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_MsMatching, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_MsMatching, readonly);
} }
@@ -126,9 +126,9 @@ namespace BlackGui
this->setMatchingAlgorithm(setup); this->setMatchingAlgorithm(setup);
this->setPickStrategy(setup); this->setPickStrategy(setup);
ui->cb_MsNetwork->setChecked(setup.isMsNetworkEntryEnabled()); ui->cb_MsReverseLookup->setChecked(setup.isMsReverseLookupEnabled());
ui->cb_MsMatching->setChecked(setup.isMsMatchingStageEnabled()); ui->cb_MsMatching->setChecked(setup.isMsMatchingStageEnabled());
ui->le_MsNetwork->setText(setup.getMsNetworkEntryFile()); ui->le_MsReverseLookup->setText(setup.getMsReverseLookupFile());
ui->le_MsMatching->setText(setup.getMsMatchingStageFile()); ui->le_MsMatching->setText(setup.getMsMatchingStageFile());
} }
@@ -136,9 +136,9 @@ namespace BlackGui
{ {
CAircraftMatcherSetup setup(algorithm(), matchingMode(), pickStrategy()); CAircraftMatcherSetup setup(algorithm(), matchingMode(), pickStrategy());
setup.setAirlineGroupBehaviour(ui->rb_AirlineGroupIfNoAirline->isChecked(), ui->rb_AirlineGroupAsAirline->isChecked()); setup.setAirlineGroupBehaviour(ui->rb_AirlineGroupIfNoAirline->isChecked(), ui->rb_AirlineGroupAsAirline->isChecked());
setup.setMsNetworkEntryFile(ui->le_MsNetwork->text()); setup.setMsReverseLookupFile(ui->le_MsReverseLookup->text());
setup.setMsMatchingStageFile(ui->le_MsMatching->text()); setup.setMsMatchingStageFile(ui->le_MsMatching->text());
setup.setMsNetworkEntryEnabled(ui->cb_MsNetwork->isChecked()); setup.setMsReverseLookupEnabled(ui->cb_MsReverseLookup->isChecked());
setup.setMsMatchingStageEnabled(ui->cb_MsMatching->isChecked()); setup.setMsMatchingStageEnabled(ui->cb_MsMatching->isChecked());
return setup; return setup;
} }
@@ -162,14 +162,14 @@ namespace BlackGui
void CMatchingForm::fileDialog() void CMatchingForm::fileDialog()
{ {
const bool nw = (QObject::sender() == ui->pb_MsNetwork); const bool nw = (QObject::sender() == ui->pb_MsReverseLookup);
QString fn = nw ? ui->le_MsNetwork->text() : ui->le_MsMatching->text(); QString fn = nw ? ui->le_MsReverseLookup->text() : ui->le_MsMatching->text();
fn = QFileDialog::getOpenFileName(nullptr, tr("Matching script"), fn, "Matching script (*.js)"); fn = QFileDialog::getOpenFileName(nullptr, tr("Matching script"), fn, "Matching script (*.js)");
const QFileInfo fi(fn); const QFileInfo fi(fn);
if (!fi.exists()) { return; } if (!fi.exists()) { return; }
if (nw) if (nw)
{ {
ui->le_MsNetwork->setText(fi.absoluteFilePath()); ui->le_MsReverseLookup->setText(fi.absoluteFilePath());
} }
else else
{ {

View File

@@ -103,9 +103,9 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="le_MsNetwork"> <widget class="QLineEdit" name="le_MsReverseLookup">
<property name="placeholderText"> <property name="placeholderText">
<string>network entry matching script file</string> <string>reverse lookup matching script file</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -117,21 +117,21 @@
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QPushButton" name="pb_MsNetwork"> <widget class="QPushButton" name="pb_MsReverseLookup">
<property name="text"> <property name="text">
<string>[...]</string> <string>[...]</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="lbl_MsNetwork"> <widget class="QLabel" name="lbl_MsReverseLookup">
<property name="text"> <property name="text">
<string>Network:</string> <string>Lookup:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QCheckBox" name="cb_MsNetwork"> <widget class="QCheckBox" name="cb_MsReverseLookup">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@@ -436,9 +436,9 @@
<tabstop>rb_ScoreOnly</tabstop> <tabstop>rb_ScoreOnly</tabstop>
<tabstop>rb_ScoreAndReduction</tabstop> <tabstop>rb_ScoreAndReduction</tabstop>
<tabstop>pb_ResetAlgorithm</tabstop> <tabstop>pb_ResetAlgorithm</tabstop>
<tabstop>le_MsNetwork</tabstop> <tabstop>le_MsReverseLookup</tabstop>
<tabstop>cb_MsNetwork</tabstop> <tabstop>cb_MsReverseLookup</tabstop>
<tabstop>pb_MsNetwork</tabstop> <tabstop>pb_MsReverseLookup</tabstop>
<tabstop>le_MsMatching</tabstop> <tabstop>le_MsMatching</tabstop>
<tabstop>cb_MsMatching</tabstop> <tabstop>cb_MsMatching</tabstop>
<tabstop>pb_MsMatching</tabstop> <tabstop>pb_MsMatching</tabstop>

View File

@@ -44,9 +44,9 @@ namespace BlackMisc
return true; return true;
} }
bool CAircraftMatcherSetup::doRunMsNetworkEntryScript() const bool CAircraftMatcherSetup::doRunMsReverseLookupScript() const
{ {
return m_msNetworkEnabled && !m_msNetworkEntryFile.isEmpty(); return m_msReverseEnabled && !m_msReverseLookupFile.isEmpty();
} }
bool CAircraftMatcherSetup::doRunMsMatchingStageScript() const bool CAircraftMatcherSetup::doRunMsMatchingStageScript() const
@@ -91,7 +91,7 @@ namespace BlackMisc
return u"algorithm: '" % this->getMatchingAlgorithmAsString() % return u"algorithm: '" % this->getMatchingAlgorithmAsString() %
u"' mode: '" % this->getMatchingModeAsString() % u"' mode: '" % this->getMatchingModeAsString() %
u"' strategy: '" % this->getPickStrategyAsString() % u"' strategy: '" % this->getPickStrategyAsString() %
u"\' matching script: " % boolToOnOff(m_msNetworkEnabled) % u'/' % boolToOnOff(m_msMatchingEnabled); u"\' matching script: " % boolToOnOff(m_msReverseEnabled) % u'/' % boolToOnOff(m_msMatchingEnabled);
} }
CVariant CAircraftMatcherSetup::propertyByIndex(const CPropertyIndex &index) const CVariant CAircraftMatcherSetup::propertyByIndex(const CPropertyIndex &index) const
@@ -103,9 +103,9 @@ namespace BlackMisc
case IndexMatchingAlgorithm: return CVariant::fromValue(m_algorithm); case IndexMatchingAlgorithm: return CVariant::fromValue(m_algorithm);
case IndexMatchingMode: return CVariant::fromValue(m_mode); case IndexMatchingMode: return CVariant::fromValue(m_mode);
case IndexPickStrategy: return CVariant::fromValue(m_strategy); case IndexPickStrategy: return CVariant::fromValue(m_strategy);
case IndexMsNetworkEntryFile: return CVariant::fromValue(m_msNetworkEntryFile); case IndexMsNetworkEntryFile: return CVariant::fromValue(m_msReverseLookupFile);
case IndexMsMatchingStageFile: return CVariant::fromValue(m_msMatchingStageFile); case IndexMsMatchingStageFile: return CVariant::fromValue(m_msMatchingStageFile);
case IndexMsNetworkEnabled: return CVariant::fromValue(m_msNetworkEnabled); case IndexMsNetworkEnabled: return CVariant::fromValue(m_msReverseEnabled);
case IndexMsMatchingStageEnabled: return CVariant::fromValue(m_msMatchingEnabled); case IndexMsMatchingStageEnabled: return CVariant::fromValue(m_msMatchingEnabled);
default: break; default: break;
} }
@@ -121,10 +121,10 @@ namespace BlackMisc
case IndexMatchingAlgorithm: m_algorithm = variant.toInt(); break; case IndexMatchingAlgorithm: m_algorithm = variant.toInt(); break;
case IndexMatchingMode: m_mode = variant.toInt(); break; case IndexMatchingMode: m_mode = variant.toInt(); break;
case IndexPickStrategy: m_strategy = variant.toInt(); break; case IndexPickStrategy: m_strategy = variant.toInt(); break;
case IndexMsNetworkEntryFile: m_msNetworkEntryFile = variant.toQString(); break; case IndexMsNetworkEntryFile: m_msReverseLookupFile = variant.toQString(); break;
case IndexMsMatchingStageFile: m_msMatchingStageFile = variant.toQString(); break; case IndexMsMatchingStageFile: m_msMatchingStageFile = variant.toQString(); break;
case IndexMsNetworkEnabled: m_msNetworkEnabled = variant.toBool(); break; case IndexMsNetworkEnabled: m_msReverseEnabled = variant.toBool(); break;
case IndexMsMatchingStageEnabled: m_msNetworkEnabled = variant.toBool(); break; case IndexMsMatchingStageEnabled: m_msReverseEnabled = variant.toBool(); break;
default: break; default: break;
} }
CValueObject::setPropertyByIndex(index, variant); CValueObject::setPropertyByIndex(index, variant);
@@ -133,9 +133,9 @@ namespace BlackMisc
void CAircraftMatcherSetup::reset() void CAircraftMatcherSetup::reset()
{ {
this->reset(MatchingStepwiseReducePlusScoreBased); this->reset(MatchingStepwiseReducePlusScoreBased);
m_msNetworkEntryFile.clear(); m_msReverseLookupFile.clear();
m_msMatchingStageFile.clear(); m_msMatchingStageFile.clear();
m_msNetworkEnabled = false; m_msReverseEnabled = false;
m_msMatchingEnabled = false; m_msMatchingEnabled = false;
} }

View File

@@ -125,27 +125,27 @@ namespace BlackMisc
MatchingMode getMatchingMode() const { return static_cast<MatchingMode>(m_mode); } MatchingMode getMatchingMode() const { return static_cast<MatchingMode>(m_mode); }
//! Get matching files @{ //! Get matching files @{
const QString &getMsNetworkEntryFile() const { return m_msNetworkEntryFile; } const QString &getMsReverseLookupFile() const { return m_msReverseLookupFile; }
const QString &getMsMatchingStageFile() const { return m_msMatchingStageFile; } const QString &getMsMatchingStageFile() const { return m_msMatchingStageFile; }
//! @} //! @}
//! Set matching files @{ //! Set matching files @{
void setMsNetworkEntryFile(const QString &file) { m_msNetworkEntryFile = file; } void setMsReverseLookupFile(const QString &file) { m_msReverseLookupFile = file; }
void setMsMatchingStageFile(const QString &file) { m_msMatchingStageFile = file; } void setMsMatchingStageFile(const QString &file) { m_msMatchingStageFile = file; }
//! @} //! @}
//! Is matching script enabled @{ //! Is matching script enabled @{
bool isMsNetworkEntryEnabled() const { return m_msNetworkEnabled; } bool isMsReverseLookupEnabled() const { return m_msReverseEnabled; }
bool isMsMatchingStageEnabled() const { return m_msMatchingEnabled; } bool isMsMatchingStageEnabled() const { return m_msMatchingEnabled; }
//! @} //! @}
//! Run the scripts @{ //! Run the scripts @{
bool doRunMsNetworkEntryScript() const; bool doRunMsReverseLookupScript() const;
bool doRunMsMatchingStageScript() const; bool doRunMsMatchingStageScript() const;
//! @} //! @}
//! Is matching script enabled @{ //! Is matching script enabled @{
void setMsNetworkEntryEnabled(bool enabled) { m_msNetworkEnabled = enabled; } void setMsReverseLookupEnabled(bool enabled) { m_msReverseEnabled = enabled; }
void setMsMatchingStageEnabled(bool enabled) { m_msMatchingEnabled = enabled; } void setMsMatchingStageEnabled(bool enabled) { m_msMatchingEnabled = enabled; }
//! @} //! @}
@@ -226,16 +226,16 @@ namespace BlackMisc
bool byFamily, bool byLivery, bool byCombinedType, bool byFamily, bool byLivery, bool byCombinedType,
bool byForceMilitary, bool byForceCivilian, bool byForceMilitary, bool byForceCivilian,
bool byVtol, bool byGliderCategory, bool byMilitaryCategory, bool byVtol, bool byGliderCategory, bool byMilitaryCategory,
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded, bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded,
bool modelVerification, bool modelVerificationWarnError, bool modelSetRemoveFailedModel, bool modelFailover); bool modelVerification, bool modelVerificationWarnError, bool modelSetRemoveFailedModel, bool modelFailover);
private: private:
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased); int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);
int m_mode = static_cast<int>(ModeDefaultReducePlusScore); int m_mode = static_cast<int>(ModeDefaultReducePlusScore);
int m_strategy = static_cast<int>(PickByOrder); int m_strategy = static_cast<int>(PickByOrder);
QString m_msNetworkEntryFile; //!< network entry matching script file QString m_msReverseLookupFile; //!< network entry matching script file
QString m_msMatchingStageFile; //!< matching stage matching script file QString m_msMatchingStageFile; //!< matching stage matching script file
bool m_msNetworkEnabled = false; //!< enable network matching script bool m_msReverseEnabled = false; //!< enable network matching script
bool m_msMatchingEnabled = false; //!< enable matching stage matching script bool m_msMatchingEnabled = false; //!< enable matching stage matching script
BLACK_METACLASS( BLACK_METACLASS(
@@ -243,9 +243,9 @@ namespace BlackMisc
BLACK_METAMEMBER(algorithm), BLACK_METAMEMBER(algorithm),
BLACK_METAMEMBER(mode), BLACK_METAMEMBER(mode),
BLACK_METAMEMBER(strategy), BLACK_METAMEMBER(strategy),
BLACK_METAMEMBER(msNetworkEntryFile), BLACK_METAMEMBER(msReverseLookupFile),
BLACK_METAMEMBER(msMatchingStageFile), BLACK_METAMEMBER(msMatchingStageFile),
BLACK_METAMEMBER(msNetworkEnabled), BLACK_METAMEMBER(msReverseEnabled),
BLACK_METAMEMBER(msMatchingEnabled) BLACK_METAMEMBER(msMatchingEnabled)
); );
}; };