Cppcheck
Public Member Functions | Protected Slots | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ProjectFileDialog Class Reference

A dialog for editing project file data. More...

#include <projectfiledialog.h>

Inheritance diagram for ProjectFileDialog:

Public Member Functions

 ProjectFileDialog (ProjectFile *projectFile, bool premium, QWidget *parent=nullptr)
 
 ~ProjectFileDialog () override
 

Protected Slots

void ok ()
 ok button pressed, save changes and accept More...
 
void browseBuildDir ()
 Browse for build dir. More...
 
void clearImportProject ()
 Clear 'import project'. More...
 
void browseImportProject ()
 Browse for solution / project / compile database. More...
 
void addCheckPath ()
 Add new path to check. More...
 
void editCheckPath ()
 Edit path in the list. More...
 
void removeCheckPath ()
 Remove path from the list. More...
 
void addIncludeDir ()
 Browse for include directory. More...
 
void removeIncludeDir ()
 Remove include directory from the list. More...
 
void editIncludeDir ()
 Edit include directory in the list. More...
 
void addExcludePath ()
 Add new path to exclude list. More...
 
void addExcludeFile ()
 Add new file to exclude list. More...
 
void editExcludePath ()
 Edit excluded path in the list. More...
 
void removeExcludePath ()
 Remove excluded path from the list. More...
 
void moveIncludePathUp ()
 Move include path up in the list. More...
 
void moveIncludePathDown ()
 Move include path down in the list. More...
 
void addSuppression ()
 Add suppression to the list. More...
 
void removeSuppression ()
 Remove selected suppression from the list. More...
 
void editSuppression (const QModelIndex &index)
 Edit suppression (double clicking on suppression) More...
 
void browseMisraFile ()
 Browse for misra file. More...
 
void checkAllVSConfigs ()
 Check for all VS configurations. More...
 

Protected Member Functions

void loadSettings ()
 Save dialog settings. More...
 
void saveSettings () const
 Load dialog settings. More...
 
void addIncludeDir (const QString &dir)
 Add new indlude directory. More...
 
void addCheckPath (const QString &path)
 Add new path to check. More...
 
void addExcludePath (const QString &path)
 Add new path to ignore list. More...
 
int getSuppressionIndex (const QString &shortText) const
 Get mSuppressions index that match the given short text. More...
 

Private Member Functions

void loadFromProjectFile (const ProjectFile *projectFile)
 
void saveToProjectFile (ProjectFile *projectFile) const
 
void updatePathsAndDefines ()
 Enable and disable widgets in the 'Paths and Defines' tab. More...
 
QString getRootPath () const
 Return project root path from the dialog control. More...
 
QStringList getProjectConfigurations () const
 
void setProjectConfigurations (const QStringList &configs)
 
QString getImportProject () const
 
QString getBuildDir () const
 Get Cppcheck build dir. More...
 
QStringList getIncludePaths () const
 Return include paths from the dialog control. More...
 
QStringList getDefines () const
 Return define names from the dialog control. More...
 
QStringList getUndefines () const
 Return undefine names from the dialog control. More...
 
QStringList getCheckPaths () const
 Return check paths from the dialog control. More...
 
QStringList getExcludedPaths () const
 Return excluded paths from the dialog control. More...
 
QStringList getLibraries () const
 Return selected libraries from the dialog control. More...
 
const QList< SuppressionList::Suppression > & getSuppressions () const
 Return suppressions from the dialog control. More...
 
void setRootPath (const QString &root)
 Set project root path to dialog control. More...
 
void setBuildDir (const QString &buildDir)
 Set build dir. More...
 
void setImportProject (const QString &importProject)
 
void setIncludepaths (const QStringList &includes)
 Set include paths to dialog control. More...
 
void setDefines (const QStringList &defines)
 Set define names to dialog control. More...
 
void setUndefines (const QStringList &undefines)
 Set undefine names to dialog control. More...
 
void setCheckPaths (const QStringList &paths)
 Set check paths to dialog control. More...
 
void setExcludedPaths (const QStringList &paths)
 Set excluded paths to dialog control. More...
 
void setLibraries (const QStringList &libraries)
 Set libraries to dialog control. More...
 
void addSingleSuppression (const SuppressionList::Suppression &suppression)
 Add a single suppression to dialog control. More...
 
void setSuppressions (const QList< SuppressionList::Suppression > &suppressions)
 Set suppressions to dialog control. More...
 
QString getExistingDirectory (const QString &caption, bool trailingSlash)
 

Static Private Member Functions

