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