mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #199, sendStatusMessage now in application context (an only done via application context)
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
#include "context_application_impl.h"
|
||||
#include "context_runtime.h"
|
||||
#include "blackmisc/settingutilities.h"
|
||||
#include <QtMsgHandler>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
/*
|
||||
* Init this context
|
||||
*/
|
||||
@@ -26,6 +26,24 @@ namespace BlackCore
|
||||
{
|
||||
return token;
|
||||
}
|
||||
|
||||
/*
|
||||
* Status message
|
||||
*/
|
||||
void CContextApplication::sendStatusMessage(const CStatusMessage &message)
|
||||
{
|
||||
emit this->statusMessage(message);
|
||||
}
|
||||
|
||||
/*
|
||||
* Status messages
|
||||
*/
|
||||
void CContextApplication::sendStatusMessages(const CStatusMessageList &messages)
|
||||
{
|
||||
emit this->statusMessages(messages);
|
||||
}
|
||||
|
||||
/*
|
||||
* Re-emit signal
|
||||
*/
|
||||
void CContextApplication::signalFromProxy(const QString &signalName)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BLACKCORE_CONTEXTAPPLICATION_IMPL_H
|
||||
#define BLACKCORE_CONTEXTAPPLICATION_IMPL_H
|
||||
|
||||
#include "context_application.h"
|
||||
#include "context_application_base.h"
|
||||
#include "context_runtime.h"
|
||||
#include "dbus_server.h"
|
||||
|
||||
@@ -23,6 +23,16 @@ namespace BlackCore
|
||||
Q_OBJECT
|
||||
friend class CRuntime;
|
||||
|
||||
public slots:
|
||||
//! \copydoc IContextApplication::ping()
|
||||
virtual qint64 ping(qint64 token) const override;
|
||||
|
||||
//! \brief Status message
|
||||
virtual void sendStatusMessage(const BlackMisc::CStatusMessage &message) override;
|
||||
|
||||
//! Send status messages
|
||||
virtual void sendStatusMessages(const BlackMisc::CStatusMessageList &messages) override;
|
||||
|
||||
//! \copydoc CContext::reEmitSignalFromProxy
|
||||
virtual void signalFromProxy(const QString &signalName) override;
|
||||
|
||||
@@ -37,13 +47,6 @@ namespace BlackCore
|
||||
server->addObject(IContextApplication::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
public:
|
||||
//! Destructor
|
||||
virtual ~CContextApplication() {}
|
||||
|
||||
public slots:
|
||||
//! \copydoc IContextApplication::ping()
|
||||
virtual qint64 ping(qint64 token) const override;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -59,4 +59,20 @@ namespace BlackCore
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("signalFromProxy"), signalName);
|
||||
}
|
||||
|
||||
/*
|
||||
* Status messages
|
||||
*/
|
||||
void CContextApplicationProxy::sendStatusMessage(const BlackMisc::CStatusMessage &message)
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("sendStatusMessage"), message);
|
||||
}
|
||||
|
||||
/*
|
||||
* Status messages
|
||||
*/
|
||||
void CContextApplicationProxy::sendStatusMessages(const BlackMisc::CStatusMessageList &messages)
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("sendStatusMessages"), messages);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BLACKCORE_CONTEXTAPPLICATION_PROXY_H
|
||||
#define BLACKCORE_CONTEXTAPPLICATION_PROXY_H
|
||||
|
||||
#include "context_application.h"
|
||||
#include "context_application_base.h"
|
||||
#include "blackmisc/genericdbusinterface.h"
|
||||
|
||||
namespace BlackCore
|
||||
@@ -28,6 +28,12 @@ namespace BlackCore
|
||||
//! \copydoc IContextApplication::ping()
|
||||
virtual qint64 ping(qint64 token) const override;
|
||||
|
||||
//! \brief Status message
|
||||
virtual void sendStatusMessage(const BlackMisc::CStatusMessage &message) override;
|
||||
|
||||
//! Send status messages
|
||||
virtual void sendStatusMessages(const BlackMisc::CStatusMessageList &messages) override;
|
||||
|
||||
//! \copydoc CContext::reEmitSignalFromProxy
|
||||
void signalFromProxy(const QString &signalName) override;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BlackCore
|
||||
this->connect(this->m_network, &INetwork::aircraftPositionUpdate, this, &CContextNetwork::psFsdAircraftUpdateReceived);
|
||||
this->connect(this->m_network, &INetwork::frequencyReplyReceived, this, &CContextNetwork::psFsdFrequencyReceived);
|
||||
this->connect(this->m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::psFsdTextMessageReceived);
|
||||
this->connect(this->m_network, &INetwork::statusMessage, this, &CContextNetwork::statusMessage);
|
||||
if (this->getIContextApplication()) this->connect(this->m_network, &INetwork::statusMessage, this->getIContextApplication(), &IContextApplication::sendStatusMessage);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user