mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Context menus to temp.disable parts (for single aircraft) and "0" zero pitch
This commit is contained in:
committed by
Mat Sutcliffe
parent
9618073a04
commit
0d66a995ce
@@ -24,6 +24,7 @@
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore::Context;
|
||||
@@ -112,9 +113,18 @@ namespace BlackGui
|
||||
}
|
||||
if (m_withMenuHighlightAndFollow)
|
||||
{
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Follow in simulator", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestFollowInSimulator });
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Follow in simulator", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestFollowInSimulator });
|
||||
if (!menuActions.isEmpty()) { menuActions.addSeparator(CMenuAction::pathClientSimulationDisplay()); }
|
||||
menuActions.addAction(CIcons::appSimulator16(), "Highlight in simulator", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestHighlightInSimulator });
|
||||
if (aircraft.isPartsSynchronized())
|
||||
{
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Temp.disable parts", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestDisableParts });
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Re/enabled parts", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestEnableParts });
|
||||
}
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Zero 0 pitch on ground", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::request0PitchOnGround });
|
||||
menuActions.addAction(CIcons::appAircraft16(), "Remove pitch manipulation", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestNullPitchOnGround });
|
||||
|
||||
if (!menuActions.isEmpty()) { menuActions.addSeparator(CMenuAction::pathClientSimulationDisplay()); }
|
||||
menuActions.addAction(CIcons::appSimulator16(), "Highlight in simulator", CMenuAction::pathClientSimulationDisplay(), { this, &CSimulatedAircraftView::requestHighlightInSimulator });
|
||||
}
|
||||
if (m_withMenuEnableGndFlag)
|
||||
{
|
||||
@@ -180,6 +190,34 @@ namespace BlackGui
|
||||
this->followAircraftInSimulator(aircraft);
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::requestEnableParts()
|
||||
{
|
||||
const CSimulatedAircraft aircraft(this->selectedObject());
|
||||
if (aircraft.getCallsign().isEmpty()) { return; }
|
||||
this->enableParts(aircraft, true);
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::requestDisableParts()
|
||||
{
|
||||
const CSimulatedAircraft aircraft(this->selectedObject());
|
||||
if (aircraft.getCallsign().isEmpty()) { return; }
|
||||
this->enableParts(aircraft, false);
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::request0PitchOnGround()
|
||||
{
|
||||
const CSimulatedAircraft aircraft(this->selectedObject());
|
||||
if (aircraft.getCallsign().isEmpty()) { return; }
|
||||
this->setPitchOnGround(aircraft, CAngle(0, CAngleUnit::deg()));
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::requestNullPitchOnGround()
|
||||
{
|
||||
const CSimulatedAircraft aircraft(this->selectedObject());
|
||||
if (aircraft.getCallsign().isEmpty()) { return; }
|
||||
this->setPitchOnGround(aircraft, CAngle::null());
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::requestTempDisable()
|
||||
{
|
||||
if (!m_menus.testFlag(MenuDisableModelsTemp)) { return; }
|
||||
@@ -247,6 +285,35 @@ namespace BlackGui
|
||||
simContext->followAircraft(aircraft.getCallsign());
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::enableParts(const CSimulatedAircraft &aircraft, bool enabled)
|
||||
{
|
||||
IContextSimulator *simContext = simulatorContext();
|
||||
if (!simContext || !aircraft.hasCallsign()) { return; }
|
||||
CInterpolationAndRenderingSetupPerCallsign setup = simContext->getInterpolationAndRenderingSetupPerCallsignOrDefault(aircraft.getCallsign());
|
||||
if (setup.isAircraftPartsEnabled() == enabled) { return; }
|
||||
setup.setEnabledAircraftParts(enabled);
|
||||
setup.setCallsign(aircraft.getCallsign());
|
||||
simContext->setInterpolationAndRenderingSetupsPerCallsign(setup, true);
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::setPitchOnGround(const CSimulatedAircraft &aircraft, const PhysicalQuantities::CAngle &pitch)
|
||||
{
|
||||
IContextSimulator *simContext = simulatorContext();
|
||||
if (!simContext || !aircraft.hasCallsign()) { return; }
|
||||
CInterpolationAndRenderingSetupPerCallsign setup = simContext->getInterpolationAndRenderingSetupPerCallsignOrDefault(aircraft.getCallsign());
|
||||
if (setup.getPitchOnGround() == pitch) { return; }
|
||||
setup.setPitchOnGround(pitch);
|
||||
setup.setCallsign(aircraft.getCallsign());
|
||||
simContext->setInterpolationAndRenderingSetupsPerCallsign(setup, true);
|
||||
}
|
||||
|
||||
bool CSimulatedAircraftView::isSupportingAircraftParts(const CCallsign &cs) const
|
||||
{
|
||||
const IContextNetwork *netContext = networkContext();
|
||||
if (!netContext) { return false; }
|
||||
return netContext->isRemoteAircraftSupportingParts(cs);
|
||||
}
|
||||
|
||||
void CSimulatedAircraftView::highlightInSimulator(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
IContextSimulator *simContext = simulatorContext();
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "blackgui/models/simulatedaircraftlistmodel.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/pq/angle.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -87,6 +89,16 @@ namespace BlackGui
|
||||
//! Follow in simulator
|
||||
void requestFollowInSimulator();
|
||||
|
||||
//! Enable/disable parts @{
|
||||
void requestEnableParts();
|
||||
void requestDisableParts();
|
||||
//! @}
|
||||
|
||||
//! Enable/disable parts @{
|
||||
void request0PitchOnGround();
|
||||
void requestNullPitchOnGround();
|
||||
//! @}
|
||||
|
||||
//! Request temp disabling of matching models
|
||||
void requestTempDisable();
|
||||
|
||||
@@ -108,6 +120,15 @@ namespace BlackGui
|
||||
//! Follow aircraft in simulator
|
||||
void followAircraftInSimulator(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
//! Enable aircraft parts
|
||||
void enableParts(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, bool enabled);
|
||||
|
||||
//! Set pitch
|
||||
void setPitchOnGround(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::PhysicalQuantities::CAngle &pitch);
|
||||
|
||||
//! Aircraft supporting parts?
|
||||
bool isSupportingAircraftParts(const BlackMisc::Aviation::CCallsign &cs) const;
|
||||
|
||||
//! Highlight in simulator
|
||||
void highlightInSimulator(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user