Commit f28dabe4 authored by Frantisek Vacek's avatar Frantisek Vacek Committed by Mehdi Fekari

Qnx: Fixing crash on Import Momentics Cascades Project

Task-number: QTCREATORBUG-10967

Change-Id: I5493f8854910209a25810dad3422bd92359df449
Reviewed-by: default avatarMehdi Fekari <mfekari@blackberry.com>
Reviewed-by: default avatarDavid Kaspar <dkaspar@blackberry.com>
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 8da53e65
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 \
......
......@@ -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;
......
/****************************************************************************
**
** 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
/****************************************************************************
**
** 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
<?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>
......
......@@ -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",
......
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