mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Ref T357, FSX settings component allows to copy terrain probe via context
This commit is contained in:
@@ -10,10 +10,15 @@
|
||||
#include "fsxsettingscomponent.h"
|
||||
#include "ui_fsxsettingscomponent.h"
|
||||
#include "simulatorfsxcommon.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Context;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
@@ -28,6 +33,7 @@ namespace BlackSimPlugin
|
||||
|
||||
connect(ui->cb_TraceSimConnectCalls, &QCheckBox::released, this, &CFsxSettingsComponent::onSimConnectTraceChanged);
|
||||
connect(ui->cb_EnableTerrainProbe, &QCheckBox::released, this, &CFsxSettingsComponent::onEnableTerrainProbeChanged);
|
||||
connect(ui->pb_CopyTerrainProbe, &QPushButton::released, this, &CFsxSettingsComponent::copyTerrainProbe);
|
||||
|
||||
const CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||
if (fsx)
|
||||
@@ -40,6 +46,12 @@ namespace BlackSimPlugin
|
||||
CFsxSettingsComponent::~CFsxSettingsComponent()
|
||||
{ }
|
||||
|
||||
CSimulatorInfo CFsxSettingsComponent::getSimulator() const
|
||||
{
|
||||
const CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||
return fsx ? fsx->getSimulatorInfo() : m_simulator;
|
||||
}
|
||||
|
||||
void CFsxSettingsComponent::onSimConnectTraceChanged()
|
||||
{
|
||||
CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||
@@ -54,6 +66,16 @@ namespace BlackSimPlugin
|
||||
fsx->setUsingFsxTerrainProbe(ui->cb_EnableTerrainProbe->isChecked());
|
||||
}
|
||||
|
||||
void CFsxSettingsComponent::copyTerrainProbe()
|
||||
{
|
||||
if (!sGui || !sGui->getIContextSimulator() || sGui->isShuttingDown()) { return; }
|
||||
const CSimulatorInfo simulator(this->getSimulator());
|
||||
const CStatusMessageList msgs = sGui->getIContextSimulator()->copyFsxTerrainProbe(simulator);
|
||||
CLogMessage::preformatted(msgs);
|
||||
if (!m_mf) { m_mf = CGuiUtility::nextOverlayMessageFrame(this); }
|
||||
if (m_mf) { m_mf->showOverlayMessages(msgs); }
|
||||
}
|
||||
|
||||
CSimulatorFsxCommon *CFsxSettingsComponent::getFsxSimulator() const
|
||||
{
|
||||
if (!sGui || !sGui->getISimulator() || sGui->isShuttingDown()) { return nullptr; }
|
||||
|
||||
Reference in New Issue
Block a user