diff --git a/src/blackcore/context_ownaircraft.h b/src/blackcore/context_ownaircraft.h index 635aa8d66..d47c131f2 100644 --- a/src/blackcore/context_ownaircraft.h +++ b/src/blackcore/context_ownaircraft.h @@ -65,11 +65,9 @@ namespace BlackCore signals: //! Aircraft cockpit update - //! \remarks DBus and local void changedAircraftCockpit(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator); //! Changed SELCAL code - //! \remarks DBus and local void changedSelcal(const BlackMisc::Aviation::CSelcal &selcal, const QString &originator); public slots: diff --git a/src/blackmisc/propertyindex.cpp b/src/blackmisc/propertyindex.cpp index ab98a962a..1006da176 100644 --- a/src/blackmisc/propertyindex.cpp +++ b/src/blackmisc/propertyindex.cpp @@ -121,4 +121,9 @@ namespace BlackMisc this->setIndexStringByList(newList); } + bool CPropertyIndex::contains(int index) const + { + return this->indexList().contains(index); + } + } // namespace diff --git a/src/blackmisc/propertyindex.h b/src/blackmisc/propertyindex.h index 8ccc07db9..1299511b7 100644 --- a/src/blackmisc/propertyindex.h +++ b/src/blackmisc/propertyindex.h @@ -93,6 +93,16 @@ namespace BlackMisc //! Shif existing indexes to right and insert given index at front void prepend(int newLeftIndex); + //! Contains index? + bool contains(int index) const; + + //! Compare with index given by enum + template bool contains(EnumType ev) const + { + static_assert(std::is_enum::value, "Argument must be an enum"); + return contains(static_cast(ev)); + } + //! First element casted to given type, usually then PropertIndex enum template CastType frontCasted() const { diff --git a/src/blackmisc/simulation/aircraftmodel.cpp b/src/blackmisc/simulation/aircraftmodel.cpp index 7e2b66274..dd60e8724 100644 --- a/src/blackmisc/simulation/aircraftmodel.cpp +++ b/src/blackmisc/simulation/aircraftmodel.cpp @@ -134,6 +134,7 @@ namespace BlackMisc case TypeQueriedFromNetwork: return "queried"; case TypeModelMatching: return "matching"; case TypeModelMapping: return "mapping"; + case TypeModelMatchingDefaultModel: return "map. default"; case TypeOwnSimulatorModel: return "own simulator"; case TypeManuallySet: return "set"; case TypeUnknown: diff --git a/src/blackmisc/simulation/aircraftmodel.h b/src/blackmisc/simulation/aircraftmodel.h index 1a8af2ac7..9e2b05e0e 100644 --- a/src/blackmisc/simulation/aircraftmodel.h +++ b/src/blackmisc/simulation/aircraftmodel.h @@ -32,6 +32,7 @@ namespace BlackMisc TypeUnknown, TypeQueriedFromNetwork, //!< model was queried by network protocol TypeModelMatching, //!< model is result of model matching + TypeModelMatchingDefaultModel, //!< a default model assigned by model matching TypeModelMapping, //!< used along with mapping definition TypeManuallySet, //!< manually set, e.g. from GUI TypeOwnSimulatorModel //!< represents own simulator model @@ -56,6 +57,10 @@ namespace BlackMisc //! Constructor. CAircraftModel(const QString &model, ModelType type) : m_modelString(model), m_modelType(type) {} + //! Constructor. + CAircraftModel(const QString &model, ModelType type, const QString &description, const BlackMisc::Aviation::CAircraftIcao &icao) : + m_icao(icao), m_modelString(model), m_description(description), m_modelType(type) {} + //! Constructor CAircraftModel(const BlackMisc::Aviation::CAircraft &aircraft); diff --git a/src/blackmisc/simulation/simulatedaircraft.cpp b/src/blackmisc/simulation/simulatedaircraft.cpp index 4f229992c..0bb44a878 100644 --- a/src/blackmisc/simulation/simulatedaircraft.cpp +++ b/src/blackmisc/simulation/simulatedaircraft.cpp @@ -51,6 +51,8 @@ namespace BlackMisc return this->m_client.propertyByIndex(index.copyFrontRemoved()); case IndexEnabled: return CVariant::fromValue(this->isEnabled()); + case IndexRendered: + return CVariant::fromValue(this->isRendered()); default: return CAircraft::propertyByIndex(index); } @@ -75,6 +77,9 @@ namespace BlackMisc case IndexEnabled: this->m_enabled = variant.toBool(); break; + case IndexRendered: + this->m_rendered = variant.toBool(); + break; default: CAircraft::setPropertyByIndex(variant, index); break; @@ -141,6 +146,9 @@ namespace BlackMisc s += " enabled: "; s += this->isEnabled() ? "yes" : "no"; s += " "; + s += " rendered: "; + s += this->isRendered() ? "yes" : "no"; + s += " "; s += this->m_model.toQString(i18n); s += " "; s += this->m_client.toQString(i18n); diff --git a/src/blackmisc/simulation/simulatedaircraft.h b/src/blackmisc/simulation/simulatedaircraft.h index a5144180f..51cb30f60 100644 --- a/src/blackmisc/simulation/simulatedaircraft.h +++ b/src/blackmisc/simulation/simulatedaircraft.h @@ -30,7 +30,8 @@ namespace BlackMisc { IndexModel = BlackMisc::CPropertyIndex::GlobalIndexCSimulatedAircraft, IndexClient, - IndexEnabled + IndexEnabled, + IndexRendered }; //! Default constructor. @@ -50,6 +51,9 @@ namespace BlackMisc //! Get model const BlackMisc::Simulation::CAircraftModel &getModel() const { return m_model; } + //! Get model string + QString getModelString() const { return m_model.getModelString(); } + //! Set model void setModel(const BlackMisc::Simulation::CAircraftModel &model); @@ -74,9 +78,15 @@ namespace BlackMisc //! Enabled? bool isEnabled() const { return m_enabled; } - //! Enabled + //! Enabled / disabled void setEnabled(bool enabled) { m_enabled = enabled; } + //! Rendered? + bool isRendered() const { return m_rendered; } + + //! Rendered? + void setRendered(bool rendered) { m_rendered = rendered; } + //! Update from aviation aircraft void setAircraft(const BlackMisc::Aviation::CAircraft &aircraft); @@ -88,7 +98,8 @@ namespace BlackMisc BLACK_ENABLE_TUPLE_CONVERSION(CSimulatedAircraft) BlackMisc::Simulation::CAircraftModel m_model; BlackMisc::Network::CClient m_client; - bool m_enabled = true; + bool m_enabled = true; // to be displayed in sim + bool m_rendered = false; // really shown in sim void init(); }; @@ -98,7 +109,8 @@ namespace BlackMisc BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Simulation::CSimulatedAircraft, ( attr(o.m_model), attr(o.m_client), - attr(o.m_enabled) + attr(o.m_enabled), + attr(o.m_rendered) )) Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatedAircraft)