diff --git a/gui/erroritem.h b/gui/erroritem.h index 447d89700..692e6d888 100644 --- a/gui/erroritem.h +++ b/gui/erroritem.h @@ -21,6 +21,7 @@ #include #include +#include class ErrorLine; @@ -36,6 +37,7 @@ public: ErrorItem() { } ErrorItem(const ErrorItem &item); ErrorItem(const ErrorLine &line); + ~ErrorItem() { } QString file; QStringList files; @@ -45,6 +47,8 @@ public: QString msg; }; +Q_DECLARE_METATYPE(ErrorItem); + /** * @brief A class containing error data for one shown error line. */ diff --git a/gui/main.cpp b/gui/main.cpp index d0df43d25..93f60e006 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -22,6 +22,7 @@ #include #include #include "mainwindow.h" +#include "erroritem.h" int main(int argc, char *argv[]) { @@ -29,7 +30,7 @@ int main(int argc, char *argv[]) app.setWindowIcon(QIcon(":icon.png")); // Register this metatype that is used to transfer error info - qRegisterMetaType< QList >("QList"); + qRegisterMetaType("ErrorItem"); // Set codecs so that UTF-8 strings in sources are handled correctly. QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 2e941979a..bbea6d44f 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -20,6 +20,7 @@ #include #include #include +#include "erroritem.h" #include "resultsview.h" #include "report.h" #include "txtreport.h" @@ -66,22 +67,9 @@ void ResultsView::Progress(int value) mUI.mProgress->setValue(value); } -void ResultsView::Error(const QString &file, - const QString &severity, - const QString &message, - const QStringList &files, - const QList &lines, - const QString &id) +void ResultsView::Error(const ErrorItem &item) { mErrorsFound = true; - ErrorItem item; - item.file = file; - item.files = files; - item.id = id; - item.lines = lines; - item.msg = message; - item.severity = severity; - mUI.mTree->AddErrorItem(item); emit GotResults(); } diff --git a/gui/resultsview.h b/gui/resultsview.h index a940fdebb..bc81d28d1 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -29,6 +29,8 @@ #include "report.h" #include "ui_resultsview.h" +class ErrorItem; + /// @addtogroup GUI /// @{ @@ -158,19 +160,9 @@ public slots: /** * @brief Slot for new error to be displayed * - * @param file filename - * @param severity error severity - * @param message error message - * @param files list of files affected by the error - * @param lines list of file line numers affected by the error - * @param id error id + * @param item Error data */ - void Error(const QString &file, - const QString &severity, - const QString &message, - const QStringList &files, - const QList &lines, - const QString &id); + void Error(const ErrorItem &item); /** * @brief Collapse all results in the result list. diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index feae8b503..7ea918437 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -141,18 +141,8 @@ void ThreadHandler::Initialize(ResultsView *view) connect(&mResults, SIGNAL(Progress(int)), view, SLOT(Progress(int))); - connect(&mResults, SIGNAL(Error(const QString &, - const QString &, - const QString &, - const QStringList &, - const QList &, - const QString &)), - view, SLOT(Error(const QString &, - const QString &, - const QString &, - const QStringList &, - const QList &, - const QString &))); + connect(&mResults, SIGNAL(Error(const ErrorItem &)), + view, SLOT(Error(const ErrorItem &))); } diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp index 4e241ad8d..bef889a91 100644 --- a/gui/threadresult.cpp +++ b/gui/threadresult.cpp @@ -17,8 +17,9 @@ */ -#include "threadresult.h" #include +#include "erroritem.h" +#include "threadresult.h" ThreadResult::ThreadResult() : mMaxProgress(0), mProgress(0) { @@ -62,12 +63,15 @@ void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg) lines << (*tok).line; } - emit Error(QString(callStackToString(msg._callStack).c_str()), - QString(msg._severity.c_str()), - QString(msg._msg.c_str()), - files, - lines, - QString(msg._id.c_str())); + ErrorItem item; + item.file = QString(callStackToString(msg._callStack).c_str()); + item.files = files; + item.id = QString(msg._id.c_str()); + item.lines = lines; + item.msg = QString(msg._msg.c_str()); + item.severity = QString(msg._severity.c_str()); + + emit Error(item); } QString ThreadResult::GetNextFile() diff --git a/gui/threadresult.h b/gui/threadresult.h index 494d5db16..7e6b1a618 100644 --- a/gui/threadresult.h +++ b/gui/threadresult.h @@ -26,6 +26,8 @@ #include #include "../lib/errorlogger.h" +class ErrorItem; + /// @addtogroup GUI /// @{ @@ -87,19 +89,9 @@ signals: /** * @brief Signal of a new error * - * @param file filename - * @param severity error severity - * @param message error message - * @param files list of files affected by the error - * @param lines list of file line numers affected by the error - * @param id error id + * @param item Error data */ - void Error(const QString &file, - const QString &severity, - const QString &message, - const QStringList &files, - const QList &lines, - const QString &id); + void Error(const ErrorItem &item); protected: