mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Allow to enable HTML color (as tooltip must be "black")
This commit is contained in:
@@ -117,7 +117,7 @@ namespace BlackGui
|
||||
void CLogComponent::appendStatusMessageToConsole(const CStatusMessage &statusMessage)
|
||||
{
|
||||
if (statusMessage.isEmpty()) return;
|
||||
ui->tep_StatusPageConsole->appendHtml(statusMessage.toHtml(false));
|
||||
ui->tep_StatusPageConsole->appendHtml(statusMessage.toHtml(false, true));
|
||||
}
|
||||
|
||||
void CLogComponent::appendPlainTextToConsole(const QString &text)
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace BlackGui
|
||||
{
|
||||
// the underlying model object as summary
|
||||
const CStatusMessage msg(this->at(index));
|
||||
return msg.toHtml(false);
|
||||
return msg.toHtml(false, false);
|
||||
}
|
||||
return CListModelTimestampObjects::data(index, role);
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
this->setModeToHTMLMessage();
|
||||
ui->te_HTMLMessage->setText(message.toHtml(true));
|
||||
ui->te_HTMLMessage->setText(message.toHtml(true, true));
|
||||
this->display(timeOutMs);
|
||||
}
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace BlackMisc
|
||||
case IndexCategoriesAsString: return CVariant::from(m_categories.toQString());
|
||||
case IndexCategoriesHumanReadableAsString: return CVariant::from(this->getHumanReadablePattern());
|
||||
case IndexCategoryHumanReadableOrTechnicalAsString: return CVariant::from(this->getHumanOrTechnicalCategoriesAsString());
|
||||
case IndexMessageAsHtml: return CVariant::from(this->toHtml(false));
|
||||
case IndexMessageAsHtml: return CVariant::from(this->toHtml(false, true));
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
@@ -445,7 +445,7 @@ namespace BlackMisc
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString CStatusMessage::toHtml(bool withIcon) const
|
||||
QString CStatusMessage::toHtml(bool withIcon, bool withColors) const
|
||||
{
|
||||
QString img;
|
||||
if (withIcon)
|
||||
@@ -454,12 +454,15 @@ namespace BlackMisc
|
||||
if (!r.isEmpty()) { img = QStringLiteral("<img src=\"%1\"> ").arg(r); }
|
||||
}
|
||||
|
||||
switch (this->getSeverity())
|
||||
if (withColors)
|
||||
{
|
||||
case SeverityWarning: return img % QStringLiteral("<font color=\"yellow\">") % this->getMessage() % QStringLiteral("</font>");
|
||||
case SeverityError: return img % QStringLiteral("<font color=\"red\">") % this->getMessage() % QStringLiteral("</font>");
|
||||
case SeverityDebug: break;
|
||||
default: break;
|
||||
switch (this->getSeverity())
|
||||
{
|
||||
case SeverityWarning: return img % QStringLiteral("<font color=\"yellow\">") % this->getMessage() % QStringLiteral("</font>");
|
||||
case SeverityError: return img % QStringLiteral("<font color=\"red\">") % this->getMessage() % QStringLiteral("</font>");
|
||||
case SeverityDebug: break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return img % this->getMessage();
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace BlackMisc
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! To HTML
|
||||
QString toHtml(bool withIcon) const;
|
||||
QString toHtml(bool withIcon, bool withColors) const;
|
||||
|
||||
//! Representing icon
|
||||
static const CIcon &convertToIcon(const CStatusMessage &statusMessage);
|
||||
|
||||
Reference in New Issue
Block a user