Fix for context menu of aircraft view as reported in slack

* reported: https://swift-project.slack.com/archives/G7GD2UP9C/p1533749013000483
* logic moved to view
* removed no longer required code
This commit is contained in:
Klaus Basan
2018-08-09 01:35:27 +02:00
parent 5b44f55435
commit 79a133892b
7 changed files with 137 additions and 145 deletions

View File

@@ -93,12 +93,6 @@ namespace BlackGui
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestUpdate, this, &CMappingComponent::tokenBucketUpdate);
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestTextMessageWidget, this, &CMappingComponent::requestTextMessageWidget);
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestEnableAircraft, this, &CMappingComponent::onMenuToggleEnableAircraft);
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestFastPositionUpdates, this, &CMappingComponent::onMenuChangeFastPositionUpdates);
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestHighlightInSimulator, this, &CMappingComponent::onMenuHighlightInSimulator);
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestFollowInSimulator, this, &CMappingComponent::onMenuFollowAircraftInSimulator);
connect(ui->tvp_RenderedAircraft, &CSimulatedAircraftView::requestSupportingGndFlag, this, &CMappingComponent::onMenuSupportGndFLag);
connect(ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::onSaveAircraft);
connect(ui->pb_ResetAircraft, &QPushButton::clicked, this, &CMappingComponent::onResetAircraft);
connect(ui->pb_LoadModels, &QPushButton::clicked, this, &CMappingComponent::onModelsUpdateRequested);
@@ -406,38 +400,6 @@ namespace BlackGui
}
}
void CMappingComponent::onMenuChangeFastPositionUpdates(const CSimulatedAircraft &aircraft)
{
if (sGui && sGui->getIContextNetwork())
{
sGui->getIContextNetwork()->updateFastPositionEnabled(aircraft.getCallsign(), aircraft.fastPositionUpdates());
}
}
void CMappingComponent::onMenuFollowAircraftInSimulator(const CSimulatedAircraft &aircraft)
{
if (sGui && sGui->getIContextSimulator())
{
sGui->getIContextSimulator()->followAircraft(aircraft.getCallsign());
}
}
void CMappingComponent::onMenuSupportGndFLag(const CSimulatedAircraft &aircraft)
{
if (sGui && sGui->getIContextNetwork())
{
sGui->getIContextNetwork()->updateAircraftSupportingGndFLag(aircraft.getCallsign(), aircraft.isSupportingGndFlag());
}
}
void CMappingComponent::onMenuHighlightInSimulator(const CSimulatedAircraft &aircraft)
{
if (sGui && sGui->getIContextSimulator())
{
sGui->getIContextSimulator()->highlightAircraft(aircraft, true, IContextSimulator::HighlightTime());
}
}
CSimulatorInfo CMappingComponent::getConnectedOrSelectedSimulator() const
{
if (this->isSimulatorAvailable()) { return sGui->getIContextSimulator()->isSimulatorAvailable(); }
@@ -458,8 +420,8 @@ namespace BlackGui
QList<int> newSizes({0, 0});
if (show)
{
newSizes[0] = total * 0.8;
newSizes[1] = total * 0.2;
newSizes[0] = qRound(total * 0.8);
newSizes[1] = qRound(total * 0.2);
}
else
{
@@ -476,14 +438,6 @@ namespace BlackGui
Q_UNUSED(message);
}
void CMappingComponent::onMenuToggleEnableAircraft(const CSimulatedAircraft &aircraft)
{
if (sGui->getIContextNetwork())
{
sGui->getIContextNetwork()->updateAircraftEnabled(aircraft.getCallsign(), aircraft.isEnabled());
}
}
void CMappingComponent::onTabWidgetChanged(int index)
{
Q_UNUSED(index);