mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 19:25:49 +08:00
refs #338 Severity strings.
This commit is contained in:
@@ -164,9 +164,37 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* Severity
|
* Severity
|
||||||
*/
|
*/
|
||||||
const QString &CStatusMessage::getSeverityAsString() const
|
CStatusMessage::StatusSeverity CStatusMessage::stringToSeverity(const QString &severity)
|
||||||
{
|
{
|
||||||
switch (this->m_severity)
|
if (severity.compare(severityToString(SeverityDebug), Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
return SeverityDebug;
|
||||||
|
}
|
||||||
|
else if (severity.compare(severityToString(SeverityInfo), Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
return SeverityInfo;
|
||||||
|
}
|
||||||
|
else if (severity.compare(severityToString(SeverityWarning), Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
return SeverityWarning;
|
||||||
|
}
|
||||||
|
else if (severity.compare(severityToString(SeverityError), Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
return SeverityError;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qFatal("Unknown severity string");
|
||||||
|
return SeverityError;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Severity
|
||||||
|
*/
|
||||||
|
const QString &CStatusMessage::severityToString(CStatusMessage::StatusSeverity severity)
|
||||||
|
{
|
||||||
|
switch (severity)
|
||||||
{
|
{
|
||||||
case SeverityDebug:
|
case SeverityDebug:
|
||||||
{
|
{
|
||||||
@@ -195,6 +223,23 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Severity
|
||||||
|
*/
|
||||||
|
const QString &CStatusMessage::getSeverityAsString() const
|
||||||
|
{
|
||||||
|
return severityToString(this->m_severity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Severity
|
||||||
|
*/
|
||||||
|
const QStringList &CStatusMessage::allSeverityStrings()
|
||||||
|
{
|
||||||
|
static const QStringList all { severityToString(SeverityDebug), severityToString(SeverityInfo), severityToString(SeverityWarning), severityToString(SeverityError) };
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Property by index
|
* Property by index
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -99,9 +99,18 @@ namespace BlackMisc
|
|||||||
//! Representing icon
|
//! Representing icon
|
||||||
virtual CIcon toIcon() const override { return CStatusMessage::convertToIcon(*this); }
|
virtual CIcon toIcon() const override { return CStatusMessage::convertToIcon(*this); }
|
||||||
|
|
||||||
//! Type as string
|
//! Severity as string
|
||||||
const QString &getSeverityAsString() const;
|
const QString &getSeverityAsString() const;
|
||||||
|
|
||||||
|
//! Severity as string
|
||||||
|
static const QString &severityToString(StatusSeverity severity);
|
||||||
|
|
||||||
|
//! Severity as string
|
||||||
|
static StatusSeverity stringToSeverity(const QString &severityString);
|
||||||
|
|
||||||
|
//! Severities as strings
|
||||||
|
static const QStringList &allSeverityStrings();
|
||||||
|
|
||||||
//! \copydoc CValueObject::propertyByIndex(int)
|
//! \copydoc CValueObject::propertyByIndex(int)
|
||||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user