refs #432, adjusted originators

This commit is contained in:
Klaus Basan
2015-05-28 00:32:17 +02:00
parent a62cf48e18
commit 6c06ff5d46
20 changed files with 96 additions and 138 deletions

View File

@@ -28,10 +28,12 @@ using namespace BlackMisc::Simulation;
namespace BlackCore
{
CContextOwnAircraft::CContextOwnAircraft(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
IContextOwnAircraft(mode, runtime)
IContextOwnAircraft(mode, runtime),
COriginatorAware(this)
{
Q_ASSERT(this->getRuntime());
Q_ASSERT(this->getRuntime()->getIContextSettings());
this->setObjectName("CContextOwnAircraft");
// Init own aircraft
this->initOwnAircraft();
@@ -360,8 +362,7 @@ namespace BlackCore
{
if (CSelcal::isValidCode(parser.part(1)))
{
// todo RW: replace originator
this->updateSelcal(parser.part(1), COriginator("commandline"));
this->updateSelcal(parser.part(1), this->originator());
return true;
}
}

View File

@@ -19,6 +19,7 @@
#include "blackcore/dbus_server.h"
#include "blackmisc/aviation/atcstation.h"
#include "blackmisc/simulation/ownaircraftprovider.h"
#include "blackmisc/originatoraware.h"
namespace BlackCore
{
@@ -27,7 +28,8 @@ namespace BlackCore
//! Central instance of data for \sa IOwnAircraftProvider .
class BLACKCORE_EXPORT CContextOwnAircraft :
public IContextOwnAircraft,
public BlackMisc::Simulation::IOwnAircraftProvider
public BlackMisc::Simulation::IOwnAircraftProvider,
public BlackMisc::COriginatorAware
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTOWNAIRCRAFT_INTERFACENAME)

View File

@@ -29,14 +29,6 @@ namespace BlackCore
return status;
}
COriginator ISimulator::simulatorOriginator()
{
if (m_originator.getName().isEmpty())
m_originator = COriginator(QStringLiteral("SIMULATOR"));
return m_originator;
}
QString ISimulator::statusToString(int status)
{
if (status > 0)

View File

@@ -26,19 +26,22 @@
#include "blackmisc/network/textmessage.h"
#include "blackmisc/network/client.h"
#include "blackmisc/pixmap.h"
#include "blackmisc/originatoraware.h"
#include <QObject>
namespace BlackCore
{
//! Interface to a simulator.
class BLACKCORE_EXPORT ISimulator : public QObject
class BLACKCORE_EXPORT ISimulator :
public QObject,
public BlackMisc::COriginatorAware
{
Q_OBJECT
public:
//! ISimulator status
enum SimulatorStatus
enum SimulatorStatusFlag
{
Disconnected = 0,
Connected = 1 << 0, //!< Is the plugin connected to the simulator?
@@ -46,6 +49,8 @@ namespace BlackCore
Paused = 1 << 2, //!< Is the simulator paused?
};
Q_DECLARE_FLAGS(SimulatorStatus, SimulatorStatusFlag)
//! Render all aircraft if number of aircraft >= MaxAircraftInfinite
const int MaxAircraftInfinite = 100;
@@ -169,9 +174,6 @@ namespace BlackCore
//! Driver will be unloaded
virtual void unload() = 0;
//! Originator
BlackMisc::COriginator simulatorOriginator();
//! Status to string
static QString statusToString(int status);
@@ -196,7 +198,10 @@ namespace BlackCore
protected:
//! Default constructor
ISimulator(QObject *parent = nullptr) : QObject(parent) {}
ISimulator(QObject *parent = nullptr) :
QObject(parent),
BlackMisc::COriginatorAware(this)
{}
//! Are we connected to the simulator?
virtual bool isConnected() const = 0;
@@ -223,10 +228,6 @@ namespace BlackCore
//! Emit the combined status
//! \sa simulatorStatusChanged;
void emitSimulatorCombinedStatus();
private:
BlackMisc::COriginator m_originator;
};
//! Interface to a simulator listener.
@@ -287,5 +288,6 @@ namespace BlackCore
} // namespace
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorinterface")
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
#endif // guard