GUI: Cleanup NewSuppressionDialog interface
This commit is contained in:
parent
3a52f217d3
commit
ff2c376fe8
|
@ -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;
|
||||
|
|
|
@ -15,7 +15,6 @@ public:
|
|||
explicit NewSuppressionDialog(QWidget *parent = 0);
|
||||
~NewSuppressionDialog();
|
||||
|
||||
void setErrorIds(const QStringList &errorIds);
|
||||
Suppressions::Suppression getSuppression() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue