mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Model matching resolution for airline groups
* UI * setup class
This commit is contained in:
@@ -27,12 +27,18 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->rb_Reduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection);
|
||||
connect(ui->rb_ScoreAndReduction, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection);
|
||||
connect(ui->rb_ScoreOnly, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, 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_MsNetwork, &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_ScoreOnly, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection);
|
||||
|
||||
connect(ui->rb_AirlineGroupIfNoAirline, &QRadioButton::released, this, &CMatchingForm::onAirlineGroupChanged, Qt::QueuedConnection);
|
||||
connect(ui->rb_AirlineGroupAsAirline, &QRadioButton::released, this, &CMatchingForm::onAirlineGroupChanged, Qt::QueuedConnection);
|
||||
connect(ui->rb_AirlineGroupNo, &QRadioButton::released, this, &CMatchingForm::onAirlineGroupChanged, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
CMatchingForm::~CMatchingForm()
|
||||
@@ -62,7 +68,10 @@ namespace BlackGui
|
||||
ui->rb_ScoreOnly->setEnabled(enabled);
|
||||
ui->rb_ByIcaoDataAircraft1st->setEnabled(enabled);
|
||||
ui->rb_ByIcaoDataAirline1st->setEnabled(enabled);
|
||||
ui->rb_PickFirst->setEnabled(enabled);
|
||||
ui->rb_AirlineGroupAsAirline->setEnabled(enabled); ui->rb_PickFirst->setEnabled(enabled);
|
||||
ui->rb_AirlineGroupNo->setEnabled(enabled);
|
||||
ui->rb_AirlineGroupIfNoAirline->setEnabled(enabled);
|
||||
|
||||
ui->rb_PickByOrder->setEnabled(enabled);
|
||||
ui->rb_PickRandom->setEnabled(enabled);
|
||||
|
||||
@@ -83,8 +92,21 @@ namespace BlackGui
|
||||
const CAircraftMatcherSetup::MatchingMode mode = setup.getMatchingMode();
|
||||
ui->cb_ByModelString->setChecked(mode.testFlag(CAircraftMatcherSetup::ByModelString));
|
||||
ui->cb_ByCombinedCode->setChecked(mode.testFlag(CAircraftMatcherSetup::ByCombinedType));
|
||||
|
||||
ui->rb_ByIcaoDataAircraft1st->setChecked(mode.testFlag(CAircraftMatcherSetup::ByIcaoOrderAircraftFirst));
|
||||
ui->rb_ByIcaoDataAirline1st->setChecked(mode.testFlag(CAircraftMatcherSetup::ByIcaoOrderAirlineFirst));
|
||||
|
||||
const bool nag = !mode.testFlag(CAircraftMatcherSetup::ByAirlineGroupSameAsAirline) && !mode.testFlag(CAircraftMatcherSetup::ByAirlineGroupIfNoAirline);
|
||||
if (nag)
|
||||
{
|
||||
ui->rb_AirlineGroupNo->setChecked(nag);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->rb_AirlineGroupAsAirline->setChecked(mode.testFlag(CAircraftMatcherSetup::ByAirlineGroupSameAsAirline));
|
||||
ui->rb_AirlineGroupIfNoAirline->setChecked(mode.testFlag(CAircraftMatcherSetup::CAircraftMatcherSetup::ByAirlineGroupIfNoAirline));
|
||||
}
|
||||
|
||||
ui->cb_ByLivery->setChecked(mode.testFlag(CAircraftMatcherSetup::ByLivery));
|
||||
ui->cb_ByFamily->setChecked(mode.testFlag(CAircraftMatcherSetup::ByFamily));
|
||||
ui->cb_ByForceMilitary->setChecked(mode.testFlag(CAircraftMatcherSetup::ByForceMilitary));
|
||||
@@ -113,6 +135,7 @@ namespace BlackGui
|
||||
CAircraftMatcherSetup CMatchingForm::value() const
|
||||
{
|
||||
CAircraftMatcherSetup setup(algorithm(), matchingMode(), pickStrategy());
|
||||
setup.setAirlineGroupBehaviour(ui->rb_AirlineGroupIfNoAirline->isChecked(), ui->rb_AirlineGroupAsAirline->isChecked());
|
||||
setup.setMsNetworkEntryFile(ui->le_MsNetwork->text());
|
||||
setup.setMsMatchingStageFile(ui->le_MsMatching->text());
|
||||
setup.setMsNetworkEntryEnabled(ui->cb_MsNetwork->isChecked());
|
||||
@@ -228,5 +251,11 @@ namespace BlackGui
|
||||
const CAircraftMatcherSetup setup = this->value();
|
||||
this->setValue(setup);
|
||||
}
|
||||
|
||||
void CMatchingForm::onAirlineGroupChanged()
|
||||
{
|
||||
const CAircraftMatcherSetup setup = this->value();
|
||||
this->setValue(setup);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -66,6 +66,9 @@ namespace BlackGui
|
||||
//! Algorithm has been toggled
|
||||
void onAlgorithmChanged();
|
||||
|
||||
//! Airline group changed
|
||||
void onAirlineGroupChanged();
|
||||
|
||||
//! Reset @{
|
||||
void resetByAlgorithm();
|
||||
void resetAll();
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>293</width>
|
||||
<height>647</height>
|
||||
<width>323</width>
|
||||
<height>667</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -182,34 +182,28 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>150</height>
|
||||
<height>165</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Reduction</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_Mode">
|
||||
<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>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="Line" name="line_Reduction">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</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>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="cb_ByLivery">
|
||||
<property name="text">
|
||||
<string>force military</string>
|
||||
<string> livery</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="cb_ByForceCivilian">
|
||||
<property name="toolTip">
|
||||
<string>inbound civilian force matched civilian</string>
|
||||
@@ -219,46 +213,55 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="cb_ByLivery">
|
||||
<item row="3" column="2">
|
||||
<widget class="QCheckBox" name="cb_ByFamily">
|
||||
<property name="text">
|
||||
<string> livery</string>
|
||||
<string>family</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="cb_ByCombinedCode">
|
||||
<property name="text">
|
||||
<string>combined code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" 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="3" column="0">
|
||||
<widget class="QCheckBox" name="cb_ByModelString">
|
||||
<property name="text">
|
||||
<string>model string</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" 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="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">
|
||||
<widget class="QCheckBox" name="cb_ByCombinedCode">
|
||||
<property name="text">
|
||||
<string>combined code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cb_ByFamily">
|
||||
<property name="text">
|
||||
<string>family</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="Line" name="line_Reduction">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_ICAOfirst</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -266,6 +269,39 @@
|
||||
<property name="text">
|
||||
<string>by ICAO: aircraft first</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_ICAOfirst</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="rb_AirlineGroupNo">
|
||||
<property name="text">
|
||||
<string>no airline group</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_AirlineGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rb_AirlineGroupIfNoAirline">
|
||||
<property name="text">
|
||||
<string>group if no airline</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_AirlineGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="rb_AirlineGroupAsAirline">
|
||||
<property name="text">
|
||||
<string>group=airline</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_AirlineGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -411,6 +447,9 @@
|
||||
<tabstop>rb_PickByOrder</tabstop>
|
||||
<tabstop>rb_ByIcaoDataAircraft1st</tabstop>
|
||||
<tabstop>rb_ByIcaoDataAirline1st</tabstop>
|
||||
<tabstop>rb_AirlineGroupNo</tabstop>
|
||||
<tabstop>rb_AirlineGroupIfNoAirline</tabstop>
|
||||
<tabstop>rb_AirlineGroupAsAirline</tabstop>
|
||||
<tabstop>cb_ByModelString</tabstop>
|
||||
<tabstop>cb_ByLivery</tabstop>
|
||||
<tabstop>cb_ByFamily</tabstop>
|
||||
@@ -431,4 +470,8 @@
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="bg_AirlineGroup"/>
|
||||
<buttongroup name="bg_ICAOfirst"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
@@ -75,6 +75,16 @@ namespace BlackMisc
|
||||
this->setMatchingMode(m);
|
||||
}
|
||||
|
||||
void CAircraftMatcherSetup::setAirlineGroupBehaviour(bool ifNoAirline, bool sameAsAirline)
|
||||
{
|
||||
MatchingMode m = this->getMatchingMode();
|
||||
const bool icao = m.testFlag(ByIcaoData);
|
||||
m.setFlag(ByAirlineGroupIfNoAirline, ifNoAirline);
|
||||
m.setFlag(ByAirlineGroupSameAsAirline, sameAsAirline);
|
||||
m.setFlag(ByIcaoData, icao);
|
||||
this->setMatchingMode(m);
|
||||
}
|
||||
|
||||
QString CAircraftMatcherSetup::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
@@ -192,6 +202,8 @@ namespace BlackMisc
|
||||
static const QString categoryGlider("glider categories");
|
||||
static const QString categoryMilitary("military categories");
|
||||
static const QString revModelString("reverse model lookup");
|
||||
static const QString agSameAsAirline("group as airline");
|
||||
static const QString agIfNoAirline("group if no airline");
|
||||
|
||||
switch (modeFlag)
|
||||
{
|
||||
@@ -214,6 +226,8 @@ namespace BlackMisc
|
||||
case ExcludeNoExcluded: return exExcl;
|
||||
case ModelSetRemoveFailedModel: return removeFromModelSet;
|
||||
case ModelVerificationAtStartup: return verification;
|
||||
case ByAirlineGroupIfNoAirline: return agIfNoAirline;
|
||||
case ByAirlineGroupSameAsAirline: return agSameAsAirline;
|
||||
case ModelVerificationOnlyWarnError: return verificationWarn;
|
||||
case ModelFailoverIfNoModelCanBeAdded: return modelFailedAdded;
|
||||
default: break;
|
||||
@@ -243,9 +257,10 @@ namespace BlackMisc
|
||||
if (mode.testFlag(ScorePreferColorLiveries)) { modes << modeFlagToString(ScorePreferColorLiveries); }
|
||||
if (mode.testFlag(ModelSetRemoveFailedModel)) { modes << modeFlagToString(ModelSetRemoveFailedModel); }
|
||||
if (mode.testFlag(ModelVerificationAtStartup)) { modes << modeFlagToString(ModelVerificationAtStartup); }
|
||||
if (mode.testFlag(ByAirlineGroupIfNoAirline)) { modes << modeFlagToString(ByAirlineGroupIfNoAirline); }
|
||||
if (mode.testFlag(ByAirlineGroupSameAsAirline)) { modes << modeFlagToString(ByAirlineGroupSameAsAirline); }
|
||||
if (mode.testFlag(ModelVerificationOnlyWarnError)) { modes << modeFlagToString(ModelVerificationOnlyWarnError); }
|
||||
if (mode.testFlag(ModelFailoverIfNoModelCanBeAdded)) { modes << modeFlagToString(ModelFailoverIfNoModelCanBeAdded); }
|
||||
|
||||
return modes.join(", ");
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,10 @@ namespace BlackMisc
|
||||
ByForceCivilian = 1 << 7, //!< civilian (in) will only search in civilian
|
||||
ByMilitary = ByForceCivilian | ByForceMilitary,
|
||||
ByVtol = 1 << 8,
|
||||
ByIcaoOrderAircraftFirst = (1 << 9) | ByIcaoData,
|
||||
ByIcaoOrderAirlineFirst = (1 << 10) | ByIcaoData,
|
||||
ByIcaoOrderAircraftFirst = (1 << 9) | ByIcaoData,
|
||||
ByIcaoOrderAirlineFirst = (1 << 10) | ByIcaoData,
|
||||
ByAirlineGroupSameAsAirline = (1 << 11) | ByIcaoData,
|
||||
ByAirlineGroupIfNoAirline = (1 << 12) | ByIcaoData,
|
||||
ByCategoryGlider = 1 << 20,
|
||||
ByCategoryMilitary = 1 << 21,
|
||||
|
||||
@@ -76,8 +78,8 @@ namespace BlackMisc
|
||||
|
||||
// default depending on algorithm
|
||||
ModeDefaultScore = ScoreIgnoreZeros | ScorePreferColorLiveries | ExcludeDefault | ReverseLookupDefault,
|
||||
ModeDefaultReduce = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ByLivery | ExcludeDefault | ReverseLookupDefault,
|
||||
ModeDefaultReducePlusScore = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ModeDefaultScore | ExcludeDefault | ReverseLookupDefault,
|
||||
ModeDefaultReduce = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ByAirlineGroupIfNoAirline | ReverseLookupDefault | ExcludeDefault | ByLivery,
|
||||
ModeDefaultReducePlusScore = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ByAirlineGroupIfNoAirline | ReverseLookupDefault | ExcludeDefault | ModeDefaultScore,
|
||||
};
|
||||
Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
|
||||
|
||||
@@ -186,6 +188,9 @@ namespace BlackMisc
|
||||
//! Set reverse lookup flags
|
||||
void setReverseLookup(bool useModelLookup);
|
||||
|
||||
//! Airline group behaviour
|
||||
void setAirlineGroupBehaviour(bool ifNoAirline, bool sameAsAirline);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user