mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
Make FSUIPC/SB offsets configurable
* based https://swift-project.slack.com/archives/CC6THKCAZ/p1538387046000100 * "dot" commands added * Plugin settings
This commit is contained in:
@@ -75,7 +75,7 @@ namespace BlackSimPlugin
|
||||
static void registerHelp();
|
||||
|
||||
std::unique_ptr<CFsuipc> m_fsuipc; //!< FSUIPC
|
||||
bool m_useFsuipc = true; //!< use FSUIPC
|
||||
bool m_useFsuipc = false; //!< use FSUIPC
|
||||
bool m_simPaused = false; //!< Simulator paused?
|
||||
bool m_simTimeSynced = false; //!< Time synchronized?
|
||||
BlackMisc::PhysicalQuantities::CTime m_syncTimeOffset; //!< time offset
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace BlackSimPlugin
|
||||
|
||||
connect(ui->cb_TraceSimConnectCalls, &QCheckBox::released, this, &CFsxSettingsComponent::onSimConnectTraceChanged);
|
||||
connect(ui->cb_EnableTerrainProbe, &QCheckBox::released, this, &CFsxSettingsComponent::onEnableTerrainProbeChanged);
|
||||
connect(ui->cb_UseFsuipc, &QCheckBox::released, this, &CFsxSettingsComponent::onFsuipcChanged);
|
||||
connect(ui->cb_SBOffsets, &QCheckBox::released, this, &CFsxSettingsComponent::onSBOffsetsChanged);
|
||||
connect(ui->pb_CopyTerrainProbe, &QPushButton::released, this, &CFsxSettingsComponent::copyTerrainProbe);
|
||||
|
||||
const CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||
@@ -40,6 +42,8 @@ namespace BlackSimPlugin
|
||||
{
|
||||
ui->cb_TraceSimConnectCalls->setChecked(fsx->isTracingSendId());
|
||||
ui->cb_EnableTerrainProbe->setChecked(fsx->isUsingFsxTerrainProbe());
|
||||
ui->cb_SBOffsets->setChecked(fsx->isUsingSbOffsetValues());
|
||||
ui->cb_UseFsuipc->setChecked(fsx->isFsuipcConnected());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +70,20 @@ namespace BlackSimPlugin
|
||||
fsx->setUsingFsxTerrainProbe(ui->cb_EnableTerrainProbe->isChecked());
|
||||
}
|
||||
|
||||
void CFsxSettingsComponent::onFsuipcChanged()
|
||||
{
|
||||
CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||
if (!fsx) { return; }
|
||||
fsx->useFsuipc(ui->cb_UseFsuipc->isChecked());
|
||||
}
|
||||
|
||||
void CFsxSettingsComponent::onSBOffsetsChanged()
|
||||
{
|
||||
CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||
if (!fsx) { return; }
|
||||
fsx->setUsingSbOffsetValues(ui->cb_SBOffsets->isChecked());
|
||||
}
|
||||
|
||||
void CFsxSettingsComponent::copyTerrainProbe()
|
||||
{
|
||||
if (!sGui || !sGui->getIContextSimulator() || sGui->isShuttingDown()) { return; }
|
||||
|
||||
@@ -49,6 +49,12 @@ namespace BlackSimPlugin
|
||||
//! Terrain probe checkbox changed
|
||||
void onEnableTerrainProbeChanged();
|
||||
|
||||
//! FSUIPC setting changed
|
||||
void onFsuipcChanged();
|
||||
|
||||
//! Offsets on/off
|
||||
void onSBOffsetsChanged();
|
||||
|
||||
//! Copy the terrain probe
|
||||
void copyTerrainProbe();
|
||||
|
||||
|
||||
@@ -7,20 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>180</width>
|
||||
<height>87</height>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FSX/P3D settings</string>
|
||||
</property>
|
||||
<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>
|
||||
<layout class="QGridLayout" name="gl_Settings" columnstretch="0,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cb_TraceSimConnectCalls">
|
||||
<property name="text">
|
||||
@@ -28,10 +21,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" alignment="Qt::AlignLeft">
|
||||
<widget class="QPushButton" name="pb_CopyTerrainProbe">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_UseFsuipc">
|
||||
<property name="text">
|
||||
<string> copy terrain probe </string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -45,15 +38,57 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lbl_SBOffsets">
|
||||
<property name="text">
|
||||
<string>Enable SB SimConnect offsets</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="lbl_TraceTerrainProbe">
|
||||
<property name="text">
|
||||
<string>Use the terrain probe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cb_EnableTerrainProbe">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cb_SBOffsets">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lbl_UseFsuipc">
|
||||
<property name="text">
|
||||
<string>Enable FSUIPC support</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="pb_CopyTerrainProbe">
|
||||
<property name="text">
|
||||
<string> copy terrain probe </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>cb_TraceSimConnectCalls</tabstop>
|
||||
<tabstop>cb_UseFsuipc</tabstop>
|
||||
<tabstop>cb_SBOffsets</tabstop>
|
||||
<tabstop>cb_EnableTerrainProbe</tabstop>
|
||||
<tabstop>pb_CopyTerrainProbe</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1198,6 +1198,16 @@ namespace BlackSimPlugin
|
||||
CLogMessage(this, CLogCategory::cmdLine()).info("Tracing %1 driver sendIds is '%2'") << this->getSimulatorPluginInfo().getIdentifier() << boolToOnOff(trace);
|
||||
return true;
|
||||
}
|
||||
|
||||
// .driver sboffsets on|off
|
||||
if (parser.matchesPart(1, "sboffsets") && parser.hasPart(2))
|
||||
{
|
||||
const bool on = parser.toBool(2);
|
||||
this->setUsingSbOffsetValues(on);
|
||||
CLogMessage(this, CLogCategory::cmdLine()).info("SB offsets is '%1'") << boolToOnOff(on);
|
||||
return true;
|
||||
}
|
||||
|
||||
return CSimulatorFsCommon::parseDetails(parser);
|
||||
}
|
||||
|
||||
@@ -1206,6 +1216,7 @@ namespace BlackSimPlugin
|
||||
if (CSimpleCommandParser::registered("BlackSimPlugin::CSimulatorFsxCommon::CSimulatorFsxCommon")) { return; }
|
||||
CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"});
|
||||
CSimpleCommandParser::registerCommand({".drv sendid on|off", "Trace simConnect sendId on|off"});
|
||||
CSimpleCommandParser::registerCommand({".drv sboffsets on|off", "SB offsets via simConnect on|off"});
|
||||
}
|
||||
|
||||
CCallsign CSimulatorFsxCommon::getCallsignForPendingProbeRequests(DWORD requestId, bool remove)
|
||||
|
||||
@@ -168,6 +168,12 @@ namespace BlackSimPlugin
|
||||
//! FSX terrain probe
|
||||
void setUsingFsxTerrainProbe(bool use) { m_useFsxTerrainProbe = use; }
|
||||
|
||||
//! Using the SB offsets?
|
||||
bool isUsingSbOffsetValues() const { return m_useSbOffsets; }
|
||||
|
||||
//! Use SB offset values
|
||||
void setUsingSbOffsetValues(bool use) { m_useSbOffsets = use; }
|
||||
|
||||
//! Request for sim data (request in range of sim data)?
|
||||
static bool isRequestForSimObjAircraft(DWORD requestId) { return requestId >= RequestSimObjAircraftStart && requestId <= RequestSimObjAircraftRangeEnd; }
|
||||
|
||||
@@ -220,7 +226,7 @@ namespace BlackSimPlugin
|
||||
//! \addtogroup swiftdotcommands
|
||||
//! @{
|
||||
//! <pre>
|
||||
//! .drv sendid on|off tracing simCOnnect sendId on/off
|
||||
//! .drv sendid on|off tracing simConnect sendId on/off
|
||||
//! </pre>
|
||||
//! @}
|
||||
virtual bool parseDetails(const BlackMisc::CSimpleCommandParser &parser) override;
|
||||
@@ -272,9 +278,9 @@ namespace BlackSimPlugin
|
||||
CSimConnectObjects m_simConnectObjects; //!< AI objects and their object and request ids
|
||||
|
||||
// probes
|
||||
bool m_useFsxTerrainProbe = true; //!< Use FSX Terrain probe?
|
||||
bool m_useFsxTerrainProbe = true; //!< Use FSX Terrain probe?
|
||||
bool m_initFsxTerrainProbes = false; //!< initialized terrain probes
|
||||
int m_addedProbes = 0; //!< added probes
|
||||
int m_addedProbes = 0; //!< added probes
|
||||
QMap<DWORD, BlackMisc::Aviation::CCallsign> m_pendingProbeRequests; //!< pending elevation requests: requestId/aircraft callsign
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user