mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-03 16:25:54 +08:00
Ref T528, avoid crash (assert) if simulator object is not accessible (remote UI)
Also disable some UI elements in that case + display an info
This commit is contained in:
committed by
Mat Sutcliffe
parent
ddd44edebd
commit
2031ba3d8b
@@ -69,6 +69,7 @@ namespace BlackSimPlugin
|
|||||||
void CFsxSettingsComponent::refresh()
|
void CFsxSettingsComponent::refresh()
|
||||||
{
|
{
|
||||||
const CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
|
const CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
|
||||||
|
const bool localSim = fsxOrP3D;
|
||||||
if (fsxOrP3D)
|
if (fsxOrP3D)
|
||||||
{
|
{
|
||||||
ui->cb_TraceSimConnectCalls->setChecked(fsxOrP3D->isTracingSendId());
|
ui->cb_TraceSimConnectCalls->setChecked(fsxOrP3D->isTracingSendId());
|
||||||
@@ -77,6 +78,12 @@ namespace BlackSimPlugin
|
|||||||
ui->cb_UseFsuipc->setChecked(fsxOrP3D->isFsuipcOpened());
|
ui->cb_UseFsuipc->setChecked(fsxOrP3D->isFsuipcOpened());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->lbl_NoLocalSimulator->setVisible(!localSim);
|
||||||
|
ui->cb_TraceSimConnectCalls->setEnabled(localSim);
|
||||||
|
ui->cb_EnableTerrainProbe->setEnabled(localSim);
|
||||||
|
ui->cb_SBOffsets->setEnabled(localSim);
|
||||||
|
ui->cb_UseFsuipc->setEnabled(localSim);
|
||||||
|
|
||||||
const bool terrainProbe = CBuildConfig::isRunningOnWindowsNtPlatform() && (CBuildConfig::buildWordSize() == 32);
|
const bool terrainProbe = CBuildConfig::isRunningOnWindowsNtPlatform() && (CBuildConfig::buildWordSize() == 32);
|
||||||
ui->cb_EnableTerrainProbe->setEnabled(terrainProbe);
|
ui->cb_EnableTerrainProbe->setEnabled(terrainProbe);
|
||||||
ui->pb_CopyTerrainProbe->setVisible(terrainProbe);
|
ui->pb_CopyTerrainProbe->setVisible(terrainProbe);
|
||||||
@@ -134,10 +141,13 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
CSimulatorFsxCommon *CFsxSettingsComponent::getFsxOrP3DSimulator() const
|
CSimulatorFsxCommon *CFsxSettingsComponent::getFsxOrP3DSimulator() const
|
||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator() || !sGui->getISimulator()) { return nullptr; }
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return nullptr; }
|
||||||
const CSimulatorPluginInfo plugin = sGui->getIContextSimulator()->getSimulatorPluginInfo();
|
const CSimulatorPluginInfo plugin = sGui->getIContextSimulator()->getSimulatorPluginInfo();
|
||||||
if (plugin.isEmulatedPlugin()) { return nullptr; } // cast would fail
|
if (plugin.isEmulatedPlugin()) { return nullptr; } // cast would fail
|
||||||
|
|
||||||
|
// ISimulator can only be obtained in local environment, not distributed UI
|
||||||
|
if (!sGui->hasSimulator()) { return nullptr; }
|
||||||
|
|
||||||
ISimulator *simulator = sGui->getISimulator().data();
|
ISimulator *simulator = sGui->getISimulator().data();
|
||||||
if (!simulator || simulator->isEmulatedDriver()) { return nullptr; }
|
if (!simulator || simulator->isEmulatedDriver()) { return nullptr; }
|
||||||
if (!simulator->getSimulatorInfo().isFsxP3DFamily()) { return nullptr; }
|
if (!simulator->getSimulatorInfo().isFsxP3DFamily()) { return nullptr; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>254</width>
|
<width>254</width>
|
||||||
<height>147</height>
|
<height>174</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -109,6 +109,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="lbl_NoLocalSimulator">
|
||||||
|
<property name="text">
|
||||||
|
<string>Looks like you are running a remote GUI, these settings only work locally. Use core settings.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
|||||||
Reference in New Issue
Block a user