mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refactor: Remove FSX specific method from context
This method was only uses to provide a secondary way installing the terrain probe. For simplicity we should only provide a single way to install the probe (through the config wizard).
This commit is contained in:
@@ -330,9 +330,6 @@ namespace BlackCore::Context
|
||||
//! Get matching setup
|
||||
virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const = 0;
|
||||
|
||||
//! Copy the terrain probe
|
||||
virtual BlackMisc::CStatusMessageList copyFsxTerrainProbe(const BlackMisc::Simulation::CSimulatorInfo &simulator) = 0;
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IContextSimulator(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) : IContext(mode, runtime) {}
|
||||
|
||||
@@ -435,13 +435,6 @@ namespace BlackCore::Context
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return BlackMisc::Simulation::CAircraftMatcherSetup();
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::copyFsxTerrainProbe
|
||||
virtual BlackMisc::CStatusMessageList copyFsxTerrainProbe(const BlackMisc::Simulation::CSimulatorInfo &simulator) override
|
||||
{
|
||||
Q_UNUSED(simulator)
|
||||
return BlackMisc::CStatusMessageList();
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include "blackmisc/simulation/matchingutils.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
@@ -45,7 +44,6 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::XPlane;
|
||||
using namespace BlackMisc::Simulation::FsCommon;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Weather;
|
||||
using namespace BlackMisc::Simulation;
|
||||
@@ -1004,34 +1002,6 @@ namespace BlackCore::Context
|
||||
return m_aircraftMatcher.getSetup();
|
||||
}
|
||||
|
||||
CStatusMessageList CContextSimulator::copyFsxTerrainProbe(const CSimulatorInfo &simulator)
|
||||
{
|
||||
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << simulator.toQString(); }
|
||||
|
||||
CStatusMessageList msgs;
|
||||
if (!simulator.isFsxP3DFamily())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(this, CStatusMessage::SeverityError, u"Wrong simulator " % simulator.toQString()));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
const QStringList modelDirs = m_multiSimulatorSettings.getModelDirectoriesOrDefault(simulator);
|
||||
if (modelDirs.isEmpty() || modelDirs.front().isEmpty())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(this, CStatusMessage::SeverityError, u"No model directory"));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
const int copied = CFsCommonUtil::copyFsxTerrainProbeFiles(modelDirs.front(), msgs);
|
||||
if (copied < 1 && !msgs.hasWarningOrErrorMessages())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(this, CStatusMessage::SeverityError, u"No files copied"));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
return msgs;
|
||||
}
|
||||
|
||||
bool CContextSimulator::testRemoteAircraft(const CSimulatedAircraft &aircraft, bool add)
|
||||
{
|
||||
if (!m_simulatorPlugin.second || !m_simulatorPlugin.second->isConnected()) { return false; }
|
||||
|
||||
@@ -225,9 +225,6 @@ namespace BlackCore
|
||||
//! \copydoc BlackCore::Context::IContextSimulator::getMatchingSetup
|
||||
virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextSimulator::copyFsxTerrainProbe
|
||||
virtual BlackMisc::CStatusMessageList copyFsxTerrainProbe(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextSimulator::testRemoteAircraft
|
||||
virtual bool testRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, bool add) override;
|
||||
|
||||
|
||||
@@ -366,11 +366,6 @@ namespace BlackCore::Context
|
||||
return m_dBusInterface->callDBusRet<CAircraftMatcherSetup>(QLatin1String("getMatchingSetup"));
|
||||
}
|
||||
|
||||
CStatusMessageList CContextSimulatorProxy::copyFsxTerrainProbe(const CSimulatorInfo &simulator)
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CStatusMessageList>(QLatin1String("copyFsxTerrainProbe"), simulator);
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::testRemoteAircraft(const CSimulatedAircraft &aircraft, bool add)
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("testRemoteAircraft"), aircraft, add);
|
||||
|
||||
@@ -216,9 +216,6 @@ namespace BlackCore
|
||||
//! \copydoc BlackCore::Context::IContextSimulator::getMatchingSetup
|
||||
virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextSimulator::copyFsxTerrainProbe
|
||||
virtual BlackMisc::CStatusMessageList copyFsxTerrainProbe(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextSimulator::testRemoteAircraft
|
||||
virtual bool testRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, bool add) override;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace BlackSimPlugin::FsxCommon
|
||||
connect(ui->cb_TraceSimConnectCalls, &QCheckBox::released, this, &CFsxSettingsComponent::onSimConnectTraceChanged);
|
||||
connect(ui->cb_EnableTerrainProbe, &QCheckBox::released, this, &CFsxSettingsComponent::onEnableTerrainProbeChanged);
|
||||
connect(ui->cb_SBOffsets, &QCheckBox::released, this, &CFsxSettingsComponent::onSBOffsetsChanged);
|
||||
connect(ui->pb_CopyTerrainProbe, &QPushButton::released, this, &CFsxSettingsComponent::copyTerrainProbe);
|
||||
connect(ui->pb_Refresh, &QPushButton::released, this, &CFsxSettingsComponent::refresh);
|
||||
|
||||
if (sGui && sGui->getIContextSimulator())
|
||||
@@ -75,7 +74,6 @@ namespace BlackSimPlugin::FsxCommon
|
||||
|
||||
const bool terrainProbe = CBuildConfig::isRunningOnWindowsNtPlatform() && (CBuildConfig::buildWordSize() == 32);
|
||||
ui->cb_EnableTerrainProbe->setEnabled(terrainProbe);
|
||||
ui->pb_CopyTerrainProbe->setVisible(terrainProbe);
|
||||
}
|
||||
|
||||
void CFsxSettingsComponent::onSimConnectTraceChanged()
|
||||
@@ -106,16 +104,6 @@ namespace BlackSimPlugin::FsxCommon
|
||||
fsxOrP3D->setUsingSbOffsetValues(ui->cb_SBOffsets->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); }
|
||||
}
|
||||
|
||||
void CFsxSettingsComponent::onSimulatorStatusChanged(int status)
|
||||
{
|
||||
Q_UNUSED(status);
|
||||
|
||||
@@ -58,9 +58,6 @@ namespace BlackSimPlugin::FsxCommon
|
||||
//! Offsets on/off
|
||||
void onSBOffsetsChanged();
|
||||
|
||||
//! Copy the terrain probe
|
||||
void copyTerrainProbe();
|
||||
|
||||
//! Status has been changed
|
||||
void onSimulatorStatusChanged(int status);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>296</width>
|
||||
<height>275</height>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -59,42 +59,19 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pb_CopyTerrainProbe">
|
||||
<property name="text">
|
||||
<string>copy terrain probe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pb_Refresh">
|
||||
<property name="text">
|
||||
<string>refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_Buttons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QPushButton" name="pb_Refresh">
|
||||
<property name="text">
|
||||
<string>refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="lbl_TraceTerrainProbe">
|
||||
<property name="text">
|
||||
<string>Use the terrain probe (32bit only)</string>
|
||||
<string>Use the terrain probe (32bit only) (needs to be installed through the config wizard first)</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -129,7 +106,6 @@
|
||||
<tabstop>cb_SBOffsets</tabstop>
|
||||
<tabstop>cb_AddingAsSimulatedObject</tabstop>
|
||||
<tabstop>cb_EnableTerrainProbe</tabstop>
|
||||
<tabstop>pb_CopyTerrainProbe</tabstop>
|
||||
<tabstop>pb_Refresh</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
||||
Reference in New Issue
Block a user