forked from qt-creator/qt-creator
ProjectExplorer: Follow up on too-much-magic in IProjectManager
Use a ProjectManager::registerProjectType<Project>(MimeType) function, removing cryptic IProjectManager object ownership. Change-Id: I212cd25bd4ee757022a8cb0decb4b8de3a112d12 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -30,19 +30,20 @@
|
||||
#include "qmlprojectrunconfiguration.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "qmlprojectnodes.h"
|
||||
#include "qmlprojectmanager.h"
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** 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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmlprojectmanager.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "qmlproject.h"
|
||||
|
||||
namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QString Manager::mimeType() const
|
||||
{
|
||||
return QLatin1String(Constants::QMLPROJECT_MIMETYPE);
|
||||
}
|
||||
|
||||
ProjectExplorer::Project *Manager::openProject(const QString &fileName)
|
||||
{
|
||||
return new QmlProject(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
||||
@@ -1,43 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** 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 https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/iprojectmanager.h>
|
||||
|
||||
namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class Manager: public ProjectExplorer::IProjectManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QString mimeType() const override;
|
||||
ProjectExplorer::Project *openProject(const QString &fileName) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
||||
@@ -7,7 +7,6 @@ DEFINES += QMLPROJECTMANAGER_LIBRARY
|
||||
HEADERS += qmlproject.h \
|
||||
qmlprojectenvironmentaspect.h \
|
||||
qmlprojectplugin.h \
|
||||
qmlprojectmanager.h \
|
||||
qmlprojectconstants.h \
|
||||
qmlprojectnodes.h \
|
||||
qmlprojectfile.h \
|
||||
@@ -20,7 +19,6 @@ HEADERS += qmlproject.h \
|
||||
SOURCES += qmlproject.cpp \
|
||||
qmlprojectenvironmentaspect.cpp \
|
||||
qmlprojectplugin.cpp \
|
||||
qmlprojectmanager.cpp \
|
||||
qmlprojectnodes.cpp \
|
||||
qmlprojectfile.cpp \
|
||||
qmlprojectrunconfiguration.cpp \
|
||||
|
||||
@@ -19,7 +19,6 @@ QtcPlugin {
|
||||
"qmlprojectconstants.h",
|
||||
"qmlprojectenvironmentaspect.cpp", "qmlprojectenvironmentaspect.h",
|
||||
"qmlprojectfile.cpp", "qmlprojectfile.h",
|
||||
"qmlprojectmanager.cpp", "qmlprojectmanager.h",
|
||||
"qmlprojectmanager_global.h",
|
||||
"qmlprojectmanagerconstants.h",
|
||||
"qmlprojectnodes.cpp", "qmlprojectnodes.h",
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmlprojectplugin.h"
|
||||
#include "qmlprojectmanager.h"
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectrunconfigurationfactory.h"
|
||||
#include "fileformat/qmlprojectfileformat.h"
|
||||
@@ -32,7 +31,9 @@
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
|
||||
#include <qmljstools/qmljstoolsconstants.h>
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
@@ -40,6 +41,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmlProjectManager {
|
||||
|
||||
QmlProjectPlugin::QmlProjectPlugin()
|
||||
@@ -53,9 +56,9 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
|
||||
addAutoReleasedObject(new Internal::Manager);
|
||||
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
|
||||
|
||||
ProjectManager::registerProjectType<QmlProject>(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
|
||||
Core::FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png", "qmlproject");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user