mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #618, allow to filter my include/exclude
This commit is contained in:
@@ -10,7 +10,9 @@
|
|||||||
#include "aircraftmodelfilterbar.h"
|
#include "aircraftmodelfilterbar.h"
|
||||||
#include "ui_aircraftmodelfilterbar.h"
|
#include "ui_aircraftmodelfilterbar.h"
|
||||||
#include "blackgui/uppercasevalidator.h"
|
#include "blackgui/uppercasevalidator.h"
|
||||||
|
#include "blackmisc/simulation/aircraftmodel.h"
|
||||||
|
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackGui::Models;
|
using namespace BlackGui::Models;
|
||||||
using namespace BlackGui::Components;
|
using namespace BlackGui::Components;
|
||||||
@@ -34,6 +36,10 @@ namespace BlackGui
|
|||||||
connect(ui->le_LiveryCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
connect(ui->le_LiveryCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||||
connect(ui->le_ModelDescription, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
connect(ui->le_ModelDescription, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||||
connect(ui->le_ModelKey, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
connect(ui->le_ModelKey, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter);
|
||||||
|
|
||||||
|
connect(ui->cb_Include, &QCheckBox::toggled, this, &CAircraftModelFilterBar::ps_checkBoxChanged);
|
||||||
|
connect(ui->cb_Exclude, &QCheckBox::toggled, this, &CAircraftModelFilterBar::ps_checkBoxChanged);
|
||||||
|
|
||||||
connect(ui->frp_SimulatorSelector, &CSimulatorSelector::changed, this, &CAircraftModelFilterBar::ps_simulatorSelectionChanged);
|
connect(ui->frp_SimulatorSelector, &CSimulatorSelector::changed, this, &CAircraftModelFilterBar::ps_simulatorSelectionChanged);
|
||||||
connect(ui->comp_DistributorSelector, &CDbDistributorSelectorComponent::changedDistributor, this, &CAircraftModelFilterBar::ps_distributorChanged);
|
connect(ui->comp_DistributorSelector, &CDbDistributorSelectorComponent::changedDistributor, this, &CAircraftModelFilterBar::ps_distributorChanged);
|
||||||
|
|
||||||
@@ -52,10 +58,13 @@ namespace BlackGui
|
|||||||
|
|
||||||
std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Simulation::CAircraftModelList> > CAircraftModelFilterBar::createModelFilter() const
|
std::unique_ptr<BlackGui::Models::IModelFilter<BlackMisc::Simulation::CAircraftModelList> > CAircraftModelFilterBar::createModelFilter() const
|
||||||
{
|
{
|
||||||
|
CAircraftModel::ModelModeFilter mf = this->ui->cb_Include->isChecked() ? CAircraftModel::Include : CAircraftModel::Undefined;
|
||||||
|
if (this->ui->cb_Exclude->isChecked()) { mf |= CAircraftModel::Exclude; }
|
||||||
return std::unique_ptr<CAircraftModelFilter>(
|
return std::unique_ptr<CAircraftModelFilter>(
|
||||||
new CAircraftModelFilter(
|
new CAircraftModelFilter(
|
||||||
this->ui->le_ModelKey->text(),
|
this->ui->le_ModelKey->text(),
|
||||||
this->ui->le_ModelDescription->text(),
|
this->ui->le_ModelDescription->text(),
|
||||||
|
mf,
|
||||||
this->ui->le_AircraftIcao->text(),
|
this->ui->le_AircraftIcao->text(),
|
||||||
this->ui->le_AircraftManufacturer->text(),
|
this->ui->le_AircraftManufacturer->text(),
|
||||||
this->ui->le_AirlineIcao->text(),
|
this->ui->le_AirlineIcao->text(),
|
||||||
@@ -82,6 +91,8 @@ namespace BlackGui
|
|||||||
this->ui->le_LiveryCode->clear();
|
this->ui->le_LiveryCode->clear();
|
||||||
this->ui->frp_SimulatorSelector->setAll();
|
this->ui->frp_SimulatorSelector->setAll();
|
||||||
this->ui->comp_DistributorSelector->clear();
|
this->ui->comp_DistributorSelector->clear();
|
||||||
|
this->ui->cb_Exclude->setChecked(true);
|
||||||
|
this->ui->cb_Include->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAircraftModelFilterBar::ps_simulatorSelectionChanged(const BlackMisc::Simulation::CSimulatorInfo &info)
|
void CAircraftModelFilterBar::ps_simulatorSelectionChanged(const BlackMisc::Simulation::CSimulatorInfo &info)
|
||||||
@@ -95,5 +106,11 @@ namespace BlackGui
|
|||||||
Q_UNUSED(distributor);
|
Q_UNUSED(distributor);
|
||||||
this->triggerFilter();
|
this->triggerFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAircraftModelFilterBar::ps_checkBoxChanged(bool state)
|
||||||
|
{
|
||||||
|
Q_UNUSED(state);
|
||||||
|
triggerFilter();
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ namespace BlackGui
|
|||||||
//! Distributor changed
|
//! Distributor changed
|
||||||
void ps_distributorChanged(const BlackMisc::Simulation::CDistributor &distributor);
|
void ps_distributorChanged(const BlackMisc::Simulation::CDistributor &distributor);
|
||||||
|
|
||||||
|
//! Checkbox has been changed
|
||||||
|
void ps_checkBoxChanged(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CAircraftModelFilterBar> ui;
|
QScopedPointer<Ui::CAircraftModelFilterBar> ui;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,10 +38,92 @@
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="11">
|
<item row="0" column="5">
|
||||||
<widget class="QLineEdit" name="le_AircraftManufacturer">
|
<widget class="QWidget" name="wi_IncludeExclude" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="hl_IncludeExclude">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_Include">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Included models</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>In.</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_Exclude">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Excluded models</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ex.</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="4" alignment="Qt::AlignLeft">
|
||||||
|
<widget class="BlackGui::Filters::CFilterBarButtons" name="filter_Buttons">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="8">
|
||||||
|
<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="1" column="0" colspan="6">
|
||||||
|
<widget class="BlackGui::Components::CSimulatorSelector" name="frp_SimulatorSelector"/>
|
||||||
|
</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">
|
<property name="placeholderText">
|
||||||
<string>Manufacturer</string>
|
<string>ICAO</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -65,26 +147,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="10">
|
<item row="0" column="11">
|
||||||
<widget class="QLineEdit" name="le_AirlineIcao">
|
<widget class="QLineEdit" name="le_AircraftManufacturer">
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>ICAO</string>
|
<string>Manufacturer</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="7">
|
<item row="1" column="9">
|
||||||
<widget class="QLineEdit" name="le_LiveryCode">
|
<widget class="QLabel" name="lbl_Airline">
|
||||||
<property name="placeholderText">
|
<property name="text">
|
||||||
<string>Code</string>
|
<string>Airline:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -95,6 +168,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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="6">
|
<item row="1" column="6">
|
||||||
<widget class="QLabel" name="lbl_Livery">
|
<widget class="QLabel" name="lbl_Livery">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -102,13 +182,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="9">
|
|
||||||
<widget class="QLabel" name="lbl_Airline">
|
|
||||||
<property name="text">
|
|
||||||
<string>Airline:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="8">
|
<item row="0" column="8">
|
||||||
<widget class="QLineEdit" name="le_ModelDescription">
|
<widget class="QLineEdit" name="le_ModelDescription">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -119,13 +192,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="7">
|
|
||||||
<widget class="QLineEdit" name="le_ModelKey">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Key</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="9">
|
<item row="0" column="9">
|
||||||
<widget class="QLabel" name="lbl_Aircraft">
|
<widget class="QLabel" name="lbl_Aircraft">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -133,48 +199,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="4" alignment="Qt::AlignLeft">
|
<item row="0" column="7">
|
||||||
<widget class="BlackGui::Filters::CFilterBarButtons" name="filter_Buttons">
|
<widget class="QLineEdit" name="le_ModelKey">
|
||||||
<property name="minimumSize">
|
<property name="placeholderText">
|
||||||
<size>
|
<string>Key</string>
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="5">
|
|
||||||
<spacer name="hs_FilterButtons">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>60</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="6">
|
|
||||||
<widget class="BlackGui::Components::CSimulatorSelector" name="frp_SimulatorSelector"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="8">
|
|
||||||
<widget class="BlackGui::Components::CDbDistributorSelectorComponent" name="comp_DistributorSelector">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -16,15 +16,13 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
CAircraftModelFilter::CAircraftModelFilter(const QString &modelKey, const QString &description, CAircraftModel::ModelModeFilter modelMode,
|
||||||
CAircraftModelFilter::CAircraftModelFilter(
|
|
||||||
const QString &modelKey, const QString &description,
|
|
||||||
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
||||||
const QString &airlineIcao, const QString &airlineName,
|
const QString &airlineIcao, const QString &airlineName,
|
||||||
const QString &liveryCode,
|
const QString &liveryCode,
|
||||||
const CSimulatorInfo &simInfo,
|
const CSimulatorInfo &simInfo,
|
||||||
const CDistributor &distributor) :
|
const CDistributor &distributor) :
|
||||||
m_modelKey(modelKey.trimmed()), m_description(description.trimmed()),
|
m_modelKey(modelKey.trimmed().toUpper()), m_description(description.trimmed()), m_modelMode(modelMode),
|
||||||
m_aircraftIcao(aircraftIcao.trimmed().toUpper()), m_aircraftManufacturer(aircraftManufacturer.trimmed().toUpper()),
|
m_aircraftIcao(aircraftIcao.trimmed().toUpper()), m_aircraftManufacturer(aircraftManufacturer.trimmed().toUpper()),
|
||||||
m_airlineIcao(airlineIcao.trimmed().toUpper()), m_airlineName(airlineName.trimmed().toUpper()),
|
m_airlineIcao(airlineIcao.trimmed().toUpper()), m_airlineName(airlineName.trimmed().toUpper()),
|
||||||
m_liveryCode(liveryCode.trimmed().toUpper()),
|
m_liveryCode(liveryCode.trimmed().toUpper()),
|
||||||
@@ -53,6 +51,11 @@ namespace BlackGui
|
|||||||
if (!this->stringMatchesFilterExpression(model.getDescription(), this->m_description)) { continue; }
|
if (!this->stringMatchesFilterExpression(model.getDescription(), this->m_description)) { continue; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->m_modelMode != CAircraftModel::Undefined)
|
||||||
|
{
|
||||||
|
if (!model.matchesMode(this->m_modelMode)) { continue; }
|
||||||
|
}
|
||||||
|
|
||||||
if (!this->m_aircraftIcao.isEmpty())
|
if (!this->m_aircraftIcao.isEmpty())
|
||||||
{
|
{
|
||||||
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCodeDesignator(), this->m_aircraftIcao)) { continue; }
|
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCodeDesignator(), this->m_aircraftIcao)) { continue; }
|
||||||
@@ -91,6 +94,7 @@ namespace BlackGui
|
|||||||
bool CAircraftModelFilter::isValid() const
|
bool CAircraftModelFilter::isValid() const
|
||||||
{
|
{
|
||||||
return !(this->m_modelKey.isEmpty() && this->m_description.isEmpty() &&
|
return !(this->m_modelKey.isEmpty() && this->m_description.isEmpty() &&
|
||||||
|
(this->m_modelMode != CAircraftModel::Undefined && this->m_modelMode != CAircraftModel::All) &&
|
||||||
this->m_aircraftManufacturer.isEmpty() && this->m_aircraftIcao.isEmpty() &&
|
this->m_aircraftManufacturer.isEmpty() && this->m_aircraftIcao.isEmpty() &&
|
||||||
this->m_airlineIcao.isEmpty() && this->m_airlineName.isEmpty() &&
|
this->m_airlineIcao.isEmpty() && this->m_airlineName.isEmpty() &&
|
||||||
this->m_liveryCode.isEmpty() &&
|
this->m_liveryCode.isEmpty() &&
|
||||||
|
|||||||
@@ -20,13 +20,12 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Models
|
namespace Models
|
||||||
{
|
{
|
||||||
|
|
||||||
//! Filter for aircraft models
|
//! Filter for aircraft models
|
||||||
class BLACKGUI_EXPORT CAircraftModelFilter : public IModelFilter<BlackMisc::Simulation::CAircraftModelList>
|
class BLACKGUI_EXPORT CAircraftModelFilter : public IModelFilter<BlackMisc::Simulation::CAircraftModelList>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CAircraftModelFilter(const QString &modelKey, const QString &description,
|
CAircraftModelFilter(const QString &modelKey, const QString &description, BlackMisc::Simulation::CAircraftModel::ModelModeFilter modelMode,
|
||||||
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
||||||
const QString &airlineIcao, const QString &airlineName,
|
const QString &airlineIcao, const QString &airlineName,
|
||||||
const QString &liveryCode,
|
const QString &liveryCode,
|
||||||
@@ -43,6 +42,7 @@ namespace BlackGui
|
|||||||
private:
|
private:
|
||||||
QString m_modelKey;
|
QString m_modelKey;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
|
BlackMisc::Simulation::CAircraftModel::ModelModeFilter m_modelMode;
|
||||||
QString m_aircraftIcao;
|
QString m_aircraftIcao;
|
||||||
QString m_aircraftManufacturer;
|
QString m_aircraftManufacturer;
|
||||||
QString m_airlineIcao;
|
QString m_airlineIcao;
|
||||||
|
|||||||
@@ -295,6 +295,11 @@ namespace BlackMisc
|
|||||||
return distributors.matchesAnyKeyOrAlias(this->m_distributor.getDbKey());
|
return distributors.matchesAnyKeyOrAlias(this->m_distributor.getDbKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CAircraftModel::matchesMode(ModelModeFilter mode) const
|
||||||
|
{
|
||||||
|
return (mode & this->m_modelMode) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
const CIcon &CAircraftModel::getModelModeAsIcon() const
|
const CIcon &CAircraftModel::getModelModeAsIcon() const
|
||||||
{
|
{
|
||||||
switch (this->getModelMode())
|
switch (this->getModelMode())
|
||||||
@@ -303,6 +308,8 @@ namespace BlackMisc
|
|||||||
return CIconList::iconByIndex(CIcons::ModelInclude);
|
return CIconList::iconByIndex(CIcons::ModelInclude);
|
||||||
case Exclude:
|
case Exclude:
|
||||||
return CIconList::iconByIndex(CIcons::ModelExclude);
|
return CIconList::iconByIndex(CIcons::ModelExclude);
|
||||||
|
case Undefined:
|
||||||
|
return CIconList::iconByIndex(CIcons::StandardIconUnknown16);
|
||||||
default:
|
default:
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong mode");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong mode");
|
||||||
break;
|
break;
|
||||||
@@ -332,6 +339,7 @@ namespace BlackMisc
|
|||||||
if (this->m_fileName.isEmpty()) { this->setFileName(otherModel.getFileName()); }
|
if (this->m_fileName.isEmpty()) { this->setFileName(otherModel.getFileName()); }
|
||||||
if (this->m_callsign.isEmpty()) { this->setCallsign(otherModel.getCallsign()); }
|
if (this->m_callsign.isEmpty()) { this->setCallsign(otherModel.getCallsign()); }
|
||||||
if (this->m_modelType == TypeUnknown) { this->m_modelType = otherModel.getModelType(); }
|
if (this->m_modelType == TypeUnknown) { this->m_modelType = otherModel.getModelType(); }
|
||||||
|
if (this->m_modelMode == Undefined) { this->m_modelType = otherModel.getModelType(); }
|
||||||
if (this->m_simulator.isUnspecified())
|
if (this->m_simulator.isUnspecified())
|
||||||
{
|
{
|
||||||
this->setSimulatorInfo(otherModel.getSimulatorInfo());
|
this->setSimulatorInfo(otherModel.getSimulatorInfo());
|
||||||
|
|||||||
@@ -49,10 +49,14 @@ namespace BlackMisc
|
|||||||
//! Mode
|
//! Mode
|
||||||
enum ModelMode
|
enum ModelMode
|
||||||
{
|
{
|
||||||
Include,
|
Undefined = 0,
|
||||||
Exclude
|
Include = 1 << 0,
|
||||||
|
Exclude = 1 << 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Supposed to be used only in filter operations
|
||||||
|
Q_DECLARE_FLAGS(ModelModeFilter, ModelMode)
|
||||||
|
|
||||||
//! Indexes
|
//! Indexes
|
||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
@@ -201,6 +205,9 @@ namespace BlackMisc
|
|||||||
//! Model mode
|
//! Model mode
|
||||||
ModelMode getModelMode() const { return m_modelMode; }
|
ModelMode getModelMode() const { return m_modelMode; }
|
||||||
|
|
||||||
|
//! Matches given mode?
|
||||||
|
bool matchesMode(BlackMisc::Simulation::CAircraftModel::ModelModeFilter mode) const;
|
||||||
|
|
||||||
//! Model mode as string
|
//! Model mode as string
|
||||||
const QString &getModelModeAsString() const { return modelModeToString(getModelMode()); }
|
const QString &getModelModeAsString() const { return modelModeToString(getModelMode()); }
|
||||||
|
|
||||||
@@ -309,8 +316,11 @@ BLACK_DECLARE_TUPLE_CONVERSION(
|
|||||||
attr(o.m_modelType),
|
attr(o.m_modelType),
|
||||||
attr(o.m_modelMode)
|
attr(o.m_modelMode)
|
||||||
))
|
))
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftModel)
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftModel)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftModel::ModelType)
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftModel::ModelType)
|
||||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftModel::ModelMode)
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftModel::ModelMode)
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftModel::ModelModeFilter)
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::CAircraftModel::ModelModeFilter)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
Reference in New Issue
Block a user