improve the clang settings
This commit is contained in:
parent
c29536cfe1
commit
1afebfa96d
|
@ -80,6 +80,7 @@
|
||||||
#define SETTINGS_APPLICATION_DEFAULT "Default Application"
|
#define SETTINGS_APPLICATION_DEFAULT "Default Application"
|
||||||
#define SETTINGS_LANGUAGE "Application language"
|
#define SETTINGS_LANGUAGE "Application language"
|
||||||
#define SETTINGS_GLOBAL_INCLUDE_PATHS "Global include paths"
|
#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_VS_INCLUDE_PATHS "Visual studio include paths"
|
||||||
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
|
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
|
||||||
#define SETTINGS_INCONCLUSIVE_ERRORS "Inconclusive errors"
|
#define SETTINGS_INCONCLUSIVE_ERRORS "Inconclusive errors"
|
||||||
|
|
|
@ -445,9 +445,13 @@ void MainWindow::doAnalyzeProject(ImportProject p)
|
||||||
mThread->setAddons(mProjectFile->getAddons());
|
mThread->setAddons(mProjectFile->getAddons());
|
||||||
mThread->setVsIncludePaths(mSettings->value(SETTINGS_VS_INCLUDE_PATHS).toString());
|
mThread->setVsIncludePaths(mSettings->value(SETTINGS_VS_INCLUDE_PATHS).toString());
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// Try to autodetect clang
|
QString clangPath = mSettings->value(SETTINGS_CLANG_PATH,QString()).toString();
|
||||||
if (QFileInfo("C:/Program Files/LLVM/bin/clang.exe").exists())
|
if (clangPath.isEmpty()) {
|
||||||
mThread->setClangPath("C:/Program Files/LLVM/bin");
|
// Try to autodetect clang
|
||||||
|
if (QFileInfo("C:/Program Files/LLVM/bin/clang.exe").exists())
|
||||||
|
clangPath = "C:/Program Files/LLVM/bin";
|
||||||
|
}
|
||||||
|
mThread->setClangPath(clangPath);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
mThread->setProject(p);
|
mThread->setProject(p);
|
||||||
|
|
|
@ -240,16 +240,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="mLabelVsInclude">
|
|
||||||
<property name="text">
|
|
||||||
<string><html><head/><body><p>Visual Studio include paths<br/>Open Visual Studio command prompt. Type &quot;SET INCLUDE&quot; and paste the outputs below:</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="mEditVsInclude"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_2">
|
<widget class="QWidget" name="tab_2">
|
||||||
|
@ -355,6 +345,74 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="mTabClang">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Clang</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clang path</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="mEditClangPath">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mBtnBrowseClangPath">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>51</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p>Visual Studio include paths.</p><p>Open Visual Studio Command Prompt. Type &quot;SET INSTALL&quot; and then copy paste the output here</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="mEditVsIncludePaths"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -55,13 +55,12 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
||||||
mUI.mShowErrorId->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_ERROR_ID, false).toBool()));
|
mUI.mShowErrorId->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_ERROR_ID, false).toBool()));
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
mUI.mLabelVsInclude->setVisible(true);
|
mUI.mTabClang->setVisible(true);
|
||||||
mUI.mEditVsInclude->setVisible(true);
|
mUI.mEditClangPath->setText(settings.value(SETTINGS_CLANG_PATH, QString()).toString());
|
||||||
mUI.mEditVsInclude->setText(settings.value(SETTINGS_VS_INCLUDE_PATHS, QString()).toString());
|
mUI.mEditVsIncludePaths->setText(settings.value(SETTINGS_VS_INCLUDE_PATHS, QString()).toString());
|
||||||
|
connect(mUI.mBtnBrowseClangPath, &QPushButton::released, this, &SettingsDialog::browseClangPath);
|
||||||
#else
|
#else
|
||||||
mUI.mLabelVsInclude->setVisible(false);
|
mUI.mTabClang->setVisible(false);
|
||||||
mUI.mEditVsInclude->setVisible(false);
|
|
||||||
mUI.mEditVsInclude->setText(QString());
|
|
||||||
#endif
|
#endif
|
||||||
connect(mUI.mButtons, &QDialogButtonBox::accepted, this, &SettingsDialog::ok);
|
connect(mUI.mButtons, &QDialogButtonBox::accepted, this, &SettingsDialog::ok);
|
||||||
connect(mUI.mButtons, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
|
connect(mUI.mButtons, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
|
||||||
|
@ -187,7 +186,8 @@ void SettingsDialog::saveSettingValues() const
|
||||||
saveCheckboxValue(&settings, mUI.mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
saveCheckboxValue(&settings, mUI.mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#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="))
|
if (vsIncludePaths.startsWith("INCLUDE="))
|
||||||
vsIncludePaths.remove(0, 8);
|
vsIncludePaths.remove(0, 8);
|
||||||
settings.setValue(SETTINGS_VS_INCLUDE_PATHS, vsIncludePaths);
|
settings.setValue(SETTINGS_VS_INCLUDE_PATHS, vsIncludePaths);
|
||||||
|
@ -358,3 +358,14 @@ void SettingsDialog::editIncludePath()
|
||||||
QListWidgetItem *item = mUI.mListIncludePaths->currentItem();
|
QListWidgetItem *item = mUI.mListIncludePaths->currentItem();
|
||||||
mUI.mListIncludePaths->editItem(item);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -142,6 +142,9 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void editIncludePath();
|
void editIncludePath();
|
||||||
|
|
||||||
|
/** @brief Slot for browsing for the clang binary */
|
||||||
|
void browseClangPath();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue