Ref T348, setup "remove from set if failed"

This commit is contained in:
Klaus Basan
2018-09-20 00:42:40 +02:00
parent 136370fc63
commit de4dffae8f
4 changed files with 74 additions and 44 deletions

View File

@@ -46,6 +46,7 @@ namespace BlackGui
CGuiUtility::checkBoxReadOnly(ui->cb_ByForceCivilian, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ByForceCivilian, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ScoreIgnoreZeros, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ScoreIgnoreZeros, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ScorePreferColorLiveries, readonly); CGuiUtility::checkBoxReadOnly(ui->cb_ScorePreferColorLiveries, readonly);
CGuiUtility::checkBoxReadOnly(ui->cb_ModelSetRemoveFailed, readonly);
const bool enabled = !readonly; const bool enabled = !readonly;
ui->rb_Reduction->setEnabled(enabled); ui->rb_Reduction->setEnabled(enabled);
@@ -80,6 +81,7 @@ namespace BlackGui
ui->cb_ScorePreferColorLiveries->setChecked(mode.testFlag(CAircraftMatcherSetup::ScorePreferColorLiveries)); ui->cb_ScorePreferColorLiveries->setChecked(mode.testFlag(CAircraftMatcherSetup::ScorePreferColorLiveries));
ui->cb_ExclNoExcludedModels->setChecked(mode.testFlag(CAircraftMatcherSetup::ExcludeNoExcluded)); ui->cb_ExclNoExcludedModels->setChecked(mode.testFlag(CAircraftMatcherSetup::ExcludeNoExcluded));
ui->cb_ExclNoDbData->setChecked(mode.testFlag(CAircraftMatcherSetup::ExcludeNoDbData)); ui->cb_ExclNoDbData->setChecked(mode.testFlag(CAircraftMatcherSetup::ExcludeNoDbData));
ui->cb_ModelSetRemoveFailed->setChecked(mode.testFlag(CAircraftMatcherSetup::ModelSetRemoveFailedModel));
this->setMatchingAlgorithm(setup); this->setMatchingAlgorithm(setup);
this->setPickStrategy(setup); this->setPickStrategy(setup);
@@ -115,7 +117,8 @@ namespace BlackGui
ui->cb_ByForceCivilian->isChecked(), ui->cb_ByForceCivilian->isChecked(),
ui->cb_ByVtol->isChecked(), ui->cb_ByVtol->isChecked(),
ui->cb_ScoreIgnoreZeros->isChecked(), ui->cb_ScorePreferColorLiveries->isChecked(), ui->cb_ScoreIgnoreZeros->isChecked(), ui->cb_ScorePreferColorLiveries->isChecked(),
ui->cb_ExclNoDbData->isChecked(), ui->cb_ExclNoExcludedModels->isChecked() ui->cb_ExclNoDbData->isChecked(), ui->cb_ExclNoExcludedModels->isChecked(),
ui->cb_ModelSetRemoveFailed->isChecked()
); );
} }

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>293</width> <width>293</width>
<height>375</height> <height>438</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -105,10 +105,40 @@
<string>Reduction</string> <string>Reduction</string>
</property> </property>
<layout class="QGridLayout" name="gl_Mode"> <layout class="QGridLayout" name="gl_Mode">
<item row="0" column="1"> <item row="3" column="1" colspan="2">
<widget class="QRadioButton" name="rb_ByIcaoDataAirline1st"> <widget class="QCheckBox" name="cb_ByVtol">
<property name="toolTip">
<string>Vertical Takeoff or Landing</string>
</property>
<property name="text"> <property name="text">
<string>by ICAO: airline first</string> <string>VTOL (helicopters and such)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="cb_ByForceMilitary">
<property name="toolTip">
<string>inbound military force matched military</string>
</property>
<property name="text">
<string>force military</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="cb_ByForceCivilian">
<property name="toolTip">
<string>inbound civilian force matched civilian</string>
</property>
<property name="text">
<string>force civilian</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="cb_ByLivery">
<property name="text">
<string> livery</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -119,6 +149,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QRadioButton" name="rb_ByIcaoDataAirline1st">
<property name="text">
<string>by ICAO: airline first</string>
</property>
</widget>
</item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QCheckBox" name="cb_ByCombinedCode"> <widget class="QCheckBox" name="cb_ByCombinedCode">
<property name="text"> <property name="text">
@@ -126,10 +163,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="2">
<widget class="QCheckBox" name="cb_ByLivery"> <widget class="QCheckBox" name="cb_ByFamily">
<property name="text"> <property name="text">
<string> livery</string> <string>family</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -147,40 +184,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> </layout>
<widget class="QCheckBox" name="cb_ByFamily">
<property name="text">
<string>family</string>
</property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item>
<widget class="QCheckBox" name="cb_ByForceMilitary"> <widget class="QGroupBox" name="gb_FailureHandling">
<property name="toolTip"> <property name="title">
<string>inbound military force matched military</string> <string>Failure handling</string>
</property> </property>
<layout class="QHBoxLayout" name="hFailureHandling">
<item>
<widget class="QCheckBox" name="cb_ModelSetRemoveFailed">
<property name="text"> <property name="text">
<string>force military</string> <string>removed failed from set</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="cb_ByVtol">
<property name="toolTip">
<string>Vertical Takeoff or Landing</string>
</property>
<property name="text">
<string>VTOL (helicopters and such)</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="cb_ByForceCivilian">
<property name="toolTip">
<string>inbound civilian force matched civilian</string>
</property>
<property name="text">
<string>force civilian</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -134,6 +134,7 @@ namespace BlackMisc
static const QString preferColorLiveries("scoring, prefer color liveries"); static const QString preferColorLiveries("scoring, prefer color liveries");
static const QString exNoDb("excl.without DB data"); static const QString exNoDb("excl.without DB data");
static const QString exExcl("excl.excluded"); static const QString exExcl("excl.excluded");
static const QString remModelSet("rem.from model set");
switch (modeFlag) switch (modeFlag)
{ {
@@ -151,6 +152,7 @@ namespace BlackMisc
case ScorePreferColorLiveries: return preferColorLiveries; case ScorePreferColorLiveries: return preferColorLiveries;
case ExcludeNoDbData: return exNoDb; case ExcludeNoDbData: return exNoDb;
case ExcludeNoExcluded: return exExcl; case ExcludeNoExcluded: return exExcl;
case ModelSetRemoveFailedModel: return remModelSet;
default: break; default: break;
} }
@@ -173,6 +175,7 @@ namespace BlackMisc
if (mode.testFlag(ByVtol)) { modes << modeFlagToString(ByVtol); } if (mode.testFlag(ByVtol)) { modes << modeFlagToString(ByVtol); }
if (mode.testFlag(ScoreIgnoreZeros)) { modes << modeFlagToString(ScoreIgnoreZeros); } if (mode.testFlag(ScoreIgnoreZeros)) { modes << modeFlagToString(ScoreIgnoreZeros); }
if (mode.testFlag(ScorePreferColorLiveries)) { modes << modeFlagToString(ScorePreferColorLiveries); } if (mode.testFlag(ScorePreferColorLiveries)) { modes << modeFlagToString(ScorePreferColorLiveries); }
if (mode.testFlag(ModelSetRemoveFailedModel)) { modes << modeFlagToString(ModelSetRemoveFailedModel); }
return modes.join(", "); return modes.join(", ");
} }
@@ -198,7 +201,8 @@ namespace BlackMisc
bool byForceMilitary, bool byForceCivilian, bool byForceMilitary, bool byForceCivilian,
bool byVtol, bool byVtol,
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool scoreIgnoreZeros, bool scorePreferColorLiveries,
bool excludeNoDbData, bool excludeNoExcluded) bool excludeNoDbData, bool excludeNoExcluded,
bool modelSetRemoveFailedModel)
{ {
MatchingMode mode = byModelString ? ByModelString : ModeNone; MatchingMode mode = byModelString ? ByModelString : ModeNone;
if (byIcaoDataAircraft1st) { mode |= ByIcaoOrderAircraftFirst; } if (byIcaoDataAircraft1st) { mode |= ByIcaoOrderAircraftFirst; }
@@ -213,6 +217,7 @@ namespace BlackMisc
if (scorePreferColorLiveries) { mode |= ScorePreferColorLiveries; } if (scorePreferColorLiveries) { mode |= ScorePreferColorLiveries; }
if (excludeNoDbData) { mode |= ExcludeNoDbData; } if (excludeNoDbData) { mode |= ExcludeNoDbData; }
if (excludeNoExcluded) { mode |= ExcludeNoExcluded; } if (excludeNoExcluded) { mode |= ExcludeNoExcluded; }
if (modelSetRemoveFailedModel) { mode |= ModelSetRemoveFailedModel; }
return mode; return mode;
} }
} // namespace } // namespace

