2009-03-22 18:47:25 +01:00
|
|
|
/*
|
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
2019-06-29 07:49:14 +02:00
|
|
|
* Copyright (C) 2007-2019 Cppcheck team.
|
2009-03-22 18:47:25 +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-22 18:47:25 +01:00
|
|
|
*/
|
|
|
|
|
2009-03-22 18:39:44 +01:00
|
|
|
#ifndef COMMON_H
|
|
|
|
#define COMMON_H
|
|
|
|
|
2018-05-25 07:09:49 +02:00
|
|
|
#include <QMap>
|
2013-02-08 16:18:05 +01:00
|
|
|
#include <QString>
|
|
|
|
|
2009-07-17 10:49:01 +02:00
|
|
|
/// @addtogroup GUI
|
|
|
|
/// @{
|
|
|
|
|
2017-09-22 15:41:27 +02:00
|
|
|
#define CLANG_ANALYZER "clang-analyzer"
|
|
|
|
#define CLANG_TIDY "clang-tidy"
|
2009-07-17 10:49:01 +02:00
|
|
|
|
2009-07-02 10:32:29 +02:00
|
|
|
/**
|
|
|
|
* QSetting value names
|
|
|
|
*/
|
2010-12-26 17:35:51 +01:00
|
|
|
|
|
|
|
// Window/dialog sizes
|
2009-07-02 10:32:29 +02:00
|
|
|
#define SETTINGS_WINDOW_MAXIMIZED "Window maximized"
|
|
|
|
#define SETTINGS_WINDOW_WIDTH "Window width"
|
|
|
|
#define SETTINGS_WINDOW_HEIGHT "Window height"
|
2010-12-26 17:35:51 +01:00
|
|
|
#define SETTINGS_LOG_VIEW_WIDTH "Log/View width"
|
|
|
|
#define SETTINGS_LOG_VIEW_HEIGHT "Log/View height"
|
|
|
|
#define SETTINGS_MAINWND_SPLITTER_STATE "Mainwindow/Vertical splitter state"
|
|
|
|
#define SETTINGS_CHECK_DIALOG_WIDTH "Check dialog width"
|
|
|
|
#define SETTINGS_CHECK_DIALOG_HEIGHT "Check dialog height"
|
2011-05-13 09:12:19 +02:00
|
|
|
#define SETTINGS_PROJECT_DIALOG_WIDTH "Project dialog width"
|
|
|
|
#define SETTINGS_PROJECT_DIALOG_HEIGHT "Project dialog height"
|
2010-12-26 17:35:51 +01:00
|
|
|
|
|
|
|
// Main window settings
|
|
|
|
#define SETTINGS_RESULT_COLUMN_WIDTH "Result column %1 width"
|
|
|
|
#define SETTINGS_TOOLBARS_MAIN_SHOW "Toolbars/ShowStandard"
|
|
|
|
#define SETTINGS_TOOLBARS_VIEW_SHOW "Toolbars/ShowView"
|
2011-05-04 07:30:54 +02:00
|
|
|
#define SETTINGS_TOOLBARS_FILTER_SHOW "Toolbars/ShowFilter"
|
2010-12-26 17:35:51 +01:00
|
|
|
|
|
|
|
// Show * states
|
2009-07-02 10:32:29 +02:00
|
|
|
#define SETTINGS_SHOW_STYLE "Show style"
|
|
|
|
#define SETTINGS_SHOW_ERRORS "Show errors"
|
2010-10-18 19:50:34 +02:00
|
|
|
#define SETTINGS_SHOW_WARNINGS "Show warnings"
|
|
|
|
#define SETTINGS_SHOW_PERFORMANCE "Show performance"
|
2010-12-26 11:35:31 +01:00
|
|
|
#define SETTINGS_SHOW_INFORMATION "Show information"
|
2010-12-27 10:06:31 +01:00
|
|
|
#define SETTINGS_SHOW_PORTABILITY "Show portability"
|
2010-12-26 17:35:51 +01:00
|
|
|
|
2011-12-27 21:12:52 +01:00
|
|
|
// Standards support
|
2019-04-12 12:12:12 +02:00
|
|
|
#define SETTINGS_STD_CPP "Standard CPP"
|
|
|
|
#define SETTINGS_STD_C "Standard C"
|
2011-12-27 21:12:52 +01:00
|
|
|
|
2015-10-14 14:31:52 +02:00
|
|
|
// Language enforcement
|
|
|
|
#define SETTINGS_ENFORCED_LANGUAGE "Enforced language"
|
|
|
|
|
2010-12-26 17:35:51 +01:00
|
|
|
// Other settings
|
2009-07-02 10:32:29 +02:00
|
|
|
#define SETTINGS_CHECK_FORCE "Check force"
|
|
|
|
#define SETTINGS_CHECK_THREADS "Check threads"
|
|
|
|
#define SETTINGS_SHOW_FULL_PATH "Show full path"
|
|
|
|
#define SETTINGS_SHOW_NO_ERRORS "Show no errors message"
|
2010-08-29 08:38:03 +02:00
|
|
|
#define SETTINGS_SHOW_DEBUG_WARNINGS "Show debug warnings"
|
2009-07-02 10:32:29 +02:00
|
|
|
#define SETTINGS_SAVE_ALL_ERRORS "Save all errors"
|
|
|
|
#define SETTINGS_SAVE_FULL_PATH "Save full path"
|
|
|
|
#define SETTINGS_APPLICATION_NAMES "Application names"
|
|
|
|
#define SETTINGS_APPLICATION_PATHS "Application paths"
|
2011-04-01 23:53:26 +02:00
|
|
|
#define SETTINGS_APPLICATION_PARAMS "Application parameters"
|
2011-02-25 10:45:04 +01:00
|
|
|
#define SETTINGS_APPLICATION_DEFAULT "Default Application"
|
2009-07-02 10:32:29 +02:00
|
|
|
#define SETTINGS_LANGUAGE "Application language"
|
2010-11-26 21:35:45 +01:00
|
|
|
#define SETTINGS_GLOBAL_INCLUDE_PATHS "Global include paths"
|
2017-08-14 00:23:21 +02:00
|
|
|
#define SETTINGS_PYTHON_PATH "Python path"
|
2018-01-20 14:13:09 +01:00
|
|
|
#define SETTINGS_MISRA_FILE "MISRA C 2012 file"
|
2017-08-10 15:47:20 +02:00
|
|
|
#define SETTINGS_CLANG_PATH "Clang path"
|
2017-08-13 17:13:24 +02:00
|
|
|
#define SETTINGS_VS_INCLUDE_PATHS "VS include paths"
|
2010-12-26 17:29:43 +01:00
|
|
|
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
|
2011-04-16 17:42:32 +02:00
|
|
|
#define SETTINGS_INCONCLUSIVE_ERRORS "Inconclusive errors"
|
2011-05-12 11:34:23 +02:00
|
|
|
#define SETTINGS_MRU_PROJECTS "MRU Projects"
|
2012-10-27 11:18:41 +02:00
|
|
|
#define SETTINGS_SHOW_ERROR_ID "Show error Id"
|
2016-01-16 17:43:57 +01:00
|
|
|
#define SETTINGS_SHOW_STATISTICS "Show statistics"
|
2017-07-30 00:13:00 +02:00
|
|
|
#define SETTINGS_OPEN_PROJECT "Open Project"
|
2009-07-02 10:32:29 +02:00
|
|
|
|
2011-07-28 08:30:45 +02:00
|
|
|
// The maximum value for the progress bar
|
|
|
|
#define PROGRESS_MAX 1024.0
|
|
|
|
|
2011-09-29 21:46:19 +02:00
|
|
|
#define SETTINGS_CHECKED_PLATFORM "Checked platform"
|
2013-02-08 16:18:05 +01:00
|
|
|
|
|
|
|
#define SETTINGS_LAST_CHECK_PATH "Last check path"
|
2013-02-10 08:15:32 +01:00
|
|
|
#define SETTINGS_LAST_PROJECT_PATH "Last project path"
|
2013-02-08 16:18:05 +01:00
|
|
|
#define SETTINGS_LAST_RESULT_PATH "Last result path"
|
|
|
|
#define SETTINGS_LAST_SOURCE_PATH "Last source path"
|
|
|
|
#define SETTINGS_LAST_INCLUDE_PATH "Last include path"
|
|
|
|
#define SETTINGS_LAST_APP_PATH "Last application path"
|
|
|
|
|
2018-05-25 07:09:49 +02:00
|
|
|
#define SETTINGS_LAST_ANALYZE_FILES_FILTER "Last analyze files filter"
|
2013-02-08 16:18:05 +01:00
|
|
|
|
2013-02-19 21:39:50 +01:00
|
|
|
/**
|
2013-02-09 17:58:51 +01:00
|
|
|
* @brief Obtains the path of specified type
|
2013-02-17 19:59:16 +01:00
|
|
|
* Returns the path of specified type if not empty. Otherwise returns last check
|
|
|
|
* path if valid or user's home directory.
|
2013-02-09 17:58:51 +01:00
|
|
|
* @param type Type of path to obtain
|
2019-09-11 19:21:38 +02:00
|
|
|
* @return Best path for provided type
|
2013-02-09 17:58:51 +01:00
|
|
|
*/
|
2017-07-28 11:20:35 +02:00
|
|
|
QString getPath(const QString &type);
|
2013-02-09 17:58:51 +01:00
|
|
|
|
2013-02-19 21:39:50 +01:00
|
|
|
/**
|
2013-02-09 17:58:51 +01:00
|
|
|
* @brief Stores last used path of specified type
|
2013-02-17 19:59:16 +01:00
|
|
|
* Stores provided path as last used path for specified type.
|
2013-02-09 17:58:51 +01:00
|
|
|
* @param type Type of the path to store
|
|
|
|
* @param value Path to store
|
|
|
|
*/
|
2017-07-28 11:20:35 +02:00
|
|
|
void setPath(const QString &type, const QString &value);
|
2011-09-29 21:46:19 +02:00
|
|
|
|
2018-05-25 07:09:49 +02:00
|
|
|
/**
|
|
|
|
* @brief Creates a string suitable for passing as the filter argument to
|
|
|
|
* methods like QFileDialog::getOpenFileName.
|
|
|
|
* @param filters A map of filter descriptions to the associated file name
|
|
|
|
* patterns.
|
|
|
|
* @param addAllSupported If set to true (the default), the function will
|
|
|
|
* include a filter entry containing all the file name patterns found in
|
|
|
|
* \p filters. This entry will be the first in the resulting filter string.
|
|
|
|
* @param addAll If set to true (the default), the function will
|
|
|
|
* include a filter entry displaying all files. This entry will be placed
|
|
|
|
* after the entry for \p addAllSupported files.
|
|
|
|
*
|
|
|
|
* Example usage:
|
|
|
|
*
|
|
|
|
* @code
|
|
|
|
* QMap<QString,QString> filters;
|
|
|
|
* filters[tr("Supported images")] = "*.bmp *.jpg *.png";
|
|
|
|
* filters[tr("Plain text")] = "*.txt";
|
|
|
|
*
|
|
|
|
* const QString filterString = toFilterString(filters);
|
|
|
|
*
|
|
|
|
* // filterString contains "All supported files (*.txt *.bmp *.jpg *.png);;All files (*.*);;Plain text (*.txt);;Supported images (*.bmp *.jpg *.png)"
|
|
|
|
* @endcode
|
|
|
|
*/
|
|
|
|
QString toFilterString(const QMap<QString,QString>& filters, bool addAllSupported=true, bool addAll=true);
|
|
|
|
|
2020-08-29 21:26:49 +02:00
|
|
|
/**
|
|
|
|
* Get configured data dir. If not configured then it will try to determine that from exe path.
|
|
|
|
*/
|
|
|
|
QString getDataDir();
|
|
|
|
|
2009-07-17 10:49:01 +02:00
|
|
|
/// @}
|
2009-03-22 18:39:44 +01:00
|
|
|
#endif
|