GUI: Show bughunting report

This commit is contained in:
Daniel Marjamäki 2020-02-10 20:24:36 +01:00
parent 4e2e944eb9
commit e4250f890e
8 changed files with 51 additions and 2 deletions

View File

@ -136,6 +136,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
connect(mThread, &ThreadHandler::done, this, &MainWindow::analysisDone);
connect(mThread, &ThreadHandler::log, mUI.mResults, &ResultsView::log);
connect(mThread, &ThreadHandler::debugError, mUI.mResults, &ResultsView::debugError);
connect(mThread, &ThreadHandler::bughuntingReportLine, mUI.mResults, &ResultsView::bughuntingReportLine);
connect(mUI.mResults, &ResultsView::gotResults, this, &MainWindow::resultsAdded);
connect(mUI.mResults, &ResultsView::resultsHidden, mUI.mActionShowHidden, &QAction::setEnabled);
connect(mUI.mResults, &ResultsView::checkSelected, this, &MainWindow::performSelectedFilesCheck);
@ -841,6 +842,7 @@ Settings MainWindow::getCppcheckSettings()
result.clang = mProjectFile->clangParser;
result.bugHunting = mProjectFile->bugHunting;
result.bugHuntingReport = " ";
const QStringList undefines = mProjectFile->getUndefines();
foreach (QString undefine, undefines)

View File

@ -433,6 +433,11 @@ void ResultsView::debugError(const ErrorItem &item)
mUI.mListLog->addItem(item.ToString());
}
void ResultsView::bughuntingReportLine(QString line)
{
mUI.mListSafeFunctions->addItem(line);
}
void ResultsView::logClear()
{
mUI.mListLog->clear();

View File

@ -323,6 +323,11 @@ public slots:
*/
void debugError(const ErrorItem &item);
/**
* \brief bughunting report line
*/
void bughuntingReportLine(QString line);
/**
* \brief Clear log messages
*/

View File

@ -153,6 +153,28 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="mTabSafeFunctions">
<attribute name="title">
<string>Safe functions</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="mListSafeFunctions"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>

View File

@ -194,6 +194,9 @@ void ThreadHandler::initialize(ResultsView *view)
connect(&mResults, &ThreadResult::debugError,
this, &ThreadHandler::debugError);
connect(&mResults, &ThreadResult::bughuntingReportLine,
this, &ThreadHandler::bughuntingReportLine);
}
void ThreadHandler::loadSettings(QSettings &settings)

View File

@ -189,6 +189,8 @@ signals:
void debugError(const ErrorItem &item);
void bughuntingReportLine(QString line);
public slots:
/**

View File

@ -27,7 +27,7 @@
#include "errorlogger.h"
#include "threadresult.h"
ThreadResult::ThreadResult() : mMaxProgress(0), mProgress(0), mFilesChecked(0), mTotalFiles(0)
ThreadResult::ThreadResult() : QObject(), ErrorLogger(), mMaxProgress(0), mProgress(0), mFilesChecked(0), mTotalFiles(0)
{
//ctor
}
@ -137,3 +137,10 @@ int ThreadResult::getFileCount() const
QMutexLocker locker(&mutex);
return mFiles.size() + mFileSettings.size();
}
void ThreadResult::bughuntingReport(const std::string &str)
{
if (str.empty())
return;
emit bughuntingReportLine(QString::fromStdString(str));
}

View File

@ -74,7 +74,7 @@ public:
*/
void reportOut(const std::string &outmsg) override;
void reportErr(const ErrorLogger::ErrorMessage &msg) override;
void bughuntingReport(const std::string &/*str*/) override {}
void bughuntingReport(const std::string &str) override;
public slots:
@ -112,6 +112,9 @@ signals:
*/
void debugError(const ErrorItem &item);
/** @brief bug hunting report */
void bughuntingReportLine(QString line);
protected:
/**