mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Follow up, made "private slots" -> "private"
This commit is contained in:
@@ -61,6 +61,10 @@ namespace BlackGui
|
|||||||
CIdentifiable(this),
|
CIdentifiable(this),
|
||||||
ui(new Ui::CMappingComponent)
|
ui(new Ui::CMappingComponent)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT_X(sGui, Q_FUNC_INFO, "need sGui");
|
||||||
|
Q_ASSERT_X(sGui->getIContextSimulator(), Q_FUNC_INFO, "need simulator context");
|
||||||
|
Q_ASSERT_X(sGui->getIContextNetwork(), Q_FUNC_INFO, "need network context");
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tvp_AircraftModels->setAircraftModelMode(CAircraftModelListModel::OwnAircraftModelClient);
|
ui->tvp_AircraftModels->setAircraftModelMode(CAircraftModelListModel::OwnAircraftModelClient);
|
||||||
ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff);
|
ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff);
|
||||||
@@ -70,56 +74,56 @@ namespace BlackGui
|
|||||||
ui->tvp_RenderedAircraft->setAircraftMode(CSimulatedAircraftListModel::RenderedMode);
|
ui->tvp_RenderedAircraft->setAircraftMode(CSimulatedAircraftListModel::RenderedMode);
|
||||||
ui->tvp_RenderedAircraft->setResizeMode(CAircraftModelView::ResizingOnce);
|
ui->tvp_RenderedAircraft->setResizeMode(CAircraftModelView::ResizingOnce);
|
||||||
|
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::ps_connectionStatusChanged);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::connectionStatusChanged);
|
||||||
|
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested);
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::onModelsUpdateRequested);
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::modelDataChanged, this, &CMappingComponent::ps_onRowCountChanged);
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::modelDataChanged, this, &CMappingComponent::onRowCountChanged);
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView);
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::onModelSelectedInView);
|
||||||
|
|
||||||
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::modelDataChanged, this, &CMappingComponent::ps_onRowCountChanged);
|
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::modelDataChanged, this, &CMappingComponent::onRowCountChanged);
|
||||||
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::clicked, this, &CMappingComponent::ps_onAircraftSelectedInView);
|
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::clicked, this, &CMappingComponent::onAircraftSelectedInView);
|
||||||
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestUpdate, this, &CMappingComponent::ps_tokenBucketUpdate);
|
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestUpdate, this, &CMappingComponent::tokenBucketUpdate);
|
||||||
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestTextMessageWidget, this, &CMappingComponent::requestTextMessageWidget);
|
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestTextMessageWidget, this, &CMappingComponent::requestTextMessageWidget);
|
||||||
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestEnableAircraft, this, &CMappingComponent::ps_onMenuToggleEnableAircraft);
|
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestEnableAircraft, this, &CMappingComponent::onMenuToggleEnableAircraft);
|
||||||
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestFastPositionUpdates, this, &CMappingComponent::ps_onMenuChangeFastPositionUpdates);
|
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestFastPositionUpdates, this, &CMappingComponent::onMenuChangeFastPositionUpdates);
|
||||||
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestHighlightInSimulator, this, &CMappingComponent::ps_onMenuHighlightInSimulator);
|
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestHighlightInSimulator, this, &CMappingComponent::onMenuHighlightInSimulator);
|
||||||
|
|
||||||
connect(ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::ps_onSaveAircraft);
|
connect(ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::onSaveAircraft);
|
||||||
connect(ui->pb_ResetAircraft, &QPushButton::clicked, this, &CMappingComponent::ps_onResetAircraft);
|
connect(ui->pb_ResetAircraft, &QPushButton::clicked, this, &CMappingComponent::onResetAircraft);
|
||||||
connect(ui->pb_LoadModels, &QPushButton::clicked, this, &CMappingComponent::ps_onModelsUpdateRequested);
|
connect(ui->pb_LoadModels, &QPushButton::clicked, this, &CMappingComponent::onModelsUpdateRequested);
|
||||||
|
|
||||||
m_currentMappingsViewDelegate = new CCheckBoxDelegate(":/diagona/icons/diagona/icons/tick.png", ":/diagona/icons/diagona/icons/cross.png", this);
|
m_currentMappingsViewDelegate = new CCheckBoxDelegate(":/diagona/icons/diagona/icons/tick.png", ":/diagona/icons/diagona/icons/cross.png", this);
|
||||||
ui->tvp_RenderedAircraft->setItemDelegateForColumn(0, m_currentMappingsViewDelegate);
|
ui->tvp_RenderedAircraft->setItemDelegateForColumn(0, m_currentMappingsViewDelegate);
|
||||||
this->showKillButton(false);
|
this->showKillButton(false);
|
||||||
|
|
||||||
// Aircraft previews
|
// Aircraft previews
|
||||||
connect(ui->cb_AircraftIconDisplayed, &QCheckBox::stateChanged, this, &CMappingComponent::ps_onModelPreviewChanged);
|
connect(ui->cb_AircraftIconDisplayed, &QCheckBox::stateChanged, this, &CMappingComponent::onModelPreviewChanged);
|
||||||
|
|
||||||
// model string completer
|
// model string completer
|
||||||
ui->completer_ModelStrings->setSourceVisible(CAircraftModelStringCompleter::OwnModels, false);
|
ui->completer_ModelStrings->setSourceVisible(CAircraftModelStringCompleter::OwnModels, false);
|
||||||
ui->completer_ModelStrings->selectSource(CAircraftModelStringCompleter::ModelSet);
|
ui->completer_ModelStrings->selectSource(CAircraftModelStringCompleter::ModelSet);
|
||||||
|
|
||||||
// Updates
|
// Updates
|
||||||
connect(&m_updateTimer, &QTimer::timeout, this, &CMappingComponent::ps_timerUpdate);
|
connect(&m_updateTimer, &QTimer::timeout, this, &CMappingComponent::timerUpdate);
|
||||||
ui->tvp_AircraftModels->setDisplayAutomatically(false);
|
ui->tvp_AircraftModels->setDisplayAutomatically(false);
|
||||||
this->ps_settingsChanged();
|
this->settingsChanged();
|
||||||
|
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CMappingComponent::ps_onModelSetChanged);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CMappingComponent::onModelSetChanged);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::ps_tokenBucketUpdateAircraft);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::tokenBucketUpdateAircraft);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::aircraftRenderingChanged, this, &CMappingComponent::ps_tokenBucketUpdateAircraft);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::aircraftRenderingChanged, this, &CMappingComponent::tokenBucketUpdateAircraft);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::airspaceSnapshotHandled, this, &CMappingComponent::ps_tokenBucketUpdate);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::airspaceSnapshotHandled, this, &CMappingComponent::tokenBucketUpdate);
|
||||||
connect(sGui->getIContextSimulator(), &IContextSimulator::addingRemoteModelFailed, this, &CMappingComponent::ps_addingRemoteAircraftFailed);
|
connect(sGui->getIContextSimulator(), &IContextSimulator::addingRemoteModelFailed, this, &CMappingComponent::addingRemoteAircraftFailed);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftModel, this, &CMappingComponent::ps_onRemoteAircraftModelChanged);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftModel, this, &CMappingComponent::onRemoteAircraftModelChanged);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftEnabled, this, &CMappingComponent::ps_tokenBucketUpdateAircraft);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::changedRemoteAircraftEnabled, this, &CMappingComponent::tokenBucketUpdateAircraft);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedFastPositionUpdates, this, &CMappingComponent::ps_tokenBucketUpdateAircraft);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::changedFastPositionUpdates, this, &CMappingComponent::tokenBucketUpdateAircraft);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::removedAircraft, this, &CMappingComponent::ps_tokenBucketUpdate);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::removedAircraft, this, &CMappingComponent::tokenBucketUpdate);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::ps_onConnectionStatusChanged);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::onConnectionStatusChanged);
|
||||||
|
|
||||||
// requires simulator context
|
// requires simulator context
|
||||||
connect(ui->tvp_RenderedAircraft, &CAircraftModelView::objectChanged, this, &CMappingComponent::ps_onChangedSimulatedAircraftInView);
|
connect(ui->tvp_RenderedAircraft, &CAircraftModelView::objectChanged, this, &CMappingComponent::onChangedSimulatedAircraftInView);
|
||||||
|
|
||||||
// with external core models might be already available
|
// with external core models might be already available
|
||||||
this->ps_onModelSetChanged();
|
this->onModelSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMappingComponent::~CMappingComponent()
|
CMappingComponent::~CMappingComponent()
|
||||||
@@ -143,11 +147,11 @@ namespace BlackGui
|
|||||||
return ui->tvp_AircraftModels->container().findModelsStartingWith(modelName, cs);
|
return ui->tvp_AircraftModels->container().findModelsStartingWith(modelName, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onModelSetChanged()
|
void CMappingComponent::onModelSetChanged()
|
||||||
{
|
{
|
||||||
if (ui->tvp_AircraftModels->displayAutomatically())
|
if (ui->tvp_AircraftModels->displayAutomatically())
|
||||||
{
|
{
|
||||||
this->ps_onModelsUpdateRequested();
|
this->onModelsUpdateRequested();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -155,7 +159,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onRowCountChanged(int count, bool withFilter)
|
void CMappingComponent::onRowCountChanged(int count, bool withFilter)
|
||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
Q_UNUSED(withFilter);
|
Q_UNUSED(withFilter);
|
||||||
@@ -170,9 +174,9 @@ namespace BlackGui
|
|||||||
ui->tw_ListViews->tabBar()->setTabText(cm, c);
|
ui->tw_ListViews->tabBar()->setTabText(cm, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
|
void CMappingComponent::onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
|
||||||
{
|
{
|
||||||
if (!sGui || !index.contains(CSimulatedAircraft::IndexEnabled)) { return; } // we only deal with enabled/disabled here
|
if (!index.contains(CSimulatedAircraft::IndexEnabled)) { return; } // we only deal with enabled/disabled here
|
||||||
const CSimulatedAircraft sa = object.to<CSimulatedAircraft>(); // changed in GUI
|
const CSimulatedAircraft sa = object.to<CSimulatedAircraft>(); // changed in GUI
|
||||||
const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign());
|
const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign());
|
||||||
if (!saFromBackend.hasValidCallsign()) { return; } // obviously deleted
|
if (!saFromBackend.hasValidCallsign()) { return; } // obviously deleted
|
||||||
@@ -182,7 +186,7 @@ namespace BlackGui
|
|||||||
sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), nowEnabled);
|
sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), nowEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onAircraftSelectedInView(const QModelIndex &index)
|
void CMappingComponent::onAircraftSelectedInView(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
const CSimulatedAircraft simAircraft = ui->tvp_RenderedAircraft->at(index);
|
const CSimulatedAircraft simAircraft = ui->tvp_RenderedAircraft->at(index);
|
||||||
ui->cb_AircraftEnabled->setChecked(simAircraft.isEnabled());
|
ui->cb_AircraftEnabled->setChecked(simAircraft.isEnabled());
|
||||||
@@ -190,7 +194,7 @@ namespace BlackGui
|
|||||||
ui->completer_ModelStrings->setModel(simAircraft.getModel());
|
ui->completer_ModelStrings->setModel(simAircraft.getModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onModelSelectedInView(const QModelIndex &index)
|
void CMappingComponent::onModelSelectedInView(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
const CAircraftModel model = ui->tvp_AircraftModels->at(index);
|
const CAircraftModel model = ui->tvp_AircraftModels->at(index);
|
||||||
ui->completer_ModelStrings->setModel(model);
|
ui->completer_ModelStrings->setModel(model);
|
||||||
@@ -210,7 +214,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->ps_onModelPreviewChanged(Qt::Unchecked);
|
this->onModelPreviewChanged(Qt::Unchecked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +237,7 @@ namespace BlackGui
|
|||||||
return callsign;
|
return callsign;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onSaveAircraft()
|
void CMappingComponent::onSaveAircraft()
|
||||||
{
|
{
|
||||||
if (!sGui->getIContextSimulator()->isSimulatorSimulating()) { return; }
|
if (!sGui->getIContextSimulator()->isSimulatorSimulating()) { return; }
|
||||||
const CCallsign callsign(this->validateRenderedCallsign());
|
const CCallsign callsign(this->validateRenderedCallsign());
|
||||||
@@ -251,7 +255,7 @@ namespace BlackGui
|
|||||||
CLogMessage(this).validationError("Invalid model for mapping, reload models");
|
CLogMessage(this).validationError("Invalid model for mapping, reload models");
|
||||||
if (ui->tvp_AircraftModels->isEmpty())
|
if (ui->tvp_AircraftModels->isEmpty())
|
||||||
{
|
{
|
||||||
this->ps_onModelsUpdateRequested();
|
this->onModelsUpdateRequested();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -295,12 +299,12 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onResetAircraft()
|
void CMappingComponent::onResetAircraft()
|
||||||
{
|
{
|
||||||
if (!sGui->getIContextSimulator()->isSimulatorSimulating()) { return; }
|
if (!sGui->getIContextSimulator()->isSimulatorSimulating()) { return; }
|
||||||
const CCallsign callsign(this->validateRenderedCallsign());
|
const CCallsign callsign(this->validateRenderedCallsign());
|
||||||
if (callsign.isEmpty()) { return; }
|
if (callsign.isEmpty()) { return; }
|
||||||
bool reset = sGui->getIContextSimulator()->resetToModelMatchingAircraft(callsign);
|
const bool reset = sGui->getIContextSimulator()->resetToModelMatchingAircraft(callsign);
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Model reset for '%1'") << callsign.toQString();
|
CLogMessage(this).info("Model reset for '%1'") << callsign.toQString();
|
||||||
@@ -311,35 +315,35 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onModelPreviewChanged(int state)
|
void CMappingComponent::onModelPreviewChanged(int state)
|
||||||
{
|
{
|
||||||
Q_UNUSED(state);
|
Q_UNUSED(state);
|
||||||
this->closeOverlay();
|
this->closeOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onModelsUpdateRequested()
|
void CMappingComponent::onModelsUpdateRequested()
|
||||||
{
|
{
|
||||||
const CAircraftModelList ml(sGui->getIContextSimulator()->getModelSet());
|
const CAircraftModelList ml(sGui->getIContextSimulator()->getModelSet());
|
||||||
ui->tvp_AircraftModels->updateContainerMaybeAsync(ml);
|
ui->tvp_AircraftModels->updateContainerMaybeAsync(ml);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onRemoteAircraftModelChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
void CMappingComponent::onRemoteAircraftModelChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
||||||
{
|
{
|
||||||
if (CIdentifiable::isMyIdentifier(originator)) { return; }
|
if (CIdentifiable::isMyIdentifier(originator)) { return; }
|
||||||
this->ps_tokenBucketUpdateAircraft(aircraft);
|
this->tokenBucketUpdateAircraft(aircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to)
|
void CMappingComponent::onConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to)
|
||||||
{
|
{
|
||||||
Q_UNUSED(from);
|
Q_UNUSED(from);
|
||||||
if (INetwork::isDisconnectedStatus(to))
|
if (INetwork::isDisconnectedStatus(to))
|
||||||
{
|
{
|
||||||
this->ps_tokenBucketUpdate();
|
this->tokenBucketUpdate();
|
||||||
ui->tvp_RenderedAircraft->clear();
|
ui->tvp_RenderedAircraft->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onMenuChangeFastPositionUpdates(const CSimulatedAircraft &aircraft)
|
void CMappingComponent::onMenuChangeFastPositionUpdates(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
if (sGui->getIContextNetwork())
|
if (sGui->getIContextNetwork())
|
||||||
{
|
{
|
||||||
@@ -347,7 +351,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onMenuHighlightInSimulator(const CSimulatedAircraft &aircraft)
|
void CMappingComponent::onMenuHighlightInSimulator(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
if (sGui->getIContextSimulator())
|
if (sGui->getIContextSimulator())
|
||||||
{
|
{
|
||||||
@@ -355,14 +359,14 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
void CMappingComponent::addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
||||||
{
|
{
|
||||||
this->ps_tokenBucketUpdate();
|
this->tokenBucketUpdate();
|
||||||
Q_UNUSED(aircraft);
|
Q_UNUSED(aircraft);
|
||||||
Q_UNUSED(message);
|
Q_UNUSED(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onMenuToggleEnableAircraft(const CSimulatedAircraft &aircraft)
|
void CMappingComponent::onMenuToggleEnableAircraft(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
if (sGui->getIContextNetwork())
|
if (sGui->getIContextNetwork())
|
||||||
{
|
{
|
||||||
@@ -401,32 +405,32 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_timerUpdate()
|
void CMappingComponent::timerUpdate()
|
||||||
{
|
{
|
||||||
// timer update to update position, speed ...
|
// timer update to update position, speed ...
|
||||||
this->updateRenderedAircraftView(false); // unforced
|
this->updateRenderedAircraftView(false); // unforced
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_tokenBucketUpdateAircraft(const CSimulatedAircraft &aircraft)
|
void CMappingComponent::tokenBucketUpdateAircraft(const CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
Q_UNUSED(aircraft);
|
Q_UNUSED(aircraft);
|
||||||
this->ps_tokenBucketUpdate();
|
this->tokenBucketUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_tokenBucketUpdate()
|
void CMappingComponent::tokenBucketUpdate()
|
||||||
{
|
{
|
||||||
if (!m_bucket.tryConsume()) { return; }
|
if (!m_bucket.tryConsume()) { return; }
|
||||||
this->updateRenderedAircraftView(true); // forced update
|
this->updateRenderedAircraftView(true); // forced update
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_settingsChanged()
|
void CMappingComponent::settingsChanged()
|
||||||
{
|
{
|
||||||
const CViewUpdateSettings settings = m_settings.get();
|
const CViewUpdateSettings settings = m_settings.get();
|
||||||
const int ms = settings.getRenderingUpdateTime().toMs();
|
const int ms = settings.getRenderingUpdateTime().toMs();
|
||||||
m_updateTimer.setInterval(ms);
|
m_updateTimer.setInterval(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
|
void CMappingComponent::connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
|
||||||
{
|
{
|
||||||
Q_UNUSED(from);
|
Q_UNUSED(from);
|
||||||
if (INetwork::isDisconnectedStatus(to))
|
if (INetwork::isDisconnectedStatus(to))
|
||||||
|
|||||||
@@ -74,69 +74,68 @@ namespace BlackGui
|
|||||||
//! Request a text message
|
//! Request a text message
|
||||||
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
//! Aircraft models available
|
//! Aircraft models available
|
||||||
void ps_onModelSetChanged();
|
void onModelSetChanged();
|
||||||
|
|
||||||
//! Changed count
|
//! Changed count
|
||||||
void ps_onRowCountChanged(int count, bool withFilter);
|
void onRowCountChanged(int count, bool withFilter);
|
||||||
|
|
||||||
//! Simulated aircraft did change in view
|
//! Simulated aircraft did change in view
|
||||||
//! \sa CViewBaseNonTemplate::objectChanged
|
//! \sa CViewBaseNonTemplate::objectChanged
|
||||||
void ps_onChangedSimulatedAircraftInView(const BlackMisc::CVariant &simulatedAircraft, const BlackMisc::CPropertyIndex &index);
|
void onChangedSimulatedAircraftInView(const BlackMisc::CVariant &simulatedAircraft, const BlackMisc::CPropertyIndex &index);
|
||||||
|
|
||||||
//! Aircraft selected (in view)
|
//! Aircraft selected (in view)
|
||||||
void ps_onAircraftSelectedInView(const QModelIndex &index);
|
void onAircraftSelectedInView(const QModelIndex &index);
|
||||||
|
|
||||||
//! Model selected (in view)
|
//! Model selected (in view)
|
||||||
void ps_onModelSelectedInView(const QModelIndex &index);
|
void onModelSelectedInView(const QModelIndex &index);
|
||||||
|
|
||||||
//! Save changed aircraft
|
//! Save changed aircraft
|
||||||
void ps_onSaveAircraft();
|
void onSaveAircraft();
|
||||||
|
|
||||||
//! Reset aircraft
|
//! Reset aircraft
|
||||||
void ps_onResetAircraft();
|
void onResetAircraft();
|
||||||
|
|
||||||
//! Model preview
|
//! Model preview
|
||||||
void ps_onModelPreviewChanged(int state);
|
void onModelPreviewChanged(int state);
|
||||||
|
|
||||||
//! Request update for models from backend
|
//! Request update for models from backend
|
||||||
void ps_onModelsUpdateRequested();
|
void onModelsUpdateRequested();
|
||||||
|
|
||||||
//! Rendered aircraft changed in backend
|
//! Rendered aircraft changed in backend
|
||||||
void ps_onRemoteAircraftModelChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
void onRemoteAircraftModelChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||||
|
|
||||||
//! Connection status has been changed
|
//! Connection status has been changed
|
||||||
void ps_onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||||
|
|
||||||
//! Fast position updates onf/off
|
//! Fast position updates onf/off
|
||||||
void ps_onMenuChangeFastPositionUpdates(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
void onMenuChangeFastPositionUpdates(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
//! Enable / disable aircraft
|
//! Enable / disable aircraft
|
||||||
void ps_onMenuToggleEnableAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
void onMenuToggleEnableAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
//! Highlight in simulator
|
//! Highlight in simulator
|
||||||
void ps_onMenuHighlightInSimulator(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
void onMenuHighlightInSimulator(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
//! Adding a remote aircraft failed
|
//! Adding a remote aircraft failed
|
||||||
void ps_addingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CStatusMessage &message);
|
void addingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CStatusMessage &message);
|
||||||
|
|
||||||
//! Timer update
|
//! Timer update
|
||||||
void ps_timerUpdate();
|
void timerUpdate();
|
||||||
|
|
||||||
//! Token bucket based update
|
//! Token bucket based update
|
||||||
void ps_tokenBucketUpdate();
|
void tokenBucketUpdate();
|
||||||
|
|
||||||
//! Token bucket based update
|
//! Token bucket based update
|
||||||
void ps_tokenBucketUpdateAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
void tokenBucketUpdateAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
//! Settings have been changed
|
//! Settings have been changed
|
||||||
void ps_settingsChanged();
|
void settingsChanged();
|
||||||
|
|
||||||
//! Connection status has been changed
|
//! Connection status has been changed
|
||||||
void ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||||
|
|
||||||
private:
|
|
||||||
//! Identifier for data send from this component
|
//! Identifier for data send from this component
|
||||||
BlackMisc::CIdentifier mappingIdentifier();
|
BlackMisc::CIdentifier mappingIdentifier();
|
||||||
|
|
||||||
@@ -147,11 +146,11 @@ namespace BlackGui
|
|||||||
BlackMisc::Aviation::CCallsign validateRenderedCallsign() const;
|
BlackMisc::Aviation::CCallsign validateRenderedCallsign() const;
|
||||||
|
|
||||||
QScopedPointer<Ui::CMappingComponent> ui;
|
QScopedPointer<Ui::CMappingComponent> ui;
|
||||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settings { this, &CMappingComponent::ps_settingsChanged }; //!< settings changed
|
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settings { this, &CMappingComponent::settingsChanged }; //!< settings changed
|
||||||
bool m_missedRenderedAircraftUpdate = true; //! Rendered aircraft need update
|
bool m_missedRenderedAircraftUpdate = true; //! Rendered aircraft need update
|
||||||
QTimer m_updateTimer { this };
|
QTimer m_updateTimer { this };
|
||||||
BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1};
|
BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1};
|
||||||
BlackGui::Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
||||||
BlackMisc::CIdentifier m_identifier;
|
BlackMisc::CIdentifier m_identifier;
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user