GUI: Update more severity conversion methods.
This commit is contained in:
parent
5bf98447c9
commit
0d27966eb8
|
@ -129,7 +129,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
|
|||
QStandardItem *stditem = AddBacktraceFiles(EnsureFileItem(line.file, hide),
|
||||
line,
|
||||
hide,
|
||||
SeverityToIcon(GuiSeverity::toString(line.severity)));
|
||||
SeverityToIcon(line.severity));
|
||||
|
||||
if (!stditem)
|
||||
return;
|
||||
|
@ -270,6 +270,42 @@ ShowTypes ResultsTree::SeverityToShowType(Severity::SeverityType severity)
|
|||
return SHOW_NONE;
|
||||
}
|
||||
|
||||
Severity::SeverityType ResultsTree::ShowTypeToSeverity(ShowTypes type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SHOW_STYLE:
|
||||
return Severity::style;
|
||||
break;
|
||||
|
||||
case SHOW_ERRORS:
|
||||
return Severity::error;
|
||||
break;
|
||||
|
||||
case SHOW_WARNINGS:
|
||||
return Severity::warning;
|
||||
break;
|
||||
|
||||
case SHOW_PERFORMANCE:
|
||||
return Severity::performance;
|
||||
break;
|
||||
|
||||
case SHOW_PORTABILITY:
|
||||
return Severity::portability;
|
||||
break;
|
||||
|
||||
case SHOW_INFORMATION:
|
||||
return Severity::information;
|
||||
break;
|
||||
|
||||
case SHOW_NONE:
|
||||
return Severity::none;
|
||||
break;
|
||||
}
|
||||
|
||||
return Severity::none;
|
||||
}
|
||||
|
||||
QStandardItem *ResultsTree::FindFileItem(const QString &name)
|
||||
{
|
||||
QList<QStandardItem *> list = mModel.findItems(name);
|
||||
|
@ -736,21 +772,25 @@ void ResultsTree::CopyPath(QStandardItem *target, bool fullPath)
|
|||
}
|
||||
}
|
||||
|
||||
QString ResultsTree::SeverityToIcon(const QString &severity) const
|
||||
QString ResultsTree::SeverityToIcon(Severity::SeverityType severity) const
|
||||
{
|
||||
if (severity == "error")
|
||||
switch (severity)
|
||||
{
|
||||
case Severity::error:
|
||||
return ":images/dialog-error.png";
|
||||
if (severity == "style")
|
||||
case Severity::style:
|
||||
return ":images/applications-development.png";
|
||||
if (severity == "warning")
|
||||
case Severity::warning:
|
||||
return ":images/dialog-warning.png";
|
||||
if (severity == "portability")
|
||||
case Severity::portability:
|
||||
return ":images/applications-system.png";
|
||||
if (severity == "performance")
|
||||
case Severity::performance:
|
||||
return ":images/utilities-system-monitor.png";
|
||||
if (severity == "information")
|
||||
case Severity::information:
|
||||
return ":images/dialog-information.png";
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -795,7 +835,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item)
|
|||
QVariantMap data = userdata.toMap();
|
||||
|
||||
ErrorItem item;
|
||||
item.severity = GuiSeverity::fromString(ShowTypeToString(VariantToShowType(data["severity"])));
|
||||
item.severity = ShowTypeToSeverity(VariantToShowType(data["severity"]));
|
||||
item.summary = data["summary"].toString();
|
||||
item.message = data["message"].toString();
|
||||
item.id = data["id"].toString();
|
||||
|
@ -824,42 +864,6 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
QString ResultsTree::ShowTypeToString(ShowTypes type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SHOW_STYLE:
|
||||
return tr("style");
|
||||
break;
|
||||
|
||||
case SHOW_ERRORS:
|
||||
return tr("error");
|
||||
break;
|
||||
|
||||
case SHOW_WARNINGS:
|
||||
return tr("warning");
|
||||
break;
|
||||
|
||||
case SHOW_PERFORMANCE:
|
||||
return tr("performance");
|
||||
break;
|
||||
|
||||
case SHOW_PORTABILITY:
|
||||
return tr("portability");
|
||||
break;
|
||||
|
||||
case SHOW_INFORMATION:
|
||||
return tr("information");
|
||||
break;
|
||||
|
||||
case SHOW_NONE:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void ResultsTree::UpdateSettings(bool showFullPath,
|
||||
bool saveFullPath,
|
||||
bool saveAllErrors)
|
||||
|
|
|
@ -231,9 +231,9 @@ protected:
|
|||
/**
|
||||
* @brief Convert a severity string to a icon filename
|
||||
*
|
||||
* @param severity Severity string
|
||||
* @param severity Severity
|
||||
*/
|
||||
QString SeverityToIcon(const QString &severity) const;
|
||||
QString SeverityToIcon(Severity::SeverityType severity) const;
|
||||
|
||||
/**
|
||||
* @brief Helper function to open an error within target with application*
|
||||
|
@ -292,9 +292,9 @@ protected:
|
|||
/**
|
||||
* @brief Convert ShowType to severity string
|
||||
* @param type ShowType to convert
|
||||
* @return ShowType converted to string
|
||||
* @return ShowType converted to severity
|
||||
*/
|
||||
QString ShowTypeToString(ShowTypes type);
|
||||
Severity::SeverityType ShowTypeToSeverity(ShowTypes type);
|
||||
|
||||
/**
|
||||
* @brief Load all settings
|
||||
|
|
Loading…
Reference in New Issue