From 72b7a7ab958359d8fb7df27a70e3fd2a7b0a2353 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 17 Jan 2014 18:42:34 +0100 Subject: [PATCH] Added statusMessages (plural) as signal. This makes it easier to send either single or multiple messages as required. Along with the changes fixed some places where not all status messages had been sent. MainWindow connected with both signals (statusMessage, statusMessages) Recreated DBus XML file --- samples/blackgui/mainwindow_init.cpp | 1 + src/blackcore/blackcore.contextnetwork.xml | 4 ++++ src/blackcore/context_network.cpp | 6 +++--- src/blackcore/context_network_interface.cpp | 2 ++ src/blackcore/context_network_interface.h | 10 +++++++--- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/samples/blackgui/mainwindow_init.cpp b/samples/blackgui/mainwindow_init.cpp index 0878f8ad8..015de7ac8 100644 --- a/samples/blackgui/mainwindow_init.cpp +++ b/samples/blackgui/mainwindow_init.cpp @@ -117,6 +117,7 @@ void MainWindow::init(GuiModes::CoreMode coreMode) // signal / slots bool connect; this->connect(this->m_contextNetwork, &IContextNetwork::statusMessage, this, &MainWindow::displayStatusMessage); + this->connect(this->m_contextNetwork, &IContextNetwork::statusMessages, this, &MainWindow::displayStatusMessages); this->connect(this->m_contextNetwork, &IContextNetwork::connectionTerminated, this, &MainWindow::connectionTerminated); this->connect(this->m_contextNetwork, &IContextNetwork::connectionStatusChanged, this, &MainWindow::connectionStatusChanged); this->connect(this->m_contextSettings, &IContextSettings::changedNetworkSettings, this, &MainWindow::changedNetworkSettings); diff --git a/src/blackcore/blackcore.contextnetwork.xml b/src/blackcore/blackcore.contextnetwork.xml index f3352421b..23b28f64f 100644 --- a/src/blackcore/blackcore.contextnetwork.xml +++ b/src/blackcore/blackcore.contextnetwork.xml @@ -5,6 +5,10 @@ + + + + diff --git a/src/blackcore/context_network.cpp b/src/blackcore/context_network.cpp index a7c246459..85ac3f4c5 100644 --- a/src/blackcore/context_network.cpp +++ b/src/blackcore/context_network.cpp @@ -246,11 +246,11 @@ namespace BlackCore } // send as message - QString m("connection status changed "); - m.append(this->m_network->connectionStatusToString(from)).append(" ").append(this->m_network->connectionStatusToString(to)); + QString m("connection status changed from %1 to %2"); + m = m.arg(INetwork::connectionStatusToString(from), INetwork::connectionStatusToString(to)); msgs.push_back(CStatusMessage(CStatusMessage::TypeTrafficNetwork, to == INetwork::DisconnectedError ? CStatusMessage::SeverityError : CStatusMessage::SeverityInfo, m)); - emit this->statusMessage(msgs[0]); + emit this->statusMessages(msgs); // send as own signal emit this->connectionStatusChanged(from, to); diff --git a/src/blackcore/context_network_interface.cpp b/src/blackcore/context_network_interface.cpp index 0e0f5fddc..23fc2ae6e 100644 --- a/src/blackcore/context_network_interface.cpp +++ b/src/blackcore/context_network_interface.cpp @@ -38,6 +38,8 @@ namespace BlackCore "connectionTerminated", this, SIGNAL(connectionTerminated())); connection.connect(serviceName, IContextNetwork::ServicePath(), IContextNetwork::InterfaceName(), "statusMessage", this, SIGNAL(statusMessage(BlackMisc::CStatusMessage))); + connection.connect(serviceName, IContextNetwork::ServicePath(), IContextNetwork::InterfaceName(), + "statusMessages", this, SIGNAL(statusMessages(BlackMisc::CStatusMessageList))); connection.connect(serviceName, IContextNetwork::ServicePath(), IContextNetwork::InterfaceName(), "textMessagesReceived", this, SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList))); } diff --git a/src/blackcore/context_network_interface.h b/src/blackcore/context_network_interface.h index 73b70e57d..89c189f9c 100644 --- a/src/blackcore/context_network_interface.h +++ b/src/blackcore/context_network_interface.h @@ -106,11 +106,17 @@ namespace BlackCore signals: /*! - * \brief ATC station list has been changed + * \brief Send status messages * \param message */ void statusMessage(const BlackMisc::CStatusMessage &message); + /*! + * \brief Send status messages + * \param messages + */ + void statusMessages(const BlackMisc::CStatusMessageList &messages); + /*! * \brief List has been changed */ @@ -137,8 +143,6 @@ namespace BlackCore * \param to */ // If I use the enum, adaptor / interface are not created correctly - - void connectionStatusChanged(uint from, uint to); /*!