static QStringList getProjectConfigs (const QString &fileName)
 

Private Attributes

Ui::ProjectFile * mUI
 
ProjectFilemProjectFile
 Projectfile path. More...
 
bool mPremium
 Is this Cppcheck Premium? More...
 
QList< SuppressionList::SuppressionmSuppressions
 

Detailed Description

A dialog for editing project file data.

Definition at line 45 of file projectfiledialog.h.

Constructor & Destructor Documentation

◆ ProjectFileDialog()

ProjectFileDialog::ProjectFileDialog ( ProjectFile projectFile,
bool  premium,
QWidget *  parent = nullptr 
)
explicit

◆ ~ProjectFileDialog()

ProjectFileDialog::~ProjectFileDialog ( )
override

Definition at line 249 of file projectfiledialog.cpp.

References mUI, and saveSettings().

Member Function Documentation

◆ addCheckPath [1/2]

void ProjectFileDialog::addCheckPath ( )
protectedslot

Add new path to check.

Definition at line 783 of file projectfiledialog.cpp.

References getExistingDirectory().

Referenced by ProjectFileDialog(), and setCheckPaths().

◆ addCheckPath() [2/2]

void ProjectFileDialog::addCheckPath ( const QString &  path)
protected

Add new path to check.

Parameters
pathPath to add.

Definition at line 630 of file projectfiledialog.cpp.

References mUI.

◆ addExcludeFile

void ProjectFileDialog::addExcludeFile ( )
protectedslot

Add new file to exclude list.

Definition at line 828 of file projectfiledialog.cpp.

References addExcludePath(), ProjectFile::getFilename(), mProjectFile, and toFilterString().

Referenced by ProjectFileDialog().

◆ addExcludePath [1/2]

void ProjectFileDialog::addExcludePath ( )
protectedslot

Add new path to exclude list.

Definition at line 823 of file projectfiledialog.cpp.

References getExistingDirectory().

Referenced by addExcludeFile(), ProjectFileDialog(), and setExcludedPaths().

◆ addExcludePath() [2/2]

void ProjectFileDialog::addExcludePath ( const QString &  path)
protected

Add new path to ignore list.

Parameters
pathPath to add.

Definition at line 641 of file projectfiledialog.cpp.

References mUI.

◆ addIncludeDir [1/2]

void ProjectFileDialog::addIncludeDir ( )
protectedslot

Browse for include directory.

Allow user to add new include directory to the list.

Definition at line 803 of file projectfiledialog.cpp.

References getExistingDirectory().

Referenced by ProjectFileDialog(), and setIncludepaths().

◆ addIncludeDir() [2/2]

void ProjectFileDialog::addIncludeDir ( const QString &  dir)
protected

Add new indlude directory.

Parameters
dirDirectory to add.

Definition at line 619 of file projectfiledialog.cpp.

References mUI.

◆ addSingleSuppression()

void ProjectFileDialog::addSingleSuppression ( const SuppressionList::Suppression suppression)
private

Add a single suppression to dialog control.

Parameters
suppressionA suppressions to add to dialog control.

Definition at line 766 of file projectfiledialog.cpp.

References SuppressionList::Suppression::getText(), mSuppressions, and mUI.

Referenced by addSuppression(), and setSuppressions().

◆ addSuppression

void ProjectFileDialog::addSuppression ( )
protectedslot

Add suppression to the list.

Definition at line 870 of file projectfiledialog.cpp.

References addSingleSuppression(), and NewSuppressionDialog::getSuppression().

Referenced by ProjectFileDialog().

◆ browseBuildDir

void ProjectFileDialog::browseBuildDir ( )
protectedslot

Browse for build dir.

Definition at line 533 of file projectfiledialog.cpp.

References getExistingDirectory(), and mUI.

Referenced by ProjectFileDialog().

◆ browseImportProject

void ProjectFileDialog::browseImportProject ( )
protectedslot

Browse for solution / project / compile database.

Definition at line 570 of file projectfiledialog.cpp.

References ProjectFile::getFilename(), getProjectConfigs(), mProjectFile, mUI, setProjectConfigurations(), toFilterString(), and updatePathsAndDefines().

Referenced by ProjectFileDialog().

◆ browseMisraFile

void ProjectFileDialog::browseMisraFile ( )
protectedslot

Browse for misra file.

Definition at line 916 of file projectfiledialog.cpp.

References ADDON_MISRA, getDataDir(), mUI, SETTINGS_MISRA_FILE, and updateAddonCheckBox().

Referenced by ProjectFileDialog().

