39 #include <QApplication>
41 #include <QContextMenuEvent>
43 #include <QDesktopServices>
46 #include <QFileDialog>
48 #include <QItemSelectionModel>
54 #include <QMessageBox>
55 #include <QModelIndex>
59 #include <QSignalMapper>
60 #include <QStandardItem>
63 #include <QVariantMap>
66 static constexpr
char COLUMN[] =
"column";
67 static constexpr
char CWE[] =
"cwe";
70 static constexpr
char FILE0[] =
"file0";
71 static constexpr
char HASH[] =
"hash";
72 static constexpr
char HIDE[] =
"hide";
74 static constexpr
char LINE[] =
"line";
75 static constexpr
char MESSAGE[] =
"message";
79 static constexpr
char SUMMARY[] =
"summary";
80 static constexpr
char TAGS[] =
"tags";
91 setExpandsOnDoubleClick(
false);
92 setSortingEnabled(
true);
99 if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
102 QTreeView::keyPressEvent(event);
116 auto *item =
new QStandardItem(name);
117 item->setData(name, Qt::ToolTipRole);
118 item->setEditable(
false);
124 auto *item =
new QStandardItem;
125 item->setCheckable(
true);
126 item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
127 item->setEnabled(
false);
133 auto *item =
new QStandardItem();
134 item->setData(QVariant(linenumber.toInt()), Qt::DisplayRole);
135 item->setToolTip(linenumber);
136 item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
137 item->setEditable(
false);
150 if (realfile.isEmpty()) {
151 realfile = tr(
"Undefined file");
161 if (!hide && !
mFilter.isEmpty()) {
176 line.
file = realfile;
187 line.
tags = activeProject->getWarningTags(item.
hash);
202 QMap<QString, QVariant> data;
218 stditem->setData(QVariant(data));
222 for (
int i = 0; i < item.
errorPath.size(); i++) {
230 ":images/go-down.png",
236 QMap<QString, QVariant> child_data;
244 child_data[
CWE] = line.
cwe;
248 child_item->setData(QVariant(child_data));
269 QList<QStandardItem*> list;
284 for (
int i = 0; i < parent->rowCount(); i++) {
288 if (parent->child(i, 2)->text() == list[2]->text()) {
290 if (parent->child(i, 1)->text() == list[1]->text()) {
292 if (parent->child(i, 5)->text() == list[5]->text()) {
300 parent->appendRow(list);
302 setRowHidden(parent->rowCount() - 1, parent->index(), hide);
304 if (!icon.isEmpty()) {
305 list[0]->setIcon(QIcon(icon));
335 return tr(
"warning");
338 return tr(
"performance");
341 return tr(
"portability");
344 return tr(
"information");
350 return tr(
"internal");
363 for (
int i = 0; i <
mModel.rowCount(); i++) {
365 if (QString::compare(
mModel.item(i, 0)->text(), name, Qt::CaseInsensitive) == 0)
367 if (
mModel.item(i, 0)->text() == name)
381 const QString stripped =
stripPath(filename,
false);
383 for (
int i = 0; i <
mModel.rowCount(); ++i) {
384 const QStandardItem *fileItem =
mModel.item(i, 0);
388 QVariantMap data = fileItem->data().toMap();
399 for (
int i = 0; i <
mModel.rowCount(); ++i) {
400 const QStandardItem *fileItem =
mModel.item(i, 0);
405 QVariantMap data = fileItem->data().toMap();
406 QString storedfile = data[
FILENAME].toString();
408 if (actualfile == storedfile) {
418 for (
int i = 0; i <
mModel.columnCount(); i++) {
420 setColumnWidth(i, qMax(20,
mSettings->value(temp, 800 /
mModel.columnCount()).toInt()));
433 for (
int i = 0; i <
mModel.columnCount(); i++) {
435 mSettings->setValue(temp, columnWidth(i));
469 const int filecount =
mModel.rowCount();
470 for (
int i = 0; i < filecount; i++) {
471 QStandardItem *fileItem =
mModel.item(i, 0);
475 QVariantMap data = fileItem->data().toMap();
477 fileItem->setData(QVariant(data));
479 const int errorcount = fileItem->rowCount();
480 for (
int j = 0; j < errorcount; j++) {
481 QStandardItem *child = fileItem->child(j, 0);
483 data = child->data().toMap();
485 child->setData(QVariant(data));
498 const int filecount =
mModel.rowCount();
500 for (
int i = 0; i < filecount; i++) {
502 QStandardItem *fileItem =
mModel.item(i, 0);
508 const int errorcount = fileItem->rowCount();
513 for (
int j = 0; j < errorcount; j++) {
515 QStandardItem *child = fileItem->child(j, 0);
521 QVariant userdata = child->data();
523 QVariantMap data = userdata.toMap();
529 if (!hide && !
mFilter.isEmpty()) {
531 !data[
MESSAGE].toString().contains(
mFilter, Qt::CaseInsensitive) &&
533 !data[
ERRORID].toString().contains(
mFilter, Qt::CaseInsensitive)) {
551 setRowHidden(j, fileItem->index(), hide);
560 if (fileItem->data().toMap()[
"hide"].toBool()) {
565 setRowHidden(i, QModelIndex(), !show);
571 QString name =
stripPath(fullpath,
false);
574 QStandardItem *item =
findFileItem(QDir::toNativeSeparators(name));
581 name = QDir::toNativeSeparators(name);
583 item->setIcon(QIcon(
":images/text-x-generic.png"));
586 QMap<QString, QVariant> data;
589 item->setData(QVariant(data));
592 setRowHidden(
mModel.rowCount() - 1, QModelIndex(), hide);
599 QModelIndex index = indexAt(e->pos());
600 if (index.isValid()) {
601 bool multipleSelection =
false;
605 multipleSelection =
true;
613 QList<QAction*> actions;
617 auto *signalMapper =
new QSignalMapper(
this);
622 if (defaultApplicationIndex < 0)
623 defaultApplicationIndex = 0;
625 auto *start =
new QAction(app.
getName(), &menu);
626 if (multipleSelection)
627 start->setDisabled(
true);
633 menu.addAction(start);
636 connect(start, SIGNAL(triggered()), signalMapper, SLOT(map()));
639 signalMapper->setMapping(start, defaultApplicationIndex);
641 connect(signalMapper, SIGNAL(mapped(
int)),
652 auto *recheckAction =
new QAction(tr(
"Recheck"), &menu);
653 auto *copyAction =
new QAction(tr(
"Copy"), &menu);
654 auto *hide =
new QAction(tr(
"Hide"), &menu);
655 auto *hideallid =
new QAction(tr(
"Hide all with id"), &menu);
656 auto *opencontainingfolder =
new QAction(tr(
"Open containing folder"), &menu);
658 if (multipleSelection) {
659 hideallid->setDisabled(
true);
660 opencontainingfolder->setDisabled(
true);
663 recheckAction->setDisabled(
true);
665 recheckAction->setDisabled(
false);
667 menu.addAction(recheckAction);
669 menu.addAction(copyAction);
671 menu.addAction(hide);
672 menu.addAction(hideallid);
674 auto *suppress =
new QAction(tr(
"Suppress selected id(s)"), &menu);
677 const QString messageId = data[
ERRORID].toString();
680 menu.addAction(suppress);
684 menu.addAction(opencontainingfolder);
686 connect(recheckAction, SIGNAL(triggered()),
this, SLOT(recheckAction()));
687 connect(copyAction, SIGNAL(triggered()),
this, SLOT(copyAction()));
688 connect(hide, SIGNAL(triggered()),
this, SLOT(
hideResult()));
689 connect(hideallid, SIGNAL(triggered()),
this, SLOT(
hideAllIdResult()));
693 if (currentProject && !currentProject->
getTags().isEmpty()) {
695 QMenu *tagMenu = menu.addMenu(tr(
"Tag"));
697 auto *action =
new QAction(tr(
"No tag"), tagMenu);
698 tagMenu->addAction(action);
699 connect(action, &QAction::triggered, [=]() {
704 for (
const QString& tagstr : currentProject->
getTags()) {
705 auto *action =
new QAction(tagstr, tagMenu);
706 tagMenu->addAction(action);
707 connect(action, &QAction::triggered, [=]() {
715 menu.exec(e->globalPos());
716 index = indexAt(e->pos());
717 if (index.isValid()) {
721 for (
const QAction* action : actions) {
722 disconnect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
725 disconnect(signalMapper, SIGNAL(mapped(
int)),
738 QMessageBox msg(QMessageBox::Critical,
740 tr(
"No editor application configured.\n\n"
741 "Configure the editor application for Cppcheck in preferences/Applications."),
748 if (application == -1)
751 if (application == -1) {
752 QMessageBox msg(QMessageBox::Critical,
754 tr(
"No default editor application selected.\n\n"
755 "Please select the default editor application in preferences/Applications."),
763 if (target && application >= 0 && application < mApplications->getApplicationCount() && target->parent()) {
765 if (target->column() != 0)
766 target = target->parent()->child(target->row(), 0);
768 QVariantMap data = target->data().toMap();
771 QString file = data[
FILENAME].toString();
772 file = QDir::toNativeSeparators(file);
773 qDebug() <<
"Opening file: " << file;
775 QFileInfo info(file);
776 if (!info.exists()) {
777 if (info.isAbsolute()) {
778 QMessageBox msgbox(
this);
779 msgbox.setWindowTitle(
"Cppcheck");
780 msgbox.setText(tr(
"Could not find the file!"));
781 msgbox.setIcon(QMessageBox::Critical);
785 if (checkdir.isAbsolute() && checkdir.exists()) {
795 if (file.indexOf(
" ") > -1) {
796 file.insert(0,
"\"");
802 params.replace(
"(file)", file, Qt::CaseInsensitive);
804 QVariant line = data[
LINE];
805 params.replace(
"(line)", QString(
"%1").arg(line.toInt()), Qt::CaseInsensitive);
807 params.replace(
"(message)", data[
MESSAGE].
toString(), Qt::CaseInsensitive);
808 params.replace(
"(severity)", data[
SEVERITY].
toString(), Qt::CaseInsensitive);
810 QString program = app.
getPath();
814 if (program.indexOf(
" ") > -1) {
815 if (!program.startsWith(
'"') && !program.endsWith(
'"')) {
816 program.insert(0,
"\"");
817 program.append(
"\"");
822 const QString cmdLine = QString(
"%1 %2").arg(program).arg(params);
825 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
829 const bool success = QProcess::startDetached(cmdLine);
830 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
835 QString text = tr(
"Could not start %1\n\nPlease check the application path and parameters are correct.").arg(program);
837 QMessageBox msgbox(
this);
838 msgbox.setWindowTitle(
"Cppcheck");
839 msgbox.setText(text);
840 msgbox.setIcon(QMessageBox::Critical);
849 QString text = tr(
"Could not find file:") +
'\n' + file +
'\n';
851 if (file.indexOf(
'/')) {
852 QString folderName = file.mid(0, file.indexOf(
'/'));
853 text += tr(
"Please select the folder '%1'").arg(folderName);
854 title = tr(
"Select Directory '%1'").arg(folderName);
856 text += tr(
"Please select the directory where file is located.");
857 title = tr(
"Select Directory");
860 QMessageBox msgbox(
this);
861 msgbox.setWindowTitle(
"Cppcheck");
862 msgbox.setText(text);
863 msgbox.setIcon(QMessageBox::Warning);
866 QString dir = QFileDialog::getExistingDirectory(
this, title,
868 QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
874 if (QFileInfo::exists(dir +
'/' + file))
878 else if (file.indexOf(
'/') > 0) {
880 QString folderName = file.mid(0, file.indexOf(
'/'));
881 if (dir.indexOf(
'/' + folderName +
'/'))
882 dir = dir.mid(0, dir.lastIndexOf(
'/' + folderName +
'/'));
883 if (QFileInfo::exists(dir +
'/' + file))
902 QStandardItem *item =
mModel.itemFromIndex(index);
903 if (!item->parent()) {
904 text += item->text() +
'\n';
907 if (item->parent()->parent())
908 item = item->parent();
909 QVariantMap data = item->data().toMap();
910 if (!data.contains(
"id"))
913 text +=
'[' + data[
FILENAME].toString() +
':' + QString::number(data[
LINE].toInt())
923 QClipboard *clipboard = QApplication::clipboard();
924 clipboard->setText(text);
933 QStandardItem *item =
mModel.itemFromIndex(index);
935 QVariantMap data = item->data().toMap();
937 item->setData(QVariant(data));
949 QStringList selectedItems;
951 QStandardItem *item =
mModel.itemFromIndex(index);
952 while (item->parent())
953 item = item->parent();
954 QVariantMap data = item->data().toMap();
955 QString currentFile = data[
FILENAME].toString();
956 if (!currentFile.isEmpty()) {
957 QString fileNameWithCheckPath;
958 QFileInfo curfileInfo(currentFile);
960 fileNameWithCheckPath =
mCheckPath +
"/" + currentFile;
962 fileNameWithCheckPath = currentFile;
963 const QFileInfo fileInfo(fileNameWithCheckPath);
964 if (!fileInfo.exists()) {
969 if (!data[
FILE0].
toString().isEmpty() && !selectedItems.contains(data[
FILE0].toString())) {
971 if (!selectedItems.contains(fileNameWithCheckPath))
972 selectedItems<<fileNameWithCheckPath;
974 }
else if (!selectedItems.contains(fileNameWithCheckPath))
975 selectedItems<<fileNameWithCheckPath;
991 QString messageId = data[
ERRORID].toString();
996 const int filecount =
mModel.rowCount();
997 for (
int i = 0; i < filecount; i++) {
999 QStandardItem *file =
mModel.item(i, 0);
1005 const int errorcount = file->rowCount();
1007 for (
int j = 0; j < errorcount; j++) {
1009 QStandardItem *child = file->child(j, 0);
1014 QVariantMap userdata = child->data().toMap();
1016 userdata[
HIDE] =
true;
1017 child->setData(QVariant(userdata));
1031 QSet<QString> selectedIds;
1033 QStandardItem *item =
mModel.itemFromIndex(index);
1034 if (!item->parent())
1036 if (item->parent()->parent())
1037 item = item->parent();
1038 QVariantMap data = item->data().toMap();
1039 if (!data.contains(
"id"))
1041 selectedIds << data[
ERRORID].toString();
1045 for (
int i = 0; i <
mModel.rowCount(); i++) {
1046 QStandardItem *
const file =
mModel.item(i, 0);
1047 for (
int j = 0; j < file->rowCount();) {
1048 QStandardItem *errorItem = file->child(j, 0);
1049 QVariantMap userdata = errorItem->data().toMap();
1050 if (selectedIds.contains(userdata[
ERRORID].toString())) {
1056 if (file->rowCount() == 0)
1057 mModel.removeRow(file->row());
1070 QSet<QStandardItem *> selectedWarnings;
1072 QStandardItem *item =
mModel.itemFromIndex(index);
1073 if (!item->parent())
1075 while (item->parent()->parent())
1076 item = item->parent();
1077 selectedWarnings.insert(item);
1080 bool changed =
false;
1082 for (QStandardItem *item: selectedWarnings) {
1083 QStandardItem *fileItem = item->parent();
1084 const QVariantMap data = item->data().toMap();
1085 if (projectFile && data.contains(
HASH)) {
1087 suppression.
hash = data[
HASH].toULongLong();
1094 fileItem->removeRow(item->row());
1095 if (fileItem->rowCount() == 0)
1096 mModel.removeRow(fileItem->row());
1100 projectFile->
write();
1106 if (!filePath.isEmpty()) {
1107 filePath = QFileInfo(filePath).absolutePath();
1108 QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
1116 bool isTagged =
false;
1119 QStandardItem *item =
mModel.itemFromIndex(index);
1120 QVariantMap data = item->data().toMap();
1121 if (data.contains(
"tags")) {
1123 item->setData(QVariant(data));
1124 item->parent()->child(index.row(),
COLUMN_TAGS)->setText(tag);
1125 if (currentProject && data.contains(
HASH)) {
1132 currentProject->
write();
1149 if (target->column() != 0)
1150 target = target->parent()->child(target->row(), 0);
1152 QVariantMap data = target->data().toMap();
1155 QString file = data[
FILENAME].toString();
1156 QString pathStr = QDir::toNativeSeparators(file);
1158 QFileInfo fi(pathStr);
1159 pathStr = fi.fileName();
1172 return ":images/dialog-error.png";
1174 return ":images/applications-development.png";
1176 return ":images/dialog-warning.png";
1178 return ":images/applications-system.png";
1180 return ":images/utilities-system-monitor.png";
1182 return ":images/dialog-information.png";
1192 for (
int i = 0; i <
mModel.rowCount(); i++) {
1206 for (
int i = 0; i < fileItem->rowCount(); i++) {
1207 const QStandardItem *
error = fileItem->child(i, 0);
1226 for (
int i = 0; i < list.size(); i++) {
1236 QList<ErrorItem> oldErrors;
1238 if (oldReport.
open()) {
1239 oldErrors = oldReport.
read();
1244 for (
int i = 0; i <
mModel.rowCount(); i++) {
1245 QStandardItem *fileItem =
mModel.item(i,0);
1246 for (
int j = 0; j < fileItem->rowCount(); j++) {
1247 QStandardItem *
error = fileItem->child(j,0);
1250 const int oldErrorIndex =
indexOf(oldErrors, errorItem);
1251 QVariantMap data =
error->data().toMap();
1254 if (oldErrorIndex >= 0 && !oldErrors[oldErrorIndex].sinceDate.isEmpty()) {
1255 data[
SINCEDATE] = oldErrors[oldErrorIndex].sinceDate;
1256 error->setData(data);
1257 fileItem->child(j,
COLUMN_SINCE_DATE)->setText(oldErrors[oldErrorIndex].sinceDate);
1259 const QString sinceDate = QLocale::system().toString(QDate::currentDate(), QLocale::ShortFormat);
1261 error->setData(data);
1263 if (oldErrorIndex < 0)
1267 if (!errorItem.
tags.isEmpty())
1270 const ErrorItem &oldErrorItem = oldErrors[oldErrorIndex];
1272 error->setData(data);
1280 QVariantMap data =
error->data().toMap();
1286 item->
cwe = data[
CWE].toInt();
1287 item->
hash = data[
HASH].toULongLong();
1291 item->
tags = data[
TAGS].toString();
1293 if (
error->rowCount() == 0) {
1301 for (
int j = 0; j <
error->rowCount(); j++) {
1302 const QStandardItem *child_error =
error->child(j, 0);
1304 QVariant child_userdata = child_error->data();
1306 QVariantMap child_data = child_userdata.toMap();
1320 bool showInconclusive)
1348 return QString(path);
1352 return dir.relativeFilePath(path);
1362 bool updated =
false;
1365 for (
int i = 0; i < item->rowCount(); i++) {
1367 QStandardItem *
error = item->child(i, 0);
1374 QVariant userdata =
error->data();
1376 QVariantMap data = userdata.toMap();
1379 QString file = data[
FILENAME].toString();
1385 if (
error->hasChildren()) {
1387 for (
int j = 0; j <
error->rowCount(); j++) {
1389 QStandardItem *child =
error->child(j, 0);
1394 QVariant child_userdata = child->data();
1396 QVariantMap child_data = child_userdata.toMap();
1399 QString child_files = child_data[
FILENAME].toString();
1401 child->setText(
stripPath(child_files,
false));
1408 item->setText(
error->text());
1416 qDebug(
"Refreshing file paths");
1419 for (
int i = 0; i <
mModel.rowCount(); i++) {
1431 return mModel.rowCount() > 0;
1437 labels << tr(
"File") << tr(
"Severity") << tr(
"Line") << tr(
"Id") << tr(
"Inconclusive") << tr(
"Summary") << tr(
"Since date") << tr(
"Tag");
1438 mModel.setHorizontalHeaderLabels(labels);
1461 QTreeView::currentChanged(current, previous);
List of applications user has specified to open errors with.
int getApplicationCount() const
Get the amount of applications in the list.
const Application & getApplication(const int index) const
Get specific application's name.
int getDefaultApplication() const
Return the default application.
A class containing information of the application to execute.
const QString & getParameters() const
Get application command line parameters.
const QString & getPath() const
Get application path.
const QString & getName() const
Get application name.
A class containing error data for one error.
static bool sameCID(const ErrorItem &errorItem1, const ErrorItem &errorItem2)
Compare "CID".
QList< QErrorPathItem > errorPath
A class containing error data for one shown error line.
static bool isCriticalErrorId(const std::string &id)
static bool isHeader2(const std::string &path)
Is filename a header based on file extension.
A class that reads and writes project files.
static ProjectFile * getActiveProject()
void setWarningTags(std::size_t hash, const QString &tags)
Set tags for a warning.
const QStringList & getTags() const
void addSuppression(const SuppressionList::Suppression &suppression)
Add suppression.
bool write(const QString &filename=QString())
Write project file (to disk).
A class containing data for one error path item.
A base class for reports.
virtual void writeError(const ErrorItem &error)=0
Write error to report.
virtual void writeHeader()=0
Write report header.
virtual void writeFooter()=0
Write report footer.
void close()
Close the report (file).
void hideResult()
Slot for context menu item to hide the current error message.
bool mSaveFullPath
Should full path of files be saved.
void updateFromOldReport(const QString &filename)
Update items from old report (tag, sinceDate)
void treeSelectionChanged(const QModelIndex ¤t)
Signal for selection change in result tree.
static QString severityToIcon(Severity severity)
Convert a severity string to a icon filename.
void hideAllIdResult()
Slot for context menu item to hide all messages with the current message Id.
QString stripPath(const QString &path, bool saving) const
Removes checking directory from given path if mShowFullPath is false.
QString mFilter
A string used to filter the results for display.
void openContainingFolder()
Slot for context menu item to open the folder containing the current file.
void suppressSelectedIds()
Slot for context menu item to suppress all messages with the current message id.
QStandardItem * addBacktraceFiles(QStandardItem *parent, const ErrorLine &item, const bool hide, const QString &icon, bool childOfMessage)
Add a new error item beneath a file or a backtrace item beneath an error.
void tagSelectedItems(const QString &tag)
tag selected items
void showHiddenResults()
Function to show results that were previous hidden with HideResult()
void updateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showErrorId, bool showInconclusive)
Update tree settings.
void resultsHidden(bool hidden)
Signal that results have been hidden or shown.
void clearRecheckFile(const QString &filename)
Clear errors of a file selected for recheck.
void clear()
Clear all errors from the tree.
static QStandardItem * createCheckboxItem(bool checked)
Create new normal item.
void showClangResults(bool show)
Show/hide clang-tidy/clang-analyzer errors.
bool showIdColumn() const
Returns true if column "Id" is shown.
ShowTypes mShowSeverities
GUI severities.
static QStandardItem * createLineNumberItem(const QString &linenumber)
Create new line number item.
bool mVisibleErrors
Are there any visible errors.
void saveSettings() const
Save all settings Column widths.
static QString getFilePath(const QStandardItem *target, bool fullPath)
Helper function returning the filename/full path of the error tree item target.
bool hasVisibleResults() const
Check if there are any visible results in view.
void checkSelected(QStringList selectedItems)
Signal to perform selected files recheck.
void translate()
Change all visible texts language.
QSettings * mSettings
Program settings.
void loadSettings()
Load all settings Column widths.
void refreshTree()
Refresh tree by checking which of the items should be shown and which should be hidden.
bool addErrorItem(const ErrorItem &item)
Add a new item to the tree.
QStandardItemModel mModel
Item model for tree.
void filterResults(const QString &filter)
Function to filter the displayed list of errors.
void readErrorItem(const QStandardItem *error, ErrorItem *item) const
Convert GUI error item into data error item.
QString mCheckPath
Path we are currently checking.
bool mShowErrorId
true if optional column "Id" is shown
ApplicationList * mApplications
List of applications to open errors with.
void refreshFilePaths()
Hides/shows full file path on all error file items according to mShowFullPath.
ResultsTree(QWidget *parent=nullptr)
void suppressHash()
Slot for context menu item to suppress message with hash.
bool mShowFullPath
Should full path of files be shown (true) or relative (false)
QStandardItem * findFileItem(const QString &name) const
Finds a file item.
void saveResults(Report *report) const
Save results to a text stream.
QStandardItem * ensureFileItem(const QString &fullpath, const QString &file0, bool hide)
Ensures there's a item in the model for the specified file.
bool mSaveAllErrors
Save all errors (true) or only visible (false)
void recheckSelectedFiles()
Slot for rechecking selected files.
void suppressIds(QStringList ids)
Suppress Ids.
QStringList mHiddenMessageId
bool hasResults() const
Do we have results from check?
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override
Slot for selection change in the results tree.
void startApplication(const QStandardItem *target, int application=-1)
Helper function to open an error within target with application*.
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler)
QString askFileDir(const QString &file)
Ask directory where file is located.
void saveErrors(Report *report, const QStandardItem *fileItem) const
Save all errors under specified item.
QItemSelectionModel * mSelectionModel
void showResults(ShowTypes::ShowType type, bool show)
Function to show/hide certain type of errors Refreshes the tree.
QStandardItem * mContextItem
Right clicked item (used by context menu slots)
static QStandardItem * createNormalItem(const QString &name)
Create new normal item.
void context(int application)
Slot for context menu item to open an error with specified application.
void keyPressEvent(QKeyEvent *event) override
void copy()
Slot for context menu item to copy selection to clipboard.
static QString severityToTranslatedString(Severity severity)
Convert Severity to translated string for GUI.
void showInconclusiveColumn(bool show)
Show optional column "Inconclusve".
void showCppcheckResults(bool show)
Show/hide cppcheck errors.
void setCheckDirectory(const QString &dir)
Set the directory we are checking.
void quickStartApplication(const QModelIndex &index)
Slot to quickstart an error with default application.
const QString & getCheckDirectory()
Get the directory we are checking.
void contextMenuEvent(QContextMenuEvent *e) override
Context menu event (user right clicked on the tree)
static ShowTypes::ShowType SeverityToShowType(Severity severity)
Convert severity string to ShowTypes value.
static ShowTypes::ShowType VariantToShowType(const QVariant &data)
Convert QVariant (that contains an int) to Showtypes value.
ShowType
Show types we have (i.e.
static Severity ShowTypeToSeverity(ShowTypes::ShowType type)
Convert ShowType to severity string.
void show(ShowTypes::ShowType category, bool showing)
Show/hide the showtype.
bool isShown(ShowTypes::ShowType category) const
Is the showtype visible in the GUI?
This class handles creating threadresult and starting threads.
bool isChecking() const
Is checking running?
XML file report version 2.
QList< ErrorItem > read() override
Read contents of the report file.
bool open() override
Open existing report file.
std::string toString(Color c)
#define SUPPRESS_WARNING_GCC_POP
#define SUPPRESS_WARNING_CLANG_POP
#define SUPPRESS_WARNING_GCC_PUSH(warning)
#define SUPPRESS_WARNING_CLANG_PUSH(warning)
Severity
enum class for severity.
std::string severityToString(Severity severity)
@ none
No severity (default value).
@ portability
Portability warning.
@ information
Checking information.
@ performance
Performance warning.
@ error
Programming error.
@ internal
Internal message.
#define SETTINGS_LAST_SOURCE_PATH
#define SETTINGS_SHOW_FULL_PATH
QString getPath(const QString &type)
Obtains the path of specified type Returns the path of specified type if not empty.
#define SETTINGS_SAVE_FULL_PATH
#define SETTINGS_RESULT_COLUMN_WIDTH
#define SETTINGS_INCONCLUSIVE_ERRORS
#define SETTINGS_SHOW_ERROR_ID
void setPath(const QString &type, const QString &value)
Stores last used path of specified type Stores provided path as last used path for specified type.
#define SETTINGS_SAVE_ALL_ERRORS
static constexpr int COLUMN_SINCE_DATE
static constexpr char SEVERITY[]
static constexpr char FILENAME[]
static constexpr char SINCEDATE[]
static constexpr char TAGS[]
static constexpr char HIDE[]
static constexpr char ERRORID[]
static constexpr char FILE0[]
static constexpr int COLUMN_TAGS
static int indexOf(const QList< ErrorItem > &list, const ErrorItem &item)
static constexpr char HASH[]
static constexpr char SYMBOLNAMES[]
static constexpr char CWE[]
static constexpr char INCONCLUSIVE[]
static constexpr char LINE[]
static constexpr char COLUMN[]
static constexpr char SUMMARY[]
static constexpr char MESSAGE[]