GUI: Make Severity to ShowType use enum values.
Continue converting Severity use in GUI from QString to enum values.
This commit is contained in:
parent
d2c06501d9
commit
5bf98447c9
|
@ -109,7 +109,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
realfile = tr("Undefined file");
|
realfile = tr("Undefined file");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hide = !mShowTypes[SeverityToShowType(GuiSeverity::toString(item.severity))];
|
bool hide = !mShowTypes[SeverityToShowType(item.severity)];
|
||||||
|
|
||||||
//if there is at least one error that is not hidden, we have a visible error
|
//if there is at least one error that is not hidden, we have a visible error
|
||||||
if (!hide)
|
if (!hide)
|
||||||
|
@ -137,7 +137,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
//Add user data to that item
|
//Add user data to that item
|
||||||
QMap<QString, QVariant> data;
|
QMap<QString, QVariant> data;
|
||||||
data["hide"] = false;
|
data["hide"] = false;
|
||||||
data["severity"] = SeverityToShowType(GuiSeverity::toString(item.severity));
|
data["severity"] = SeverityToShowType(item.severity);
|
||||||
data["summary"] = item.summary;
|
data["summary"] = item.summary;
|
||||||
data["message"] = item.message;
|
data["message"] = item.message;
|
||||||
data["file"] = item.files[0];
|
data["file"] = item.files[0];
|
||||||
|
@ -158,7 +158,7 @@ void ResultsTree::AddErrorItem(const ErrorItem &item)
|
||||||
|
|
||||||
//Add user data to that item
|
//Add user data to that item
|
||||||
QMap<QString, QVariant> child_data;
|
QMap<QString, QVariant> child_data;
|
||||||
child_data["severity"] = SeverityToShowType(GuiSeverity::toString(line.severity));
|
child_data["severity"] = SeverityToShowType(line.severity);
|
||||||
child_data["summary"] = line.summary;
|
child_data["summary"] = line.summary;
|
||||||
child_data["message"] = line.message;
|
child_data["message"] = line.message;
|
||||||
child_data["file"] = item.files[i];
|
child_data["file"] = item.files[i];
|
||||||
|
@ -252,19 +252,19 @@ ShowTypes ResultsTree::VariantToShowType(const QVariant &data)
|
||||||
return (ShowTypes)value;
|
return (ShowTypes)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowTypes ResultsTree::SeverityToShowType(const QString & severity)
|
ShowTypes ResultsTree::SeverityToShowType(Severity::SeverityType severity)
|
||||||
{
|
{
|
||||||
if (severity == "error")
|
if (severity == Severity::error)
|
||||||
return SHOW_ERRORS;
|
return SHOW_ERRORS;
|
||||||
if (severity == "style")
|
if (severity == Severity::style)
|
||||||
return SHOW_STYLE;
|
return SHOW_STYLE;
|
||||||
if (severity == "warning")
|
if (severity == Severity::warning)
|
||||||
return SHOW_WARNINGS;
|
return SHOW_WARNINGS;
|
||||||
if (severity == "performance")
|
if (severity == Severity::performance)
|
||||||
return SHOW_PERFORMANCE;
|
return SHOW_PERFORMANCE;
|
||||||
if (severity == "portability")
|
if (severity == Severity::portability)
|
||||||
return SHOW_PORTABILITY;
|
return SHOW_PORTABILITY;
|
||||||
if (severity == "information")
|
if (severity == Severity::information)
|
||||||
return SHOW_INFORMATION;
|
return SHOW_INFORMATION;
|
||||||
|
|
||||||
return SHOW_NONE;
|
return SHOW_NONE;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "applicationlist.h"
|
#include "applicationlist.h"
|
||||||
|
#include "errorlogger.h" // Severity
|
||||||
|
|
||||||
class Report;
|
class Report;
|
||||||
class ErrorItem;
|
class ErrorItem;
|
||||||
|
@ -128,10 +129,10 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert severity string to ShowTypes value
|
* @brief Convert severity string to ShowTypes value
|
||||||
* @param severity Error severity string
|
* @param severity Error severity
|
||||||
* @return Severity converted to ShowTypes value
|
* @return Severity converted to ShowTypes value
|
||||||
*/
|
*/
|
||||||
static ShowTypes SeverityToShowType(const QString &severity);
|
static ShowTypes SeverityToShowType(Severity::SeverityType severity);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,7 +88,7 @@ void ResultsView::Error(const ErrorItem &item)
|
||||||
mErrorsFound = true;
|
mErrorsFound = true;
|
||||||
mUI.mTree->AddErrorItem(item);
|
mUI.mTree->AddErrorItem(item);
|
||||||
emit GotResults();
|
emit GotResults();
|
||||||
mStatistics->AddItem(ResultsTree::SeverityToShowType(GuiSeverity::toString(item.severity)));
|
mStatistics->AddItem(ResultsTree::SeverityToShowType(item.severity));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResultsView::ShowResults(ShowTypes type, bool show)
|
void ResultsView::ShowResults(ShowTypes type, bool show)
|
||||||
|
|
Loading…
Reference in New Issue