From 48dccd937fe7b67a0089c547c8e53ca77c118524 Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Sun, 24 Mar 2024 22:25:26 +0100 Subject: [PATCH] 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). --- src/blackcore/context/contextsimulator.h | 3 -- src/blackcore/context/contextsimulatorempty.h | 7 ---- .../context/contextsimulatorimpl.cpp | 30 ------------- src/blackcore/context/contextsimulatorimpl.h | 3 -- .../context/contextsimulatorproxy.cpp | 5 --- src/blackcore/context/contextsimulatorproxy.h | 3 -- .../fsxcommon/fsxsettingscomponent.cpp | 12 ------ .../fsxcommon/fsxsettingscomponent.h | 3 -- .../fsxcommon/fsxsettingscomponent.ui | 42 ++++--------------- 9 files changed, 9 insertions(+), 99 deletions(-) diff --git a/src/blackcore/context/contextsimulator.h b/src/blackcore/context/contextsimulator.h index 5986770c1..172af07ad 100644 --- a/src/blackcore/context/contextsimulator.h +++ b/src/blackcore/context/contextsimulator.h @@ -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) {} diff --git a/src/blackcore/context/contextsimulatorempty.h b/src/blackcore/context/contextsimulatorempty.h index 8d85f77a7..ce1cdb46b 100644 --- a/src/blackcore/context/contextsimulatorempty.h +++ b/src/blackcore/context/contextsimulatorempty.h @@ -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 diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index 06ea53dc5..2d0bc4bfd 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -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; } diff --git a/src/blackcore/context/contextsimulatorimpl.h b/src/blackcore/context/contextsimulatorimpl.h index e8ed93870..93668244a 100644 --- a/src/blackcore/context/contextsimulatorimpl.h +++ b/src/blackcore/context/contextsimulatorimpl.h @@ -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; diff --git a/src/blackcore/context/contextsimulatorproxy.cpp b/src/blackcore/context/contextsimulatorproxy.cpp index 9de3c3c81..6f1f4bec5 100644 --- a/src/blackcore/context/contextsimulatorproxy.cpp +++ b/src/blackcore/context/contextsimulatorproxy.cpp @@ -366,11 +366,6 @@ namespace BlackCore::Context return m_dBusInterface->callDBusRet(QLatin1String("getMatchingSetup")); } - CStatusMessageList CContextSimulatorProxy::copyFsxTerrainProbe(const CSimulatorInfo &simulator) - { - return m_dBusInterface->callDBusRet(QLatin1String("copyFsxTerrainProbe"), simulator); - } - bool CContextSimulatorProxy::testRemoteAircraft(const CSimulatedAircraft &aircraft, bool add) { return m_dBusInterface->callDBusRet(QLatin1String("testRemoteAircraft"), aircraft, add); diff --git a/src/blackcore/context/contextsimulatorproxy.h b/src/blackcore/context/contextsimulatorproxy.h index e8759cbf2..8504e5c10 100644 --- a/src/blackcore/context/contextsimulatorproxy.h +++ b/src/blackcore/context/contextsimulatorproxy.h @@ -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; diff --git a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp index 72d77e39a..1a12686a7 100644 --- a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp +++ b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp @@ -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); diff --git a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.h b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.h index 67ef74b45..881d2af9f 100644 --- a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.h +++ b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.h @@ -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); diff --git a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.ui b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.ui index 79e8ab9c0..ec02e78d7 100644 --- a/src/plugins/simulator/fsxcommon/fsxsettingscomponent.ui +++ b/src/plugins/simulator/fsxcommon/fsxsettingscomponent.ui @@ -7,7 +7,7 @@ 0 0 296 - 275 + 400 @@ -59,42 +59,19 @@ - - - - - - copy terrain probe - - - - - - - refresh - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + refresh + - Use the terrain probe (32bit only) + Use the terrain probe (32bit only) (needs to be installed through the config wizard first) + + + true @@ -129,7 +106,6 @@ cb_SBOffsets cb_AddingAsSimulatedObject cb_EnableTerrainProbe - pb_CopyTerrainProbe pb_Refresh