Commit 20a05c98 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Remove PathChooser subclasses that are no longer needed.



Change-Id: Iceb848d1be36e1dba1cea3c336dc4ec0094e491e
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 22fe5538
......@@ -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"));
}
......
......@@ -144,14 +144,6 @@ private:
QString m_snippet;
};
class LibraryPathChooser : public Utils::PathChooser
{
Q_OBJECT
public:
LibraryPathChooser(QWidget *parent);
};
} // namespace Internal
} // namespace QmakeProjectManager
......
......@@ -31,7 +31,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QmakeProjectManager::Internal::LibraryPathChooser" name="libraryPathChooser" native="true"/>
<widget class="Utils::PathChooser" name="libraryPathChooser" native="true"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="includeLabel">
......@@ -241,12 +241,6 @@
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QmakeProjectManager::Internal::LibraryPathChooser</class>
<extends>QWidget</extends>
<header location="global">qmakeprojectmanager/addlibrarywizard.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
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 \
......
/****************************************************************************
**
** 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 <QDirIterator>
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
/****************************************************************************
**
** 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 <utils/pathchooser.h>
namespace Qnx {
namespace Internal {
class SrcProjectPathChooser : public Utils::PathChooser
{
Q_OBJECT
public:
explicit SrcProjectPathChooser(QWidget *parent = 0);
};
} // namespace Internal
} // namespace Qnx
#endif // SRCPROJECTPATHCHOOSER_H
......@@ -34,15 +34,45 @@
#include <utils/wizard.h>
#include <QDir>
#include <QDirIterator>
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)));
......
......@@ -25,15 +25,15 @@
</widget>
</item>
<item row="0" column="1">
<widget class="Qnx::Internal::SrcProjectPathChooser" name="pathChooser" native="true"/>
<widget class="Utils::PathChooser" name="pathChooser" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Qnx::Internal::SrcProjectPathChooser</class>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">qnx/cascadesimport/srcprojectpathchooser.h</header>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -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",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment