mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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;
|
CStatusMessageList msgs;
|
||||||
if (!sApp || !sApp->isNetworkAccessible())
|
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();
|
const CSimulatorInfo simulators = this->simulatorsWithInitializedModelSet();
|
||||||
if (simulators.isNoSimulator())
|
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;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,4 +53,12 @@ namespace BlackGui
|
|||||||
m_mwaOverlayFrame->showOverlayMessages(messages, false, timeOutMs);
|
m_mwaOverlayFrame->showOverlayMessages(messages, false, timeOutMs);
|
||||||
return true;
|
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
|
} // ns
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ namespace BlackGui
|
|||||||
//! Display in overlay window
|
//! Display in overlay window
|
||||||
virtual bool displayInOverlayWindow(const BlackMisc::CStatusMessageList &messages, int timeOutMs = -1);
|
virtual bool displayInOverlayWindow(const BlackMisc::CStatusMessageList &messages, int timeOutMs = -1);
|
||||||
|
|
||||||
|
//! Display in overlay window
|
||||||
|
virtual bool displayInOverlayWindow(const QString &html, int timeOutMs = -1);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Components::CLogComponent *m_mwaLogComponent = nullptr; //!< the log component if any
|
Components::CLogComponent *m_mwaLogComponent = nullptr; //!< the log component if any
|
||||||
CManagedStatusBar *m_mwaStatusBar = nullptr; //!< status bar if any
|
CManagedStatusBar *m_mwaStatusBar = nullptr; //!< status bar if any
|
||||||
|
|||||||
@@ -389,6 +389,15 @@ void SwiftGuiStd::onChangedMainInfoAreaFloating(bool floating)
|
|||||||
Q_UNUSED(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()
|
void SwiftGuiStd::showMinimized()
|
||||||
{
|
{
|
||||||
this->showMinimizedModeChecked();
|
this->showMinimizedModeChecked();
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ private:
|
|||||||
bool m_init = false;
|
bool m_init = false;
|
||||||
|
|
||||||
// contexts
|
// 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
|
int m_coreFailures = 0; //!< failed access to core
|
||||||
bool m_coreAvailable = false; //!< core already available?
|
bool m_coreAvailable = false; //!< core already available?
|
||||||
bool m_contextNetworkAvailable = false; //!< network context available?
|
bool m_contextNetworkAvailable = false; //!< network context available?
|
||||||
@@ -252,6 +252,9 @@ private:
|
|||||||
//! Whole main info area floating
|
//! Whole main info area floating
|
||||||
void onChangedMainInfoAreaFloating(bool floating);
|
void onChangedMainInfoAreaFloating(bool floating);
|
||||||
|
|
||||||
|
//! UI Console message has been recevied
|
||||||
|
void onRequestedConsoleMessage(const QString &logMsg, bool clear);
|
||||||
|
|
||||||
//! Show window minimized
|
//! Show window minimized
|
||||||
void showMinimized();
|
void showMinimized();
|
||||||
|
|
||||||
|
|||||||
@@ -129,15 +129,7 @@ void SwiftGuiStd::init()
|
|||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connect(sGui->getIContextNetwork(), &IContextNetwork::kicked, this, &SwiftGuiStd::onKickedFromNetwork, Qt::QueuedConnection);
|
s = connect(sGui->getIContextNetwork(), &IContextNetwork::kicked, this, &SwiftGuiStd::onKickedFromNetwork, Qt::QueuedConnection);
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connect(sGui->getIContextSimulator(), &IContextSimulator::requestUiConsoleMessage, this, [ = ](const QString & logMsg, bool clear)
|
s = connect(sGui->getIContextSimulator(), &IContextSimulator::requestUiConsoleMessage, this, &SwiftGuiStd::onRequestedConsoleMessage, Qt::QueuedConnection);
|
||||||
{
|
|
||||||
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);
|
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
s = connect(&m_timerContextWatchdog, &QTimer::timeout, this, &SwiftGuiStd::handleTimerBasedUpdates);
|
s = connect(&m_timerContextWatchdog, &QTimer::timeout, this, &SwiftGuiStd::handleTimerBasedUpdates);
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
|
|||||||
Reference in New Issue
Block a user