GUI: Add back translation of severity texts.

Translation of severity texts was temporarily disabled by earlier
commits. Now adding new method to ResultsTree for getting
translated severity string.
This commit is contained in:
Kimmo Varis 2011-03-07 23:35:58 +02:00
parent 0d27966eb8
commit d9efd53033
2 changed files with 60 additions and 6 deletions

View File

@ -254,18 +254,25 @@ ShowTypes ResultsTree::VariantToShowType(const QVariant &data)
ShowTypes ResultsTree::SeverityToShowType(Severity::SeverityType severity)
{
if (severity == Severity::error)
switch (severity)
{
case Severity::none:
return SHOW_NONE;
case Severity::error:
return SHOW_ERRORS;
if (severity == Severity::style)
case Severity::style:
return SHOW_STYLE;
if (severity == Severity::warning)
case Severity::warning:
return SHOW_WARNINGS;
if (severity == Severity::performance)
case Severity::performance:
return SHOW_PERFORMANCE;
if (severity == Severity::portability)
case Severity::portability:
return SHOW_PORTABILITY;
if (severity == Severity::information)
case Severity::information:
return SHOW_INFORMATION;
default:
return SHOW_NONE;
}
return SHOW_NONE;
}
@ -306,6 +313,46 @@ Severity::SeverityType ResultsTree::ShowTypeToSeverity(ShowTypes type)
return Severity::none;
}
QString ResultsTree::SeverityToTranslatedString(Severity::SeverityType severity)
{
switch (severity)
{
case Severity::style:
return tr("style");
break;
case Severity::error:
return tr("error");
break;
case Severity::warning:
return tr("warning");
break;
case Severity::performance:
return tr("performance");
break;
case Severity::portability:
return tr("portability");
break;
case Severity::information:
return tr("information");
break;
case Severity::debug:
return tr("debug");
break;
case Severity::none:
return "";
break;
}
return "";
}
QStandardItem *ResultsTree::FindFileItem(const QString &name)
{
QList<QStandardItem *> list = mModel.findItems(name);

View File

@ -296,6 +296,13 @@ protected:
*/
Severity::SeverityType ShowTypeToSeverity(ShowTypes type);
/**
* @brief Convert Severity to translated string for GUI.
* @param type Severity to convert
* @return Severity as translated string
*/
QString SeverityToTranslatedString(Severity::SeverityType severity);
/**
* @brief Load all settings
* Colum widths