diff --git a/gui/newsuppressiondialog.cpp b/gui/newsuppressiondialog.cpp index 9a7ce6333..59cb6f02d 100644 --- a/gui/newsuppressiondialog.cpp +++ b/gui/newsuppressiondialog.cpp @@ -1,11 +1,32 @@ #include "newsuppressiondialog.h" #include "ui_newsuppressiondialog.h" +#include "cppcheck.h" +#include "errorlogger.h" + NewSuppressionDialog::NewSuppressionDialog(QWidget *parent) : QDialog(parent), mUI(new Ui::NewSuppressionDialog) { mUI->setupUi(this); + + class QErrorLogger : public ErrorLogger { + public: + virtual void reportOut(const std::string &/*outmsg*/) {} + virtual void reportErr(const ErrorLogger::ErrorMessage &msg) { + errorIds << QString::fromStdString(msg._id); + } + QStringList errorIds; + }; + + QErrorLogger errorLogger; + CppCheck cppcheck(errorLogger,false); + cppcheck.getErrorMessages(); + errorLogger.errorIds.sort(); + + mUI->mComboErrorId->addItems(errorLogger.errorIds); + mUI->mComboErrorId->setCurrentIndex(-1); + mUI->mComboErrorId->setCurrentText(""); } NewSuppressionDialog::~NewSuppressionDialog() @@ -13,13 +34,6 @@ NewSuppressionDialog::~NewSuppressionDialog() delete mUI; } -void NewSuppressionDialog::setErrorIds(const QStringList &errorIds) -{ - mUI->mComboErrorId->addItems(errorIds); - mUI->mComboErrorId->setCurrentIndex(-1); - mUI->mComboErrorId->setCurrentText(""); -} - Suppressions::Suppression NewSuppressionDialog::getSuppression() const { Suppressions::Suppression ret; diff --git a/gui/newsuppressiondialog.h b/gui/newsuppressiondialog.h index 90f10f81d..9f51d5cf6 100644 --- a/gui/newsuppressiondialog.h +++ b/gui/newsuppressiondialog.h @@ -15,7 +15,6 @@ public: explicit NewSuppressionDialog(QWidget *parent = 0); ~NewSuppressionDialog(); - void setErrorIds(const QStringList &errorIds); Suppressions::Suppression getSuppression() const; private: diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index fde42bee2..a1cc69220 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -32,8 +32,6 @@ #include "checkthread.h" #include "projectfile.h" #include "library.h" -#include "cppcheck.h" -#include "errorlogger.h" #include "platforms.h" /** Platforms shown in the platform combobox */ @@ -638,22 +636,7 @@ void ProjectFileDialog::moveIncludePathDown() void ProjectFileDialog::addSuppression() { - class QErrorLogger : public ErrorLogger { - public: - virtual void reportOut(const std::string &/*outmsg*/) {} - virtual void reportErr(const ErrorLogger::ErrorMessage &msg) { - errorIds << QString::fromStdString(msg._id); - } - QStringList errorIds; - }; - - QErrorLogger errorLogger; - CppCheck cppcheck(errorLogger,false); - cppcheck.getErrorMessages(); - errorLogger.errorIds.sort(); - NewSuppressionDialog dlg; - dlg.setErrorIds(errorLogger.errorIds); if (dlg.exec() == QDialog::Accepted) { setSuppressions(mSuppressions << dlg.getSuppression()); }