From 2cf097ae2e7b22901b56b5df31338436bb1671e7 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 15 Jan 2014 23:52:22 +0100 Subject: [PATCH] Receiving errors as status message results in a pop up message now. --- samples/blackgui/mainwindow.cpp | 11 +++++++++++ samples/blackgui/mainwindow.h | 6 ++++++ src/blackcore/context_network.cpp | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/samples/blackgui/mainwindow.cpp b/samples/blackgui/mainwindow.cpp index e12049ce3..a8a44b979 100644 --- a/samples/blackgui/mainwindow.cpp +++ b/samples/blackgui/mainwindow.cpp @@ -224,6 +224,8 @@ void MainWindow::displayStatusMessage(const CStatusMessage &message) { this->ui->sb_MainStatusBar->showMessage(message.getMessage(), 3000); this->ui->te_StatusMessages->insertPlainText(message.toQString(true).append("\n")); + if (message.getSeverity() == CStatusMessage::SeverityError) this->displayOverlayInfo(message); + } /* @@ -412,3 +414,12 @@ void MainWindow::displayOverlayInfo(const QString &message) this->m_infoWindow->setInfoMessage(message); } } + +/* + * Info window by + */ +void MainWindow::displayOverlayInfo(const CStatusMessage &message) +{ + this->displayOverlayInfo(message.getMessage()); + // further code goes here, such as marking errors as red ... +} diff --git a/samples/blackgui/mainwindow.h b/samples/blackgui/mainwindow.h index 79270e04f..23b9f963f 100644 --- a/samples/blackgui/mainwindow.h +++ b/samples/blackgui/mainwindow.h @@ -233,6 +233,12 @@ private: */ void displayOverlayInfo(const QString &message = ""); + /*! + * \brief Overlay info by status message + * \param message + */ + void displayOverlayInfo(const BlackMisc::CStatusMessage &message); + /*! * \brief Is given main page selected? * \param mainPage diff --git a/src/blackcore/context_network.cpp b/src/blackcore/context_network.cpp index 1cd3ead81..a7c246459 100644 --- a/src/blackcore/context_network.cpp +++ b/src/blackcore/context_network.cpp @@ -248,7 +248,8 @@ namespace BlackCore // send as message QString m("connection status changed "); m.append(this->m_network->connectionStatusToString(from)).append(" ").append(this->m_network->connectionStatusToString(to)); - msgs.push_back(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityInfo, m)); + msgs.push_back(CStatusMessage(CStatusMessage::TypeTrafficNetwork, + to == INetwork::DisconnectedError ? CStatusMessage::SeverityError : CStatusMessage::SeverityInfo, m)); emit this->statusMessage(msgs[0]); // send as own signal