summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrantisek Vacek <fvacek@blackberry.com>2013-12-03 18:59:31 +0100
committerMehdi Fekari <mfekari@blackberry.com>2014-01-09 11:21:59 +0100
commitf28dabe4c3a8575bd3170b436df8dcae41d46b89 (patch)
treeef25dcfec31aeb298d71a1954495cfcc4beaf5f9
parent8da53e65873facd0dab7cf54adc19cfbc3e337ba (diff)
downloadqt-creator-f28dabe4c3a8575bd3170b436df8dcae41d46b89.tar.gz
Qnx: Fixing crash on Import Momentics Cascades Project
Task-number: QTCREATORBUG-10967 Change-Id: I5493f8854910209a25810dad3422bd92359df449 Reviewed-by: Mehdi Fekari <mfekari@blackberry.com> Reviewed-by: David Kaspar <dkaspar@blackberry.com> Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
-rw-r--r--src/plugins/qnx/cascadesimport/cascadesimport.pri2
-rw-r--r--src/plugins/qnx/cascadesimport/cascadesimportwizard.h2
-rw-r--r--src/plugins/qnx/cascadesimport/srcprojectpathchooser.cpp77
-rw-r--r--src/plugins/qnx/cascadesimport/srcprojectpathchooser.h53
-rw-r--r--src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui10
-rw-r--r--src/plugins/qnx/qnx.qbs2
6 files changed, 140 insertions, 6 deletions
diff --git a/src/plugins/qnx/cascadesimport/cascadesimport.pri b/src/plugins/qnx/cascadesimport/cascadesimport.pri
index 82962717e3..d8a1093103 100644
--- a/src/plugins/qnx/cascadesimport/cascadesimport.pri
+++ b/src/plugins/qnx/cascadesimport/cascadesimport.pri
@@ -1,6 +1,7 @@
SOURCES += \
$$PWD/cascadesimportwizard.cpp \
$$PWD/srcprojectwizardpage.cpp \
+ $$PWD/srcprojectpathchooser.cpp \
$$PWD/fileconverter.cpp \
$$PWD/bardescriptorconverter.cpp \
$$PWD/projectfileconverter.cpp \
@@ -10,6 +11,7 @@ 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/cascadesimportwizard.h b/src/plugins/qnx/cascadesimport/cascadesimportwizard.h
index e7dd5ba41e..8e0facc8e0 100644
--- a/src/plugins/qnx/cascadesimport/cascadesimportwizard.h
+++ b/src/plugins/qnx/cascadesimport/cascadesimportwizard.h
@@ -76,7 +76,7 @@ protected:
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
private:
bool collectFiles(ConvertedProjectContext &projectContext, QString &errorMessage) const;
- void collectFiles_helper(QStringList &file_paths, ConvertedProjectContext &projectContext,
+ void collectFiles_helper(QStringList &filePaths, ConvertedProjectContext &projectContext,
const QString &rootPath, const QList< QRegExp > &blackList) const;
bool convertFile(Core::GeneratedFile &file, ConvertedProjectContext &projectContext,
QString &errorMessage) const;
diff --git a/src/plugins/qnx/cascadesimport/srcprojectpathchooser.cpp b/src/plugins/qnx/cascadesimport/srcprojectpathchooser.cpp
new file mode 100644
index 0000000000..ce7db49f69
--- /dev/null
+++ b/src/plugins/qnx/cascadesimport/srcprojectpathchooser.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "srcprojectpathchooser.h"
+
+#include <QDirIterator>
+
+namespace Qnx {
+namespace Internal {
+
+SrcProjectPathChooser::SrcProjectPathChooser(QWidget *parent) :
+ Utils::PathChooser(parent)
+{
+ setPromptDialogTitle(tr("Choose imported Cascades project directory"));
+ setExpectedKind(Utils::PathChooser::ExistingDirectory);
+}
+
+SrcProjectPathChooser::~SrcProjectPathChooser()
+{
+}
+
+bool SrcProjectPathChooser::validatePath(const QString &path, QString *errorMessage)
+{
+ if (!Utils::PathChooser::validatePath(path, errorMessage))
+ return false;
+
+ 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 = tr("Directory does not seem to be a valid Cascades project.");
+ return ret;
+}
+
+
+} // namespace Internal
+} // namespace Qnx
diff --git a/src/plugins/qnx/cascadesimport/srcprojectpathchooser.h b/src/plugins/qnx/cascadesimport/srcprojectpathchooser.h
new file mode 100644
index 0000000000..2b7fae720f
--- /dev/null
+++ b/src/plugins/qnx/cascadesimport/srcprojectpathchooser.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt 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);
+ virtual ~SrcProjectPathChooser();
+
+ virtual bool validatePath(const QString &path, QString *errorMessage = 0);
+};
+
+} // namespace Internal
+} // namespace Qnx
+
+
+#endif // SRCPROJECTPATHCHOOSER_H
diff --git a/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui b/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui
index 9348909441..e29f3d6fae 100644
--- a/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui
+++ b/src/plugins/qnx/cascadesimport/srcprojectwizardpage.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>Qnx::Internal::SrcProjectWizardPage</class>
- <widget class="QWizardPage" name="Qnx::Internal::SrcProjectWizardPage">
+ <class>Qnx::Internal::SrcProjectWizardPage</class>
+ <widget class="QWizardPage" name="Qnx::Internal::SrcProjectWizardPage">
<property name="geometry">
<rect>
<x>0</x>
@@ -25,15 +25,15 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="Utils::PathChooser" name="pathChooser" native="true"/>
+ <widget class="Qnx::Internal::SrcProjectPathChooser" name="pathChooser" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
- <class>Utils::PathChooser</class>
+ <class>Qnx::Internal::SrcProjectPathChooser</class>
<extends>QWidget</extends>
- <header location="global">utils/pathchooser.h</header>
+ <header location="global">qnx/cascadesimport/srcprojectpathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs
index a425414e93..5cf317bab4 100644
--- a/src/plugins/qnx/qnx.qbs
+++ b/src/plugins/qnx/qnx.qbs
@@ -256,6 +256,7 @@ QtcPlugin {
"cascadesimportwizard.cpp",
"srcprojectwizardpage.cpp",
+ "srcprojectpathchooser.cpp",
"fileconverter.cpp",
"bardescriptorconverter.cpp",
"projectfileconverter.cpp",
@@ -264,6 +265,7 @@ QtcPlugin {
"cascadesimportwizard.h",
"srcprojectwizardpage.h",
+ "srcprojectpathchooser.h",
"fileconverter.h",
"bardescriptorconverter.h",
"projectfileconverter.h",