◆ checkAllVSConfigs

void ProjectFileDialog::checkAllVSConfigs ( )
protectedslot

Check for all VS configurations.

Definition at line 279 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ clearImportProject

void ProjectFileDialog::clearImportProject ( )
protectedslot

Clear 'import project'.

Definition at line 564 of file projectfiledialog.cpp.

References mUI, and updatePathsAndDefines().

Referenced by ProjectFileDialog().

◆ editCheckPath

void ProjectFileDialog::editCheckPath ( )
protectedslot

Edit path in the list.

Definition at line 790 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ editExcludePath

void ProjectFileDialog::editExcludePath ( )
protectedslot

Edit excluded path in the list.

Definition at line 838 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ editIncludeDir

void ProjectFileDialog::editIncludeDir ( )
protectedslot

Edit include directory in the list.

Definition at line 817 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ editSuppression

void ProjectFileDialog::editSuppression ( const QModelIndex &  index)
protectedslot

Edit suppression (double clicking on suppression)

Definition at line 891 of file projectfiledialog.cpp.

References NewSuppressionDialog::getSuppression(), getSuppressionIndex(), mSuppressions, mUI, NewSuppressionDialog::setSuppression(), and setSuppressions().

Referenced by ProjectFileDialog().

◆ getBuildDir()

QString ProjectFileDialog::getBuildDir ( ) const
private

Get Cppcheck build dir.

Definition at line 660 of file projectfiledialog.cpp.

References mUI.

Referenced by saveToProjectFile().

◆ getCheckPaths()

QStringList ProjectFileDialog::getCheckPaths ( ) const
private

Return check paths from the dialog control.

Returns
List of check paths.

Definition at line 691 of file projectfiledialog.cpp.

References getPaths(), and mUI.

Referenced by saveToProjectFile().

◆ getDefines()

QStringList ProjectFileDialog::getDefines ( ) const
private

Return define names from the dialog control.

Returns
List of define names.

Definition at line 670 of file projectfiledialog.cpp.

References mUI.

Referenced by saveToProjectFile().

◆ getExcludedPaths()

QStringList ProjectFileDialog::getExcludedPaths ( ) const
private

Return excluded paths from the dialog control.

Returns
List of excluded paths.

Definition at line 696 of file projectfiledialog.cpp.

References getPaths(), and mUI.

Referenced by saveToProjectFile().

◆ getExistingDirectory()

QString ProjectFileDialog::getExistingDirectory ( const QString &  caption,
bool  trailingSlash 
)
private

◆ getImportProject()

QString ProjectFileDialog::getImportProject ( ) const
private

Definition at line 614 of file projectfiledialog.cpp.

References mUI.

Referenced by saveToProjectFile().

◆ getIncludePaths()

QStringList ProjectFileDialog::getIncludePaths ( ) const
private

Return include paths from the dialog control.

Returns
List of include paths.

Definition at line 665 of file projectfiledialog.cpp.

References getPaths(), and mUI.

Referenced by saveToProjectFile().

◆ getLibraries()

QStringList ProjectFileDialog::getLibraries ( ) const
private

Return selected libraries from the dialog control.

Returns
List of libraries.

Definition at line 701 of file projectfiledialog.cpp.

References mUI.

Referenced by saveToProjectFile().

◆ getProjectConfigs()

QStringList ProjectFileDialog::getProjectConfigs ( const QString &  fileName)
staticprivate

◆ getProjectConfigurations()

QStringList ProjectFileDialog::getProjectConfigurations ( ) const
private

Definition at line 592 of file projectfiledialog.cpp.

References mUI.

Referenced by saveToProjectFile().

◆ getRootPath()

QString ProjectFileDialog::getRootPath ( ) const
private

Return project root path from the dialog control.

Returns
Project root path.

Definition at line 652 of file projectfiledialog.cpp.

References mUI.

Referenced by saveToProjectFile().

◆ getSuppressionIndex()

int ProjectFileDialog::getSuppressionIndex ( const QString &  shortText) const
protected

Get mSuppressions index that match the given short text.

Parameters
shortTexttext as generated by Suppression::getText
Returns
index of matching suppression, -1 if not found

Definition at line 906 of file projectfiledialog.cpp.

References mSuppressions.

Referenced by editSuppression(), and removeSuppression().

◆ getSuppressions()

const QList<SuppressionList::Suppression>& ProjectFileDialog::getSuppressions ( ) const
inlineprivate

Return suppressions from the dialog control.

Returns
List of suppressions.

