mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
refs #199 , prepared Status message for output redirection (qDebug, qWarning)
* new type * output as HTML (GUI console)
This commit is contained in:
@@ -10,9 +10,14 @@ namespace BlackMisc
|
||||
*/
|
||||
CStatusMessage::CStatusMessage(StatusType type, StatusSeverity severity, const QString &message)
|
||||
: m_type(type), m_severity(severity), m_message(message), m_timestamp(QDateTime::currentDateTimeUtc())
|
||||
{
|
||||
// void
|
||||
}
|
||||
{ }
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CStatusMessage::CStatusMessage(StatusType type, StatusSeverity severity, const char *message)
|
||||
: m_type(type), m_severity(severity), m_message(QString(message)), m_timestamp(QDateTime::currentDateTimeUtc())
|
||||
{ }
|
||||
|
||||
/*
|
||||
* To string
|
||||
@@ -298,4 +303,26 @@ namespace BlackMisc
|
||||
}
|
||||
return BlackMisc::qVariantToString(qv, i18n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Message as HTML
|
||||
*/
|
||||
QString CStatusMessage::toHtml() const
|
||||
{
|
||||
QString html;
|
||||
if (this->isEmpty()) return html;
|
||||
switch (this->getSeverity())
|
||||
{
|
||||
case SeverityInfo:
|
||||
break;
|
||||
case SeverityWarning:
|
||||
html = "<font color=\"yellow\">";
|
||||
case SeverityError:
|
||||
html = "<font color=\"red\">";
|
||||
}
|
||||
html.append(this->getMessage());
|
||||
if (this->getSeverity() == SeverityInfo) return html;
|
||||
html.append("</font>");
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace BlackMisc
|
||||
TypeSettings,
|
||||
TypeCore,
|
||||
TypeAudio,
|
||||
TypeGui
|
||||
TypeGui,
|
||||
TypeStdoutRedirect
|
||||
};
|
||||
|
||||
//! Status severities
|
||||
|
||||
Reference in New Issue
Block a user