2009-03-01 21:44:42 +01:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2009-05-30 07:48:12 +02:00
|
|
|
* Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team.
|
2009-03-01 21:44:42 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "threadresult.h"
|
2009-03-02 20:56:51 +01:00
|
|
|
#include <QDebug>
|
2009-03-01 21:44:42 +01:00
|
|
|
|
|
|
|
ThreadResult::ThreadResult() : mMaxProgress(0), mProgress(0)
|
|
|
|
{
|
|
|
|
//ctor
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadResult::~ThreadResult()
|
|
|
|
{
|
|
|
|
//dtor
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadResult::reportOut(const std::string &outmsg)
|
|
|
|
{
|
|
|
|
Q_UNUSED(outmsg);
|
|
|
|
}
|
|
|
|
|
2009-03-02 20:56:51 +01:00
|
|
|
void ThreadResult::FileChecked(const QString &file)
|
|
|
|
{
|
2009-06-09 08:30:28 +02:00
|
|
|
QMutexLocker locker(&mutex);
|
2009-03-02 20:56:51 +01:00
|
|
|
Q_UNUSED(file); //For later use maybe?
|
|
|
|
mProgress++;
|
|
|
|
emit Progress(mProgress, mMaxProgress);
|
|
|
|
}
|
|
|
|
|
2009-03-01 21:44:42 +01:00
|
|
|
void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
|
|
|
|
{
|
|
|
|
QMutexLocker locker(&mutex);
|
|
|
|
|
2009-05-23 10:17:27 +02:00
|
|
|
QVariantList lines;
|
2009-03-01 21:44:42 +01:00
|
|
|
QStringList files;
|
|
|
|
|
|
|
|
for (std::list<ErrorLogger::ErrorMessage::FileLocation>::const_iterator tok = msg._callStack.begin();
|
|
|
|
tok != msg._callStack.end();
|
|
|
|
++tok)
|
|
|
|
{
|
|
|
|
files << QString((*tok).file.c_str());
|
|
|
|
lines << (*tok).line;
|
|
|
|
}
|
|
|
|
|
|
|
|
emit Error(QString(callStackToString(msg._callStack).c_str()),
|
|
|
|
QString(msg._severity.c_str()),
|
|
|
|
QString(msg._msg.c_str()),
|
|
|
|
files,
|
2009-06-03 20:18:22 +02:00
|
|
|
lines,
|
|
|
|
QString(msg._id.c_str()));
|
2009-03-01 21:44:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ThreadResult::GetNextFile()
|
|
|
|
{
|
|
|
|
QMutexLocker locker(&mutex);
|
|
|
|
if (mFiles.size() == 0)
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
return mFiles.takeFirst();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThreadResult::reportStatus(unsigned int index, unsigned int max)
|
|
|
|
{
|
|
|
|
Q_UNUSED(index);
|
|
|
|
Q_UNUSED(max);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadResult::SetFiles(const QStringList &files)
|
|
|
|
{
|
2009-03-02 20:56:51 +01:00
|
|
|
QMutexLocker locker(&mutex);
|
2009-03-01 21:44:42 +01:00
|
|
|
mFiles = files;
|
|
|
|
mProgress = 0;
|
|
|
|
mMaxProgress = files.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadResult::ClearFiles()
|
|
|
|
{
|
2009-03-02 20:56:51 +01:00
|
|
|
QMutexLocker locker(&mutex);
|
2009-03-01 21:44:42 +01:00
|
|
|
mFiles.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
int ThreadResult::GetFileCount()
|
|
|
|
{
|
2009-03-02 20:56:51 +01:00
|
|
|
QMutexLocker locker(&mutex);
|
2009-03-01 21:44:42 +01:00
|
|
|
return mFiles.size();
|
|
|
|
}
|
|
|
|
|