Added 22x22 icons from http://tango.freedesktop.org.
Also added icon source to AUTHORS file. Also added toolbar with the default actions. Added icons to result files and errors.
2
AUTHORS
|
@ -11,3 +11,5 @@ Reijo Tomperi
|
||||||
Slava Semushin
|
Slava Semushin
|
||||||
Vesa Pikki
|
Vesa Pikki
|
||||||
|
|
||||||
|
GUI graphics courtesy of Tango Desktop Project:
|
||||||
|
http://tango.freedesktop.org
|
||||||
|
|
After Width: | Height: | Size: 925 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 954 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 874 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 787 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 523 B |
After Width: | Height: | Size: 1.3 KiB |
|
@ -24,6 +24,7 @@
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QToolBar>
|
||||||
#include "../src/filelister.h"
|
#include "../src/filelister.h"
|
||||||
#include "../src/cppcheckexecutor.h"
|
#include "../src/cppcheckexecutor.h"
|
||||||
|
|
||||||
|
@ -43,13 +44,17 @@ MainWindow::MainWindow() :
|
||||||
mActionShowCheckAll(tr("Check all"), this),
|
mActionShowCheckAll(tr("Check all"), this),
|
||||||
mActionShowUncheckAll(tr("Uncheck all"), this),
|
mActionShowUncheckAll(tr("Uncheck all"), this),
|
||||||
mActionAbout(tr("About"), this),
|
mActionAbout(tr("About"), this),
|
||||||
|
mActionStop(tr("Stop checking"), this),
|
||||||
|
mActionSave(tr("Save results to a file"), this),
|
||||||
mResults(mSettings, mApplications)
|
mResults(mSettings, mApplications)
|
||||||
{
|
{
|
||||||
QMenu *menu = menuBar()->addMenu(tr("&File"));
|
QMenu *menu = menuBar()->addMenu(tr("&File"));
|
||||||
menu->addAction(&mActionCheckFiles);
|
menu->addAction(&mActionCheckFiles);
|
||||||
menu->addAction(&mActionCheckDirectory);
|
menu->addAction(&mActionCheckDirectory);
|
||||||
menu->addAction(&mActionReCheck);
|
menu->addAction(&mActionReCheck);
|
||||||
|
menu->addAction(&mActionStop);
|
||||||
menu->addAction(&mActionClearResults);
|
menu->addAction(&mActionClearResults);
|
||||||
|
menu->addAction(&mActionSave);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(&mActionExit);
|
menu->addAction(&mActionExit);
|
||||||
|
|
||||||
|
@ -93,12 +98,42 @@ MainWindow::MainWindow() :
|
||||||
|
|
||||||
connect(&mActionReCheck, SIGNAL(triggered()), this, SLOT(ReCheck()));
|
connect(&mActionReCheck, SIGNAL(triggered()), this, SLOT(ReCheck()));
|
||||||
|
|
||||||
connect(&mActionAbout, SIGNAL(triggered()), this, SLOT(About()));
|
//TODO: This crashed
|
||||||
|
//connect(&mActionStop, SIGNAL(triggered()), &mThread, SLOT(Stop()));
|
||||||
|
connect(&mActionSave, SIGNAL(triggered()), this, SLOT(Save()));
|
||||||
|
|
||||||
|
connect(&mActionAbout, SIGNAL(triggered()), this, SLOT(About()));
|
||||||
connect(&mThread, SIGNAL(Done()), this, SLOT(CheckDone()));
|
connect(&mThread, SIGNAL(Done()), this, SLOT(CheckDone()));
|
||||||
|
|
||||||
|
//Toolbar
|
||||||
|
QToolBar *toolbar = addToolBar("Toolbar");
|
||||||
|
toolbar->setIconSize(QSize(22,22));
|
||||||
|
|
||||||
|
mActionCheckDirectory.setIcon(QIcon("icon.svg"));
|
||||||
|
mActionReCheck.setIcon(QIcon("images/view-refresh.png"));
|
||||||
|
mActionSettings.setIcon(QIcon("images/preferences-system.png"));
|
||||||
|
mActionAbout.setIcon(QIcon("images/help-browser.png"));
|
||||||
|
mActionStop.setIcon(QIcon("images/process-stop.png"));
|
||||||
|
mActionSave.setIcon(QIcon("images/media-floppy.png"));
|
||||||
|
mActionClearResults.setIcon(QIcon("images/edit-clear.png"));
|
||||||
|
|
||||||
|
toolbar->addAction(&mActionCheckDirectory);
|
||||||
|
toolbar->addAction(&mActionSave);
|
||||||
|
toolbar->addAction(&mActionReCheck);
|
||||||
|
toolbar->addAction(&mActionStop);
|
||||||
|
toolbar->addAction(&mActionClearResults);
|
||||||
|
toolbar->addAction(&mActionSettings);
|
||||||
|
toolbar->addAction(&mActionAbout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
mThread.Initialize(&mResults);
|
mThread.Initialize(&mResults);
|
||||||
setWindowTitle(tr("Cppcheck"));
|
setWindowTitle(tr("Cppcheck"));
|
||||||
|
|
||||||
|
EnableCheckButtons(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -272,6 +307,7 @@ void MainWindow::ClearResults()
|
||||||
|
|
||||||
void MainWindow::EnableCheckButtons(bool enable)
|
void MainWindow::EnableCheckButtons(bool enable)
|
||||||
{
|
{
|
||||||
|
mActionStop.setEnabled(!enable);
|
||||||
mActionCheckFiles.setEnabled(enable);
|
mActionCheckFiles.setEnabled(enable);
|
||||||
mActionReCheck.setEnabled(enable);
|
mActionReCheck.setEnabled(enable);
|
||||||
mActionCheckDirectory.setEnabled(enable);
|
mActionCheckDirectory.setEnabled(enable);
|
||||||
|
@ -350,3 +386,13 @@ void MainWindow::About()
|
||||||
).arg(version));
|
).arg(version));
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::Save()
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle(tr("Not implemented yet..."));
|
||||||
|
msgBox.setText(tr("Not implemented yet..."));
|
||||||
|
msgBox.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,13 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void About();
|
void About();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to stop processing files
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void Save();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,6 +281,17 @@ protected:
|
||||||
*/
|
*/
|
||||||
QAction mActionAbout;
|
QAction mActionAbout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action stop checking files
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
QAction mActionStop;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Action save found errors to a file
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
QAction mActionSave;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -84,7 +84,8 @@ void ResultsTree::AddErrorItem(const QString &file,
|
||||||
lines[0].toInt(),
|
lines[0].toInt(),
|
||||||
severity,
|
severity,
|
||||||
message,
|
message,
|
||||||
hide);
|
hide,
|
||||||
|
SeverityToIcon(severity));
|
||||||
|
|
||||||
|
|
||||||
//Add user data to that item
|
//Add user data to that item
|
||||||
|
@ -95,10 +96,17 @@ void ResultsTree::AddErrorItem(const QString &file,
|
||||||
data["lines"] = lines;
|
data["lines"] = lines;
|
||||||
item->setData(QVariant(data));
|
item->setData(QVariant(data));
|
||||||
|
|
||||||
|
|
||||||
//Add backtrace files as children
|
//Add backtrace files as children
|
||||||
for (int i = 1;i < files.size() && i < lines.size();i++)
|
for (int i = 1;i < files.size() && i < lines.size();i++)
|
||||||
{
|
{
|
||||||
AddBacktraceFiles(item, files[i], lines[i].toInt(), severity, message, hide);
|
AddBacktraceFiles(item,
|
||||||
|
files[i],
|
||||||
|
lines[i].toInt(),
|
||||||
|
severity,
|
||||||
|
message,
|
||||||
|
hide,
|
||||||
|
"images/go-down.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO just hide/show current error and it's file
|
//TODO just hide/show current error and it's file
|
||||||
|
@ -114,7 +122,8 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
|
||||||
const int line,
|
const int line,
|
||||||
const QString &severity,
|
const QString &severity,
|
||||||
const QString &message,
|
const QString &message,
|
||||||
const bool hide)
|
const bool hide,
|
||||||
|
const QString &icon)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!parent)
|
if (!parent)
|
||||||
|
@ -135,6 +144,10 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
|
||||||
|
|
||||||
setRowHidden(parent->rowCount() - 1, parent->index(), hide);
|
setRowHidden(parent->rowCount() - 1, parent->index(), hide);
|
||||||
|
|
||||||
|
if (!icon.isEmpty()) {
|
||||||
|
list[0]->setIcon(QIcon(icon));
|
||||||
|
}
|
||||||
|
|
||||||
//TODO Does this leak memory? Should items from list be deleted?
|
//TODO Does this leak memory? Should items from list be deleted?
|
||||||
|
|
||||||
return list[0];
|
return list[0];
|
||||||
|
@ -271,6 +284,7 @@ QStandardItem *ResultsTree::EnsureFileItem(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
item = CreateItem(name);
|
item = CreateItem(name);
|
||||||
|
item->setIcon(QIcon("images/text-x-generic.png"));
|
||||||
|
|
||||||
mModel.appendRow(item);
|
mModel.appendRow(item);
|
||||||
|
|
||||||
|
@ -396,3 +410,15 @@ void ResultsTree::QuickStartApplication(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
StartApplication(mModel.itemFromIndex(index), 0);
|
StartApplication(mModel.itemFromIndex(index), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ResultsTree::SeverityToIcon(const QString &severity)
|
||||||
|
{
|
||||||
|
if (severity == "all")
|
||||||
|
return "images/dialog-warning.png";
|
||||||
|
if (severity == "error")
|
||||||
|
return "images/dialog-error.png";
|
||||||
|
if (severity == "style")
|
||||||
|
return "images/dialog-information.png";
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
|
@ -85,6 +85,13 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void Context(int application);
|
void Context(int application);
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief Convert a severity string to a icon filename
|
||||||
|
*
|
||||||
|
* @param severity Severity string
|
||||||
|
* @param Icon filename
|
||||||
|
*/
|
||||||
|
QString SeverityToIcon(const QString &severity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Helper function to open an error within target with application
|
* @brief Helper function to open an error within target with application
|
||||||
|
@ -110,7 +117,8 @@ protected:
|
||||||
* @param line Line numer
|
* @param line Line numer
|
||||||
* @param severity Error severity
|
* @param severity Error severity
|
||||||
* @param message Error message
|
* @param message Error message
|
||||||
* @param hide Should this be hidden (true) or shown (false)
|
* @param hide Should this be hidden (true) or shown (false)
|
||||||
|
* @param addicon Should a default backtrace item icon be added
|
||||||
* @return newly created QStandardItem *
|
* @return newly created QStandardItem *
|
||||||
*/
|
*/
|
||||||
QStandardItem *AddBacktraceFiles(QStandardItem *parent,
|
QStandardItem *AddBacktraceFiles(QStandardItem *parent,
|
||||||
|
@ -118,7 +126,8 @@ protected:
|
||||||
const int line,
|
const int line,
|
||||||
const QString &severity,
|
const QString &severity,
|
||||||
const QString &message,
|
const QString &message,
|
||||||
const bool hide);
|
const bool hide,
|
||||||
|
const QString &icon);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|