diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp
index 4b26fe2de..c8b9ccdf7 100644
--- a/gui/projectfiledialog.cpp
+++ b/gui/projectfiledialog.cpp
@@ -92,6 +92,7 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
connect(mUI.mBtnBrowseBuildDir, SIGNAL(clicked()), this, SLOT(browseBuildDir()));
+ connect(mUI.mBtnClearImportProject, SIGNAL(clicked(bool)), this, SLOT(clearImportProject()));
connect(mUI.mBtnBrowseImportProject, SIGNAL(clicked()), this, SLOT(browseImportProject()));
connect(mUI.mBtnAddCheckPath, SIGNAL(clicked()), this, SLOT(addCheckPath()));
connect(mUI.mBtnEditCheckPath, SIGNAL(clicked()), this, SLOT(editCheckPath()));
@@ -138,6 +139,7 @@ void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile)
setExcludedPaths(projectFile->getExcludedPaths());
setLibraries(projectFile->getLibraries());
setSuppressions(projectFile->getSuppressions());
+ updatePathsAndDefines();
}
void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
@@ -185,6 +187,26 @@ void ProjectFileDialog::browseBuildDir()
mUI.mEditBuildDir->setText(dir);
}
+void ProjectFileDialog::updatePathsAndDefines() {
+ bool importProject = !mUI.mEditImportProject->text().isEmpty();
+ mUI.mBtnClearImportProject->setEnabled(importProject);
+ mUI.mListCheckPaths->setEnabled(!importProject);
+ mUI.mBtnAddCheckPath->setEnabled(!importProject);
+ mUI.mBtnEditCheckPath->setEnabled(!importProject);
+ mUI.mBtnRemoveCheckPath->setEnabled(!importProject);
+ mUI.mEditDefines->setEnabled(!importProject);
+ mUI.mBtnAddInclude->setEnabled(!importProject);
+ mUI.mBtnEditInclude->setEnabled(!importProject);
+ mUI.mBtnRemoveInclude->setEnabled(!importProject);
+ mUI.mBtnIncludeUp->setEnabled(!importProject);
+ mUI.mBtnIncludeDown->setEnabled(!importProject);
+}
+
+void ProjectFileDialog::clearImportProject() {
+ mUI.mEditImportProject->clear();
+ updatePathsAndDefines();
+}
+
void ProjectFileDialog::browseImportProject()
{
const QFileInfo inf(mFilePath);
@@ -192,8 +214,15 @@ void ProjectFileDialog::browseImportProject()
QString fileName = QFileDialog::getOpenFileName(this, tr("Import Project"),
dir.canonicalPath(),
tr("Visual Studio (*.sln *.vcxproj);;Compile database (compile_database.json)"));
- if (!fileName.isEmpty())
+ if (!fileName.isEmpty()) {
mUI.mEditImportProject->setText(dir.relativeFilePath(fileName));
+ updatePathsAndDefines();
+ }
+}
+
+QString ProjectFileDialog::getImportProject() const
+{
+ return mUI.mEditImportProject->text();
}
void ProjectFileDialog::addIncludeDir(const QString &dir)
@@ -242,10 +271,6 @@ QString ProjectFileDialog::getBuildDir() const
return mUI.mEditBuildDir->text();
}
-QString ProjectFileDialog::getImportProject() const
-{
- return mUI.mEditImportProject->text();
-}
QStringList ProjectFileDialog::getIncludePaths() const
{
diff --git a/gui/projectfiledialog.h b/gui/projectfiledialog.h
index 41db79973..2e27730b2 100644
--- a/gui/projectfiledialog.h
+++ b/gui/projectfiledialog.h
@@ -46,6 +46,10 @@ public:
void loadFromProjectFile(const ProjectFile *projectFile);
void saveToProjectFile(ProjectFile *projectFile) const;
+private:
+ /** Enable and disable widgets in the 'Paths and Defines' tab */
+ void updatePathsAndDefines();
+
/**
* @brief Return project root path from the dialog control.
* @return Project root path.
@@ -147,6 +151,11 @@ protected slots:
*/
void browseBuildDir();
+ /**
+ * @brief Clear 'import project'.
+ */
+ void clearImportProject();
+
/**
* @brief Browse for solution / project / compile database.
*/
diff --git a/gui/projectfiledialog.ui b/gui/projectfiledialog.ui
index 5364c5085..f302fe59e 100644
--- a/gui/projectfiledialog.ui
+++ b/gui/projectfiledialog.ui
@@ -7,7 +7,7 @@
0
0
642
- 434
+ 498
@@ -69,34 +69,6 @@
- -
-
-
-
-
-
- <html><head/><body><p>Cppcheck can import Visual studio solutions (*.sln), Visual studio projects (*.vcxproj) or compile databases.</p><p>Files to check, include paths, configurations, defines, platform settings are imported.\n\nLibrary settings are not imported.\n\n</p><p>A compile database can be generated from a cmake project using cmake, or from a Makefile project using bear (build ear).</p></body></html>
-
-
- Import Project (Visual studio / compile database)
-
-
-
- -
-
-
-
-
-
- -
-
-
- ...
-
-
-
-
-
-
-
-
-
@@ -137,7 +109,61 @@
Paths and Defines
-
+
+
-
+
+
-
+
+
+ <html><head/><body><p>Cppcheck can import Visual studio solutions (*.sln), Visual studio projects (*.vcxproj) or compile databases.</p><p>Files to check, defines, include paths are imported.</p></body></html>
+
+
+ Import Project (Visual studio / compile database)
+
+
+
+ -
+
+
-
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+
+ :/images/edit-clear.png
+
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
-
-