mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
@@ -14,6 +14,7 @@
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
#include "blacksim/simulatorinfo.h"
|
||||
#include "blacksim/simulatorinfolist.h"
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackCore
|
||||
@@ -48,6 +49,9 @@ namespace BlackCore
|
||||
|
||||
public slots:
|
||||
|
||||
//! Return list of available simulator plugins
|
||||
virtual BlackSim::CSimulatorInfoList getAvailableSimulatorPlugins() const = 0;
|
||||
|
||||
//! Returns true when simulator is connected and available
|
||||
virtual bool isConnected() const = 0;
|
||||
|
||||
|
||||
@@ -33,6 +33,16 @@ namespace BlackCore
|
||||
unloadSimulatorPlugin();
|
||||
}
|
||||
|
||||
CSimulatorInfoList CContextSimulator::getAvailableSimulatorPlugins() const
|
||||
{
|
||||
CSimulatorInfoList simulatorPlugins;
|
||||
foreach(ISimulatorFactory *factory, m_simulatorFactories)
|
||||
{
|
||||
simulatorPlugins.push_back(factory->getSimulatorInfo());
|
||||
}
|
||||
return simulatorPlugins;
|
||||
}
|
||||
|
||||
bool CContextSimulator::isConnected() const
|
||||
{
|
||||
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/simulator.h"
|
||||
|
||||
#include "blacksim/simulatorinfo.h"
|
||||
#include "blacksim/simulatorinfolist.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDir>
|
||||
|
||||
@@ -30,6 +33,9 @@ namespace BlackCore
|
||||
|
||||
public slots:
|
||||
|
||||
//! \copydoc IContextSimulator::getSimulatorPluginList()
|
||||
virtual BlackSim::CSimulatorInfoList getAvailableSimulatorPlugins() const override;
|
||||
|
||||
//! \copydoc IContextSimulator::isConnected()
|
||||
virtual bool isConnected() const override;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackSim;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -27,6 +28,11 @@ namespace BlackCore
|
||||
void CContextSimulatorProxy::relaySignals(const QString &/*serviceName*/, QDBusConnection &/*connection*/)
|
||||
{ }
|
||||
|
||||
CSimulatorInfoList CContextSimulatorProxy::getAvailableSimulatorPlugins() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CSimulatorInfoList>(QLatin1Literal("getAvailableSimulatorPlugins"));
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::isConnected() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isConnected"));
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace BlackCore
|
||||
CContextSimulatorProxy(const QString &serviceName, QDBusConnection &connection, CRuntimeConfig::ContextMode mode, CRuntime *runtime);
|
||||
|
||||
public slots:
|
||||
|
||||
//! \copydoc IContextSimulator::getSimulatorPluginList()
|
||||
virtual BlackSim::CSimulatorInfoList getAvailableSimulatorPlugins() const override;
|
||||
|
||||
//! \copydoc IContextSimulator::isConnected()
|
||||
virtual bool isConnected() const override;
|
||||
|
||||
15
src/blacksim/simulatorinfolist.cpp
Normal file
15
src/blacksim/simulatorinfolist.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / authors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "simulatorinfolist.h"
|
||||
|
||||
namespace BlackSim
|
||||
{
|
||||
|
||||
CSimulatorInfoList::CSimulatorInfoList()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace BlackSim
|
||||
41
src/blacksim/simulatorinfolist.h
Normal file
41
src/blacksim/simulatorinfolist.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / authors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*!
|
||||
\file
|
||||
*/
|
||||
|
||||
#ifndef BLACKSIM_SIMULATORINFOLIST_H
|
||||
#define BLACKSIM_SIMULATORINFOLIST_H
|
||||
|
||||
#include "simulatorinfo.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/collection.h"
|
||||
|
||||
namespace BlackSim
|
||||
{
|
||||
//! \brief Value object encapsulating a list of SimulatorInfos.
|
||||
class CSimulatorInfoList : public BlackMisc::CSequence<CSimulatorInfo>
|
||||
{
|
||||
public:
|
||||
CSimulatorInfoList();
|
||||
|
||||
//! \brief Construct from a base class object.
|
||||
CSimulatorInfoList(const CSequence<CSimulatorInfo> &other);
|
||||
|
||||
//! \copydoc CValueObject::toQVariant
|
||||
virtual QVariant toQVariant() const
|
||||
{
|
||||
return QVariant::fromValue(*this);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(BlackSim::CSimulatorInfoList)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackSim::CSimulatorInfo>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackSim::CSimulatorInfo>)
|
||||
|
||||
#endif // BLACKSIM_SIMULATORINFOLIST_H
|
||||
Reference in New Issue
Block a user