2009-03-01 08:38:21 +01:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2023-01-28 10:16:34 +01:00
|
|
|
* Copyright (C) 2007-2023 Cppcheck team.
|
2009-03-01 08:38:21 +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
|
2009-09-27 17:08:31 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-03-01 08:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2022-04-13 12:24:00 +02:00
|
|
|
#include "library.h"
|
2010-07-26 22:59:35 +02:00
|
|
|
#include "settings.h"
|
2011-10-02 21:08:12 +02:00
|
|
|
#include "platforms.h"
|
2022-02-02 16:17:28 +01:00
|
|
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QMainWindow>
|
2023-04-08 16:08:47 +02:00
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
2022-02-02 16:17:28 +01:00
|
|
|
#include <QStringList>
|
2010-08-15 10:35:46 +02:00
|
|
|
|
2009-06-20 18:55:23 +02:00
|
|
|
class ThreadHandler;
|
2012-10-07 12:25:34 +02:00
|
|
|
class TranslationHandler;
|
2012-10-20 20:14:52 +02:00
|
|
|
class ScratchPad;
|
2017-07-31 12:02:51 +02:00
|
|
|
class ProjectFile;
|
2022-03-19 19:54:20 +01:00
|
|
|
class ApplicationList;
|
2011-05-12 11:34:23 +02:00
|
|
|
class QAction;
|
2021-04-03 21:30:50 +02:00
|
|
|
class QActionGroup;
|
|
|
|
class QSettings;
|
|
|
|
class QTimer;
|
2022-03-19 19:54:20 +01:00
|
|
|
class QLineEdit;
|
2022-04-13 12:24:00 +02:00
|
|
|
class ImportProject;
|
|
|
|
class QCloseEvent;
|
2022-10-09 18:51:01 +02:00
|
|
|
class QNetworkAccessManager;
|
|
|
|
class QNetworkReply;
|
2022-03-19 19:54:20 +01:00
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
2022-04-11 07:30:55 +02:00
|
|
|
}
|
2009-06-20 18:55:23 +02:00
|
|
|
|
2009-07-17 10:49:01 +02:00
|
|
|
/// @addtogroup GUI
|
|
|
|
/// @{
|
|
|
|
|
2009-03-01 08:38:21 +01:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Main window for cppcheck-gui
|
|
|
|
*
|
|
|
|
*/
|
2011-10-13 20:53:06 +02:00
|
|
|
class MainWindow : public QMainWindow {
|
2009-03-01 08:38:21 +01:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2011-05-12 11:34:23 +02:00
|
|
|
|
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Maximum number of MRU project items in File-menu.
|
|
|
|
*/
|
2011-05-12 11:34:23 +02:00
|
|
|
enum { MaxRecentProjects = 5 };
|
|
|
|
|
2013-03-01 19:11:27 +01:00
|
|
|
MainWindow(TranslationHandler* th, QSettings* settings);
|
2018-05-01 09:35:53 +02:00
|
|
|
MainWindow(const MainWindow &) = delete;
|
2022-03-13 20:07:58 +01:00
|
|
|
~MainWindow() override;
|
2018-05-01 09:35:53 +02:00
|
|
|
MainWindow &operator=(const MainWindow &) = delete;
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2011-10-02 21:08:12 +02:00
|
|
|
/**
|
2021-08-07 20:51:18 +02:00
|
|
|
* List of checked platforms.
|
|
|
|
*/
|
2011-10-02 21:08:12 +02:00
|
|
|
Platforms mPlatforms;
|
|
|
|
|
2012-10-20 20:32:22 +02:00
|
|
|
/**
|
2017-07-30 13:30:35 +02:00
|
|
|
* @brief Analyze given code
|
2016-10-02 18:23:51 +02:00
|
|
|
*
|
2017-07-30 13:30:35 +02:00
|
|
|
* @param code Content of the (virtual) file to be analyzed
|
|
|
|
* @param filename Name of the (virtual) file to be analyzed - determines language.
|
2016-10-02 18:23:51 +02:00
|
|
|
*/
|
2017-07-30 11:19:47 +02:00
|
|
|
void analyzeCode(const QString& code, const QString& filename);
|
2012-10-20 20:32:22 +02:00
|
|
|
|
2009-03-01 08:38:21 +01:00
|
|
|
public slots:
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Slot for analyze files menu item */
|
2017-07-30 11:19:47 +02:00
|
|
|
void analyzeFiles();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Slot to reanalyze all files */
|
2017-07-30 11:19:47 +02:00
|
|
|
void reAnalyzeAll();
|
2015-10-14 19:07:20 +02:00
|
|
|
|
2018-04-13 15:28:05 +02:00
|
|
|
/** @brief Slot to reanalyze with checking library configuration */
|
|
|
|
void checkLibrary();
|
|
|
|
|
|
|
|
/** @brief Slot to check configuration */
|
|
|
|
void checkConfiguration();
|
|
|
|
|
2015-12-23 10:28:07 +01:00
|
|
|
/**
|
2017-07-30 13:30:35 +02:00
|
|
|
* @brief Slot to reanalyze selected files
|
2016-10-02 18:23:51 +02:00
|
|
|
* @param selectedFilesList list of selected files
|
|
|
|
*/
|
2018-06-23 23:04:54 +02:00
|
|
|
void performSelectedFilesCheck(const QStringList &selectedFilesList);
|
2015-12-23 10:28:07 +01:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Slot to reanalyze modified files */
|
2017-07-30 11:19:47 +02:00
|
|
|
void reAnalyzeModified();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to clear all search results */
|
2017-07-28 10:41:03 +02:00
|
|
|
void clearResults();
|
2009-03-22 13:32:07 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to open XML report file */
|
2017-07-28 10:41:03 +02:00
|
|
|
void openResults();
|
2010-07-10 15:37:36 +02:00
|
|
|
|
2009-05-23 18:29:24 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Show errors with type "style"
|
|
|
|
* @param checked Should errors be shown (true) or hidden (false)
|
|
|
|
*/
|
2017-07-28 10:41:03 +02:00
|
|
|
void showStyle(bool checked);
|
2009-05-23 18:29:24 +02:00
|
|
|
|
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Show errors with type "error"
|
|
|
|
* @param checked Should errors be shown (true) or hidden (false)
|
|
|
|
*/
|
2017-07-28 10:41:03 +02:00
|
|
|
void showErrors(bool checked);
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2010-10-18 19:50:34 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Show errors with type "warning"
|
|
|
|
* @param checked Should errors be shown (true) or hidden (false)
|
|
|
|
*/
|
2017-07-28 10:41:03 +02:00
|
|
|
void showWarnings(bool checked);
|
2010-10-18 19:50:34 +02:00
|
|
|
|
2010-12-27 10:06:31 +01:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Show errors with type "portability"
|
|
|
|
* @param checked Should errors be shown (true) or hidden (false)
|
|
|
|
*/
|
2017-07-28 10:41:03 +02:00
|
|
|
void showPortability(bool checked);
|
2010-12-27 10:06:31 +01:00
|
|
|
|
2010-10-18 19:50:34 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Show errors with type "performance"
|
|
|
|
* @param checked Should errors be shown (true) or hidden (false)
|
|
|
|
*/
|
2017-07-28 10:41:03 +02:00
|
|
|
void showPerformance(bool checked);
|
2010-10-18 19:50:34 +02:00
|
|
|
|
2010-12-26 13:36:24 +01:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Show errors with type "information"
|
|
|
|
* @param checked Should errors be shown (true) or hidden (false)
|
|
|
|
*/
|
2017-07-28 10:41:03 +02:00
|
|
|
void showInformation(bool checked);
|
2010-12-26 13:36:24 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to check all "Show errors" menu items */
|
2017-07-28 10:41:03 +02:00
|
|
|
void checkAll();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to uncheck all "Show errors" menu items */
|
2017-07-28 10:41:03 +02:00
|
|
|
void uncheckAll();
|
2009-03-22 18:39:44 +01:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Slot for analyze directory menu item */
|
2017-07-30 11:19:47 +02:00
|
|
|
void analyzeDirectory();
|
2009-03-22 13:32:07 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to open program's settings dialog */
|
2017-07-28 10:41:03 +02:00
|
|
|
void programSettings();
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to open program's about dialog */
|
2017-07-28 10:41:03 +02:00
|
|
|
void about();
|
2009-05-24 10:53:29 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to to show license text */
|
2017-07-28 10:41:03 +02:00
|
|
|
void showLicense();
|
2009-06-14 11:57:43 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to to show authors list */
|
2017-07-28 10:41:03 +02:00
|
|
|
void showAuthors();
|
2009-05-26 17:21:39 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to save results */
|
2017-07-28 10:41:03 +02:00
|
|
|
void save();
|
2009-05-26 17:21:39 +02:00
|
|
|
|
2023-01-30 14:59:45 +01:00
|
|
|
/** @brief Slot to generate compliance report */
|
|
|
|
void complianceReport();
|
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to create new project file */
|
2017-07-28 10:41:03 +02:00
|
|
|
void newProjectFile();
|
2010-07-08 17:59:06 +02:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Slot to open project file and start analyzing contained paths. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void openProjectFile();
|
2010-07-07 20:18:42 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to show scratchpad. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void showScratchpad();
|
2012-10-20 20:14:52 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to close open project file. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void closeProjectFile();
|
2010-08-15 11:12:28 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot to edit project file. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void editProjectFile();
|
2010-08-15 15:12:32 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for showing the scan and project statistics. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void showStatistics();
|
2010-09-01 08:12:24 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for showing the library editor */
|
2017-07-28 10:41:03 +02:00
|
|
|
void showLibraryEditor();
|
2015-08-16 17:36:10 +02:00
|
|
|
|
2009-03-01 08:38:21 +01:00
|
|
|
protected slots:
|
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for checkthread's done signal */
|
2017-07-30 11:19:47 +02:00
|
|
|
void analysisDone();
|
2009-06-03 20:18:22 +02:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Lock down UI while analyzing */
|
2017-07-28 10:41:03 +02:00
|
|
|
void checkLockDownUI();
|
2011-02-11 20:08:37 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for enabling save and clear button */
|
2017-07-28 10:41:03 +02:00
|
|
|
void resultsAdded();
|
2009-07-01 22:46:42 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for showing/hiding standard toolbar */
|
2017-07-28 10:41:03 +02:00
|
|
|
void toggleMainToolBar();
|
2009-07-02 10:32:29 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for showing/hiding Categories toolbar */
|
2017-07-28 10:41:03 +02:00
|
|
|
void toggleViewToolBar();
|
2010-07-03 18:37:09 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for showing/hiding Filter toolbar */
|
2017-07-28 10:41:03 +02:00
|
|
|
void toggleFilterToolBar();
|
2011-05-04 07:30:54 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Slot for updating View-menu before it is shown. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void aboutToShowViewMenu();
|
2009-07-01 22:46:42 +02:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Slot when stop analysis button is pressed */
|
2017-07-30 11:19:47 +02:00
|
|
|
void stopAnalysis();
|
2009-07-02 19:23:44 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Open help file contents */
|
2017-07-28 10:41:03 +02:00
|
|
|
void openHelpContents();
|
2010-02-23 16:29:49 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Filters the results in the result list. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void filterResults();
|
2011-05-04 07:30:54 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Opens recently opened project file. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void openRecentProject();
|
2011-05-04 07:30:54 +02:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Selects the platform as analyzed platform. */
|
2017-07-28 10:41:03 +02:00
|
|
|
void selectPlatform();
|
2011-09-29 21:46:19 +02:00
|
|
|
|
2017-08-11 07:45:29 +02:00
|
|
|
/** Suppress error ids */
|
|
|
|
void suppressIds(QStringList ids);
|
|
|
|
|
2022-10-09 18:51:01 +02:00
|
|
|
private slots:
|
|
|
|
void replyFinished(QNetworkReply *reply);
|
|
|
|
|
|
|
|
void hideInformation();
|
2012-10-20 20:32:22 +02:00
|
|
|
private:
|
|
|
|
|
2022-08-22 21:11:28 +02:00
|
|
|
bool isCppcheckPremium() const;
|
|
|
|
|
2017-08-02 22:28:45 +02:00
|
|
|
/** Get filename for last results */
|
|
|
|
QString getLastResults() const;
|
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Reanalyzes files */
|
2017-07-30 11:19:47 +02:00
|
|
|
void reAnalyze(bool all);
|
2015-10-14 19:07:20 +02:00
|
|
|
|
2015-12-23 10:28:07 +01:00
|
|
|
/**
|
2017-07-30 13:30:35 +02:00
|
|
|
* @brief Reanalyze selected files
|
2016-10-02 18:23:51 +02:00
|
|
|
* @param files list of selected files
|
|
|
|
*/
|
2023-03-30 07:24:23 +02:00
|
|
|
void reAnalyzeSelected(const QStringList& files);
|
2015-12-23 10:28:07 +01:00
|
|
|
|
2012-10-20 20:32:22 +02:00
|
|
|
/**
|
2021-08-07 20:51:18 +02:00
|
|
|
* @brief Analyze the project.
|
|
|
|
* @param projectFile Pointer to the project to analyze.
|
|
|
|
* @param checkLibrary Flag to indicate if the library should be checked.
|
|
|
|
* @param checkConfiguration Flag to indicate if the configuration should be checked.
|
|
|
|
*/
|
2018-04-13 15:28:05 +02:00
|
|
|
void analyzeProject(const ProjectFile *projectFile, const bool checkLibrary = false, const bool checkConfiguration = false);
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2009-06-14 23:48:16 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Set current language
|
|
|
|
* @param code Language code of the language to set (e.g. "en").
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void setLanguage(const QString &code);
|
2009-06-14 23:48:16 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Event coming when application is about to close. */
|
2022-01-04 15:48:08 +01:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2009-06-04 16:02:35 +02:00
|
|
|
|
2009-06-01 23:54:21 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Helper function to toggle all show error menu items
|
|
|
|
* @param checked Should all errors be shown (true) or hidden (false)
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void toggleAllChecked(bool checked);
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Helper function to enable/disable all check,recheck buttons */
|
2017-07-28 05:44:15 +02:00
|
|
|
void enableCheckButtons(bool enable);
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2018-04-12 08:15:04 +02:00
|
|
|
/** @brief Helper function to enable/disable results buttons (clear,save,print) */
|
|
|
|
void enableResultsButtons();
|
|
|
|
|
2009-06-01 23:54:21 +02:00
|
|
|
/**
|
2017-07-30 13:30:35 +02:00
|
|
|
* @brief Select files/or directory to analyze.
|
2016-10-02 18:23:51 +02:00
|
|
|
* Helper function to open a dialog to ask user to select files or
|
2017-07-30 13:30:35 +02:00
|
|
|
* directory to analyze. Use native dialogs instead of Qt:s own dialogs.
|
2016-10-02 18:23:51 +02:00
|
|
|
*
|
|
|
|
* @param mode Dialog open mode (files or directories)
|
2017-07-30 13:30:35 +02:00
|
|
|
* @return QStringList of files or directories that were selected to analyze
|
2016-10-02 18:23:51 +02:00
|
|
|
*/
|
2017-07-30 11:19:47 +02:00
|
|
|
QStringList selectFilesToAnalyze(QFileDialog::FileMode mode);
|
2009-07-16 07:20:29 +02:00
|
|
|
|
2016-08-18 21:58:50 +02:00
|
|
|
/**
|
2017-07-30 13:30:35 +02:00
|
|
|
* @brief Analyze project
|
2016-10-02 18:23:51 +02:00
|
|
|
* @param p imported project
|
2018-04-13 15:28:05 +02:00
|
|
|
* @param checkLibrary Flag to indicate if library should be checked
|
|
|
|
* @param checkConfiguration Flag to indicate if the configuration should be checked.
|
2016-10-02 18:23:51 +02:00
|
|
|
*/
|
2018-04-13 15:28:05 +02:00
|
|
|
void doAnalyzeProject(ImportProject p, const bool checkLibrary = false, const bool checkConfiguration = false);
|
2016-08-18 21:58:50 +02:00
|
|
|
|
2009-07-16 07:20:29 +02:00
|
|
|
/**
|
2017-07-30 13:30:35 +02:00
|
|
|
* @brief Analyze all files specified in parameter files
|
2016-10-02 18:23:51 +02:00
|
|
|
*
|
2017-07-30 13:30:35 +02:00
|
|
|
* @param files List of files and/or directories to analyze
|
2018-04-13 15:28:05 +02:00
|
|
|
* @param checkLibrary Flag to indicate if library should be checked
|
|
|
|
* @param checkConfiguration Flag to indicate if the configuration should be checked.
|
2016-10-02 18:23:51 +02:00
|
|
|
*/
|
2018-04-13 15:28:05 +02:00
|
|
|
void doAnalyzeFiles(const QStringList &files, const bool checkLibrary = false, const bool checkConfiguration = false);
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2009-06-01 23:54:21 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Get our default cppcheck settings and read project file.
|
|
|
|
*
|
|
|
|
* @return Default cppcheck settings
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
Settings getCppcheckSettings();
|
2009-05-23 18:29:24 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Load program settings */
|
2017-07-28 05:44:15 +02:00
|
|
|
void loadSettings();
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Save program settings */
|
2017-07-28 05:44:15 +02:00
|
|
|
void saveSettings() const;
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2009-06-22 17:45:48 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Format main window title.
|
|
|
|
* @param text Text added to end of the title.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void formatAndSetTitle(const QString &text = QString());
|
2009-06-22 17:45:48 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Show help contents */
|
2022-09-08 20:01:41 +02:00
|
|
|
static void openOnlineHelp();
|
2010-02-23 16:29:49 +01:00
|
|
|
|
2010-08-25 17:54:45 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Enable or disable project file actions.
|
|
|
|
* Project editing and closing actions should be only enabled when project is
|
2017-07-30 13:30:35 +02:00
|
|
|
* open and we are not analyzing files.
|
2016-10-02 18:23:51 +02:00
|
|
|
* @param enable If true then actions are enabled.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void enableProjectActions(bool enable);
|
2010-08-25 17:54:45 +02:00
|
|
|
|
2010-08-25 19:59:30 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Enable or disable project file actions.
|
2017-07-30 13:30:35 +02:00
|
|
|
* Project opening and creating actions should be disabled when analyzing.
|
2016-10-02 18:23:51 +02:00
|
|
|
* @param enable If true then actions are enabled.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void enableProjectOpenActions(bool enable);
|
2010-08-25 19:59:30 +02:00
|
|
|
|
2010-11-26 21:51:38 +01:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Add include directories.
|
|
|
|
* @param includeDirs List of include directories to add.
|
|
|
|
* @param result Settings class where include directories are added.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void addIncludeDirs(const QStringList &includeDirs, Settings &result);
|
2010-11-26 21:51:38 +01:00
|
|
|
|
2011-04-07 14:34:15 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Handle command line parameters given to GUI.
|
|
|
|
* @param params List of string given to command line.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void handleCLIParams(const QStringList ¶ms);
|
2013-02-10 23:53:01 +01:00
|
|
|
|
2013-02-10 07:48:09 +01:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Load XML file to the GUI.
|
2017-04-01 09:31:27 +02:00
|
|
|
* @param selectedFile Filename (inc. path) of XML file to load.
|
2016-10-02 18:23:51 +02:00
|
|
|
*/
|
2018-06-23 23:04:54 +02:00
|
|
|
void loadResults(const QString &selectedFile);
|
2013-02-10 07:48:09 +01:00
|
|
|
|
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Load XML file to the GUI.
|
2017-04-01 09:31:27 +02:00
|
|
|
* @param selectedFile Filename (inc. path) of XML file to load.
|
|
|
|
* @param sourceDirectory Path to the directory that the results were generated for.
|
2016-10-02 18:23:51 +02:00
|
|
|
*/
|
2018-06-23 23:04:54 +02:00
|
|
|
void loadResults(const QString &selectedFile, const QString &sourceDirectory);
|
2011-04-07 14:34:15 +02:00
|
|
|
|
2017-07-30 13:42:34 +02:00
|
|
|
/**
|
2021-08-07 20:51:18 +02:00
|
|
|
* @brief Load last project results to the GUI.
|
|
|
|
* @return Returns true if last results was loaded
|
|
|
|
*/
|
2017-07-30 13:42:34 +02:00
|
|
|
bool loadLastResults();
|
|
|
|
|
2011-04-07 14:34:15 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Load project file to the GUI.
|
|
|
|
* @param filePath Filename (inc. path) of project file to load.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void loadProjectFile(const QString &filePath);
|
2011-04-07 14:34:15 +02:00
|
|
|
|
2013-12-31 10:46:44 +01:00
|
|
|
/**
|
|
|
|
* @brief Load library file
|
2014-01-01 20:46:00 +01:00
|
|
|
* @param library library to use
|
2013-12-31 10:46:44 +01:00
|
|
|
* @param filename filename (no path)
|
2015-01-10 22:51:45 +01:00
|
|
|
* @return error code
|
2013-12-31 10:46:44 +01:00
|
|
|
*/
|
2018-06-23 23:04:54 +02:00
|
|
|
Library::Error loadLibrary(Library *library, const QString &filename);
|
2013-12-31 10:46:44 +01:00
|
|
|
|
2015-01-10 22:51:45 +01:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Tries to load library file, prints message on error
|
|
|
|
* @param library library to use
|
|
|
|
* @param filename filename (no path)
|
|
|
|
* @return True if no error
|
|
|
|
*/
|
2020-03-07 11:33:08 +01:00
|
|
|
bool tryLoadLibrary(Library *library, const QString& filename);
|
2015-01-10 22:51:45 +01:00
|
|
|
|
2011-05-12 11:34:23 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Update project MRU items in File-menu.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void updateMRUMenuItems();
|
2011-05-12 11:34:23 +02:00
|
|
|
|
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Add project file (path) to the MRU list.
|
|
|
|
* @param project Full path to the project file to add.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void addProjectMRU(const QString &project);
|
2011-05-12 11:34:23 +02:00
|
|
|
|
2011-05-12 12:30:22 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Remove project file (path) from the MRU list.
|
|
|
|
* @param project Full path of the project file to remove.
|
|
|
|
*/
|
2017-07-28 05:44:15 +02:00
|
|
|
void removeProjectMRU(const QString &project);
|
2011-05-12 12:30:22 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Program settings */
|
2009-07-02 10:32:29 +02:00
|
|
|
QSettings *mSettings;
|
2009-03-22 16:42:00 +01:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Thread to analyze files */
|
2009-07-02 10:32:29 +02:00
|
|
|
ThreadHandler *mThread;
|
2009-05-26 17:21:39 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief List of user defined applications to open errors with */
|
2009-07-02 10:32:29 +02:00
|
|
|
ApplicationList *mApplications;
|
2009-03-22 18:39:44 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Class to handle translation changes */
|
2009-07-02 10:32:29 +02:00
|
|
|
TranslationHandler *mTranslation;
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Class holding all UI components */
|
2022-03-19 19:54:20 +01:00
|
|
|
Ui::MainWindow *mUI;
|
2009-03-01 08:38:21 +01:00
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief Current analyzed directory. */
|
2009-06-22 10:57:17 +02:00
|
|
|
QString mCurrentDirectory;
|
2009-07-01 22:46:42 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Scratchpad. */
|
2012-10-20 20:14:52 +02:00
|
|
|
ScratchPad* mScratchPad;
|
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Project (file). */
|
2017-07-31 12:02:51 +02:00
|
|
|
ProjectFile *mProjectFile;
|
2010-08-15 10:35:46 +02:00
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Filter field in the Filter toolbar. */
|
2011-05-04 07:30:54 +02:00
|
|
|
QLineEdit* mLineEditFilter;
|
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Timer to delay filtering while typing. */
|
2011-05-04 07:30:54 +02:00
|
|
|
QTimer* mFilterTimer;
|
|
|
|
|
2017-07-30 13:30:35 +02:00
|
|
|
/** @brief GUI actions for selecting the analyzed platform. */
|
2011-12-27 11:46:21 +01:00
|
|
|
QActionGroup *mPlatformActions;
|
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief GUI actions for selecting the coding standard. */
|
2013-03-02 13:01:21 +01:00
|
|
|
QActionGroup *mCStandardActions, *mCppStandardActions;
|
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief GUI actions for selecting language. */
|
2015-10-14 14:31:52 +02:00
|
|
|
QActionGroup *mSelectLanguageActions;
|
|
|
|
|
2010-07-17 22:52:50 +02:00
|
|
|
/**
|
2016-10-02 18:23:51 +02:00
|
|
|
* @brief Are we exiting the cppcheck?
|
|
|
|
* If this is true then the cppcheck is waiting for check threads to exit
|
|
|
|
* so that the application can be closed.
|
|
|
|
*/
|
2010-07-17 22:52:50 +02:00
|
|
|
bool mExiting;
|
|
|
|
|
2016-10-02 18:23:51 +02:00
|
|
|
/** @brief Set to true in case of loading log file. */
|
2016-01-16 09:59:02 +01:00
|
|
|
bool mIsLogfileLoaded;
|
|
|
|
|
2011-05-12 11:34:23 +02:00
|
|
|
/**
|
2011-08-24 22:14:28 +02:00
|
|
|
* @brief Project MRU menu actions.
|
|
|
|
* List of MRU menu actions. Needs also to store the separator.
|
|
|
|
*/
|
|
|
|
QAction *mRecentProjectActs[MaxRecentProjects + 1];
|
2022-03-24 22:44:47 +01:00
|
|
|
|
|
|
|
QString mCppcheckCfgAbout;
|
|
|
|
QString mCppcheckCfgProductName;
|
2022-10-09 18:51:01 +02:00
|
|
|
|
|
|
|
QNetworkAccessManager *mNetworkAccessManager = nullptr;
|
2009-03-01 08:38:21 +01:00
|
|
|
};
|
2009-07-17 10:49:01 +02:00
|
|
|
/// @}
|
2009-03-01 08:38:21 +01:00
|
|
|
#endif // MAINWINDOW_H
|