2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
#include "qmlproject.h"
|
2013-07-11 17:37:02 +02:00
|
|
|
#include "fileformat/qmlprojectfileformat.h"
|
2010-02-16 13:39:13 +01:00
|
|
|
#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"
|
2010-02-17 13:37:00 +01:00
|
|
|
|
2017-02-28 16:31:07 +01:00
|
|
|
#include <coreplugin/icontext.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>
|
2017-03-03 18:16:34 +01:00
|
|
|
|
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>
|
2017-03-03 18:16:34 +01:00
|
|
|
|
|
|
|
#include <qtsupport/baseqtversion.h>
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2013-03-07 14:02:04 +01:00
|
|
|
#include <qtsupport/qtsupportconstants.h>
|
2017-03-03 18:16:34 +01:00
|
|
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
2011-04-15 15:55:11 +02:00
|
|
|
|
2017-03-01 14:26:46 +01:00
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
2012-08-06 13:42:46 +02:00
|
|
|
#include <QDebug>
|
2017-03-09 23:02:32 +01:00
|
|
|
#include <QRegExp>
|
2010-01-19 13:41:02 +01:00
|
|
|
|
2013-09-05 01:52:17 +02:00
|
|
|
using namespace Core;
|
2013-09-10 17:59:34 +02:00
|
|
|
using namespace ProjectExplorer;
|
2010-01-18 16:32:14 +01:00
|
|
|
|
2013-09-05 01:52:17 +02:00
|
|
|
namespace QmlProjectManager {
|
2013-03-07 14:02:04 +01:00
|
|
|
|
2017-02-28 16:31:07 +01:00
|
|
|
QmlProject::QmlProject(const Utils::FileName &fileName) :
|
2017-03-29 11:25:01 +02:00
|
|
|
Project(QString::fromLatin1(Constants::QMLPROJECT_MIMETYPE), fileName, [this]() { refreshProjectFile(); }),
|
2016-01-08 11:31:06 +01:00
|
|
|
m_defaultImport(UnknownImport)
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
2013-09-27 16:30:20 +02:00
|
|
|
setId("QmlProjectManager.QmlProject");
|
2013-09-05 01:52:17 +02:00
|
|
|
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
|
2017-01-30 14:59:10 +01:00
|
|
|
setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID));
|
2017-04-07 14:35:49 +02:00
|
|
|
setDisplayName(fileName.toFileInfo().completeBaseName());
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QmlProject::~QmlProject()
|
|
|
|
{
|
2010-09-24 14:29:40 +02:00
|
|
|
delete m_projectItem.data();
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
2015-02-03 23:48:57 +02:00
|
|
|
void QmlProject::addedTarget(Target *target)
|
2012-10-09 16:20:26 +02:00
|
|
|
{
|
2016-07-01 12:19:37 +03:00
|
|
|
connect(target, &Target::addedRunConfiguration,
|
|
|
|
this, &QmlProject::addedRunConfiguration);
|
2015-02-03 23:48:57 +02:00
|
|
|
foreach (RunConfiguration *rc, target->runConfigurations())
|
2012-10-09 16:20:26 +02:00
|
|
|
addedRunConfiguration(rc);
|
|
|
|
}
|
|
|
|
|
2015-02-03 23:48:57 +02:00
|
|
|
void QmlProject::onActiveTargetChanged(Target *target)
|
2013-11-06 12:59:04 +01:00
|
|
|
{
|
|
|
|
if (m_activeTarget)
|
2015-02-03 23:48:57 +02:00
|
|
|
disconnect(m_activeTarget, &Target::kitChanged, this, &QmlProject::onKitChanged);
|
2013-11-06 12:59:04 +01:00
|
|
|
m_activeTarget = target;
|
|
|
|
if (m_activeTarget)
|
2016-07-01 12:19:37 +03:00
|
|
|
connect(target, &Target::kitChanged, this, &QmlProject::onKitChanged);
|
2013-11-06 12:59:04 +01:00
|
|
|
|
|
|
|
// make sure e.g. the default qml imports are adapted
|
|
|
|
refresh(Configuration);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProject::onKitChanged()
|
2013-05-02 15:29:33 +02:00
|
|
|
{
|
|
|
|
// make sure e.g. the default qml imports are adapted
|
|
|
|
refresh(Configuration);
|
|
|
|
}
|
|
|
|
|
2015-02-03 23:48:57 +02:00
|
|
|
void QmlProject::addedRunConfiguration(RunConfiguration *rc)
|
2012-10-09 16:20:26 +02:00
|
|
|
{
|
|
|
|
// 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
|
|
|
|
{
|
2014-05-02 12:22:58 +02:00
|
|
|
return projectFilePath().toFileInfo().dir();
|
2009-05-06 16:13:44 +02:00
|
|
|
}
|
|
|
|
|
2017-02-28 14:46:14 +01:00
|
|
|
static QmlProject::QmlImport detectImport(const QString &qml)
|
|
|
|
{
|
2013-01-21 13:54:20 +01:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
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) {
|
2013-07-11 17:37:02 +02:00
|
|
|
QString errorMessage;
|
2016-01-08 12:12:27 +01:00
|
|
|
m_projectItem = QmlProjectFileFormat::parseProjectFile(projectFilePath(), &errorMessage);
|
2013-07-11 17:37:02 +02:00
|
|
|
if (m_projectItem) {
|
2016-07-01 12:19:37 +03:00
|
|
|
connect(m_projectItem.data(), &QmlProjectItem::qmlFilesChanged,
|
|
|
|
this, &QmlProject::refreshFiles);
|
2013-07-11 17:37:02 +02:00
|
|
|
|
|
|
|
} else {
|
2015-02-02 00:37:38 +02:00
|
|
|
MessageManager::write(tr("Error while loading project file %1.")
|
2016-01-08 12:12:27 +01:00
|
|
|
.arg(projectFilePath().toUserOutput()),
|
2015-02-02 00:37:38 +02:00
|
|
|
MessageManager::NoModeSwitch);
|
2013-09-05 01:52:17 +02:00
|
|
|
MessageManager::write(errorMessage);
|
2013-07-11 17:37:02 +02:00
|
|
|
}
|
2010-01-18 16:32:14 +01:00
|
|
|
}
|
|
|
|
if (m_projectItem) {
|
|
|
|
m_projectItem.data()->setSourceDirectory(projectDir().path());
|
2017-03-14 11:18:09 +01:00
|
|
|
if (auto modelManager = QmlJS::ModelManagerInterface::instance())
|
|
|
|
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)) {
|
2015-02-02 00:37:38 +02:00
|
|
|
MessageManager::write(tr("Warning while loading project file %1.")
|
2016-01-08 12:12:27 +01:00
|
|
|
.arg(projectFilePath().toUserOutput()));
|
2013-09-05 01:52:17 +02:00
|
|
|
MessageManager::write(errorMessage);
|
2013-01-21 13:54:20 +01:00
|
|
|
} else {
|
|
|
|
m_defaultImport = detectImport(QString::fromUtf8(reader.data()));
|
2012-01-02 15:54:51 +01:00
|
|
|
}
|
|
|
|
}
|
2010-01-18 16:32:14 +01:00
|
|
|
}
|
2017-03-01 14:26:46 +01:00
|
|
|
generateProjectTree();
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (options & Configuration) {
|
|
|
|
// update configuration
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProject::refresh(RefreshOptions options)
|
|
|
|
{
|
|
|
|
parseProject(options);
|
|
|
|
|
|
|
|
if (options & Files)
|
2017-03-01 14:26:46 +01:00
|
|
|
generateProjectTree();
|
2010-06-22 12:54:19 +02:00
|
|
|
|
2017-03-14 11:18:09 +01:00
|
|
|
auto modelManager = QmlJS::ModelManagerInterface::instance();
|
|
|
|
if (!modelManager)
|
2014-07-24 11:48:30 +02:00
|
|
|
return;
|
|
|
|
|
2012-12-06 17:20:58 +01:00
|
|
|
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
|
2017-03-14 11:18:09 +01:00
|
|
|
modelManager->defaultProjectInfoForProject(this);
|
2014-07-22 19:06:44 +02:00
|
|
|
foreach (const QString &searchPath, customImportPaths())
|
|
|
|
projectInfo.importPaths.maybeInsert(Utils::FileName::fromString(searchPath),
|
|
|
|
QmlJS::Dialect::Qml);
|
2013-01-10 16:12:45 +01:00
|
|
|
|
2017-03-14 11:18:09 +01:00
|
|
|
modelManager->updateProjectInfo(projectInfo, this);
|
2016-10-20 13:18:54 +02:00
|
|
|
|
|
|
|
emit parsingFinished();
|
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);
|
2017-03-14 11:18:09 +01:00
|
|
|
if (!removed.isEmpty()) {
|
|
|
|
if (auto modelManager = QmlJS::ModelManagerInterface::instance())
|
|
|
|
modelManager->removeFiles(removed.toList());
|
|
|
|
}
|
2010-01-19 13:53:48 +01:00
|
|
|
}
|
|
|
|
|
2015-02-03 23:48:57 +02:00
|
|
|
bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
2015-02-03 23:48:57 +02:00
|
|
|
Id deviceType = 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
|
|
|
}
|
|
|
|
|
2016-01-08 12:49:00 +01:00
|
|
|
Internal::QmlProjectNode *QmlProject::rootProjectNode() const
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
2016-01-08 12:49:00 +01:00
|
|
|
return static_cast<Internal::QmlProjectNode *>(Project::rootProjectNode());
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
2015-05-18 16:57:29 +02:00
|
|
|
Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
2015-05-18 16:57:29 +02:00
|
|
|
RestoreResult result = Project::fromMap(map, errorMessage);
|
2015-09-08 17:15:17 +02:00
|
|
|
if (result != RestoreResult::Ok)
|
2015-05-18 16:57:29 +02:00
|
|
|
return result;
|
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);
|
|
|
|
|
2013-03-07 14:02:04 +01:00
|
|
|
if (!activeTarget()) {
|
|
|
|
// find a kit that matches prerequisites (prefer default one)
|
2017-01-11 17:25:58 +01:00
|
|
|
QList<Kit*> kits = KitManager::kits(
|
|
|
|
std::function<bool(const Kit *)>([this](const Kit *k) -> bool {
|
2014-07-23 09:09:20 +02:00
|
|
|
if (!k->isValid())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
|
|
|
|
if (dev.isNull() || dev->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
|
|
|
return false;
|
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
|
|
|
if (!version || version->type() != QLatin1String(QtSupport::Constants::DESKTOPQT))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool hasViewer = false; // Initialization needed for dumb compilers.
|
|
|
|
QtSupport::QtVersionNumber minVersion;
|
|
|
|
switch (m_defaultImport) {
|
|
|
|
case QmlProject::UnknownImport:
|
|
|
|
minVersion = QtSupport::QtVersionNumber(4, 7, 0);
|
|
|
|
hasViewer = !version->qmlviewerCommand().isEmpty() || !version->qmlsceneCommand().isEmpty();
|
|
|
|
break;
|
|
|
|
case QmlProject::QtQuick1Import:
|
|
|
|
minVersion = QtSupport::QtVersionNumber(4, 7, 1);
|
|
|
|
hasViewer = !version->qmlviewerCommand().isEmpty();
|
|
|
|
break;
|
|
|
|
case QmlProject::QtQuick2Import:
|
|
|
|
minVersion = QtSupport::QtVersionNumber(5, 0, 0);
|
|
|
|
hasViewer = !version->qmlsceneCommand().isEmpty();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return version->qtVersion() >= minVersion && hasViewer;
|
2017-01-11 17:25:58 +01:00
|
|
|
}));
|
2013-03-07 14:02:04 +01:00
|
|
|
|
|
|
|
if (!kits.isEmpty()) {
|
2013-09-10 17:59:34 +02:00
|
|
|
Kit *kit = 0;
|
2013-11-11 22:20:47 +02:00
|
|
|
if (kits.contains(KitManager::defaultKit()))
|
2013-09-10 17:59:34 +02:00
|
|
|
kit = KitManager::defaultKit();
|
2013-11-11 22:20:47 +02:00
|
|
|
else
|
2013-03-07 14:02:04 +01:00
|
|
|
kit = kits.first();
|
|
|
|
addTarget(createTarget(kit));
|
|
|
|
}
|
|
|
|
}
|
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
|
2013-09-10 17:59:34 +02:00
|
|
|
foreach (Target *t, targets())
|
2012-10-16 18:49:46 +02:00
|
|
|
addedTarget(t);
|
|
|
|
|
2015-03-31 13:04:19 +02:00
|
|
|
connect(this, &ProjectExplorer::Project::addedTarget, this, &QmlProject::addedTarget);
|
2012-10-16 18:49:46 +02:00
|
|
|
|
2015-03-31 13:04:19 +02:00
|
|
|
connect(this, &ProjectExplorer::Project::activeTargetChanged,
|
|
|
|
this, &QmlProject::onActiveTargetChanged);
|
2013-05-02 15:29:33 +02:00
|
|
|
|
2014-12-03 13:30:37 +01:00
|
|
|
onActiveTargetChanged(activeTarget());
|
2013-11-06 12:59:04 +01:00
|
|
|
|
2015-05-18 16:57:29 +02:00
|
|
|
return RestoreResult::Ok;
|
2009-05-04 12:19:22 +02:00
|
|
|
}
|
|
|
|
|
2017-03-01 14:26:46 +01:00
|
|
|
void QmlProject::generateProjectTree()
|
|
|
|
{
|
2017-03-27 12:12:38 +02:00
|
|
|
if (!m_projectItem)
|
|
|
|
return;
|
|
|
|
|
2017-03-10 17:30:40 +01:00
|
|
|
auto newRoot = new Internal::QmlProjectNode(this);
|
2017-03-01 14:26:46 +01:00
|
|
|
|
2017-03-27 12:12:38 +02:00
|
|
|
for (const QString &f : m_projectItem.data()->files()) {
|
2017-03-01 14:26:46 +01:00
|
|
|
FileType fileType = FileType::Source; // ### FIXME
|
|
|
|
if (f == projectFilePath().toString())
|
|
|
|
fileType = FileType::Project;
|
2017-03-10 17:30:40 +01:00
|
|
|
newRoot->addNestedNode(new FileNode(Utils::FileName::fromString(f), fileType, false));
|
|
|
|
}
|
2017-03-01 14:26:46 +01:00
|
|
|
|
2017-03-03 15:13:06 +01:00
|
|
|
setRootProjectNode(newRoot);
|
2017-03-01 14:26:46 +01:00
|
|
|
}
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
} // namespace QmlProjectManager
|
2009-12-17 09:54:16 +01:00
|
|
|
|