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
This commit is contained in:
Klaus Basan
2015-05-06 02:50:45 +02:00
committed by Mathew Sutcliffe
parent bbd5ad2cbc
commit e7f65ba0b6
10 changed files with 245 additions and 113 deletions

View File

@@ -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());
}

View File

@@ -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())

View File

@@ -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);

View File

@@ -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()

View File

@@ -10,14 +10,8 @@
<height>141</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Frame</string>
<string>FSX SimConnect Settings</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@@ -47,6 +41,18 @@
<string>FSX SimConnect config file</string>
</property>
<layout class="QFormLayout" name="fl_Settings">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lbl_SettingsFsxAddress">
<property name="text">

View File

@@ -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<void (QComboBox::*)(int)> (&QComboBox::currentIndexChanged), this, &CSettingsSimulatorComponent::ps_pluginHasChanged);
// connects
connect(this->ui->cb_Plugins, static_cast<void (QComboBox::*)(int)> (&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>());
CSimulatorPluginInfo p = data.value<CSimulatorPluginInfo>();
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();
}
}
}

View File

@@ -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::CSettingsSimulatorComponent> 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

View File

@@ -37,6 +37,12 @@
</property>
<item>
<widget class="QWidget" name="qw_SettingsSimulatorsAll" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QFormLayout" name="fl_SettingsSimulatorsAll">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
@@ -68,6 +74,20 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_LoadedPlugin">
<property name="text">
<string>Loaded</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lbl_PluginInfo">
<property name="text">
<string>Simulator info will go here</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_TimeSync">
<property name="toolTip">
<string>Time synchronization</string>
@@ -77,7 +97,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QWidget" name="wi_TimeSync" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
@@ -158,7 +178,62 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="lbl_RenderingEnabled">
<property name="toolTip">
<string>Rendering enabled</string>
</property>
<property name="text">
<string>Rendering en.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="hl_RenderingEnabled">
<item>
<widget class="BlackGui::CLedWidget" name="led_RenderingEnabled" native="true"/>
</item>
<item>
<spacer name="hs_RenderingEnabled">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_DisableRendering">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>disable</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lbl_RestrictedRendering">
<property name="toolTip">
<string>Current rendering restrictions (if any)</string>
@@ -168,7 +243,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="5" column="1">
<layout class="QHBoxLayout" name="hl_RestrictedRendering">
<property name="spacing">
<number>4</number>
@@ -210,14 +285,14 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QLabel" name="lbl_MaxAircraft">
<property name="text">
<string>Max.aircraft</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<layout class="QHBoxLayout" name="hl_MaxAircraft">
<property name="spacing">
<number>4</number>
@@ -256,14 +331,14 @@
</item>
</layout>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QLabel" name="lbl_MaxDistance">
<property name="text">
<string>Max.distance (NM)</string>
<string>Max.dist.(NM)</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="7" column="1">
<layout class="QHBoxLayout" name="hl_MaxDistance">
<property name="spacing">
<number>4</number>
@@ -309,21 +384,31 @@
</widget>
</item>
<item>
<spacer name="vs_SettingsSimulatorComponent">
<widget class="BlackGui::Components::CSettingsFsxComponent" name="comp_SettingsSimulatorFsx">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="vs_SettingsSimulator">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="BlackGui::Components::CSettingsFsxComponent" name="comp_SettingsSimulatorFsx"/>
</item>
</layout>
</widget>
<customwidgets>

View File

@@ -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;

View File

@@ -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);