mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +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; }
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CFsxSettingsComponent; }
|
||||
namespace BlackGui { class COverlayMessagesFrame; }
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace FsxCommon
|
||||
@@ -38,6 +39,9 @@ namespace BlackSimPlugin
|
||||
//! Simulator, P3D/FSX
|
||||
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) { m_simulator = simulator; }
|
||||
|
||||
//! Represented simulator
|
||||
BlackMisc::Simulation::CSimulatorInfo getSimulator() const;
|
||||
|
||||
private:
|
||||
//! Trace checkbox changed
|
||||
void onSimConnectTraceChanged();
|
||||
@@ -45,10 +49,14 @@ namespace BlackSimPlugin
|
||||
//! Terrain probe checkbox changed
|
||||
void onEnableTerrainProbeChanged();
|
||||
|
||||
//! Copy the terrain probe
|
||||
void copyTerrainProbe();
|
||||
|
||||
//! Access the concrete implementation
|
||||
CSimulatorFsxCommon *getFsxSimulator () const;
|
||||
CSimulatorFsxCommon *getFsxSimulator() const;
|
||||
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator { "FSX" };
|
||||
BlackGui::COverlayMessagesFrame *m_mf = nullptr;
|
||||
QScopedPointer<Ui::CFsxSettingsComponent> ui;
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -7,13 +7,20 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>180</width>
|
||||
<height>64</height>
|
||||
<height>87</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FSX settings</string>
|
||||
<string>FSX/P3D settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_FsxSettingsComponent" columnstretch="0,1">
|
||||
<layout class="QGridLayout" name="gl_SettingsComponent" columnstretch="0,1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lbl_TraceTerrainProbe">
|
||||
<property name="text">
|
||||
<string>Use the terrain probe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cb_TraceSimConnectCalls">
|
||||
<property name="text">
|
||||
@@ -21,6 +28,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" alignment="Qt::AlignLeft">
|
||||
<widget class="QPushButton" name="pb_CopyTerrainProbe">
|
||||
<property name="text">
|
||||
<string> copy terrain probe </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lbl_TraceSimConnectCalls">
|
||||
<property name="text">
|
||||
@@ -38,13 +52,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lbl_TraceTerrainProbe">
|
||||
<property name="text">
|
||||
<string>Use the terrain probe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@@ -265,9 +265,22 @@ console=1
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="hl_SimConnectCfgButtons">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="hs_SimConnectCfgButtons">
|
||||
<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_OpenSwiftSimConnectCfg">
|
||||
<property name="sizePolicy">
|
||||
|
||||
Reference in New Issue
Block a user