Definition at line 112 of file projectfiledialog.h.

References mSuppressions.

Referenced by saveToProjectFile().

◆ getUndefines()

QStringList ProjectFileDialog::getUndefines ( ) const
private

Return undefine names from the dialog control.

Returns
List of undefine names.

Definition at line 679 of file projectfiledialog.cpp.

References mUI.

Referenced by saveToProjectFile().

◆ loadFromProjectFile()

void ProjectFileDialog::loadFromProjectFile ( const ProjectFile projectFile)
private

Definition at line 290 of file projectfiledialog.cpp.

References ADDON_MISRA, builtinPlatforms, ProjectFile::clangParser, CheckThread::clangTidyCmd(), Settings::SafeChecks::classes, CODING_STANDARD_AUTOSAR, CODING_STANDARD_CERT_C, CODING_STANDARD_CERT_CPP, CODING_STANDARD_MISRA_C_2023, CODING_STANDARD_MISRA_CPP_2008, ProjectFile::getAnalyzeAllVsConfigs(), ProjectFile::getBughunting(), ProjectFile::getBuildDir(), ProjectFile::getCertIntPrecision(), ProjectFile::getCheckHeaders(), ProjectFile::getCheckPaths(), ProjectFile::getCheckUnusedTemplates(), ProjectFile::getClangAnalyzer(), ProjectFile::getClangTidy(), ProjectFile::getCodingStandards(), getDataDir(), ProjectFile::getDefines(), ProjectFile::getExcludedPaths(), ProjectFile::getImportProject(), ProjectFile::getIncludeDirs(), ProjectFile::getLibraries(), ProjectFile::getMaxCtuDepth(), ProjectFile::getMaxTemplateRecursion(), ProjectFile::getPlatform(), getProjectConfigs(), ProjectFile::getRootPath(), ProjectFile::getSuppressions(), ProjectFile::getTags(), ProjectFile::getUndefines(), ProjectFile::getVsConfigurations(), ProjectFile::isCheckLevelExhaustive(), mPremium, mUI, numberOfBuiltinPlatforms, ProjectFile::safeChecks, setBuildDir(), setCheckPaths(), setDefines(), setExcludedPaths(), setImportProject(), setIncludepaths(), setLibraries(), setProjectConfigurations(), setRootPath(), setSuppressions(), SETTINGS_MISRA_FILE, setUndefines(), Platform::toString(), updateAddonCheckBox(), and updatePathsAndDefines().

Referenced by ProjectFileDialog().

◆ loadSettings()

void ProjectFileDialog::loadSettings ( )
protected

Save dialog settings.

Definition at line 255 of file projectfiledialog.cpp.

References SETTINGS_PROJECT_DIALOG_HEIGHT, and SETTINGS_PROJECT_DIALOG_WIDTH.

Referenced by ProjectFileDialog().

◆ moveIncludePathDown

void ProjectFileDialog::moveIncludePathDown ( )
protectedslot

Move include path down in the list.

Definition at line 860 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ moveIncludePathUp

void ProjectFileDialog::moveIncludePathUp ( )
protectedslot

Move include path up in the list.

Definition at line 851 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ ok

void ProjectFileDialog::ok ( )
protectedslot

ok button pressed, save changes and accept

Definition at line 501 of file projectfiledialog.cpp.

References mProjectFile, saveToProjectFile(), and ProjectFile::write().

Referenced by ProjectFileDialog().

◆ removeCheckPath

void ProjectFileDialog::removeCheckPath ( )
protectedslot

Remove path from the list.

Definition at line 796 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ removeExcludePath

void ProjectFileDialog::removeExcludePath ( )
protectedslot

Remove excluded path from the list.

Definition at line 844 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ removeIncludeDir

void ProjectFileDialog::removeIncludeDir ( )
protectedslot

Remove include directory from the list.

Definition at line 810 of file projectfiledialog.cpp.

References mUI.

Referenced by ProjectFileDialog().

◆ removeSuppression

void ProjectFileDialog::removeSuppression ( )
protectedslot

Remove selected suppression from the list.

Definition at line 878 of file projectfiledialog.cpp.

References getSuppressionIndex(), mSuppressions, and mUI.

Referenced by ProjectFileDialog().

◆ saveSettings()

void ProjectFileDialog::saveSettings ( ) const
protected

Load dialog settings.

Definition at line 262 of file projectfiledialog.cpp.

References SETTINGS_PROJECT_DIALOG_HEIGHT, and SETTINGS_PROJECT_DIALOG_WIDTH.

