diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index dc266f0d4..a92194018 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -222,12 +222,12 @@ namespace BlackCore CStatusMessageList msgs; if (!sApp || !sApp->isNetworkAccessible()) { - msgs.push_back(CStatusMessage(this).error(u"No network interface, simulation will not work properly")); + msgs.push_back(CStatusMessage(this).validationError(u"No network interface, simulation will not work properly")); } const CSimulatorInfo simulators = this->simulatorsWithInitializedModelSet(); if (simulators.isNoSimulator()) { - msgs.push_back(CStatusMessage(this).error(u"No model set so far, you need at least one model set. Hint: You can create a model set in the mapping tool, or copy an existing set in the launcher.")); + msgs.push_back(CStatusMessage(this).validationError(u"No model set so far, you need at least one model set. Hint: You can create a model set in the mapping tool, or copy an existing set in the launcher.")); } return msgs; } diff --git a/src/blackgui/mainwindowaccess.cpp b/src/blackgui/mainwindowaccess.cpp index b03d02195..175e3fd11 100644 --- a/src/blackgui/mainwindowaccess.cpp +++ b/src/blackgui/mainwindowaccess.cpp @@ -53,4 +53,12 @@ namespace BlackGui m_mwaOverlayFrame->showOverlayMessages(messages, false, timeOutMs); return true; } + + bool IMainWindowAccess::displayInOverlayWindow(const QString &html, int timeOutMs) + { + if (html.isEmpty()) { return false; } + if (!m_mwaOverlayFrame) { return false; } + m_mwaOverlayFrame->showOverlayHTMLMessage(html, timeOutMs); + return true; + } } // ns diff --git a/src/blackgui/mainwindowaccess.h b/src/blackgui/mainwindowaccess.h index d7041f55c..40fd91b76 100644 --- a/src/blackgui/mainwindowaccess.h +++ b/src/blackgui/mainwindowaccess.h @@ -52,6 +52,9 @@ namespace BlackGui //! Display in overlay window virtual bool displayInOverlayWindow(const BlackMisc::CStatusMessageList &messages, int timeOutMs = -1); + //! Display in overlay window + virtual bool displayInOverlayWindow(const QString &html, int timeOutMs = -1); + protected: Components::CLogComponent *m_mwaLogComponent = nullptr; //!< the log component if any CManagedStatusBar *m_mwaStatusBar = nullptr; //!< status bar if any diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index d8e0dcadd..66c7eacfc 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -389,6 +389,15 @@ void SwiftGuiStd::onChangedMainInfoAreaFloating(bool floating) Q_UNUSED(floating); } +void SwiftGuiStd::onRequestedConsoleMessage(const QString &logMsg, bool clear) +{ + if (logMsg.isEmpty()) { return; } + CLogComponent *log = ui->comp_MainInfoArea->getLogComponent(); + Q_ASSERT_X(log, Q_FUNC_INFO, "Missing log component"); + if (clear) { log->clearConsole(); } + log->appendPlainTextToConsole(logMsg); +} + void SwiftGuiStd::showMinimized() { this->showMinimizedModeChecked(); diff --git a/src/swiftguistandard/swiftguistd.h b/src/swiftguistandard/swiftguistd.h index ee713b2d6..867aef5fc 100644 --- a/src/swiftguistandard/swiftguistd.h +++ b/src/swiftguistandard/swiftguistd.h @@ -108,7 +108,7 @@ private: bool m_init = false; // contexts - static constexpr int MaxCoreFailures = 5; //!< Failures counted before reconnecting + static constexpr int MaxCoreFailures = 5; //!< Failures counted before reconnecting int m_coreFailures = 0; //!< failed access to core bool m_coreAvailable = false; //!< core already available? bool m_contextNetworkAvailable = false; //!< network context available? @@ -252,6 +252,9 @@ private: //! Whole main info area floating void onChangedMainInfoAreaFloating(bool floating); + //! UI Console message has been recevied + void onRequestedConsoleMessage(const QString &logMsg, bool clear); + //! Show window minimized void showMinimized(); diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index 8ab2cce82..af2175209 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -129,15 +129,7 @@ void SwiftGuiStd::init() Q_ASSERT(s); s = connect(sGui->getIContextNetwork(), &IContextNetwork::kicked, this, &SwiftGuiStd::onKickedFromNetwork, Qt::QueuedConnection); Q_ASSERT(s); - s = connect(sGui->getIContextSimulator(), &IContextSimulator::requestUiConsoleMessage, this, [ = ](const QString & logMsg, bool clear) - { - if (logMsg.isEmpty()) { return; } - CLogComponent *log = ui->comp_MainInfoArea->getLogComponent(); - Q_ASSERT_X(log, Q_FUNC_INFO, "Missing log component"); - if (clear) { log->clearConsole(); } - log->appendPlainTextToConsole(logMsg); - }, - Qt::QueuedConnection); + s = connect(sGui->getIContextSimulator(), &IContextSimulator::requestUiConsoleMessage, this, &SwiftGuiStd::onRequestedConsoleMessage, Qt::QueuedConnection); Q_ASSERT(s); s = connect(&m_timerContextWatchdog, &QTimer::timeout, this, &SwiftGuiStd::handleTimerBasedUpdates); Q_ASSERT(s);