mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 15:15:39 +08:00
Register ENUMs in ISimulator like it is done in IVoice
This commit is contained in:
@@ -5,13 +5,14 @@
|
|||||||
|
|
||||||
#include "blackcorefreefunctions.h"
|
#include "blackcorefreefunctions.h"
|
||||||
#include "voice.h"
|
#include "voice.h"
|
||||||
|
#include "simulator.h"
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
void registerMetadata()
|
void registerMetadata()
|
||||||
{
|
{
|
||||||
IVoice::registerMetadata();
|
IVoice::registerMetadata();
|
||||||
|
ISimulator::registerMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
19
src/blackcore/simulator.cpp
Normal file
19
src/blackcore/simulator.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/* 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 "simulator.h"
|
||||||
|
|
||||||
|
namespace BlackCore
|
||||||
|
{
|
||||||
|
ISimulator::ISimulator(QObject *parent) : QObject(parent)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void ISimulator::registerMetadata()
|
||||||
|
{
|
||||||
|
// for some reasons (ask RW) this is registered twice, see IVoice
|
||||||
|
qRegisterMetaType<Status>();
|
||||||
|
qRegisterMetaType<Status>("Status");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,10 +25,11 @@ namespace BlackCore
|
|||||||
class ISimulator : public QObject
|
class ISimulator : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_ENUMS(Status)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! \brief Simulator connection
|
//! ISimulatorSimulator connection
|
||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
Disconnected,
|
Disconnected,
|
||||||
@@ -36,27 +37,31 @@ namespace BlackCore
|
|||||||
ConnectionFailed
|
ConnectionFailed
|
||||||
};
|
};
|
||||||
|
|
||||||
//! \brief Constructor
|
//! ISimulatorConstructor
|
||||||
ISimulator(QObject *parent = nullptr) : QObject(parent) {}
|
ISimulator(QObject *parent = nullptr);
|
||||||
|
|
||||||
//! \brief Destructor
|
//! ISimulatorDestructor
|
||||||
virtual ~ISimulator() {}
|
virtual ~ISimulator() {}
|
||||||
|
|
||||||
//! \brief Are we connected to the simulator?
|
//! ISimulatorAre we connected to the simulator?
|
||||||
virtual bool isConnected() const = 0;
|
virtual bool isConnected() const = 0;
|
||||||
|
|
||||||
//! \brief Can we connect?
|
//! ISimulatorCan we connect?
|
||||||
virtual bool canConnect() = 0;
|
virtual bool canConnect() = 0;
|
||||||
|
|
||||||
|
//! ISimulatorRegister metadata
|
||||||
|
static void registerMetadata();
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
//! \brief Connect to simulator
|
//! ISimulatorConnect to simulator
|
||||||
virtual bool connectTo() = 0;
|
virtual bool connectTo() = 0;
|
||||||
|
|
||||||
//! Connect asynchron to simulator
|
//! Connect asynchron to simulator
|
||||||
virtual void asyncConnectTo() = 0;
|
virtual void asyncConnectTo() = 0;
|
||||||
|
|
||||||
//! \brief Disconnect from simulator
|
//! ISimulatorDisconnect from simulator
|
||||||
virtual bool disconnectFrom() = 0;
|
virtual bool disconnectFrom() = 0;
|
||||||
|
|
||||||
//! Return user aircraft object
|
//! Return user aircraft object
|
||||||
@@ -102,11 +107,11 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! \brief Virtual destructor
|
//! ISimulatorVirtual destructor
|
||||||
virtual ~ISimulatorFactory() {}
|
virtual ~ISimulatorFactory() {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Create a new instance
|
* ISimulatorCreate a new instance
|
||||||
* \param parent
|
* \param parent
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
@@ -120,5 +125,6 @@ namespace BlackCore
|
|||||||
|
|
||||||
// TODO: Use CProject to store this string
|
// TODO: Use CProject to store this string
|
||||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "net.vatsim.PilotClient.BlackCore.SimulatorInterface")
|
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "net.vatsim.PilotClient.BlackCore.SimulatorInterface")
|
||||||
|
Q_DECLARE_METATYPE(BlackCore::ISimulator::Status)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
IVoice::IVoice(QObject *parent) : QObject(parent)
|
IVoice::IVoice(QObject *parent) : QObject(parent)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
void IVoice::registerMetadata()
|
void IVoice::registerMetadata()
|
||||||
{
|
{
|
||||||
|
// for some reasons (ask RW) this is registered twice
|
||||||
qRegisterMetaType<ComUnit>();
|
qRegisterMetaType<ComUnit>();
|
||||||
qRegisterMetaType<ComUnit>("ComUnit");
|
qRegisterMetaType<ComUnit>("ComUnit");
|
||||||
qRegisterMetaType<ConnectionStatus>();
|
qRegisterMetaType<ConnectionStatus>();
|
||||||
|
|||||||
Reference in New Issue
Block a user