|
Packit |
2035a7 |
/*
|
|
Packit |
2035a7 |
* Cppcheck - A tool for static C/C++ code analysis
|
|
Packit |
2035a7 |
* Copyright (C) 2007-2018 Cppcheck team.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* This program is free software: you can redistribute it and/or modify
|
|
Packit |
2035a7 |
* it under the terms of the GNU General Public License as published by
|
|
Packit |
2035a7 |
* the Free Software Foundation, either version 3 of the License, or
|
|
Packit |
2035a7 |
* (at your option) any later version.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
2035a7 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
2035a7 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
2035a7 |
* GNU General Public License for more details.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* You should have received a copy of the GNU General Public License
|
|
Packit |
2035a7 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
#ifndef RESULTSTREE_H
|
|
Packit |
2035a7 |
#define RESULTSTREE_H
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
#include <QTreeView>
|
|
Packit |
2035a7 |
#include <QStandardItemModel>
|
|
Packit |
2035a7 |
#include <QStandardItem>
|
|
Packit |
2035a7 |
#include <QSettings>
|
|
Packit |
2035a7 |
#include <QContextMenuEvent>
|
|
Packit |
2035a7 |
#include "errorlogger.h" // Severity
|
|
Packit |
2035a7 |
#include "showtypes.h"
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
class ApplicationList;
|
|
Packit |
2035a7 |
class Report;
|
|
Packit |
2035a7 |
class ErrorItem;
|
|
Packit |
2035a7 |
class ErrorLine;
|
|
Packit |
2035a7 |
class QModelIndex;
|
|
Packit |
2035a7 |
class QWidget;
|
|
Packit |
2035a7 |
class QItemSelectionModel;
|
|
Packit |
2035a7 |
class ThreadHandler;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/// @addtogroup GUI
|
|
Packit |
2035a7 |
/// @{
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Cppcheck's results are shown in this tree
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
class ResultsTree : public QTreeView {
|
|
Packit |
2035a7 |
Q_OBJECT
|
|
Packit |
2035a7 |
public:
|
|
Packit |
2035a7 |
explicit ResultsTree(QWidget * parent = 0);
|
|
Packit |
2035a7 |
virtual ~ResultsTree();
|
|
Packit |
2035a7 |
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
void setTags(const QStringList &tags) {
|
|
Packit |
2035a7 |
mTags = tags;
|
|
Packit |
2035a7 |
}
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Add a new item to the tree
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param item Error item data
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool addErrorItem(const ErrorItem &item);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Clear all errors from the tree
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void clear();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Clear errors for a specific file from the tree
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void clear(const QString &filename);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Clear errors of a file selected for recheck
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void clearRecheckFile(const QString &filename);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Function to filter the displayed list of errors.
|
|
Packit |
2035a7 |
* Refreshes the tree.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param filter String that must be found in the summary, description, file or id
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void filterResults(const QString& filter);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Function to show results that were previous hidden with HideResult()
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void showHiddenResults();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Save results to a text stream
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void saveResults(Report *report) const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Update items from old report (tag, sinceDate)
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void updateFromOldReport(const QString &filename);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Update tree settings
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param showFullPath Show full path of files in the tree
|
|
Packit |
2035a7 |
* @param saveFullPath Save full path of files in reports
|
|
Packit |
2035a7 |
* @param saveAllErrors Save all visible errors
|
|
Packit |
2035a7 |
* @param showErrorId Show error id
|
|
Packit |
2035a7 |
* @param showInconclusive Show inconclusive column
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void updateSettings(bool showFullPath, bool saveFullPath, bool saveAllErrors, bool showErrorId, bool showInconclusive);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Set the directory we are checking
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* This is used to split error file path to relative if necessary
|
|
Packit |
2035a7 |
* @param dir Directory we are checking
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void setCheckDirectory(const QString &dir;;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Get the directory we are checking
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @return Directory containing source files
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
QString getCheckDirectory(void);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Check if there are any visible results in view.
|
|
Packit |
2035a7 |
* @return true if there is at least one visible warning/error.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool hasVisibleResults() const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Do we have results from check?
|
|
Packit |
2035a7 |
* @return true if there is at least one warning/error, hidden or visible.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool hasResults() const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Save all settings
|
|
Packit |
2035a7 |
* Column widths
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void saveSettings() const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Change all visible texts language
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void translate();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Show optional column "Id"
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void showIdColumn(bool show);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Show optional column "Inconclusve"
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void showInconclusiveColumn(bool show);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Returns true if column "Id" is shown
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool showIdColumn() const {
|
|
Packit |
2035a7 |
return mShowErrorId;
|
|
Packit |
2035a7 |
}
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief GUI severities.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
ShowTypes mShowSeverities;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
virtual void keyPressEvent(QKeyEvent *event);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
signals:
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Signal that results have been hidden or shown
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param hidden true if there are some hidden results, or false if there are not
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void resultsHidden(bool hidden);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Signal to perform selected files recheck
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param selectedItems list of selected files
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void checkSelected(QStringList selectedItems);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Signal for selection change in result tree.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param current Model index to specify new selected item.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void selectionChanged(const QModelIndex ¤t;;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* Selected item(s) has been tagged
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void tagged();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/** Suppress Ids */
|
|
Packit |
2035a7 |
void suppressIds(QStringList ids);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
public slots:
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Function to show/hide certain type of errors
|
|
Packit |
2035a7 |
* Refreshes the tree.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param type Type of error to show/hide
|
|
Packit |
2035a7 |
* @param show Should specified errors be shown (true) or hidden (false)
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void showResults(ShowTypes::ShowType type, bool show);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Show/hide cppcheck errors.
|
|
Packit |
2035a7 |
* Refreshes the tree.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param show Should specified errors be shown (true) or hidden (false)
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void showCppcheckResults(bool show);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Show/hide clang-tidy/clang-analyzer errors.
|
|
Packit |
2035a7 |
* Refreshes the tree.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param show Should specified errors be shown (true) or hidden (false)
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void showClangResults(bool show);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
protected slots:
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot to quickstart an error with default application
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param index Model index to specify which error item to open
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void quickStartApplication(const QModelIndex &index);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to open an error with specified application
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param application Index of the application to open the error
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void context(int application);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to copy filename to clipboard
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void copyFilename();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to copy full path to clipboard
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void copyFullPath();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to the current error message to clipboard
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void copyMessage();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to the current error message Id to clipboard
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void copyMessageId();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to copy the current error line nr to clipboard
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void copyLineNr();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to hide the current error message
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void hideResult();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for rechecking selected files
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void recheckSelectedFiles();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to hide all messages with the current message Id
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void hideAllIdResult();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/** Slot for context menu item to suppress all messages with the current message id */
|
|
Packit |
2035a7 |
void suppressSelectedIds();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for context menu item to open the folder containing the current file.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void openContainingFolder();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Slot for selection change in the results tree.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param current Model index to specify new selected item.
|
|
Packit |
2035a7 |
* @param previous Model index to specify previous selected item.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
protected:
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Hides/shows full file path on all error file items according to mShowFullPath
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void refreshFilePaths();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Hides/shows full file path on all error file items according to mShowFullPath
|
|
Packit |
2035a7 |
* @param item Parent item whose childrens paths to change
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void refreshFilePaths(QStandardItem *item);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Removes checking directory from given path if mShowFullPath is false
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param path Path to remove checking directory
|
|
Packit |
2035a7 |
* @param saving are we saving? Check mSaveFullPath instead
|
|
Packit |
2035a7 |
* @return Path that has checking directory removed
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QString stripPath(const QString &path, bool saving) const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Save all errors under specified item
|
|
Packit |
2035a7 |
* @param report Report that errors are saved to
|
|
Packit |
2035a7 |
* @param fileItem Item whose errors to save
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void saveErrors(Report *report, QStandardItem *fileItem) const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Convert a severity string to a icon filename
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param severity Severity
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QString severityToIcon(Severity::SeverityType severity) const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Helper function to open an error within target with application*
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param target Error tree item to open
|
|
Packit |
2035a7 |
* @param application Index of the application to open with. Giving -1
|
|
Packit |
2035a7 |
* (default value) will open the default application.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void startApplication(QStandardItem *target, int application = -1);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Helper function to copy filename/full path to the clipboard
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param target Error tree item to open
|
|
Packit |
2035a7 |
* @param fullPath Are we copying full path or only filename?
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void copyPathToClipboard(QStandardItem *target, bool fullPath);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Helper function returning the filename/full path of the error tree item \a target.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param target The error tree item containing the filename/full path
|
|
Packit |
2035a7 |
* @param fullPath Whether or not to retrieve the full path or only the filename.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QString getFilePath(QStandardItem *target, bool fullPath);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Context menu event (user right clicked on the tree)
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param e Event
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void contextMenuEvent(QContextMenuEvent * e);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Add a new error item beneath a file or a backtrace item beneath an error
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param parent Parent for the item. Either a file item or an error item
|
|
Packit |
2035a7 |
* @param item Error line data
|
|
Packit |
2035a7 |
* @param hide Should this be hidden (true) or shown (false)
|
|
Packit |
2035a7 |
* @param icon Should a default backtrace item icon be added
|
|
Packit |
2035a7 |
* @param childOfMessage Is this a child element of a message?
|
|
Packit |
2035a7 |
* @return newly created QStandardItem *
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QStandardItem *addBacktraceFiles(QStandardItem *parent,
|
|
Packit |
2035a7 |
const ErrorLine &item,
|
|
Packit |
2035a7 |
const bool hide,
|
|
Packit |
2035a7 |
const QString &icon,
|
|
Packit |
2035a7 |
bool childOfMessage);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Refresh tree by checking which of the items should be shown
|
|
Packit |
2035a7 |
* and which should be hidden
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void refreshTree();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Convert Severity to translated string for GUI.
|
|
Packit |
2035a7 |
* @param severity Severity to convert
|
|
Packit |
2035a7 |
* @return Severity as translated string
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
static QString severityToTranslatedString(Severity::SeverityType severity);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Load all settings
|
|
Packit |
2035a7 |
* Column widths
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
void loadSettings();
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Ask directory where file is located.
|
|
Packit |
2035a7 |
* @param file File name.
|
|
Packit |
2035a7 |
* @return Directory user chose.
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QString askFileDir(const QString &file;;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Create new normal item.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* Normal item has left alignment and text set also as tooltip.
|
|
Packit |
2035a7 |
* @param name name for the item
|
|
Packit |
2035a7 |
* @return new QStandardItem
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
static QStandardItem *createNormalItem(const QString &name);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Create new normal item.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* Normal item has left alignment and text set also as tooltip.
|
|
Packit |
2035a7 |
* @param checked checked
|
|
Packit |
2035a7 |
* @return new QStandardItem
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
static QStandardItem *createCheckboxItem(bool checked);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Create new line number item.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* Line number item has right align and text set as tooltip.
|
|
Packit |
2035a7 |
* @param linenumber name for the item
|
|
Packit |
2035a7 |
* @return new QStandardItem
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
static QStandardItem *createLineNumberItem(const QString &linenumber);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Finds a file item
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param name name of the file item to find
|
|
Packit |
2035a7 |
* @return pointer to file item or null if none found
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QStandardItem *findFileItem(const QString &name) const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Ensures there's a item in the model for the specified file
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
* @param fullpath Full path to the file item.
|
|
Packit |
2035a7 |
* @param file0 Source file
|
|
Packit |
2035a7 |
* @param hide is the error (we want this file item for) hidden?
|
|
Packit |
2035a7 |
* @return QStandardItem to be used as a parent for all errors for specified file
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QStandardItem *ensureFileItem(const QString &fullpath, const QString &file0, bool hide);
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Item model for tree
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QStandardItemModel mModel;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Program settings
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QSettings *mSettings;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief A string used to filter the results for display.
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QString mFilter;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief List of applications to open errors with
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
ApplicationList *mApplications;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Right clicked item (used by context menu slots)
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QStandardItem *mContextItem;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Should full path of files be shown (true) or relative (false)
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool mShowFullPath;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Should full path of files be saved
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool mSaveFullPath;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Save all errors (true) or only visible (false)
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool mSaveAllErrors;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief true if optional column "Id" is shown
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool mShowErrorId;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Path we are currently checking
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
QString mCheckPath;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/**
|
|
Packit |
2035a7 |
* @brief Are there any visible errors
|
|
Packit |
2035a7 |
*
|
|
Packit |
2035a7 |
*/
|
|
Packit |
2035a7 |
bool mVisibleErrors;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
private:
|
|
Packit |
2035a7 |
/** tag selected items */
|
|
Packit |
2035a7 |
void tagSelectedItems(const QString &tag;;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
/** @brief Convert GUI error item into data error item */
|
|
Packit |
2035a7 |
void readErrorItem(const QStandardItem *error, ErrorItem *item) const;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
QStringList mTags;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
QStringList mHiddenMessageId;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
QItemSelectionModel *mSelectionModel;
|
|
Packit |
2035a7 |
ThreadHandler *mThread;
|
|
Packit |
2035a7 |
|
|
Packit |
2035a7 |
bool mShowCppcheck;
|
|
Packit |
2035a7 |
bool mShowClang;
|
|
Packit |
2035a7 |
};
|
|
Packit |
2035a7 |
/// @}
|
|
Packit |
2035a7 |
#endif // RESULTSTREE_H
|