mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Allow to filter by combined type
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QStringBuilder>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -28,11 +29,11 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->le_CombinedType, &QLineEdit::editingFinished, this, &CAircraftCombinedTypeSelector::combinedTypeEntered);
|
||||
connect(ui->le_CombinedType, &QLineEdit::returnPressed, this, &CAircraftCombinedTypeSelector::combinedTypeEntered);
|
||||
connect(ui->le_CombinedType, &QLineEdit::returnPressed, this, &CAircraftCombinedTypeSelector::combinedTypeEntered);
|
||||
|
||||
connect(ui->cb_EngineCount, &QComboBox::currentTextChanged, this, &CAircraftCombinedTypeSelector::changedComboBox);
|
||||
connect(ui->cb_EngineType, &QComboBox::currentTextChanged, this, &CAircraftCombinedTypeSelector::changedComboBox);
|
||||
connect(ui->cb_Type, &QComboBox::currentTextChanged, this, &CAircraftCombinedTypeSelector::changedComboBox);
|
||||
connect(ui->cb_EngineType, &QComboBox::currentTextChanged, this, &CAircraftCombinedTypeSelector::changedComboBox);
|
||||
connect(ui->cb_Type, &QComboBox::currentTextChanged, this, &CAircraftCombinedTypeSelector::changedComboBox);
|
||||
|
||||
ui->le_CombinedType->setValidator(new CUpperCaseValidator(this));
|
||||
}
|
||||
@@ -43,19 +44,26 @@ namespace BlackGui
|
||||
void CAircraftCombinedTypeSelector::setCombinedType(const QString &combinedCode)
|
||||
{
|
||||
QString engineCount, engineType, aircraftType;
|
||||
QString cc(combinedCode.trimmed().toUpper().left(3));
|
||||
const QString cc(combinedCode.trimmed().toUpper().left(3));
|
||||
if (m_cc == cc) { return; }
|
||||
m_cc = cc;
|
||||
|
||||
if (cc.length() > 0) { aircraftType = cc.left(1); }
|
||||
if (cc.length() > 1) { engineCount = cc.mid(1, 1); }
|
||||
if (cc.length() > 2) { engineType = cc.mid(2, 1); }
|
||||
if (cc.length() > 1) { engineCount = cc.mid(1, 1); }
|
||||
if (cc.length() > 2) { engineType = cc.mid(2, 1); }
|
||||
|
||||
CGuiUtility::setComboBoxValueByStartingString(ui->cb_EngineCount, engineCount, "unspecified");
|
||||
CGuiUtility::setComboBoxValueByStartingString(ui->cb_EngineType, engineType, "unspecified");
|
||||
CGuiUtility::setComboBoxValueByStartingString(ui->cb_Type, aircraftType, "unspecified");
|
||||
if (this->getCombinedTypeFromComboBoxes() != cc)
|
||||
{
|
||||
CGuiUtility::setComboBoxValueByStartingString(ui->cb_EngineCount, engineCount, "unspecified");
|
||||
CGuiUtility::setComboBoxValueByStartingString(ui->cb_EngineType, engineType, "unspecified");
|
||||
CGuiUtility::setComboBoxValueByStartingString(ui->cb_Type, aircraftType, "unspecified");
|
||||
}
|
||||
|
||||
ui->le_CombinedType->setText(cc);
|
||||
if (ui->le_CombinedType->text() != cc) { ui->le_CombinedType->setText(cc); }
|
||||
emit this->changedCombinedType(cc);
|
||||
}
|
||||
|
||||
void CAircraftCombinedTypeSelector::setCombinedType(const BlackMisc::Aviation::CAircraftIcaoCode &icao)
|
||||
void CAircraftCombinedTypeSelector::setCombinedType(const CAircraftIcaoCode &icao)
|
||||
{
|
||||
this->setCombinedType(icao.getCombinedType());
|
||||
}
|
||||
@@ -77,6 +85,7 @@ namespace BlackGui
|
||||
QString CAircraftCombinedTypeSelector::getCombinedType() const
|
||||
{
|
||||
QString ct(ui->le_CombinedType->text().trimmed().toUpper());
|
||||
if (ct.isEmpty() || ct == QStringView(u"---")) { return {}; }
|
||||
if (CAircraftIcaoCode::isValidCombinedType(ct)) { return ct; }
|
||||
|
||||
QString ct2(getCombinedTypeFromComboBoxes());
|
||||
@@ -85,15 +94,17 @@ namespace BlackGui
|
||||
|
||||
void CAircraftCombinedTypeSelector::combinedTypeEntered()
|
||||
{
|
||||
QString cc(ui->le_CombinedType->text().trimmed().toUpper());
|
||||
this->setCombinedType(cc);
|
||||
const QString cc(ui->le_CombinedType->text().trimmed().toUpper() % u"---");
|
||||
this->setCombinedType(cc.left(3));
|
||||
}
|
||||
|
||||
void CAircraftCombinedTypeSelector::changedComboBox(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text);
|
||||
QString ct(getCombinedTypeFromComboBoxes());
|
||||
const QString ct(this->getCombinedTypeFromComboBoxes());
|
||||
if (ui->le_CombinedType->text() == ct) { return; }
|
||||
ui->le_CombinedType->setText(ct);
|
||||
emit this->changedCombinedType(ct);
|
||||
}
|
||||
|
||||
QString CAircraftCombinedTypeSelector::getCombinedTypeFromComboBoxes() const
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
#include <QScopedPointer>
|
||||
#include <QString>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace BlackMisc { namespace Aviation { class CAircraftIcaoCode; } }
|
||||
namespace Ui { class CAircraftCombinedTypeSelector; }
|
||||
namespace BlackMisc { namespace Aviation { class CAircraftIcaoCode; } }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
@@ -39,7 +37,7 @@ namespace BlackGui
|
||||
explicit CAircraftCombinedTypeSelector(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAircraftCombinedTypeSelector();
|
||||
virtual ~CAircraftCombinedTypeSelector() override;
|
||||
|
||||
//! Set comined code, e.g. L1P
|
||||
void setCombinedType(const QString &combinedCode);
|
||||
@@ -56,6 +54,10 @@ namespace BlackGui
|
||||
//! Get the combined type, e.g. "L2P"
|
||||
QString getCombinedType() const;
|
||||
|
||||
signals:
|
||||
//! Combined type has beend changed
|
||||
void changedCombinedType(const QString &cominedType);
|
||||
|
||||
private:
|
||||
//! Code has been entered
|
||||
void combinedTypeEntered();
|
||||
@@ -66,6 +68,7 @@ namespace BlackGui
|
||||
//! Combined type from comboboxes
|
||||
QString getCombinedTypeFromComboBoxes() const;
|
||||
|
||||
QString m_cc;
|
||||
QScopedPointer<Ui::CAircraftCombinedTypeSelector> ui;
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace BlackGui
|
||||
mf = CAircraftModel::Exclude;
|
||||
}
|
||||
|
||||
BlackMisc::Db::DbKeyStateFilter dbf = BlackMisc::Db::All;
|
||||
DbKeyStateFilter dbf = BlackMisc::Db::All;
|
||||
if (ui->cbt_Db->checkState() == Qt::Checked)
|
||||
{
|
||||
dbf = BlackMisc::Db::Valid;
|
||||
@@ -111,6 +111,7 @@ namespace BlackGui
|
||||
ui->le_AirlineName->text(),
|
||||
ui->le_LiveryCode->text(),
|
||||
ui->le_FileName->text(),
|
||||
ui->comp_CombinedType->getCombinedType(),
|
||||
ui->comp_SimulatorSelector->getValue(),
|
||||
ui->comp_DistributorSelector->getDistributor()
|
||||
);
|
||||
@@ -133,6 +134,7 @@ namespace BlackGui
|
||||
ui->le_FileName->clear();
|
||||
ui->comp_SimulatorSelector->checkAll();
|
||||
ui->comp_DistributorSelector->clear();
|
||||
ui->comp_CombinedType->clear();
|
||||
ui->cbt_IncludeExclude->setCheckState(Qt::PartiallyChecked);
|
||||
ui->cbt_Db->setCheckState(Qt::PartiallyChecked);
|
||||
ui->cbt_Military->setCheckState(Qt::PartiallyChecked);
|
||||
@@ -151,6 +153,12 @@ namespace BlackGui
|
||||
this->triggerFilter();
|
||||
}
|
||||
|
||||
void CAircraftModelFilterBar::onCombinedTypeChanged(const QString &combinedType)
|
||||
{
|
||||
Q_UNUSED(combinedType);
|
||||
this->triggerFilter();
|
||||
}
|
||||
|
||||
void CAircraftModelFilterBar::onCheckBoxChanged(bool state)
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
@@ -163,7 +171,7 @@ namespace BlackGui
|
||||
connect(ui->le_AircraftManufacturer, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_AirlineIcao, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_AirlineName, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_LiveryCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_LiveryCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_Id, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_ModelDescription, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
connect(ui->le_ModelString, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||
@@ -174,8 +182,9 @@ namespace BlackGui
|
||||
connect(ui->cbt_Military, &QCheckBox::clicked, this, &CAircraftModelFilterBar::onCheckBoxChanged);
|
||||
connect(ui->cbt_ColorLiveries, &QCheckBox::clicked, this, &CAircraftModelFilterBar::onCheckBoxChanged);
|
||||
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CAircraftModelFilterBar::onSimulatorSelectionChanged);
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CAircraftModelFilterBar::onSimulatorSelectionChanged);
|
||||
connect(ui->comp_DistributorSelector, &CDbDistributorSelectorComponent::changedDistributor, this, &CAircraftModelFilterBar::onDistributorChanged);
|
||||
connect(ui->comp_CombinedType, &CAircraftCombinedTypeSelector::changedCombinedType, this, &CAircraftModelFilterBar::onCombinedTypeChanged);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -63,6 +63,9 @@ namespace BlackGui
|
||||
//! Distributor changed
|
||||
void onDistributorChanged(const BlackMisc::Simulation::CDistributor &distributor);
|
||||
|
||||
//! Combined type changed
|
||||
void onCombinedTypeChanged(const QString &combinedType);
|
||||
|
||||
//! Checkbox has been changed
|
||||
void onCheckBoxChanged(bool state);
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>651</width>
|
||||
<height>72</height>
|
||||
<width>535</width>
|
||||
<height>85</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -38,16 +38,10 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="5">
|
||||
<widget class="QCheckBox" name="cbt_IncludeExclude">
|
||||
<property name="toolTip">
|
||||
<string>Included/excluded models?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Incl.</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
<item row="1" column="11">
|
||||
<widget class="QLineEdit" name="le_AirlineName">
|
||||
<property name="placeholderText">
|
||||
<string>Airline name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -64,151 +58,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="9">
|
||||
<widget class="QLabel" name="lbl_Distributor">
|
||||
<property name="text">
|
||||
<string>Distributor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QCheckBox" name="cbt_Military">
|
||||
<property name="toolTip">
|
||||
<string>Military</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mil.</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="7" colspan="2">
|
||||
<widget class="QLineEdit" name="le_FileName">
|
||||
<property name="placeholderText">
|
||||
<string>filename e.g. FSX/SimObjects/MyAircraft</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QLabel" name="lbl_FileName">
|
||||
<property name="text">
|
||||
<string>File:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="QLineEdit" name="le_AircraftIcao">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QLineEdit" name="le_ModelString">
|
||||
<property name="placeholderText">
|
||||
<string>Key, i.e. model key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="10">
|
||||
<widget class="QLineEdit" name="le_AirlineIcao">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<widget class="QLineEdit" name="le_AircraftManufacturer">
|
||||
<property name="placeholderText">
|
||||
<string>Manufacturer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLabel" name="lbl_Model">
|
||||
<property name="text">
|
||||
<string>Model:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="11">
|
||||
<widget class="QLineEdit" name="le_AirlineName">
|
||||
<property name="placeholderText">
|
||||
<string>Airline name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QLabel" name="lbl_Aircraft">
|
||||
<property name="text">
|
||||
<string>Aircraft:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QCheckBox" name="cbt_Db">
|
||||
<property name="toolTip">
|
||||
<string>DB data?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DB</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<widget class="QLabel" name="lbl_Airline">
|
||||
<property name="text">
|
||||
<string>Airline:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QLabel" name="lbl_Livery">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Livery:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QLineEdit" name="le_ModelDescription">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QLineEdit" name="le_LiveryCode">
|
||||
<property name="placeholderText">
|
||||
<string>Code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<widget class="QWidget" name="wi_Id" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_Id">
|
||||
@@ -231,7 +80,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLineEdit" name="le_Id">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -260,13 +109,60 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="10" colspan="2">
|
||||
<widget class="BlackGui::Components::CDbDistributorSelectorComponent" name="comp_DistributorSelector">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<item row="2" column="6">
|
||||
<widget class="QLabel" name="lbl_FileName">
|
||||
<property name="text">
|
||||
<string>File:</string>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="7" colspan="2">
|
||||
<widget class="QLineEdit" name="le_FileName">
|
||||
<property name="placeholderText">
|
||||
<string>filename e.g. FSX/SimObjects/MyAircraft</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QLineEdit" name="le_ModelString">
|
||||
<property name="placeholderText">
|
||||
<string>Key, i.e. model key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="QLineEdit" name="le_AircraftIcao">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<widget class="QLineEdit" name="le_AircraftManufacturer">
|
||||
<property name="placeholderText">
|
||||
<string>Manufacturer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="10">
|
||||
<widget class="QLineEdit" name="le_AirlineIcao">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -280,8 +176,136 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="5">
|
||||
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector"/>
|
||||
<item row="2" column="9">
|
||||
<widget class="QLabel" name="lbl_Distributor">
|
||||
<property name="text">
|
||||
<string>Distributor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QLabel" name="lbl_Aircraft">
|
||||
<property name="text">
|
||||
<string>Aircraft:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="10" colspan="2">
|
||||
<widget class="BlackGui::Components::CDbDistributorSelectorComponent" name="comp_DistributorSelector">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="QLabel" name="lbl_Model">
|
||||
<property name="text">
|
||||
<string>Model:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QCheckBox" name="cbt_Military">
|
||||
<property name="toolTip">
|
||||
<string>Military</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mil.</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QLineEdit" name="le_LiveryCode">
|
||||
<property name="placeholderText">
|
||||
<string>Code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QCheckBox" name="cbt_Db">
|
||||
<property name="toolTip">
|
||||
<string>DB data?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DB</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QCheckBox" name="cbt_IncludeExclude">
|
||||
<property name="toolTip">
|
||||
<string>Included/excluded models?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Incl.</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QLineEdit" name="le_ModelDescription">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<widget class="QLabel" name="lbl_Airline">
|
||||
<property name="text">
|
||||
<string>Airline:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QLabel" name="lbl_Livery">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Livery:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="6" alignment="Qt::AlignLeft">
|
||||
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Combined:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="7" colspan="2">
|
||||
<widget class="BlackGui::Components::CAircraftCombinedTypeSelector" name="comp_CombinedType">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -304,6 +328,12 @@
|
||||
<header>blackgui/components/dbdistributorselectorcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CAircraftCombinedTypeSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/aircraftcombinedtypeselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cbt_Db</tabstop>
|
||||
@@ -312,6 +342,7 @@
|
||||
<tabstop>le_ModelDescription</tabstop>
|
||||
<tabstop>le_AircraftIcao</tabstop>
|
||||
<tabstop>le_AircraftManufacturer</tabstop>
|
||||
<tabstop>le_Id</tabstop>
|
||||
<tabstop>cbt_Military</tabstop>
|
||||
<tabstop>le_LiveryCode</tabstop>
|
||||
<tabstop>cbt_ColorLiveries</tabstop>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>336</width>
|
||||
<height>95</height>
|
||||
<width>400</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
||||
@@ -22,8 +22,9 @@ namespace BlackGui
|
||||
CAircraftModel::ModelModeFilter modelMode, BlackMisc::Db::DbKeyStateFilter dbKeyFilter,
|
||||
Qt::CheckState military, Qt::CheckState colorLiveries,
|
||||
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
||||
const QString &airlineIcao, const QString &airlineName,
|
||||
const QString &liveryCode, const QString &fileName,
|
||||
const QString &airlineIcao, const QString &airlineName,
|
||||
const QString &liveryCode, const QString &fileName,
|
||||
const QString &combinedType,
|
||||
const CSimulatorInfo &simInfo,
|
||||
const CDistributor &distributor) :
|
||||
m_id(id),
|
||||
@@ -33,13 +34,14 @@ namespace BlackGui
|
||||
m_airlineIcao(airlineIcao.trimmed().toUpper()), m_airlineName(airlineName.trimmed().toUpper()),
|
||||
m_liveryCode(liveryCode.trimmed().toUpper()),
|
||||
m_fileName(fileName),
|
||||
m_combinedType(combinedType),
|
||||
m_simulatorInfo(simInfo),
|
||||
m_distributor(distributor)
|
||||
{
|
||||
m_valid = valid();
|
||||
m_valid = this->valid();
|
||||
}
|
||||
|
||||
BlackMisc::Simulation::CAircraftModelList CAircraftModelFilter::filter(const CAircraftModelList &inContainer) const
|
||||
CAircraftModelList CAircraftModelFilter::filter(const CAircraftModelList &inContainer) const
|
||||
{
|
||||
if (!this->isEnabled()) { return inContainer; }
|
||||
CAircraftModelList outContainer;
|
||||
@@ -58,90 +60,95 @@ namespace BlackGui
|
||||
|
||||
if (!m_simulatorInfo.isAllSimulators())
|
||||
{
|
||||
if (!this->m_simulatorInfo.matchesAny(model.getSimulator())) { continue; }
|
||||
if (!m_simulatorInfo.matchesAny(model.getSimulator())) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_modelKey.isEmpty())
|
||||
if (!m_modelKey.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getModelString(), this->m_modelKey)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getModelString(), m_modelKey)) { continue; }
|
||||
}
|
||||
|
||||
if (this->m_military != Qt::PartiallyChecked)
|
||||
if (m_military != Qt::PartiallyChecked)
|
||||
{
|
||||
if (this->m_military == Qt::Checked)
|
||||
if (m_military == Qt::Checked)
|
||||
{
|
||||
// military only
|
||||
if (!model.isMilitary()) { continue; }
|
||||
}
|
||||
else if (this->m_military == Qt::Unchecked)
|
||||
else if (m_military == Qt::Unchecked)
|
||||
{
|
||||
// civilian only
|
||||
if (model.isMilitary()) { continue; }
|
||||
}
|
||||
}
|
||||
|
||||
if (this->m_colorLiveries != Qt::PartiallyChecked)
|
||||
if (m_colorLiveries != Qt::PartiallyChecked)
|
||||
{
|
||||
if (this->m_colorLiveries == Qt::Checked)
|
||||
if (m_colorLiveries == Qt::Checked)
|
||||
{
|
||||
// only color liveries
|
||||
if (!model.getLivery().isColorLivery()) { continue; }
|
||||
}
|
||||
else if (this->m_colorLiveries == Qt::Unchecked)
|
||||
else if (m_colorLiveries == Qt::Unchecked)
|
||||
{
|
||||
// Only airline liveries
|
||||
if (model.getLivery().isColorLivery()) { continue; }
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->m_description.isEmpty())
|
||||
if (!m_description.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getDescription(), this->m_description)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getDescription(), m_description)) { continue; }
|
||||
}
|
||||
|
||||
if (this->m_modelMode != CAircraftModel::All && this->m_modelMode != CAircraftModel::Undefined)
|
||||
if (m_modelMode != CAircraftModel::All && m_modelMode != CAircraftModel::Undefined)
|
||||
{
|
||||
if (!model.matchesMode(this->m_modelMode)) { continue; }
|
||||
if (!model.matchesMode(m_modelMode)) { continue; }
|
||||
}
|
||||
|
||||
if (this->m_dbKeyFilter != BlackMisc::Db::All && this->m_dbKeyFilter != BlackMisc::Db::Undefined)
|
||||
if (m_dbKeyFilter != BlackMisc::Db::All && m_dbKeyFilter != BlackMisc::Db::Undefined)
|
||||
{
|
||||
if (!model.matchesDbKeyState(this->m_dbKeyFilter)) { continue; }
|
||||
if (!model.matchesDbKeyState(m_dbKeyFilter)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_fileName.isEmpty())
|
||||
if (!m_fileName.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getFileName(), this->m_fileName)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getFileName(), m_fileName)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_aircraftIcao.isEmpty())
|
||||
if (!m_aircraftIcao.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCodeDesignator(), this->m_aircraftIcao)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCodeDesignator(), m_aircraftIcao)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_aircraftManufacturer.isEmpty())
|
||||
if (!m_aircraftManufacturer.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCode().getManufacturer(), this->m_aircraftManufacturer)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCode().getManufacturer(), m_aircraftManufacturer)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_airlineIcao.isEmpty())
|
||||
if (!m_airlineIcao.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAirlineIcaoCodeDesignator(), this->m_airlineIcao)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getAirlineIcaoCodeDesignator(), m_airlineIcao)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_airlineName.isEmpty())
|
||||
if (!m_airlineName.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAirlineIcaoCode().getName(), this->m_airlineName)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getAirlineIcaoCode().getName(), m_airlineName)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_liveryCode.isEmpty())
|
||||
if (!m_liveryCode.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getLivery().getCombinedCode(), this->m_liveryCode)) { continue; }
|
||||
if (!this->stringMatchesFilterExpression(model.getLivery().getCombinedCode(), m_liveryCode)) { continue; }
|
||||
}
|
||||
|
||||
if (this->m_distributor.hasValidDbKey())
|
||||
if (m_distributor.hasValidDbKey())
|
||||
{
|
||||
if (!model.getDistributor().matchesKeyOrAlias(this->m_distributor)) { continue; }
|
||||
if (!model.getDistributor().matchesKeyOrAlias(m_distributor)) { continue; }
|
||||
}
|
||||
|
||||
if (!m_combinedType.isEmpty())
|
||||
{
|
||||
if (!model.getAircraftIcaoCode().matchesCombinedType(m_combinedType)) { continue; }
|
||||
}
|
||||
|
||||
outContainer.push_back(model);
|
||||
@@ -153,17 +160,17 @@ namespace BlackGui
|
||||
{
|
||||
const bool allEmpty =
|
||||
m_id < 0 &&
|
||||
this->m_modelKey.isEmpty() && this->m_description.isEmpty() &&
|
||||
this->m_aircraftManufacturer.isEmpty() && this->m_aircraftIcao.isEmpty() &&
|
||||
this->m_airlineIcao.isEmpty() && this->m_airlineName.isEmpty() &&
|
||||
this->m_liveryCode.isEmpty() && this->m_fileName.isEmpty();
|
||||
m_modelKey.isEmpty() && m_description.isEmpty() &&
|
||||
m_aircraftManufacturer.isEmpty() && m_aircraftIcao.isEmpty() &&
|
||||
m_airlineIcao.isEmpty() && m_airlineName.isEmpty() &&
|
||||
m_liveryCode.isEmpty() && m_fileName.isEmpty() && m_combinedType.isEmpty();
|
||||
if (!allEmpty) { return true; }
|
||||
const bool noSim = this->m_simulatorInfo.isNoSimulator() || this->m_simulatorInfo.isAllSimulators();
|
||||
const bool noModelMode = this->m_modelMode == CAircraftModel::Undefined || this->m_modelMode == CAircraftModel::All;
|
||||
const bool noDbState = this->m_dbKeyFilter == BlackMisc::Db::Undefined || this->m_dbKeyFilter == BlackMisc::Db::All;
|
||||
const bool noKey = !this->m_distributor.hasValidDbKey();
|
||||
const bool noColorRestriction = this->m_colorLiveries == Qt::PartiallyChecked;
|
||||
const bool noMilitary = this->m_military == Qt::PartiallyChecked;
|
||||
const bool noSim = m_simulatorInfo.isNoSimulator() || m_simulatorInfo.isAllSimulators();
|
||||
const bool noModelMode = (m_modelMode == CAircraftModel::Undefined || m_modelMode == CAircraftModel::All);
|
||||
const bool noDbState = (m_dbKeyFilter == BlackMisc::Db::Undefined || m_dbKeyFilter == BlackMisc::Db::All);
|
||||
const bool noKey = !m_distributor.hasValidDbKey();
|
||||
const bool noColorRestriction = (m_colorLiveries == Qt::PartiallyChecked);
|
||||
const bool noMilitary = (m_military == Qt::PartiallyChecked);
|
||||
return !(noSim && noModelMode && noDbState && noKey && noMilitary && noColorRestriction);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -30,19 +30,18 @@ namespace BlackGui
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CAircraftModelFilter(
|
||||
int id,
|
||||
const QString &modelKey, const QString &description,
|
||||
BlackMisc::Simulation::CAircraftModel::ModelModeFilter modelMode,
|
||||
BlackMisc::Db::DbKeyStateFilter dbKeyFilter,
|
||||
Qt::CheckState military, Qt::CheckState colorLiveries,
|
||||
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
||||
const QString &airlineIcao, const QString &airlineName,
|
||||
const QString &liveryCode,
|
||||
const QString &fileName,
|
||||
const BlackMisc::Simulation::CSimulatorInfo &simInfo = BlackMisc::Simulation::CSimulatorInfo::allSimulators(),
|
||||
const BlackMisc::Simulation::CDistributor &distributor = BlackMisc::Simulation::CDistributor()
|
||||
);
|
||||
CAircraftModelFilter(int id,
|
||||
const QString &modelKey, const QString &description,
|
||||
BlackMisc::Simulation::CAircraftModel::ModelModeFilter modelMode,
|
||||
BlackMisc::Db::DbKeyStateFilter dbKeyFilter,
|
||||
Qt::CheckState military, Qt::CheckState colorLiveries,
|
||||
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
||||
const QString &airlineIcao, const QString &airlineName,
|
||||
const QString &liveryCode,
|
||||
const QString &fileName,
|
||||
const QString &combinedType,
|
||||
const BlackMisc::Simulation::CSimulatorInfo &simInfo = BlackMisc::Simulation::CSimulatorInfo::allSimulators(),
|
||||
const BlackMisc::Simulation::CDistributor &distributor = BlackMisc::Simulation::CDistributor());
|
||||
|
||||
//! \copydoc IModelFilter::filter
|
||||
virtual BlackMisc::Simulation::CAircraftModelList filter(const BlackMisc::Simulation::CAircraftModelList &inContainer) const override;
|
||||
@@ -61,6 +60,7 @@ namespace BlackGui
|
||||
QString m_airlineName;
|
||||
QString m_liveryCode;
|
||||
QString m_fileName;
|
||||
QString m_combinedType;
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulatorInfo;
|
||||
BlackMisc::Simulation::CDistributor m_distributor;
|
||||
bool valid() const;
|
||||
|
||||
Reference in New Issue
Block a user