From e7f65ba0b62050bb219bf69adb91c379cd414c13 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 6 May 2015 02:50:45 +0200 Subject: [PATCH] refs #395, GUI for simulator settings * improved formatting of aircraft views * extended settings for render restrictions (such as max. aircraft, max range ...) * connected new signal / slots in runtime * Doxygen / formatting --- src/blackcore/context_runtime.cpp | 18 +-- src/blackgui/components/mappingcomponent.cpp | 14 +- src/blackgui/components/mappingcomponent.h | 3 + .../components/remoteaircraftselector.cpp | 11 +- .../components/settingsfsxcomponent.ui | 20 ++- .../components/settingssimulatorcomponent.cpp | 127 +++++++++++------- .../components/settingssimulatorcomponent.h | 20 +-- .../components/settingssimulatorcomponent.ui | 111 +++++++++++++-- src/blackgui/models/columnformatters.h | 10 +- .../models/simulatedaircraftlistmodel.cpp | 24 ++-- 10 files changed, 245 insertions(+), 113 deletions(-) diff --git a/src/blackcore/context_runtime.cpp b/src/blackcore/context_runtime.cpp index f29435872..419af7906 100644 --- a/src/blackcore/context_runtime.cpp +++ b/src/blackcore/context_runtime.cpp @@ -26,17 +26,11 @@ using namespace BlackMisc::Aviation; namespace BlackCore { - /* - * Constructor - */ CRuntime::CRuntime(const CRuntimeConfig &config, QObject *parent) : QObject(parent) { this->init(config); } - /* - * Init runtime - */ void CRuntime::init(const CRuntimeConfig &config) { if (m_init) { return; } @@ -50,8 +44,7 @@ namespace BlackCore // upfront reading of settings, as DBus server already relies on settings QString dbusAddress; - // FIXME RW: We are allocating a full settings context in order to get the DBus address. - // I wonder if this can be done cleaner. + //! \todo Change when settings ready RW: We are allocating a full settings context in order to get the DBus address. I wonder if this can be done cleaner. if (config.hasDBusAddress()) { dbusAddress = config.getDBusAddress(); } // bootstrap / explicit if (config.hasLocalSettings()) { @@ -171,7 +164,7 @@ namespace BlackCore // local simulator? if (this->m_contextSimulator && this->m_contextSimulator->isUsingImplementingObject()) { - // only connect if simulator runs locally, no round trips + // only connect if network runs locally, no round trips if (this->m_contextNetwork && this->m_contextNetwork->isUsingImplementingObject()) { c = connect(this->m_contextNetwork, &IContextNetwork::textMessagesReceived, @@ -192,6 +185,9 @@ namespace BlackCore c = connect(this->m_contextNetwork, &IContextNetwork::changedRemoteAircraftEnabled, this->getCContextSimulator(), &CContextSimulator::ps_changedRemoteAircraftEnabled); Q_ASSERT(c); + c = connect(this->getCContextSimulator(), &CContextSimulator::renderRestrictionsChanged, + this->getCContextNetwork(), &CContextNetwork::ps_simulatorRenderRestrictionsChanged); + Q_ASSERT(c); } // only if own aircraft runs locally @@ -210,10 +206,6 @@ namespace BlackCore if (this->m_contextSettings) { connect(this->m_contextSettings, &IContextSettings::changedSettings, this->m_contextSimulator, &IContextSimulator::settingsChanged); -// if (!this->m_contextSimulator->loadSimulatorPluginFromSettings()) -// { -// CLogMessage(this).warning("No simulator plugin loaded"); -// } this->m_contextSimulator->listenForSimulatorFromSettings(); times.insert("Post setup, load sim. listener(s)", time.restart()); } diff --git a/src/blackgui/components/mappingcomponent.cpp b/src/blackgui/components/mappingcomponent.cpp index dc0aa65cc..fd3a2f1d2 100644 --- a/src/blackgui/components/mappingcomponent.cpp +++ b/src/blackgui/components/mappingcomponent.cpp @@ -44,10 +44,10 @@ namespace BlackGui this->ui->tvp_SimulatedAircraft->setResizeMode(CAircraftModelView::ResizingOnce); this->ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff); - connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested); - connect(this->ui->tvp_AircraftModels, &CAircraftModelView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged); - connect(this->ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView); - connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestModelReload, this, &CMappingComponent::ps_onMenuRequestModelReload); + connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested); + connect(this->ui->tvp_AircraftModels, &CAircraftModelView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged); + connect(this->ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView); + connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestModelReload, this, &CMappingComponent::ps_onMenuRequestModelReload); connect(this->ui->tvp_SimulatedAircraft, &CSimulatedAircraftView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged); connect(this->ui->tvp_SimulatedAircraft, &CSimulatedAircraftView::clicked, this, &CMappingComponent::ps_onAircraftSelectedInView); @@ -95,6 +95,7 @@ namespace BlackGui Q_ASSERT(getIContextNetwork()); connect(getIContextSimulator(), &IContextSimulator::installedAircraftModelsChanged, this, &CMappingComponent::ps_onAircraftModelsLoaded); connect(getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::ps_onModelMatchingCompleted); + connect(getIContextSimulator(), &IContextSimulator::airspaceSnapshotHandled, this, &CMappingComponent::ps_onAirspaceSnapshotHandled); connect(getIContextNetwork(), &IContextNetwork::changedRemoteAircraftModel, this, &CMappingComponent::ps_onRemoteAircraftModelChanged); connect(getIContextNetwork(), &IContextNetwork::changedRemoteAircraftEnabled, this, &CMappingComponent::ps_onChangedAircraftEnabled); connect(getIContextNetwork(), &IContextNetwork::changedFastPositionUpdates, this, &CMappingComponent::ps_onFastPositionUpdatesEnabled); @@ -334,6 +335,11 @@ namespace BlackGui } } + void CMappingComponent::ps_onAirspaceSnapshotHandled() + { + this->updateSimulatedAircraftView(); + } + void CMappingComponent::ps_onMenuChangeFastPositionUpdates(const CSimulatedAircraft &aircraft) { if (getIContextNetwork()) diff --git a/src/blackgui/components/mappingcomponent.h b/src/blackgui/components/mappingcomponent.h index 30f64c56c..2e8555e58 100644 --- a/src/blackgui/components/mappingcomponent.h +++ b/src/blackgui/components/mappingcomponent.h @@ -104,6 +104,9 @@ namespace BlackGui //! Connection status has been changed void ps_onConnectionStatusChanged(uint from, uint to); + //! Simulator has handled airspace snapshot + void ps_onAirspaceSnapshotHandled(); + //! Fast position updates onf/off void ps_onMenuChangeFastPositionUpdates(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); diff --git a/src/blackgui/components/remoteaircraftselector.cpp b/src/blackgui/components/remoteaircraftselector.cpp index 91ff70c20..9e0cd10ea 100644 --- a/src/blackgui/components/remoteaircraftselector.cpp +++ b/src/blackgui/components/remoteaircraftselector.cpp @@ -58,14 +58,19 @@ namespace BlackGui void CRemoteAircraftSelector::ps_onAddedAircraft(const CSimulatedAircraft &aircraft) { - Q_UNUSED(aircraft); + CCallsign cs(aircraft.getCallsign()); + if (cs.isEmpty()) { return; } + if (this->m_aircraft.containsCallsign(cs)) { return; } this->fillComboBox(); } void CRemoteAircraftSelector::ps_onRemovedAircraft(const CCallsign &callsign) { - Q_UNUSED(callsign); - this->fillComboBox(); + if (callsign.isEmpty()) { return; } + if (this->m_aircraft.containsCallsign(callsign)) + { + this->fillComboBox(); + } } void CRemoteAircraftSelector::fillComboBox() diff --git a/src/blackgui/components/settingsfsxcomponent.ui b/src/blackgui/components/settingsfsxcomponent.ui index 64d50e89b..751ac0fba 100644 --- a/src/blackgui/components/settingsfsxcomponent.ui +++ b/src/blackgui/components/settingsfsxcomponent.ui @@ -10,14 +10,8 @@ 141 - - - 16777215 - 16777215 - - - Frame + FSX SimConnect Settings QFrame::StyledPanel @@ -47,6 +41,18 @@ FSX SimConnect config file + + 4 + + + 6 + + + 4 + + + 4 + diff --git a/src/blackgui/components/settingssimulatorcomponent.cpp b/src/blackgui/components/settingssimulatorcomponent.cpp index f97408d10..38856a901 100644 --- a/src/blackgui/components/settingssimulatorcomponent.cpp +++ b/src/blackgui/components/settingssimulatorcomponent.cpp @@ -34,6 +34,7 @@ namespace BlackGui ui->setupUi(this); CLedWidget::LedShape shape = CLedWidget::Circle; this->ui->led_RestrictedRendering->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Limited", "Unlimited", 14); + this->ui->led_RenderingEnabled->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Rendering enabled", "No aircraft will be rendered", 14); } CSettingsSimulatorComponent::~CSettingsSimulatorComponent() @@ -45,78 +46,87 @@ namespace BlackGui Q_ASSERT(this->getIContextSettings()); // set values - this->setRestrictedValues(); - ui->cb_Plugins->addItem(tr("Auto"), CSimulatorPluginInfo().toQVariant()); - - for (const auto &p: getIContextSimulator()->getAvailableSimulatorPlugins()) + for (const auto &p : getIContextSimulator()->getAvailableSimulatorPlugins()) { ui->cb_Plugins->addItem(p.toQString(), p.toQVariant()); } - this->setCurrentPlugin(getIContextSettings()->getSimulatorSettings().getSelectedPlugin()); - - // disable / enable driver specific GUI parts - bool hasFsxDriver = - this->getIContextSimulator()->getAvailableSimulatorPlugins().supportsSimulator(QStringLiteral("fsx")); - this->ui->comp_SettingsSimulatorFsx->setVisible(hasFsxDriver); - - // time sync - bool timeSynced = this->getIContextSimulator()->isTimeSynchronized(); - this->ui->cb_TimeSync->setChecked(timeSynced); - CTime timeOffset = this->getIContextSimulator()->getTimeSynchronizationOffset(); - this->ui->le_TimeSyncOffset->setText(timeOffset.formattedHrsMin()); - - // max.aircraft - this->ui->sb_MaxAircraft->setValue(getIContextSimulator()->getMaxRenderedAircraft()); - - connect(this->ui->cb_Plugins, static_cast (&QComboBox::currentIndexChanged), this, &CSettingsSimulatorComponent::ps_pluginHasChanged); + // connects + connect(this->ui->cb_Plugins, static_cast (&QComboBox::currentIndexChanged), this, &CSettingsSimulatorComponent::ps_pluginHasBeenSelectedInComboBox); connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsSimulatorComponent::ps_settingsHaveChanged); + connect(this->getIContextSimulator(), &IContextSimulator::simulatorPluginChanged, this, &CSettingsSimulatorComponent::ps_simulatorPluginChanged); connect(this->ui->pb_ApplyMaxAircraft, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft); connect(this->ui->pb_ApplyTimeSync, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyTimeSync); connect(this->ui->pb_ApplyMaxDistance, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance); connect(this->ui->pb_ClearRestrictedRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_clearRestricedRendering); + connect(this->ui->pb_DisableRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyDisableRendering); + + // values + this->ps_simulatorPluginChanged(getIContextSimulator()->getSimulatorPluginInfo()); } - void CSettingsSimulatorComponent::setCurrentPlugin(const CSimulatorPluginInfo &plugin) + void CSettingsSimulatorComponent::setCurrentPluginInComboBox(const CSimulatorPluginInfo &plugin) { - if (plugin.isUnspecified()) { + if (plugin.isUnspecified()) + { ui->cb_Plugins->setCurrentIndex(0); return; } - + for (int i = 0; i < this->ui->cb_Plugins->count(); ++i) { QVariant data = this->ui->cb_Plugins->itemData(i); Q_ASSERT(data.canConvert()); CSimulatorPluginInfo p = data.value(); - + if (p.getIdentifier() == plugin.getIdentifier()) { - if (i == this->ui->cb_Plugins->currentIndex()) - return; - + if (i == this->ui->cb_Plugins->currentIndex()) { return; } this->ui->cb_Plugins->setCurrentIndex(i); break; } } } - void CSettingsSimulatorComponent::setRestrictedValues() + void CSettingsSimulatorComponent::setGuiValues() { Q_ASSERT(getIContextSimulator()); - this->ui->led_RestrictedRendering->setOn(getIContextSimulator()->isRenderingRestricted()); - this->ui->lbl_RestrictionText->setText(getIContextSimulator()->getRenderRestrictionText()); - int distanceBoundaryNM = getIContextSimulator()->getRenderedDistanceBoundary().valueInteger(CLengthUnit::NM()); - this->ui->sb_MaxDistance->setMaximum(distanceBoundaryNM); - this->ui->sb_MaxAircraft->setValue(getIContextSimulator()->getMaxRenderedAircraft()); + // time sync + this->ui->cb_TimeSync->setEnabled(m_pluginLoaded); + this->ui->le_TimeSyncOffset->setEnabled(m_pluginLoaded); + this->ui->sb_MaxDistance->setEnabled(m_pluginLoaded); + this->ui->sb_MaxAircraft->setEnabled(m_pluginLoaded); - int distanceNM = getIContextSimulator()->getMaxRenderedDistance().valueInteger(CLengthUnit::NM()); - this->ui->sb_MaxDistance->setValue(distanceNM); + // led + this->ui->led_RestrictedRendering->setOn(m_pluginLoaded ? getIContextSimulator()->isRenderingRestricted() : false); + this->ui->lbl_RestrictionText->setText(m_pluginLoaded ? getIContextSimulator()->getRenderRestrictionText() : ""); + + if (m_pluginLoaded) + { + bool timeSynced = this->getIContextSimulator()->isTimeSynchronized(); + this->ui->cb_TimeSync->setChecked(timeSynced); + CTime timeOffset = this->getIContextSimulator()->getTimeSynchronizationOffset(); + this->ui->le_TimeSyncOffset->setText(timeOffset.formattedHrsMin()); + + int distanceBoundaryNM = getIContextSimulator()->getRenderedDistanceBoundary().valueInteger(CLengthUnit::NM()); + this->ui->sb_MaxDistance->setMaximum(distanceBoundaryNM); + this->ui->sb_MaxAircraft->setValue(getIContextSimulator()->getMaxRenderedAircraft()); + + CLength maxDistance(getIContextSimulator()->getMaxRenderedDistance()); + int distanceNM = maxDistance.isNull() ? distanceBoundaryNM : maxDistance.valueInteger(CLengthUnit::NM()); + this->ui->sb_MaxDistance->setValue(distanceNM); + + this->ui->led_RenderingEnabled->setOn(getIContextSimulator()->isRenderingEnabled()); + } + else + { + this->ui->led_RenderingEnabled->setOn(false); + } } - void CSettingsSimulatorComponent::ps_pluginHasChanged(int index) + void CSettingsSimulatorComponent::ps_pluginHasBeenSelectedInComboBox(int index) { Q_ASSERT(this->getIContextSimulator()); Q_ASSERT(this->getIContextSettings()); @@ -148,7 +158,7 @@ namespace BlackGui if (type != IContextSettings::SettingsSimulator || !this->getIContextSettings()) return; CSettingsSimulator simSettings = this->getIContextSettings()->getSimulatorSettings(); - this->setCurrentPlugin(simSettings.getSelectedPlugin()); + this->setCurrentPluginInComboBox(simSettings.getSelectedPlugin()); this->ui->le_TimeSyncOffset->setText(simSettings.getSyncTimeOffset().formattedHrsMin()); this->ui->cb_TimeSync->setChecked(simSettings.isTimeSyncEnabled()); } @@ -172,6 +182,7 @@ namespace BlackGui CLogMessage(this).info("Max.rendered aircraft: %1, requested: %2") << noRendered << noRequested; this->ui->sb_MaxAircraft->setValue(noRendered); } + this->setGuiValues(); } void CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance() @@ -182,8 +193,15 @@ namespace BlackGui int maxDistanceNM = this->ui->sb_MaxDistance->value(); CLength distance(maxDistanceNM, CLengthUnit::NM()); this->getIContextSimulator()->setMaxRenderedDistance(distance); - CLogMessage(this).info("Max.distance requested: %1") << distance.valueRoundedWithUnit(2, true); + this->setGuiValues(); + } + + void CSettingsSimulatorComponent::ps_onApplyDisableRendering() + { + Q_ASSERT(getIContextSimulator()); + this->getIContextSimulator()->setMaxRenderedAircraft(0); + this->setGuiValues(); } void CSettingsSimulatorComponent::ps_onApplyTimeSync() @@ -205,16 +223,35 @@ namespace BlackGui } } - void CSettingsSimulatorComponent::ps_onRenderingRestricted(bool restricted) - { - Q_UNUSED(restricted); - setRestrictedValues(); - } - void CSettingsSimulatorComponent::ps_clearRestricedRendering() { Q_ASSERT(getIContextSimulator()); this->getIContextSimulator()->deleteAllRenderingRestrictions(); + this->setGuiValues(); + } + + void CSettingsSimulatorComponent::ps_simulatorPluginChanged(const CSimulatorPluginInfo &info) + { + // disable / enable driver specific GUI parts + bool hasFsxDriver = this->getIContextSimulator()->getAvailableSimulatorPlugins().supportsSimulator(QStringLiteral("fsx")); + + // combobox + setCurrentPluginInComboBox(info); + + // other GUI values + if (!info.isUnspecified()) + { + m_pluginLoaded = true; + this->ui->comp_SettingsSimulatorFsx->setVisible(hasFsxDriver); + this->ui->lbl_PluginInfo->setText(info.getDescription()); + this->setGuiValues(); + } + else + { + m_pluginLoaded = false; + this->ui->lbl_PluginInfo->setText("No plugin loaded"); + this->setGuiValues(); + } } } diff --git a/src/blackgui/components/settingssimulatorcomponent.h b/src/blackgui/components/settingssimulatorcomponent.h index 0309022ad..6d7296f9a 100644 --- a/src/blackgui/components/settingssimulatorcomponent.h +++ b/src/blackgui/components/settingssimulatorcomponent.h @@ -22,9 +22,7 @@ namespace BlackGui { namespace Components { - /*! - * All simulator settings component (GUI) - */ + //! All simulator settings component (GUI) class BLACKGUI_EXPORT CSettingsSimulatorComponent : public QFrame, public CEnableForRuntime { Q_OBJECT @@ -42,7 +40,7 @@ namespace BlackGui private slots: //! Driver changed - void ps_pluginHasChanged(int index); + void ps_pluginHasBeenSelectedInComboBox(int index); //! Settings have been changed void ps_settingsHaveChanged(uint settingsType); @@ -53,24 +51,28 @@ namespace BlackGui //! Apply max.distance void ps_onApplyMaxRenderedDistance(); + //! Apply disable rendering + void ps_onApplyDisableRendering(); + //! Apply time sync void ps_onApplyTimeSync(); - //! Restricted number of rendered aircraft - void ps_onRenderingRestricted(bool restricted); - //! Clear restricted rendering void ps_clearRestricedRendering(); + //! Simulator plugin changed + void ps_simulatorPluginChanged(const BlackMisc::Simulation::CSimulatorPluginInfo &info); + private: QScopedPointer ui; //!< UI //! Smarter way to set current driver, avoids unnecessary signals and less formatting dependend - void setCurrentPlugin(const BlackMisc::Simulation::CSimulatorPluginInfo &plugin); + void setCurrentPluginInComboBox(const BlackMisc::Simulation::CSimulatorPluginInfo &plugin); //! Set the GUI values - void setRestrictedValues(); + void setGuiValues(); + bool m_pluginLoaded = false; // plugin loaded }; } } // namespace diff --git a/src/blackgui/components/settingssimulatorcomponent.ui b/src/blackgui/components/settingssimulatorcomponent.ui index 39ed83c85..79e47381a 100644 --- a/src/blackgui/components/settingssimulatorcomponent.ui +++ b/src/blackgui/components/settingssimulatorcomponent.ui @@ -37,6 +37,12 @@ + + + 0 + 0 + + QFormLayout::AllNonFixedFieldsGrow @@ -68,6 +74,20 @@ + + + Loaded + + + + + + + Simulator info will go here + + + + Time synchronization @@ -77,7 +97,7 @@ - + @@ -158,7 +178,62 @@ - + + + + Rendering enabled + + + Rendering en. + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + disable + + + + + + Current rendering restrictions (if any) @@ -168,7 +243,7 @@ - + 4 @@ -210,14 +285,14 @@ - + Max.aircraft - + 4 @@ -256,14 +331,14 @@ - + - Max.distance (NM) + Max.dist.(NM) - + 4 @@ -309,21 +384,31 @@ - + + + + 0 + 0 + + + + + + Qt::Vertical + + QSizePolicy::Maximum + 20 - 40 + 30 - - - diff --git a/src/blackgui/models/columnformatters.h b/src/blackgui/models/columnformatters.h index 1e812cb89..f11f9bb92 100644 --- a/src/blackgui/models/columnformatters.h +++ b/src/blackgui/models/columnformatters.h @@ -203,16 +203,16 @@ namespace BlackGui public: //! Constructor - CBoolIconFormatter(int alignment = alignDefault()); + CBoolIconFormatter(int alignment = alignCentered()); //! Constructor - CBoolIconFormatter(const QString &onName, const QString &offName, int alignment = alignDefault()); + CBoolIconFormatter(const QString &onName, const QString &offName, int alignment = alignCentered()); //! Constructor - CBoolIconFormatter(const BlackMisc::CIcon &onIcon, const BlackMisc::CIcon &offIcon, const QString &onName, const QString &offName, int alignment = alignDefault()); + CBoolIconFormatter(const BlackMisc::CIcon &onIcon, const BlackMisc::CIcon &offIcon, const QString &onName, const QString &offName, int alignment = alignCentered()); //! Constructor - CBoolIconFormatter(BlackMisc::CIcons::IconIndex onIcon, BlackMisc::CIcons::IconIndex offIcon, const QString &onName, const QString &offName, int alignment = alignDefault()); + CBoolIconFormatter(BlackMisc::CIcons::IconIndex onIcon, BlackMisc::CIcons::IconIndex offIcon, const QString &onName, const QString &offName, int alignment = alignCentered()); //! \copydoc CDefaultFormatter::displayRole virtual BlackMisc::CVariant displayRole(const BlackMisc::CVariant &dataCVariant) const override; @@ -273,7 +273,7 @@ namespace BlackGui { public: //! Constructor - CAltitudeFormatter(bool flightlevel = false, int alignment = alignDefault(), bool i18n = true) : CDefaultFormatter(alignment, i18n), m_flightLevel(flightlevel) {} + CAltitudeFormatter(bool flightlevel = false, int alignment = alignRightVCenter(), bool i18n = true) : CDefaultFormatter(alignment, i18n), m_flightLevel(flightlevel) {} //! \copydoc CDefaultFormatter::displayRole virtual BlackMisc::CVariant displayRole(const BlackMisc::CVariant &altitude) const override; diff --git a/src/blackgui/models/simulatedaircraftlistmodel.cpp b/src/blackgui/models/simulatedaircraftlistmodel.cpp index e07d23dcc..aa89dad99 100644 --- a/src/blackgui/models/simulatedaircraftlistmodel.cpp +++ b/src/blackgui/models/simulatedaircraftlistmodel.cpp @@ -54,13 +54,13 @@ namespace BlackGui this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", CSimulatedAircraft::IndexCallsign, CCallsign::IndexCallsignString)); this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName })); this->m_columns.addColumn(CColumn("dist.", "distance", CSimulatedAircraft::IndexDistanceToOwnAircraft, new CAirspaceDistanceFormatter())); - this->m_columns.addColumn(CColumn("frequency", { CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter())); + this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter())); + this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter())); this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexIcao, CAircraftIcao::IndexAsString})); + this->m_columns.addColumn(CColumn("frequency", { CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter())); this->m_columns.addColumn(CColumn::standardString("transponder", { CSimulatedAircraft::IndexTransponder, CTransponder::IndexTransponderCodeAndModeFormatted })); this->m_columns.addColumn(CColumn("latitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLatitude }, new CLatLonFormatter())); this->m_columns.addColumn(CColumn("longitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLongitude }, new CLatLonFormatter())); - this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter())); - this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter())); // default sort order this->setSortColumnByPropertyIndex(CSimulatedAircraft::IndexDistanceToOwnAircraft); @@ -68,23 +68,19 @@ namespace BlackGui break; case ModelMode: - this->m_columns.addColumn(CColumn("e.", "enabled", CSimulatedAircraft::IndexEnabled, - new CBoolIconFormatter("enabled", "disabled"), true)); - this->m_columns.addColumn(CColumn("r.", "rendered", CSimulatedAircraft::IndexRendered, - new CBoolIconFormatter("rendered", "skipped"), true)); + this->m_columns.addColumn(CColumn("e.", "enabled", CSimulatedAircraft::IndexEnabled, new CBoolIconFormatter("enabled", "disabled"), true)); + this->m_columns.addColumn(CColumn("r.", "rendered", CSimulatedAircraft::IndexRendered, new CBoolIconFormatter("rendered", "skipped"), true)); this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", { CSimulatedAircraft::IndexCallsign, CCallsign::IndexCallsignString })); - this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName })); this->m_columns.addColumn(CColumn("dist.", "distance", CSimulatedAircraft::IndexDistanceToOwnAircraft, new CAirspaceDistanceFormatter())); - this->m_columns.addColumn(CColumn("p.", "parts", CSimulatedAircraft::IndexPartsSynchronized, - new CBoolIconFormatter("parts", "no parts"), true)); - this->m_columns.addColumn(CColumn("fp.", "fast position updates", CSimulatedAircraft::IndexFastPositionUpdates, - new CBoolIconFormatter("enabled", "disabled"), true)); + this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter())); + this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter())); + this->m_columns.addColumn(CColumn("p.", "parts", CSimulatedAircraft::IndexPartsSynchronized, new CBoolIconFormatter("parts", "no parts"), true)); + this->m_columns.addColumn(CColumn("fp.", "fast position updates", CSimulatedAircraft::IndexFastPositionUpdates, new CBoolIconFormatter("enabled", "disabled"), true)); + this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName })); this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexIcao, CAircraftIcao::IndexAsString})); this->m_columns.addColumn(CColumn::standardString("model", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelString})); this->m_columns.addColumn(CColumn::standardString("desc.", "description", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexDescription})); this->m_columns.addColumn(CColumn::standardString("type", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelTypeAsString})); - this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter())); - this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter())); // default sort order this->setSortColumnByPropertyIndex(CSimulatedAircraft::IndexDistanceToOwnAircraft);