mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 17:55:34 +08:00
Removed old model/views for aircraft, now all with simulated aircraft
Updates of models in view now manually / automatic possible Allow to reload models (in backend)
This commit is contained in:
@@ -117,6 +117,9 @@ namespace BlackCore
|
||||
//! Airports in range
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const = 0;
|
||||
|
||||
//! Reload models from disk
|
||||
virtual void reloadInstalledModels() = 0;
|
||||
|
||||
//! Installed models in simulator eco system
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
||||
|
||||
|
||||
@@ -58,49 +58,49 @@ namespace BlackCore
|
||||
|
||||
bool CContextSimulator::isConnected() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->isConnected();
|
||||
}
|
||||
|
||||
bool CContextSimulator::canConnect() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->canConnect();
|
||||
}
|
||||
|
||||
bool CContextSimulator::connectToSimulator()
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->connectTo();
|
||||
}
|
||||
|
||||
void CContextSimulator::asyncConnectToSimulator()
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator || m_canConnectResult.isRunning()) return; // already checking
|
||||
m_simulator->asyncConnectTo();
|
||||
}
|
||||
|
||||
bool CContextSimulator::disconnectFromSimulator()
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->disconnectFrom();
|
||||
}
|
||||
|
||||
BlackSim::CSimulatorInfo CContextSimulator::getSimulatorInfo() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return BlackSim::CSimulatorInfo::UnspecifiedSim();
|
||||
return m_simulator->getSimulatorInfo();
|
||||
}
|
||||
|
||||
CAirportList CContextSimulator::getAirportsInRange() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
// If no ISimulator object is available, return a dummy.
|
||||
if (!m_simulator) { return CAirportList(); }
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace BlackCore
|
||||
|
||||
CAircraftModelList CContextSimulator::getInstalledModels() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
// If no ISimulator object is available, return a dummy.
|
||||
if (!m_simulator) { return CAircraftModelList(); }
|
||||
|
||||
@@ -118,21 +118,28 @@ namespace BlackCore
|
||||
|
||||
CAircraftModelList CContextSimulator::getInstalledModelsStartingWith(const QString modelString) const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
|
||||
if (!m_simulator) { return CAircraftModelList(); }
|
||||
return this->m_simulator->getInstalledModels().findModelsStartingWith(modelString);
|
||||
}
|
||||
|
||||
void CContextSimulator::reloadInstalledModels()
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) { return; }
|
||||
m_simulator->reloadInstalledModels();
|
||||
}
|
||||
|
||||
CAircraftIcao CContextSimulator::getIcaoForModelString(const QString &modelString) const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
|
||||
if (!m_simulator) { return CAircraftIcao(); }
|
||||
return this->m_simulator->getIcaoForModelString(modelString);
|
||||
}
|
||||
|
||||
bool CContextSimulator::setTimeSynchronization(bool enable, CTime offset)
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) { return false; }
|
||||
bool c = this->m_simulator->setTimeSynchronization(enable, offset);
|
||||
if (!c) { return false; }
|
||||
@@ -149,7 +156,7 @@ namespace BlackCore
|
||||
|
||||
bool CContextSimulator::isTimeSynchronized() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return this->m_simulator->isTimeSynchronized();
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
||||
|
||||
//! \copydoc IContextSimulator::reloadInstalledModels
|
||||
virtual void reloadInstalledModels() override;
|
||||
|
||||
//! \copydoc IContextSimulator::getIcaoForModelString
|
||||
virtual BlackMisc::Aviation::CAircraftIcao getIcaoForModelString(const QString &modelString) const override;
|
||||
|
||||
|
||||
@@ -99,6 +99,11 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::Simulation::CAircraftModelList>(QLatin1Literal("getInstalledModelsStartingWith"), modelString);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::reloadInstalledModels()
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("reloadInstalledModels"));
|
||||
}
|
||||
|
||||
CAircraftIcao CContextSimulatorProxy::getIcaoForModelString(const QString &modelString) const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CAircraftIcao>(QLatin1Literal("getIcaoForModelString"), modelString);
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
||||
|
||||
//! \copydoc IContextSimulator::reloadInstalledModels
|
||||
virtual void reloadInstalledModels() override;
|
||||
|
||||
//! \copydoc IContextSimulator::getIcaoForModelString
|
||||
virtual BlackMisc::Aviation::CAircraftIcao getIcaoForModelString(const QString &modelString) const override;
|
||||
|
||||
|
||||
@@ -109,6 +109,9 @@ namespace BlackCore
|
||||
//! Aircraft models for available remote aircrafts
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
||||
|
||||
//! Reload the installed models
|
||||
virtual void reloadInstalledModels() = 0;
|
||||
|
||||
//! Airports in range
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user