View File

@@ -54,6 +54,8 @@ namespace BlackMisc
ExcludeNoDbData = 1 << 13, ExcludeNoDbData = 1 << 13,
ExcludeNoExcluded = 1 << 14, ExcludeNoExcluded = 1 << 14,
ExcludeDefault = ExcludeNoExcluded | ExcludeNoDbData, ExcludeDefault = ExcludeNoExcluded | ExcludeNoDbData,
// --- model set ---
ModelSetRemoveFailedModel = 1 << 15,
// --- others --- // --- others ---
ModeNone = 0, ModeNone = 0,
ModeByFLags = ByMilitary | ByVtol, ModeByFLags = ByMilitary | ByVtol,
@@ -106,6 +108,9 @@ namespace BlackMisc
//! Dynamic offset values? //! Dynamic offset values?
void setMatchingMode(MatchingMode mode) { m_mode = static_cast<int>(mode); } void setMatchingMode(MatchingMode mode) { m_mode = static_cast<int>(mode); }
//! Remove if failed?
bool removeFromSetIfFailed() const { return this->getMatchingMode().testFlag(ModelSetRemoveFailedModel); }
//! Strategy among equally suitable models //! Strategy among equally suitable models
PickSimilarStrategy getPickStrategy() const { return static_cast<PickSimilarStrategy>(m_strategy); } PickSimilarStrategy getPickStrategy() const { return static_cast<PickSimilarStrategy>(m_strategy); }
@@ -144,7 +149,8 @@ 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 byVtol,
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded); bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded,
bool modelSetRemoveFailedModel);
private: private:
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased); int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);