Ref T357, function to copy FSX terrain probe, also in context for remote UI

This commit is contained in:
Klaus Basan
2018-09-17 02:53:49 +02:00
parent 73c4af4c6d
commit 57178c75f9
8 changed files with 93 additions and 4 deletions

View File

@@ -248,10 +248,10 @@ namespace BlackCore
//! Request weather grid. Argument identifier is past in the signal to identify the requestor
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) = 0;
//! Repeat all mappings
//! Repeat all matchings
virtual int doMatchingsAgain() = 0;
//! Repeat the mapping
//! Repeat the matching
virtual bool doMatchingAgain(const BlackMisc::Aviation::CCallsign &callsign) = 0;
//! Current matching statistics
@@ -263,6 +263,9 @@ namespace BlackCore
//! 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) : CContext(mode, runtime) {}

View File

@@ -331,6 +331,13 @@ namespace BlackCore
{
return BlackMisc::Simulation::CAircraftMatcherSetup();
}
//! \copydoc IContextSimulator::copyFsxTerrainProbe
virtual BlackMisc::CStatusMessageList copyFsxTerrainProbe(const BlackMisc::Simulation::CSimulatorInfo &simulator) override
{
Q_UNUSED(simulator);
return BlackMisc::CStatusMessageList();
}
};
} // namespace
} // namespace

View File

@@ -18,6 +18,7 @@
#include "blackcore/pluginmanagersimulator.h"
#include "blackcore/simulator.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/compare.h"
@@ -48,6 +49,7 @@ 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::Simulation;
using namespace BlackMisc::Simulation::Settings;
@@ -811,6 +813,34 @@ namespace BlackCore
return m_aircraftMatcher.getSetup();
}
CStatusMessageList CContextSimulator::copyFsxTerrainProbe(const CSimulatorInfo &simulator)
{
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << simulator.toQString(); }
CStatusMessageList msgs;
if (!simulator.isFsxP3DFamily())
{
msgs.push_back(CStatusMessage(this, CStatusMessage::SeverityError, "Wrong simulator " + simulator.toQString()));
return msgs;
}
const QStringList modelDirs = m_simulatorSettings.getModelDirectoriesOrDefault(simulator);
if (modelDirs.isEmpty() || modelDirs.front().isEmpty())
{
msgs.push_back(CStatusMessage(this, CStatusMessage::SeverityError, "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, "No files copied"));
return msgs;
}
return msgs;
}
bool CContextSimulator::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
{
Q_UNUSED(originator);

View File

@@ -112,6 +112,7 @@ namespace BlackCore
virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const override;
virtual void setMatchingSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) override;
virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override;
virtual BlackMisc::CStatusMessageList copyFsxTerrainProbe(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
//! @}
//! \addtogroup swiftdotcommands

View File

@@ -295,5 +295,10 @@ namespace BlackCore
{
return m_dBusInterface->callDBusRet<CAircraftMatcherSetup>(QLatin1String("getMatchingSetup"));
}
CStatusMessageList CContextSimulatorProxy::copyFsxTerrainProbe(const CSimulatorInfo &simulator)
{
return m_dBusInterface->callDBusRet<CStatusMessageList>(QLatin1String("copyFsxTerrainProbe"), simulator);
}
} // namespace
} // namespace

View File

@@ -97,6 +97,7 @@ namespace BlackCore
virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const override;
virtual void setMatchingSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) override;
virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override;
virtual BlackMisc::CStatusMessageList copyFsxTerrainProbe(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
//! @}
private: