2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
#include "qmlproject.h"
|
2010-02-16 13:39:13 +01:00
|
|
|
#include "qmlprojectfile.h"
|
|
|
|
#include "qmlprojectmanagerconstants.h"
|
|
|
|
#include "fileformat/qmlprojectitem.h"
|
2010-03-08 14:36:44 +01:00
|
|
|
#include "qmlprojectrunconfiguration.h"
|
2011-04-12 12:17:19 +02:00
|
|
|
#include "qmlprojectconstants.h"
|
2011-08-18 16:46:26 +02:00
|
|
|
#include "qmlprojectnodes.h"
|
|
|
|
#include "qmlprojectmanager.h"
|
2010-02-17 13:37:00 +01:00
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
#include <coreplugin/messagemanager.h>
|
2012-02-14 16:43:51 +01:00
|
|
|
#include <coreplugin/documentmanager.h>
|
2009-05-04 12:19:22 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/qmldumptool.h>
|
|
|
|
#include <qtsupport/baseqtversion.h>
|
|
|
|
#include <qtsupport/qtversionmanager.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2010-06-09 15:56:03 +02:00
|
|
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
2012-12-06 17:20:58 +01:00
|
|
|
#include <qmljstools/qmljsmodelmanager.h>
|
2011-03-30 15:15:15 +02:00
|
|
|
#include <utils/fileutils.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
#include <projectexplorer/kitmanager.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2011-04-15 15:55:11 +02:00
|
|
|
#include <utils/filesystemwatcher.h>
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QTextStream>
|
|
|
|
#include <QDeclarativeComponent>
|
2012-08-06 13:42:46 +02:00
|
|
|
#include <QDebug>
|
2010-01-19 13:41:02 +01:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
namespace QmlProjectManager {
|
2010-01-18 16:32:14 +01:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
|
2009-05-04 12:19:22 +02:00
|
|
|
: m_manager(manager),
|
2009-09-04 17:54:38 +02:00
|
|
|
m_fileName(fileName),
|
2013-01-21 13:54:20 +01:00
|
|
|
m_defaultImport(UnknownImport),
|
2012-05-04 10:56:54 +02:00
|
|
|
m_modelManager(QmlJS::ModelManagerInterface::instance())
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
2011-04-12 12:17:19 +02:00
|
|
|
setProjectContext(Core::Context(QmlProjectManager::Constants::PROJECTCONTEXT));
|
2012-11-21 16:18:53 +01:00
|
|
|
setProjectLanguages(Core::Context(QmlProjectManager::Constants::LANG_QML));
|
2011-04-12 12:17:19 +02:00
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
QFileInfo fileInfo(m_fileName);
|
2009-05-06 15:56:54 +02:00
|
|
|
m_projectName = fileInfo.completeBaseName();
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
m_file = new Internal::QmlProjectFile(this, fileName);
|
|
|
|
m_rootNode = new Internal::QmlProjectNode(this, m_file);
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
Core::DocumentManager::addDocument(m_file, true);
|
2010-01-19 13:53:48 +01:00
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
m_manager->registerProject(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
QmlProject::~QmlProject()
|
|
|
|
{
|
|
|
|
m_manager->unregisterProject(this);
|
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
Core::DocumentManager::removeDocument(m_file);
|
2011-09-15 13:05:36 +02:00
|
|
|
|
2010-09-24 14:29:40 +02:00
|
|
|
delete m_projectItem.data();
|
2009-05-04 12:19:22 +02:00
|
|
|
delete m_rootNode;
|
|
|
|
}
|
|
|
|
|
2012-10-09 16:20:26 +02:00
|
|
|
void QmlProject::addedTarget(ProjectExplorer::Target *target)
|
|
|
|
{
|
|
|
|
connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
|
|
|
|
this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
|
|
|
foreach (ProjectExplorer::RunConfiguration *rc, target->runConfigurations())
|
|
|
|
addedRunConfiguration(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProject::addedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
|
|
|
|
{
|
|
|
|
// The enabled state of qml runconfigurations can only be decided after
|
|
|
|
// they have been added to a project
|
|
|
|
QmlProjectRunConfiguration *qmlrc = qobject_cast<QmlProjectRunConfiguration *>(rc);
|
|
|
|
if (qmlrc)
|
|
|
|
qmlrc->updateEnabled();
|
|
|
|
}
|
|
|
|
|
2009-05-06 16:13:44 +02:00
|
|
|
QDir QmlProject::projectDir() const
|
|
|
|
{
|
2012-02-14 16:43:51 +01:00
|
|
|
return QFileInfo(document()->fileName()).dir();
|
2009-05-06 16:13:44 +02:00
|
|
|
}
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
QString QmlProject::filesFileName() const
|
2009-05-06 15:56:54 +02:00
|
|
|
{ return m_fileName; }
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2013-01-21 13:54:20 +01:00
|
|
|
static QmlProject::QmlImport detectImport(const QString &qml) {
|
|
|
|
static QRegExp qtQuick1RegExp(QLatin1String("import\\s+QtQuick\\s+1"));
|
|
|
|
static QRegExp qtQuick2RegExp(QLatin1String("import\\s+QtQuick\\s+2"));
|
|
|
|
|
|
|
|
if (qml.contains(qtQuick1RegExp))
|
|
|
|
return QmlProject::QtQuick1Import;
|
|
|
|
else if (qml.contains(qtQuick2RegExp))
|
|
|
|
return QmlProject::QtQuick2Import;
|
|
|
|
else
|
|
|
|
return QmlProject::UnknownImport;
|
|
|
|
}
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
void QmlProject::parseProject(RefreshOptions options)
|
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
Core::MessageManager *messageManager = Core::ICore::messageManager();
|
2009-05-04 12:19:22 +02:00
|
|
|
if (options & Files) {
|
2010-01-19 13:53:48 +01:00
|
|
|
if (options & ProjectFile)
|
|
|
|
delete m_projectItem.data();
|
2010-01-18 16:32:14 +01:00
|
|
|
if (!m_projectItem) {
|
2011-03-30 15:15:15 +02:00
|
|
|
Utils::FileReader reader;
|
|
|
|
if (reader.fetch(m_fileName)) {
|
2010-02-26 14:46:04 +01:00
|
|
|
QDeclarativeComponent *component = new QDeclarativeComponent(&m_engine, this);
|
2011-03-30 15:15:15 +02:00
|
|
|
component->setData(reader.data(), QUrl::fromLocalFile(m_fileName));
|
2010-01-19 13:53:48 +01:00
|
|
|
if (component->isReady()
|
|
|
|
&& qobject_cast<QmlProjectItem*>(component->create())) {
|
|
|
|
m_projectItem = qobject_cast<QmlProjectItem*>(component->create());
|
2012-03-05 22:30:59 +01:00
|
|
|
connect(m_projectItem.data(), SIGNAL(qmlFilesChanged(QSet<QString>,QSet<QString>)),
|
|
|
|
this, SLOT(refreshFiles(QSet<QString>,QSet<QString>)));
|
2010-01-19 13:53:48 +01:00
|
|
|
} else {
|
2011-03-23 15:19:35 +01:00
|
|
|
messageManager->printToOutputPane(tr("Error while loading project file %1.").arg(m_fileName));
|
2010-05-20 10:00:30 +02:00
|
|
|
messageManager->printToOutputPane(component->errorString(), true);
|
2010-01-19 13:53:48 +01:00
|
|
|
}
|
2011-03-23 15:19:35 +01:00
|
|
|
} else {
|
2011-03-30 15:15:15 +02:00
|
|
|
messageManager->printToOutputPane(tr("QML project: %1").arg(reader.errorString()), true);
|
2010-01-18 16:32:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (m_projectItem) {
|
|
|
|
m_projectItem.data()->setSourceDirectory(projectDir().path());
|
2010-04-16 13:08:59 +02:00
|
|
|
m_modelManager->updateSourceFiles(m_projectItem.data()->files(), true);
|
2012-01-02 15:54:51 +01:00
|
|
|
|
|
|
|
QString mainFilePath = m_projectItem.data()->mainFile();
|
|
|
|
if (!mainFilePath.isEmpty()) {
|
|
|
|
mainFilePath = projectDir().absoluteFilePath(mainFilePath);
|
2013-01-21 13:54:20 +01:00
|
|
|
Utils::FileReader reader;
|
|
|
|
QString errorMessage;
|
|
|
|
if (!reader.fetch(mainFilePath, &errorMessage)) {
|
2012-01-02 15:54:51 +01:00
|
|
|
messageManager->printToOutputPane(
|
|
|
|
tr("Warning while loading project file %1.").arg(m_fileName));
|
2013-01-21 13:54:20 +01:00
|
|
|
messageManager->printToOutputPane(errorMessage, true);
|
|
|
|
} else {
|
|
|
|
m_defaultImport = detectImport(QString::fromUtf8(reader.data()));
|
2012-01-02 15:54:51 +01:00
|
|
|
}
|
|
|
|
}
|
2010-01-18 16:32:14 +01:00
|
|
|
}
|
|
|
|
m_rootNode->refresh();
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options & Configuration) {
|
|
|
|
// update configuration
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options & Files)
|
|
|
|
emit fileListChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProject::refresh(RefreshOptions options)
|
|
|
|
{
|
|
|
|
parseProject(options);
|
|
|
|
|
|
|
|
if (options & Files)
|
|
|
|
m_rootNode->refresh();
|
2010-06-22 12:54:19 +02:00
|
|
|
|
2012-12-06 17:20:58 +01:00
|
|
|
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
|
|
|
|
QmlJSTools::defaultProjectInfoForProject(this);
|
2013-01-10 16:12:45 +01:00
|
|
|
projectInfo.importPaths = customImportPaths();
|
|
|
|
|
|
|
|
m_modelManager->updateProjectInfo(projectInfo);
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
|
|
|
|
{
|
|
|
|
const QDir projectDir(QFileInfo(m_fileName).dir());
|
|
|
|
QStringList absolutePaths;
|
|
|
|
foreach (const QString &file, paths) {
|
|
|
|
QFileInfo fileInfo(projectDir, file);
|
|
|
|
absolutePaths.append(fileInfo.absoluteFilePath());
|
|
|
|
}
|
|
|
|
absolutePaths.removeDuplicates();
|
|
|
|
return absolutePaths;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList QmlProject::files() const
|
2010-01-18 16:32:14 +01:00
|
|
|
{
|
|
|
|
QStringList files;
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (m_projectItem)
|
2010-01-28 17:12:07 +01:00
|
|
|
files = m_projectItem.data()->files();
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
else
|
2010-01-18 16:32:14 +01:00
|
|
|
files = m_files;
|
|
|
|
return files;
|
|
|
|
}
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-12-03 17:04:29 +01:00
|
|
|
QString QmlProject::mainFile() const
|
|
|
|
{
|
|
|
|
if (m_projectItem)
|
|
|
|
return m_projectItem.data()->mainFile();
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2010-02-17 13:37:00 +01:00
|
|
|
bool QmlProject::validProjectFile() const
|
|
|
|
{
|
|
|
|
return !m_projectItem.isNull();
|
|
|
|
}
|
|
|
|
|
2012-12-03 15:28:34 +01:00
|
|
|
QStringList QmlProject::customImportPaths() const
|
2010-02-03 09:13:23 +01:00
|
|
|
{
|
2010-03-21 09:36:54 +01:00
|
|
|
QStringList importPaths;
|
2010-02-03 09:13:23 +01:00
|
|
|
if (m_projectItem)
|
2010-03-21 09:36:54 +01:00
|
|
|
importPaths = m_projectItem.data()->importPaths();
|
2010-10-13 13:03:32 +02:00
|
|
|
|
2010-03-21 09:36:54 +01:00
|
|
|
return importPaths;
|
2010-02-03 09:13:23 +01:00
|
|
|
}
|
|
|
|
|
2010-02-17 11:20:35 +01:00
|
|
|
bool QmlProject::addFiles(const QStringList &filePaths)
|
|
|
|
{
|
|
|
|
QStringList toAdd;
|
|
|
|
foreach (const QString &filePath, filePaths) {
|
|
|
|
if (!m_projectItem.data()->matchesFile(filePath))
|
|
|
|
toAdd << filePaths;
|
|
|
|
}
|
|
|
|
return toAdd.isEmpty();
|
|
|
|
}
|
|
|
|
|
2010-01-19 13:53:48 +01:00
|
|
|
void QmlProject::refreshProjectFile()
|
|
|
|
{
|
|
|
|
refresh(QmlProject::ProjectFile | Files);
|
|
|
|
}
|
|
|
|
|
2013-01-21 13:54:20 +01:00
|
|
|
QmlProject::QmlImport QmlProject::defaultImport() const
|
|
|
|
{
|
|
|
|
return m_defaultImport;
|
|
|
|
}
|
|
|
|
|
2010-05-18 13:40:35 +02:00
|
|
|
void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString> &removed)
|
2010-01-19 13:53:48 +01:00
|
|
|
{
|
|
|
|
refresh(Files);
|
2010-05-18 13:40:35 +02:00
|
|
|
if (!removed.isEmpty())
|
|
|
|
m_modelManager->removeFiles(removed.toList());
|
2010-01-19 13:53:48 +01:00
|
|
|
}
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString QmlProject::displayName() const
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
|
|
|
return m_projectName;
|
|
|
|
}
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
Core::Id QmlProject::id() const
|
2010-01-22 15:59:44 +01:00
|
|
|
{
|
2012-03-15 17:17:40 +01:00
|
|
|
return Core::Id("QmlProjectManager.QmlProject");
|
2010-01-22 15:59:44 +01:00
|
|
|
}
|
|
|
|
|
2012-02-14 16:43:51 +01:00
|
|
|
Core::IDocument *QmlProject::document() const
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
|
|
|
return m_file;
|
|
|
|
}
|
|
|
|
|
2011-08-18 16:46:26 +02:00
|
|
|
ProjectExplorer::IProjectManager *QmlProject::projectManager() const
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
|
|
|
return m_manager;
|
|
|
|
}
|
|
|
|
|
2012-09-20 11:16:47 +02:00
|
|
|
bool QmlProject::supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
2012-09-09 20:41:30 +03:00
|
|
|
Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k);
|
2012-09-20 11:16:47 +02:00
|
|
|
if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
|
|
|
if (errorMessage)
|
|
|
|
*errorMessage = tr("Device type is not desktop.");
|
2012-04-24 15:49:09 +02:00
|
|
|
return false;
|
2012-09-20 11:16:47 +02:00
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-09 20:41:30 +03:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
2013-01-21 13:54:20 +01:00
|
|
|
if (!version) {
|
|
|
|
if (errorMessage)
|
|
|
|
*errorMessage = tr("No Qt version set in kit.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (version->qtVersion() < QtSupport::QtVersionNumber(4, 7, 0)) {
|
|
|
|
if (errorMessage)
|
|
|
|
*errorMessage = tr("Qt version is too old.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0)
|
|
|
|
&& defaultImport() == QtQuick2Import) {
|
|
|
|
if (errorMessage)
|
|
|
|
*errorMessage = tr("Qt version is too old.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
2011-08-18 16:46:26 +02:00
|
|
|
ProjectExplorer::ProjectNode *QmlProject::rootProjectNode() const
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
|
|
|
return m_rootNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList QmlProject::files(FilesMode) const
|
|
|
|
{
|
2010-01-18 16:32:14 +01:00
|
|
|
return files();
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
2010-01-19 16:33:44 +01:00
|
|
|
bool QmlProject::fromMap(const QVariantMap &map)
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
2010-02-04 11:51:35 +01:00
|
|
|
if (!Project::fromMap(map))
|
|
|
|
return false;
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2013-01-21 13:54:20 +01:00
|
|
|
// refresh first - project information is used e.g. to decide the default RC's
|
|
|
|
refresh(Everything);
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
ProjectExplorer::Kit *defaultKit = ProjectExplorer::KitManager::instance()->defaultKit();
|
|
|
|
if (!activeTarget() && defaultKit)
|
|
|
|
addTarget(createTarget(defaultKit));
|
2009-05-07 12:27:52 +02:00
|
|
|
|
2012-10-16 18:49:46 +02:00
|
|
|
// addedTarget calls updateEnabled on the runconfigurations
|
|
|
|
// which needs to happen after refresh
|
|
|
|
foreach (ProjectExplorer::Target *t, targets())
|
|
|
|
addedTarget(t);
|
|
|
|
|
|
|
|
connect(this, SIGNAL(addedTarget(ProjectExplorer::Target*)),
|
|
|
|
this, SLOT(addedTarget(ProjectExplorer::Target*)));
|
|
|
|
|
2009-07-03 16:46:01 +02:00
|
|
|
return true;
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
} // namespace QmlProjectManager
|
2009-12-17 09:54:16 +01:00
|
|
|
|