diff --git a/gui/common.h b/gui/common.h
index 330cb77b0..953f518bd 100644
--- a/gui/common.h
+++ b/gui/common.h
@@ -80,6 +80,7 @@
#define SETTINGS_APPLICATION_DEFAULT "Default Application"
#define SETTINGS_LANGUAGE "Application language"
#define SETTINGS_GLOBAL_INCLUDE_PATHS "Global include paths"
+#define SETTINGS_CLANG_PATH "Clang path"
#define SETTINGS_VS_INCLUDE_PATHS "Visual studio include paths"
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
#define SETTINGS_INCONCLUSIVE_ERRORS "Inconclusive errors"
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index a6c49d2df..9710914e7 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -445,9 +445,13 @@ void MainWindow::doAnalyzeProject(ImportProject p)
mThread->setAddons(mProjectFile->getAddons());
mThread->setVsIncludePaths(mSettings->value(SETTINGS_VS_INCLUDE_PATHS).toString());
#ifdef Q_OS_WIN
- // Try to autodetect clang
- if (QFileInfo("C:/Program Files/LLVM/bin/clang.exe").exists())
- mThread->setClangPath("C:/Program Files/LLVM/bin");
+ QString clangPath = mSettings->value(SETTINGS_CLANG_PATH,QString()).toString();
+ if (clangPath.isEmpty()) {
+ // Try to autodetect clang
+ if (QFileInfo("C:/Program Files/LLVM/bin/clang.exe").exists())
+ clangPath = "C:/Program Files/LLVM/bin";
+ }
+ mThread->setClangPath(clangPath);
#endif
}
mThread->setProject(p);
diff --git a/gui/settings.ui b/gui/settings.ui
index c2243d460..a8a29501d 100644
--- a/gui/settings.ui
+++ b/gui/settings.ui
@@ -240,16 +240,6 @@
- -
-
-
- <html><head/><body><p>Visual Studio include paths<br/>Open Visual Studio command prompt. Type "SET INCLUDE" and paste the outputs below:</p></body></html>
-
-
-
- -
-
-
@@ -355,6 +345,74 @@
+
+
+ Clang
+
+
+ -
+
+
+ Clang path
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 51
+
+
+
+
+ -
+
+
+ <html><head/><body><p>Visual Studio include paths.</p><p>Open Visual Studio Command Prompt. Type "SET INSTALL" and then copy paste the output here</p></body></html>
+
+
+
+ -
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 50
+
+
+
+
+
+
-
diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp
index f48b486f9..0dc6c4e74 100644
--- a/gui/settingsdialog.cpp
+++ b/gui/settingsdialog.cpp
@@ -55,13 +55,12 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
mUI.mShowErrorId->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_ERROR_ID, false).toBool()));
#ifdef Q_OS_WIN
- mUI.mLabelVsInclude->setVisible(true);
- mUI.mEditVsInclude->setVisible(true);
- mUI.mEditVsInclude->setText(settings.value(SETTINGS_VS_INCLUDE_PATHS, QString()).toString());
+ mUI.mTabClang->setVisible(true);
+ mUI.mEditClangPath->setText(settings.value(SETTINGS_CLANG_PATH, QString()).toString());
+ mUI.mEditVsIncludePaths->setText(settings.value(SETTINGS_VS_INCLUDE_PATHS, QString()).toString());
+ connect(mUI.mBtnBrowseClangPath, &QPushButton::released, this, &SettingsDialog::browseClangPath);
#else
- mUI.mLabelVsInclude->setVisible(false);
- mUI.mEditVsInclude->setVisible(false);
- mUI.mEditVsInclude->setText(QString());
+ mUI.mTabClang->setVisible(false);
#endif
connect(mUI.mButtons, &QDialogButtonBox::accepted, this, &SettingsDialog::ok);
connect(mUI.mButtons, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
@@ -187,7 +186,8 @@ void SettingsDialog::saveSettingValues() const
saveCheckboxValue(&settings, mUI.mShowErrorId, SETTINGS_SHOW_ERROR_ID);
#ifdef Q_OS_WIN
- QString vsIncludePaths = mUI.mEditVsInclude->text();
+ settings.setValue(SETTINGS_CLANG_PATH, mUI.mEditClangPath->text());
+ QString vsIncludePaths = mUI.mEditVsIncludePaths->text();
if (vsIncludePaths.startsWith("INCLUDE="))
vsIncludePaths.remove(0, 8);
settings.setValue(SETTINGS_VS_INCLUDE_PATHS, vsIncludePaths);
@@ -358,3 +358,14 @@ void SettingsDialog::editIncludePath()
QListWidgetItem *item = mUI.mListIncludePaths->currentItem();
mUI.mListIncludePaths->editItem(item);
}
+
+void SettingsDialog::browseClangPath()
+{
+ QString selectedDir = QFileDialog::getExistingDirectory(this,
+ tr("Select clang path"),
+ QDir::rootPath());
+
+ if (!selectedDir.isEmpty()) {
+ mUI.mEditClangPath->setText(selectedDir);
+ }
+}
diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h
index b5d4b2e82..0ff5187e8 100644
--- a/gui/settingsdialog.h
+++ b/gui/settingsdialog.h
@@ -142,6 +142,9 @@ protected slots:
*/
void editIncludePath();
+ /** @brief Slot for browsing for the clang binary */
+ void browseClangPath();
+
protected:
/**