summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzer.pro2
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzer.qbs2
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp12
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui6
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp40
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h40
6 files changed, 14 insertions, 88 deletions
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro
index 67eb90ad41..cdffb1f1d1 100644
--- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro
+++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro
@@ -10,7 +10,6 @@ SOURCES += \
clangstaticanalyzerdiagnosticmodel.cpp \
clangstaticanalyzerdiagnosticview.cpp \
clangstaticanalyzerlogfilereader.cpp \
- clangstaticanalyzerpathchooser.cpp \
clangstaticanalyzerplugin.cpp \
clangstaticanalyzerprojectsettings.cpp \
clangstaticanalyzerprojectsettingsmanager.cpp \
@@ -30,7 +29,6 @@ HEADERS += \
clangstaticanalyzerdiagnosticview.h \
clangstaticanalyzer_global.h \
clangstaticanalyzerlogfilereader.h \
- clangstaticanalyzerpathchooser.h \
clangstaticanalyzerplugin.h \
clangstaticanalyzerprojectsettings.h \
clangstaticanalyzerprojectsettingsmanager.h \
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs
index 098c4186c2..2ccc31337c 100644
--- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs
+++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs
@@ -33,8 +33,6 @@ QtcPlugin {
"clangstaticanalyzerdiagnosticview.h",
"clangstaticanalyzerlogfilereader.cpp",
"clangstaticanalyzerlogfilereader.h",
- "clangstaticanalyzerpathchooser.cpp",
- "clangstaticanalyzerpathchooser.h",
"clangstaticanalyzerplugin.cpp",
"clangstaticanalyzerplugin.h",
"clangstaticanalyzerprojectsettings.cpp",
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp
index ced034aa6c..cb6c45c00b 100644
--- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp
+++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp
@@ -19,6 +19,8 @@
#include "clangstaticanalyzerconfigwidget.h"
#include "ui_clangstaticanalyzerconfigwidget.h"
+#include "clangstaticanalyzerutils.h"
+
#include <QThread>
namespace ClangStaticAnalyzer {
@@ -33,7 +35,15 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget(
{
m_ui->setupUi(this);
- m_ui->clangExecutableChooser->setPath(settings->clangExecutable());
+ Utils::PathChooser * const chooser = m_ui->clangExecutableChooser;
+ chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History"));
+ chooser->setPromptDialogTitle(tr("Clang Command"));
+ chooser->setPath(settings->clangExecutable());
+ const auto validator = [chooser](const QString &, QString *errorMessage) {
+ return isClangExecutableUsable(chooser->fileName().toString(), errorMessage);
+ };
+ chooser->setAdditionalPathValidator(validator);
connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed,
[settings](const QString &path) { settings->setClangExecutable(path); });
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui
index 8997f3a7d1..800733a331 100644
--- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui
+++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui
@@ -30,7 +30,7 @@
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="ClangStaticAnalyzer::Internal::PathChooser" name="clangExecutableChooser" native="true"/>
+ <widget class="Utils::PathChooser" name="clangExecutableChooser" native="true"/>
</item>
</layout>
</item>
@@ -88,9 +88,9 @@
</widget>
<customwidgets>
<customwidget>
- <class>ClangStaticAnalyzer::Internal::PathChooser</class>
+ <class>Utils::PathChooser</class>
<extends>QWidget</extends>
- <header location="global">clangstaticanalyzer/clangstaticanalyzerpathchooser.h</header>
+ <header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp
deleted file mode 100644
index b5711bfeab..0000000000
--- a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd
-** All rights reserved.
-** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
-**
-** This file is part of the Qt Enterprise LicenseChecker Add-on.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://www.qt.io/contact-us
-**
-****************************************************************************/
-#include "clangstaticanalyzerpathchooser.h"
-
-#include "clangstaticanalyzerutils.h"
-
-namespace ClangStaticAnalyzer {
-namespace Internal {
-
-PathChooser::PathChooser(QWidget *parent) : Utils::PathChooser(parent)
-{
- setExpectedKind(Utils::PathChooser::ExistingCommand);
- setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History"));
- setPromptDialogTitle(tr("Clang Command"));
-}
-
-bool PathChooser::validatePath(const QString &path, QString *errorMessage)
-{
- if (!Utils::PathChooser::validatePath(path, errorMessage))
- return false;
- return isClangExecutableUsable(fileName().toString(), errorMessage);
-}
-
-} // namespace Internal
-} // namespace ClangStaticAnalyzer
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h
deleted file mode 100644
index b4bc3c5947..0000000000
--- a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd
-** All rights reserved.
-** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
-**
-** This file is part of the Qt Enterprise LicenseChecker Add-on.
-**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://www.qt.io/contact-us
-**
-****************************************************************************/
-#ifndef QTC_CLANGSTATICANALYZER_PATHCHOOSER_H
-#define QTC_CLANGSTATICANALYZER_PATHCHOOSER_H
-
-#include <utils/pathchooser.h>
-
-namespace ClangStaticAnalyzer {
-namespace Internal {
-
-class PathChooser : public Utils::PathChooser
-{
- Q_OBJECT
-
-public:
- PathChooser(QWidget *parent = 0);
-
-private:
- bool validatePath(const QString &path, QString *errorMessage = 0);
-};
-
-} // namespace Internal
-} // namespace ClangStaticAnalyzer
-
-#endif // Include guard.