Referenced by ~ProjectFileDialog().

◆ saveToProjectFile()

void ProjectFileDialog::saveToProjectFile ( ProjectFile projectFile) const
private

◆ setBuildDir()

void ProjectFileDialog::setBuildDir ( const QString &  buildDir)
private

Set build dir.

Definition at line 717 of file projectfiledialog.cpp.

References mUI.

Referenced by loadFromProjectFile().

◆ setCheckPaths()

void ProjectFileDialog::setCheckPaths ( const QStringList &  paths)
private

Set check paths to dialog control.

Parameters
pathsList of path names to set to dialog control.

Definition at line 744 of file projectfiledialog.cpp.

References addCheckPath().

Referenced by loadFromProjectFile().

◆ setDefines()

void ProjectFileDialog::setDefines ( const QStringList &  defines)
private

Set define names to dialog control.

Parameters
definesList of define names to set to dialog control.

Definition at line 734 of file projectfiledialog.cpp.

References mUI.

Referenced by loadFromProjectFile().

◆ setExcludedPaths()

void ProjectFileDialog::setExcludedPaths ( const QStringList &  paths)
private

Set excluded paths to dialog control.

Parameters
pathsList of path names to set to dialog control.

Definition at line 751 of file projectfiledialog.cpp.

References addExcludePath().

Referenced by loadFromProjectFile().

◆ setImportProject()

void ProjectFileDialog::setImportProject ( const QString &  importProject)
private

Definition at line 722 of file projectfiledialog.cpp.

References mUI.

Referenced by loadFromProjectFile().

◆ setIncludepaths()

void ProjectFileDialog::setIncludepaths ( const QStringList &  includes)
private

Set include paths to dialog control.

Parameters
includesList of include paths to set to dialog control.

Definition at line 727 of file projectfiledialog.cpp.

References addIncludeDir().

Referenced by loadFromProjectFile().

◆ setLibraries()

void ProjectFileDialog::setLibraries ( const QStringList &  libraries)
private

Set libraries to dialog control.

Parameters
librariesList of libraries to set to dialog control.

Definition at line 758 of file projectfiledialog.cpp.

References mUI.

Referenced by loadFromProjectFile().

◆ setProjectConfigurations()

void ProjectFileDialog::setProjectConfigurations ( const QStringList &  configs)
private

Definition at line 603 of file projectfiledialog.cpp.

References cfg(), and mUI.

Referenced by browseImportProject(), and loadFromProjectFile().

◆ setRootPath()

void ProjectFileDialog::setRootPath ( const QString &  root)
private

Set project root path to dialog control.

Parameters
rootProject root path to set to dialog control.

Definition at line 712 of file projectfiledialog.cpp.

References mUI.

Referenced by loadFromProjectFile().

◆ setSuppressions()

void ProjectFileDialog::setSuppressions ( const QList< SuppressionList::Suppression > &  suppressions)
private

Set suppressions to dialog control.

Parameters
suppressionsList of suppressions to set to dialog control.

Definition at line 772 of file projectfiledialog.cpp.

References addSingleSuppression(), mSuppressions, and mUI.

Referenced by editSuppression(), and loadFromProjectFile().

◆ setUndefines()

void ProjectFileDialog::setUndefines ( const QStringList &  undefines)
private

Set undefine names to dialog control.

Parameters
undefinesList of undefine names to set to dialog control.

Definition at line 739 of file projectfiledialog.cpp.

References mUI.

Referenced by loadFromProjectFile().

◆ updatePathsAndDefines()

void ProjectFileDialog::updatePathsAndDefines ( )
private

Enable and disable widgets in the 'Paths and Defines' tab.

Definition at line 540 of file projectfiledialog.cpp.

References mUI.

Referenced by browseImportProject(), clearImportProject(), and loadFromProjectFile().

Member Data Documentation

◆ mPremium

bool ProjectFileDialog::mPremium
private

Is this Cppcheck Premium?

Definition at line 330 of file projectfiledialog.h.

Referenced by loadFromProjectFile(), and saveToProjectFile().

◆ mProjectFile

ProjectFile* ProjectFileDialog::mProjectFile
private

Projectfile path.

Definition at line 327 of file projectfiledialog.h.

Referenced by addExcludeFile(), browseImportProject(), getExistingDirectory(), and ok().

◆ mSuppressions

QList<SuppressionList::Suppression> ProjectFileDialog::mSuppressions
private

◆ mUI

Ui::ProjectFile* ProjectFileDialog::mUI
private

The documentation for this class was generated from the following files: