10 #include "ui_fsxsettingscomponent.h"
18 using namespace swift::core::context;
21 using namespace swift::misc::simulation;
22 using namespace swift::config;
24 namespace swift::simplugin::fsxcommon
26 CFsxSettingsComponent::CFsxSettingsComponent(QWidget *parent) : QFrame(parent), ui(new Ui::
CFsxSettingsComponent)
29 ui->cb_TraceSimConnectCalls->setChecked(
false);
31 connect(ui->cb_AddingAsSimulatedObject, &QCheckBox::released,
this,
32 &CFsxSettingsComponent::onSimulatedObjectChanged);
33 connect(ui->cb_TraceSimConnectCalls, &QCheckBox::released,
this,
34 &CFsxSettingsComponent::onSimConnectTraceChanged);
35 connect(ui->cb_EnableTerrainProbe, &QCheckBox::released,
this,
36 &CFsxSettingsComponent::onEnableTerrainProbeChanged);
37 connect(ui->cb_SBOffsets, &QCheckBox::released,
this, &CFsxSettingsComponent::onSBOffsetsChanged);
43 &CFsxSettingsComponent::onSimulatorStatusChanged, Qt::QueuedConnection);
45 &CFsxSettingsComponent::onSimulatorPluginChanged, Qt::QueuedConnection);
48 QPointer<CFsxSettingsComponent> myself(
this);
66 const bool localSim = fsxOrP3D;
69 ui->cb_TraceSimConnectCalls->setChecked(fsxOrP3D->
isTraceSendId());
75 ui->lbl_NoLocalSimulator->setVisible(!localSim);
76 ui->cb_TraceSimConnectCalls->setEnabled(localSim);
77 ui->cb_EnableTerrainProbe->setEnabled(CBuildConfig::isRunningOnWindowsNtPlatform() &&
78 (CBuildConfig::buildWordSize() == 32) && localSim);
79 ui->cb_SBOffsets->setEnabled(localSim);
82 void CFsxSettingsComponent::onSimConnectTraceChanged()
85 if (!fsxOrP3D) {
return; }
89 void CFsxSettingsComponent::onSimulatedObjectChanged()
91 CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
92 if (!fsxOrP3D) {
return; }
93 fsxOrP3D->setAddingAsSimulatedObjectEnabled(ui->cb_AddingAsSimulatedObject->isChecked());
96 void CFsxSettingsComponent::onEnableTerrainProbeChanged()
98 CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
99 if (!fsxOrP3D) {
return; }
100 fsxOrP3D->setUsingFsxTerrainProbe(ui->cb_EnableTerrainProbe->isChecked());
103 void CFsxSettingsComponent::onSBOffsetsChanged()
105 CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
106 if (!fsxOrP3D) {
return; }
107 fsxOrP3D->setUsingSbOffsetValues(ui->cb_SBOffsets->isChecked());
110 void CFsxSettingsComponent::onSimulatorStatusChanged(
int status)
122 CSimulatorFsxCommon *CFsxSettingsComponent::getFsxOrP3DSimulator()
const
137 CSimulatorFsxCommon *fsx =
static_cast<CSimulatorFsxCommon *
>(simulator);
QPointer< ISimulator > getISimulator() const
The simulator plugin, if available.
bool hasSimulator() const
Simulator object available?
bool isShuttingDown() const
Is application shutting down?
const context::IContextSimulator * getIContextSimulator() const
Direct access to contexts if a CCoreFacade has been initialized.
Interface to a simulator.
bool isEmulatedDriver() const
Is this the emulated driver just pretending to be P3D, FSX, or XPlane.
virtual swift::misc::simulation::CSimulatorPluginInfo getSimulatorPluginInfo() const =0
Simulator info, currently loaded plugin.
Simple hardcoded info about the corresponding simulator.
bool isFsxP3DFamily() const
FSX family, i.e. FSX or P3D?
Describing a simulator plugin.
bool isEmulatedPlugin() const
Is this the emulated driver?
CSimulatorInfo getSimulatorInfo() const
Get the represented simulator.
virtual ~CFsxSettingsComponent()
Destructor.
swift::misc::simulation::CSimulatorInfo getSimulator() const
Represented simulator.
void refresh()
Update the values.
FSX Simulator Implementation.
bool isUsingFsxTerrainProbe() const
FSX Terrain probe.
void setTractingSendId(bool trace)
Set tracing on/off.
bool isAddingAsSimulatedObjectEnabled() const
Allow adding as simulated object instead of non ATC.
bool isTraceSendId() const
Trace enable (can be auto enable also)
bool isUsingSbOffsetValues() const
Using the SB offsets?
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...