From 3ba48ca11e16949ff84dd7289084e2f7b3327d5b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 3 Mar 2015 11:08:26 +0100 Subject: Remove now-unneeded PathChooser subclass. Change-Id: Ic7cbe4566159675ae9e776d723ed213c1e7c71ec Reviewed-by: Andre Poenitz --- .../clangstaticanalyzer/clangstaticanalyzer.pro | 2 -- .../clangstaticanalyzer/clangstaticanalyzer.qbs | 2 -- .../clangstaticanalyzerconfigwidget.cpp | 12 ++++++- .../clangstaticanalyzerconfigwidget.ui | 6 ++-- .../clangstaticanalyzerpathchooser.cpp | 40 ---------------------- .../clangstaticanalyzerpathchooser.h | 40 ---------------------- 6 files changed, 14 insertions(+), 88 deletions(-) delete mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp delete mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h 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 a97dc9f83c..b430b980da 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -28,8 +28,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 6b8b0f0cee..f61a82bd5a 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 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, m_settings, &ClangStaticAnalyzerSettings::setClangExecutable); 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 @@ - + @@ -88,9 +88,9 @@ - ClangStaticAnalyzer::Internal::PathChooser + Utils::PathChooser QWidget -
clangstaticanalyzer/clangstaticanalyzerpathchooser.h
+
utils/pathchooser.h
1
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 - -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. -- cgit v1.2.1