mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T515, some minor adjustments
* use validation status messages for prerequisites * SwiftGuiStd::onRequestedConsoleMessage * displayInOverlayWindow for HTML messages
This commit is contained in:
committed by
Mat Sutcliffe
parent
cea6611656
commit
85cf339e04
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user