mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackSim;
|
||||
|
||||
@@ -145,7 +146,7 @@ namespace BlackCore
|
||||
if (originator.isEmpty() || originator == IContextSimulator::InterfaceName()) return;
|
||||
|
||||
// update
|
||||
this->m_simulator->updateOwnCockpit(ownAircraft);
|
||||
this->m_simulator->updateOwnSimulatorCockpit(ownAircraft);
|
||||
}
|
||||
|
||||
void CContextSimulator::setConnectionStatus(ISimulator::Status status)
|
||||
@@ -162,6 +163,29 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CContextSimulator::statusMessageReceived(const CStatusMessage &statusMessage)
|
||||
{
|
||||
if (statusMessage.getSeverity() != CStatusMessage::SeverityError) return;
|
||||
this->m_simulator->displayStatusMessage(statusMessage);
|
||||
}
|
||||
|
||||
void CContextSimulator::statusMessagesReceived(const CStatusMessageList &statusMessages)
|
||||
{
|
||||
foreach(CStatusMessage m, statusMessages)
|
||||
{
|
||||
this->statusMessageReceived(m);
|
||||
}
|
||||
}
|
||||
|
||||
void CContextSimulator::textMessagesReceived(const Network::CTextMessageList &textMessages)
|
||||
{
|
||||
foreach(CTextMessage tm, textMessages)
|
||||
{
|
||||
if (!tm.isPrivateMessage()) continue;
|
||||
this->m_simulator->displayStatusMessage(tm.asStatusMessage(true, true));
|
||||
}
|
||||
}
|
||||
|
||||
void CContextSimulator::findSimulatorPlugins()
|
||||
{
|
||||
m_pluginsDir = QDir(qApp->applicationDirPath().append("/plugins/simulator"));
|
||||
|
||||
@@ -93,6 +93,15 @@ namespace BlackCore
|
||||
//! Set new connection status
|
||||
void setConnectionStatus(ISimulator::Status status);
|
||||
|
||||
//! Status message received
|
||||
void statusMessageReceived(const BlackMisc::CStatusMessage &statusMessage);
|
||||
|
||||
//! Status messages received
|
||||
void statusMessagesReceived(const BlackMisc::CStatusMessageList &statusMessages);
|
||||
|
||||
//! Text message received
|
||||
void textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
|
||||
|
||||
private:
|
||||
//! \brief find and catalog all simulator plugins
|
||||
void findSimulatorPlugins();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define BLACKCORE_SIMULATOR_H
|
||||
|
||||
#include "blacksim/simulatorinfo.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
#include <QObject>
|
||||
|
||||
@@ -70,14 +71,23 @@ namespace BlackCore
|
||||
virtual void removeRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
||||
|
||||
//! Update own aircraft cockpit (usually from context)
|
||||
virtual bool updateOwnCockpit(const BlackMisc::Aviation::CAircraft &aircraft) = 0;
|
||||
virtual bool updateOwnSimulatorCockpit(const BlackMisc::Aviation::CAircraft &aircraft) = 0;
|
||||
|
||||
//! Simulator info
|
||||
virtual BlackSim::CSimulatorInfo getSimulatorInfo() const = 0;
|
||||
|
||||
//! Display a status message in the simulator
|
||||
virtual void displayStatusMessage(const BlackMisc::CStatusMessage &message) const = 0;
|
||||
|
||||
signals:
|
||||
//! Emitted when the connection status has changed
|
||||
void statusChanged(ISimulator::Status status);
|
||||
|
||||
//! Simulator started
|
||||
void simulatorStarted();
|
||||
|
||||
//! Simulator stopped;
|
||||
void simulatorStopped();
|
||||
};
|
||||
|
||||
//! Factory pattern class to create instances of ISimulator
|
||||
|
||||
Reference in New Issue
Block a user