diff --git a/src/blackcore/context_application_impl.cpp b/src/blackcore/context_application_impl.cpp index 569ebc35d..b838e775c 100644 --- a/src/blackcore/context_application_impl.cpp +++ b/src/blackcore/context_application_impl.cpp @@ -6,12 +6,12 @@ #include "context_application_impl.h" #include "context_runtime.h" #include "blackmisc/settingutilities.h" +#include 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) diff --git a/src/blackcore/context_application_impl.h b/src/blackcore/context_application_impl.h index 034cccc72..d7b6ee583 100644 --- a/src/blackcore/context_application_impl.h +++ b/src/blackcore/context_application_impl.h @@ -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; }; } diff --git a/src/blackcore/context_application_proxy.cpp b/src/blackcore/context_application_proxy.cpp index bb05f9c75..cb23c24ef 100644 --- a/src/blackcore/context_application_proxy.cpp +++ b/src/blackcore/context_application_proxy.cpp @@ -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 diff --git a/src/blackcore/context_application_proxy.h b/src/blackcore/context_application_proxy.h index bb69b7b46..cdf91264e 100644 --- a/src/blackcore/context_application_proxy.h +++ b/src/blackcore/context_application_proxy.h @@ -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; diff --git a/src/blackcore/context_network_impl.cpp b/src/blackcore/context_network_impl.cpp index 1526356c7..00d42fa7a 100644 --- a/src/blackcore/context_network_impl.cpp +++ b/src/blackcore/context_network_impl.cpp @@ -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); } /*