diff --git a/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp b/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp index bc76b5727ab..a83fb6f7ea8 100644 --- a/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp +++ b/src/plugins/qmakeprojectmanager/addlibrarywizard.cpp @@ -79,15 +79,6 @@ static bool validateLibraryPath(const QString &path, const Utils::PathChooser *p return false; } -LibraryPathChooser::LibraryPathChooser(QWidget *parent) - : Utils::PathChooser(parent) -{ - setAdditionalPathValidator([this](const QString &path, QString *errorMessage) { - return validateLibraryPath(path, this, errorMessage); - }); -} - - AddLibraryWizard::AddLibraryWizard(const QString &fileName, QWidget *parent) : Utils::Wizard(parent), m_proFile(fileName) { @@ -203,7 +194,11 @@ DetailsPage::DetailsPage(AddLibraryWizard *parent) { m_libraryDetailsWidget = new Ui::LibraryDetailsWidget(); m_libraryDetailsWidget->setupUi(this); - + Utils::PathChooser * const libPathChooser = m_libraryDetailsWidget->libraryPathChooser; + const auto pathValidator = [libPathChooser](const QString &path, QString *errorMessage) { + return validateLibraryPath(path, libPathChooser, errorMessage); + }; + libPathChooser->setAdditionalPathValidator(pathValidator); setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Details")); } diff --git a/src/plugins/qmakeprojectmanager/addlibrarywizard.h b/src/plugins/qmakeprojectmanager/addlibrarywizard.h index 55456596f7e..624eff7e6dd 100644 --- a/src/plugins/qmakeprojectmanager/addlibrarywizard.h +++ b/src/plugins/qmakeprojectmanager/addlibrarywizard.h @@ -144,14 +144,6 @@ private: QString m_snippet; }; -class LibraryPathChooser : public Utils::PathChooser -{ - Q_OBJECT -public: - LibraryPathChooser(QWidget *parent); -}; - - } // namespace Internal } // namespace QmakeProjectManager diff --git a/src/plugins/qmakeprojectmanager/librarydetailswidget.ui b/src/plugins/qmakeprojectmanager/librarydetailswidget.ui index ebcb80396b1..0d3b4b1c120 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailswidget.ui +++ b/src/plugins/qmakeprojectmanager/librarydetailswidget.ui @@ -31,7 +31,7 @@ - + @@ -241,12 +241,6 @@
utils/pathchooser.h
1 - - QmakeProjectManager::Internal::LibraryPathChooser - QWidget -
qmakeprojectmanager/addlibrarywizard.h
- 1 -
diff --git a/src/plugins/qnx/cascadesimport/cascadesimport.pri b/src/plugins/qnx/cascadesimport/cascadesimport.pri index d8a10931035..82962717e3f 100644 --- a/src/plugins/qnx/cascadesimport/cascadesimport.pri +++ b/src/plugins/qnx/cascadesimport/cascadesimport.pri @@ -1,7 +1,6 @@ SOURCES += \ $$PWD/cascadesimportwizard.cpp \ $$PWD/srcprojectwizardpage.cpp \ - $$PWD/srcprojectpathchooser.cpp \ $$PWD/fileconverter.cpp \ $$PWD/bardescriptorconverter.cpp \ $$PWD/projectfileconverter.cpp \ @@ -11,7 +10,6 @@ SOURCES += \ HEADERS += \ $$PWD/cascadesimportwizard.h \ $$PWD/srcprojectwizardpage.h \ - $$PWD/srcprojectpathchooser.h \ $$PWD/fileconverter.h \ $$PWD/bardescriptorconverter.h \ $$PWD/projectfileconverter.h \ diff --git a/src/plugins/qnx/cascadesimport/srcprojectpathchooser.cpp b/src/plugins/qnx/cascadesimport/srcprojectpathchooser.cpp deleted file mode 100644 index 390098cc685..00000000000 --- a/src/plugins/qnx/cascadesimport/srcprojectpathchooser.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 BlackBerry Limited. All rights reserved. -** -** Contact: BlackBerry (qt@blackberry.com) -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "srcprojectpathchooser.h" - -#include - -namespace Qnx { -namespace Internal { - -static bool validateProjectPath(const QString &path, QString *errorMessage) -{ - bool proFound = false; - bool barDescriptorFound = false; - QDirIterator di(path); - while (di.hasNext()) { - di.next(); - QFileInfo fi = di.fileInfo(); - if (fi.isFile()) { - if (fi.fileName() == QLatin1String("bar-descriptor.xml")) - barDescriptorFound = true; - else if (fi.fileName().endsWith(QLatin1String(".pro"))) - proFound = true; - } - if (barDescriptorFound && proFound) - break; - } - const bool ret = barDescriptorFound && proFound; - if (!ret && errorMessage) { - *errorMessage = QCoreApplication::translate("Qnx", - "Directory does not seem to be a valid Cascades project."); - } - return ret; -} - - -SrcProjectPathChooser::SrcProjectPathChooser(QWidget *parent) : - Utils::PathChooser(parent) -{ - setPromptDialogTitle(tr("Choose imported Cascades project directory")); - setExpectedKind(Utils::PathChooser::ExistingDirectory); - setAdditionalPathValidator(validateProjectPath); -} - -} // namespace Internal -} // namespace Qnx diff --git a/src/plugins/qnx/cascadesimport/srcprojectpathchooser.h b/src/plugins/qnx/cascadesimport/srcprojectpathchooser.h deleted file mode 100644 index 75642166576..00000000000 --- a/src/plugins/qnx/cascadesimport/srcprojectpathchooser.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 BlackBerry Limited. All rights reserved. -** -** Contact: BlackBerry (qt@blackberry.com) -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef SRCPROJECTPATHCHOOSER_H -#define SRCPROJECTPATHCHOOSER_H - -#include - -namespace Qnx { -namespace Internal { - -class SrcProjectPathChooser : public Utils::PathChooser -{ - Q_OBJECT -public: - explicit SrcProjectPathChooser(QWidget *parent = 0); -}; - -} // namespace Internal -} // namespace Qnx - - -#endif // SRCPROJECTPATHCHOOSER_H diff --git a/src/plugins/qnx/cascadesimport/srcprojectwizardpage.cpp b/src/plugins/qnx/cascadesimport/srcprojectwizardpage.cpp index 57636cce79a..552ce45f9ff 100644 --- a/src/plugins/qnx/cascadesimport/srcprojectwizardpage.cpp +++ b/src/plugins/qnx/cascadesimport/srcprojectwizardpage.cpp @@ -34,15 +34,45 @@ #include #include +#include namespace Qnx { namespace Internal { +static bool validateProjectPath(const QString &path, QString *errorMessage) +{ + bool proFound = false; + bool barDescriptorFound = false; + QDirIterator di(path); + while (di.hasNext()) { + di.next(); + QFileInfo fi = di.fileInfo(); + if (fi.isFile()) { + if (fi.fileName() == QLatin1String("bar-descriptor.xml")) + barDescriptorFound = true; + else if (fi.fileName().endsWith(QLatin1String(".pro"))) + proFound = true; + } + if (barDescriptorFound && proFound) + break; + } + const bool ret = barDescriptorFound && proFound; + if (!ret && errorMessage) { + *errorMessage = QCoreApplication::translate("Qnx", + "Directory does not seem to be a valid Cascades project."); + } + return ret; +} + + SrcProjectWizardPage::SrcProjectWizardPage(QWidget *parent) : QWizardPage(parent), m_complete(false) { ui = new Ui::SrcProjectWizardPage; ui->setupUi(this); + ui->pathChooser->setPromptDialogTitle(tr("Choose imported Cascades project directory")); + ui->pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); + ui->pathChooser->setAdditionalPathValidator(validateProjectPath); connect(ui->pathChooser, SIGNAL(pathChanged(QString)), this, SLOT(onPathChooserPathChanged(QString))); diff --git a/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui b/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui index e29f3d6fae2..25225cbaa95 100644 --- a/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui +++ b/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui @@ -25,15 +25,15 @@
- + - Qnx::Internal::SrcProjectPathChooser + Utils::PathChooser QWidget -
qnx/cascadesimport/srcprojectpathchooser.h
+
utils/pathchooser.h
1
diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index 5dd0558617e..e32ec93b4f7 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -274,21 +274,16 @@ QtcPlugin { prefix: "cascadesimport/" files: [ "cascadesimport.qrc", - "srcprojectwizardpage.ui", - "cascadesimportwizard.cpp", "srcprojectwizardpage.cpp", - "srcprojectpathchooser.cpp", "fileconverter.cpp", "bardescriptorconverter.cpp", "projectfileconverter.cpp", "importlogconverter.cpp", "importlog.cpp", - "cascadesimportwizard.h", "srcprojectwizardpage.h", - "srcprojectpathchooser.h", "fileconverter.h", "bardescriptorconverter.h", "projectfileconverter.h",