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:
@@ -1,48 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Openismus GmbH.
|
|
||||||
** Author: Peter Penz (ppenz@openismus.com)
|
|
||||||
** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com)
|
|
||||||
** 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 "autotoolsmanager.h"
|
|
||||||
#include "autotoolsproject.h"
|
|
||||||
#include "autotoolsprojectconstants.h"
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
|
|
||||||
namespace AutotoolsProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
Project *AutotoolsManager::openProject(const QString &fileName)
|
|
||||||
{
|
|
||||||
return new AutotoolsProject(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AutotoolsManager::mimeType() const
|
|
||||||
{
|
|
||||||
return QLatin1String(Constants::MAKEFILE_MIMETYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace AutotoolsProjectManager
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Openismus GmbH.
|
|
||||||
** Author: Peter Penz (ppenz@openismus.com)
|
|
||||||
** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com)
|
|
||||||
** 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 AutotoolsProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Implementation of ProjectExplorer::IProjectManager interface.
|
|
||||||
*
|
|
||||||
* An autotools project is identified by the MIME type text/x-makefile.
|
|
||||||
* The project is represented by an instance of ProjectExplorer::Project,
|
|
||||||
* which gets created by AutotoolsManager::openProject().
|
|
||||||
*/
|
|
||||||
class AutotoolsManager : public ProjectExplorer::IProjectManager
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ProjectExplorer::Project *openProject(const QString &fileName) override;
|
|
||||||
QString mimeType() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace AutotoolsProjectManager
|
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
#include "autotoolsproject.h"
|
#include "autotoolsproject.h"
|
||||||
#include "autotoolsbuildconfiguration.h"
|
#include "autotoolsbuildconfiguration.h"
|
||||||
#include "autotoolsprojectconstants.h"
|
#include "autotoolsprojectconstants.h"
|
||||||
#include "autotoolsmanager.h"
|
|
||||||
#include "autotoolsprojectnode.h"
|
#include "autotoolsprojectnode.h"
|
||||||
#include "autotoolsprojectfile.h"
|
#include "autotoolsprojectfile.h"
|
||||||
#include "autotoolsopenprojectwizard.h"
|
#include "autotoolsopenprojectwizard.h"
|
||||||
@@ -69,7 +68,7 @@ using namespace AutotoolsProjectManager;
|
|||||||
using namespace AutotoolsProjectManager::Internal;
|
using namespace AutotoolsProjectManager::Internal;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
AutotoolsProject::AutotoolsProject(const QString &fileName) :
|
AutotoolsProject::AutotoolsProject(const Utils::FileName &fileName) :
|
||||||
m_fileWatcher(new Utils::FileSystemWatcher(this)),
|
m_fileWatcher(new Utils::FileSystemWatcher(this)),
|
||||||
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class AutotoolsProject : public ProjectExplorer::Project
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutotoolsProject(const QString &fileName);
|
explicit AutotoolsProject(const Utils::FileName &fileName);
|
||||||
~AutotoolsProject() override;
|
~AutotoolsProject() override;
|
||||||
|
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|||||||
@@ -32,11 +32,11 @@
|
|||||||
namespace AutotoolsProjectManager {
|
namespace AutotoolsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
AutotoolsProjectFile::AutotoolsProjectFile(const QString &fileName)
|
AutotoolsProjectFile::AutotoolsProjectFile(const Utils::FileName &fileName)
|
||||||
{
|
{
|
||||||
setId("Autotools.ProjectFile");
|
setId("Autotools.ProjectFile");
|
||||||
setMimeType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
|
setMimeType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
|
||||||
setFilePath(Utils::FileName::fromString(fileName));
|
setFilePath(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Internal {
|
|||||||
class AutotoolsProjectFile : public Core::IDocument
|
class AutotoolsProjectFile : public Core::IDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutotoolsProjectFile(const QString &fileName);
|
AutotoolsProjectFile(const Utils::FileName &fileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ include(../../qtcreatorplugin.pri)
|
|||||||
|
|
||||||
HEADERS = autotoolsprojectplugin.h\
|
HEADERS = autotoolsprojectplugin.h\
|
||||||
autotoolsopenprojectwizard.h\
|
autotoolsopenprojectwizard.h\
|
||||||
autotoolsmanager.h\
|
|
||||||
autotoolsprojectfile.h\
|
autotoolsprojectfile.h\
|
||||||
autotoolsprojectnode.h\
|
autotoolsprojectnode.h\
|
||||||
autotoolsproject.h\
|
autotoolsproject.h\
|
||||||
@@ -17,7 +16,6 @@ HEADERS = autotoolsprojectplugin.h\
|
|||||||
makefileparser.h
|
makefileparser.h
|
||||||
SOURCES = autotoolsprojectplugin.cpp\
|
SOURCES = autotoolsprojectplugin.cpp\
|
||||||
autotoolsopenprojectwizard.cpp\
|
autotoolsopenprojectwizard.cpp\
|
||||||
autotoolsmanager.cpp\
|
|
||||||
autotoolsprojectfile.cpp\
|
autotoolsprojectfile.cpp\
|
||||||
autotoolsprojectnode.cpp\
|
autotoolsprojectnode.cpp\
|
||||||
autotoolsproject.cpp\
|
autotoolsproject.cpp\
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ QtcPlugin {
|
|||||||
"autotoolsbuildconfiguration.h",
|
"autotoolsbuildconfiguration.h",
|
||||||
"autotoolsbuildsettingswidget.cpp",
|
"autotoolsbuildsettingswidget.cpp",
|
||||||
"autotoolsbuildsettingswidget.h",
|
"autotoolsbuildsettingswidget.h",
|
||||||
"autotoolsmanager.cpp",
|
|
||||||
"autotoolsmanager.h",
|
|
||||||
"autotoolsopenprojectwizard.cpp",
|
"autotoolsopenprojectwizard.cpp",
|
||||||
"autotoolsopenprojectwizard.h",
|
"autotoolsopenprojectwizard.h",
|
||||||
"autotoolsproject.cpp",
|
"autotoolsproject.cpp",
|
||||||
|
|||||||
@@ -26,13 +26,15 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "autotoolsprojectplugin.h"
|
#include "autotoolsprojectplugin.h"
|
||||||
#include "autotoolsmanager.h"
|
#include "autotoolsproject.h"
|
||||||
|
#include "autotoolsprojectconstants.h"
|
||||||
#include "autotoolsbuildconfiguration.h"
|
#include "autotoolsbuildconfiguration.h"
|
||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
#include "autogenstep.h"
|
#include "autogenstep.h"
|
||||||
#include "autoreconfstep.h"
|
#include "autoreconfstep.h"
|
||||||
#include "configurestep.h"
|
#include "configurestep.h"
|
||||||
#include "autotoolsprojectconstants.h"
|
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
@@ -53,7 +55,8 @@ bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
|
|||||||
addAutoReleasedObject(new AutogenStepFactory);
|
addAutoReleasedObject(new AutogenStepFactory);
|
||||||
addAutoReleasedObject(new ConfigureStepFactory);
|
addAutoReleasedObject(new ConfigureStepFactory);
|
||||||
addAutoReleasedObject(new AutoreconfStepFactory);
|
addAutoReleasedObject(new AutoreconfStepFactory);
|
||||||
addAutoReleasedObject(new AutotoolsManager);
|
|
||||||
|
ProjectExplorer::ProjectManager::registerProjectType<AutotoolsProject>(Constants::MAKEFILE_MIMETYPE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/iprojectmanager.h>
|
#include <projectexplorer/projectmanager.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
#include <utils/temporarydirectory.h>
|
#include <utils/temporarydirectory.h>
|
||||||
|
|||||||
@@ -155,13 +155,3 @@ void CMakeManager::rescanProject(Project *project)
|
|||||||
cmakeProject->scanProjectTree();
|
cmakeProject->scanProjectTree();
|
||||||
cmakeProject->runCMake(); // by my experience: every rescan run requires cmake run too
|
cmakeProject->runCMake(); // by my experience: every rescan run requires cmake run too
|
||||||
}
|
}
|
||||||
|
|
||||||
Project *CMakeManager::openProject(const QString &fileName)
|
|
||||||
{
|
|
||||||
return new CMakeProject(Utils::FileName::fromString(fileName));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CMakeManager::mimeType() const
|
|
||||||
{
|
|
||||||
return QLatin1String(Constants::CMAKEPROJECTMIMETYPE);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/iprojectmanager.h>
|
#include <projectexplorer/project.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QAction;
|
class QAction;
|
||||||
@@ -36,15 +36,13 @@ namespace Internal {
|
|||||||
|
|
||||||
class CMakeSettingsPage;
|
class CMakeSettingsPage;
|
||||||
|
|
||||||
class CMakeManager : public ProjectExplorer::IProjectManager
|
class CMakeManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMakeManager();
|
CMakeManager();
|
||||||
|
|
||||||
ProjectExplorer::Project *openProject(const QString &fileName) override;
|
|
||||||
QString mimeType() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateCmakeActions();
|
void updateCmakeActions();
|
||||||
void clearCMakeCache(ProjectExplorer::Project *project);
|
void clearCMakeCache(ProjectExplorer::Project *project);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
|
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
#include <projectexplorer/projecttree.h>
|
#include <projectexplorer/projecttree.h>
|
||||||
|
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
@@ -64,6 +65,9 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
|||||||
addAutoReleasedObject(new Internal::CMakeSnippetProvider);
|
addAutoReleasedObject(new Internal::CMakeSnippetProvider);
|
||||||
addAutoReleasedObject(new CMakeSettingsPage);
|
addAutoReleasedObject(new CMakeSettingsPage);
|
||||||
addAutoReleasedObject(new CMakeManager);
|
addAutoReleasedObject(new CMakeManager);
|
||||||
|
|
||||||
|
ProjectManager::registerProjectType<CMakeProject>(Constants::CMAKEPROJECTMIMETYPE);
|
||||||
|
|
||||||
addAutoReleasedObject(new CMakeBuildStepFactory);
|
addAutoReleasedObject(new CMakeBuildStepFactory);
|
||||||
addAutoReleasedObject(new CMakeRunConfigurationFactory);
|
addAutoReleasedObject(new CMakeRunConfigurationFactory);
|
||||||
addAutoReleasedObject(new CMakeBuildConfigurationFactory);
|
addAutoReleasedObject(new CMakeBuildConfigurationFactory);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -64,7 +65,7 @@ namespace Internal {
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
GenericProject::GenericProject(const QString &fileName)
|
GenericProject::GenericProject(const Utils::FileName &fileName)
|
||||||
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||||
{
|
{
|
||||||
setId(Constants::GENERICPROJECT_ID);
|
setId(Constants::GENERICPROJECT_ID);
|
||||||
@@ -81,9 +82,9 @@ GenericProject::GenericProject(const QString &fileName)
|
|||||||
m_includesFileName = QFileInfo(dir, m_projectName + ".includes").absoluteFilePath();
|
m_includesFileName = QFileInfo(dir, m_projectName + ".includes").absoluteFilePath();
|
||||||
m_configFileName = QFileInfo(dir, m_projectName + ".config").absoluteFilePath();
|
m_configFileName = QFileInfo(dir, m_projectName + ".config").absoluteFilePath();
|
||||||
|
|
||||||
m_filesIDocument = new GenericProjectFile(this, m_filesFileName, GenericProject::Files);
|
m_filesIDocument = new GenericProjectFile(this, FileName::fromString(m_filesFileName), GenericProject::Files);
|
||||||
m_includesIDocument = new GenericProjectFile(this, m_includesFileName, GenericProject::Configuration);
|
m_includesIDocument = new GenericProjectFile(this, FileName::fromString(m_includesFileName), GenericProject::Configuration);
|
||||||
m_configIDocument = new GenericProjectFile(this, m_configFileName, GenericProject::Configuration);
|
m_configIDocument = new GenericProjectFile(this, FileName::fromString(m_configFileName), GenericProject::Configuration);
|
||||||
|
|
||||||
DocumentManager::addDocument(document());
|
DocumentManager::addDocument(document());
|
||||||
DocumentManager::addDocument(m_filesIDocument);
|
DocumentManager::addDocument(m_filesIDocument);
|
||||||
@@ -461,14 +462,14 @@ Project::RestoreResult GenericProject::fromMap(const QVariantMap &map, QString *
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
GenericProjectFile::GenericProjectFile(GenericProject *parent, QString fileName,
|
GenericProjectFile::GenericProjectFile(GenericProject *parent, const Utils::FileName &fileName,
|
||||||
GenericProject::RefreshOptions options) :
|
GenericProject::RefreshOptions options) :
|
||||||
m_project(parent),
|
m_project(parent),
|
||||||
m_options(options)
|
m_options(options)
|
||||||
{
|
{
|
||||||
setId("Generic.ProjectFile");
|
setId("Generic.ProjectFile");
|
||||||
setMimeType(Constants::GENERICMIMETYPE);
|
setMimeType(Constants::GENERICMIMETYPE);
|
||||||
setFilePath(Utils::FileName::fromString(fileName));
|
setFilePath(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDocument::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
IDocument::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class GenericProject : public ProjectExplorer::Project
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GenericProject(const QString &filename);
|
explicit GenericProject(const Utils::FileName &filename);
|
||||||
~GenericProject() override;
|
~GenericProject() override;
|
||||||
|
|
||||||
QString filesFileName() const;
|
QString filesFileName() const;
|
||||||
@@ -112,7 +112,8 @@ private:
|
|||||||
class GenericProjectFile : public Core::IDocument
|
class GenericProjectFile : public Core::IDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericProjectFile(GenericProject *parent, QString fileName, GenericProject::RefreshOptions options);
|
GenericProjectFile(GenericProject *parent, const Utils::FileName &fileName,
|
||||||
|
GenericProject::RefreshOptions options);
|
||||||
|
|
||||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "genericprojectfileseditor.h"
|
#include "genericprojectfileseditor.h"
|
||||||
#include "genericprojectmanager.h"
|
|
||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.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 "genericprojectmanager.h"
|
|
||||||
#include "genericprojectconstants.h"
|
|
||||||
#include "genericproject.h"
|
|
||||||
|
|
||||||
namespace GenericProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
QString Manager::mimeType() const
|
|
||||||
{
|
|
||||||
return QLatin1String(Constants::GENERICMIMETYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::Project *Manager::openProject(const QString &fileName)
|
|
||||||
{
|
|
||||||
return new GenericProject(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace GenericProjectManager
|
|
||||||
@@ -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 GenericProjectManager {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class Manager : public ProjectExplorer::IProjectManager
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual QString mimeType() const override;
|
|
||||||
virtual ProjectExplorer::Project *openProject(const QString &fileName) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace GenericProjectManager
|
|
||||||
@@ -2,7 +2,6 @@ include(../../qtcreatorplugin.pri)
|
|||||||
|
|
||||||
HEADERS = genericproject.h \
|
HEADERS = genericproject.h \
|
||||||
genericprojectplugin.h \
|
genericprojectplugin.h \
|
||||||
genericprojectmanager.h \
|
|
||||||
genericprojectconstants.h \
|
genericprojectconstants.h \
|
||||||
genericprojectnodes.h \
|
genericprojectnodes.h \
|
||||||
genericprojectwizard.h \
|
genericprojectwizard.h \
|
||||||
@@ -12,7 +11,6 @@ HEADERS = genericproject.h \
|
|||||||
filesselectionwizardpage.h
|
filesselectionwizardpage.h
|
||||||
SOURCES = genericproject.cpp \
|
SOURCES = genericproject.cpp \
|
||||||
genericprojectplugin.cpp \
|
genericprojectplugin.cpp \
|
||||||
genericprojectmanager.cpp \
|
|
||||||
genericprojectnodes.cpp \
|
genericprojectnodes.cpp \
|
||||||
genericprojectwizard.cpp \
|
genericprojectwizard.cpp \
|
||||||
genericprojectfileseditor.cpp \
|
genericprojectfileseditor.cpp \
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ QtcPlugin {
|
|||||||
"genericprojectconstants.h",
|
"genericprojectconstants.h",
|
||||||
"genericprojectfileseditor.cpp",
|
"genericprojectfileseditor.cpp",
|
||||||
"genericprojectfileseditor.h",
|
"genericprojectfileseditor.h",
|
||||||
"genericprojectmanager.cpp",
|
|
||||||
"genericprojectmanager.h",
|
|
||||||
"genericprojectnodes.cpp",
|
"genericprojectnodes.cpp",
|
||||||
"genericprojectnodes.h",
|
"genericprojectnodes.h",
|
||||||
"genericprojectplugin.cpp",
|
"genericprojectplugin.cpp",
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "genericprojectplugin.h"
|
#include "genericprojectplugin.h"
|
||||||
|
|
||||||
#include "genericbuildconfiguration.h"
|
#include "genericbuildconfiguration.h"
|
||||||
#include "genericprojectmanager.h"
|
|
||||||
#include "genericprojectwizard.h"
|
#include "genericprojectwizard.h"
|
||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
#include "genericprojectfileseditor.h"
|
#include "genericprojectfileseditor.h"
|
||||||
@@ -39,6 +38,7 @@
|
|||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
#include <projectexplorer/projecttree.h>
|
#include <projectexplorer/projecttree.h>
|
||||||
#include <projectexplorer/selectablefilesmodel.h>
|
#include <projectexplorer/selectablefilesmodel.h>
|
||||||
|
|
||||||
@@ -59,7 +59,8 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
|
|||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
addAutoReleasedObject(new Manager);
|
ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE);
|
||||||
|
|
||||||
addAutoReleasedObject(new ProjectFilesFactory);
|
addAutoReleasedObject(new ProjectFilesFactory);
|
||||||
addAutoReleasedObject(new GenericMakeStepFactory);
|
addAutoReleasedObject(new GenericMakeStepFactory);
|
||||||
addAutoReleasedObject(new GenericBuildConfigurationFactory);
|
addAutoReleasedObject(new GenericBuildConfigurationFactory);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ HEADERS += \
|
|||||||
tools/nimlexer.h \
|
tools/nimlexer.h \
|
||||||
tools/sourcecodestream.h \
|
tools/sourcecodestream.h \
|
||||||
project/nimproject.h \
|
project/nimproject.h \
|
||||||
project/nimprojectmanager.h \
|
|
||||||
project/nimprojectnode.h \
|
project/nimprojectnode.h \
|
||||||
project/nimbuildconfiguration.h \
|
project/nimbuildconfiguration.h \
|
||||||
project/nimbuildconfigurationfactory.h \
|
project/nimbuildconfigurationfactory.h \
|
||||||
@@ -47,7 +46,6 @@ SOURCES += \
|
|||||||
editor/nimindenter.cpp \
|
editor/nimindenter.cpp \
|
||||||
tools/nimlexer.cpp \
|
tools/nimlexer.cpp \
|
||||||
project/nimproject.cpp \
|
project/nimproject.cpp \
|
||||||
project/nimprojectmanager.cpp \
|
|
||||||
project/nimprojectnode.cpp \
|
project/nimprojectnode.cpp \
|
||||||
project/nimbuildconfiguration.cpp \
|
project/nimbuildconfiguration.cpp \
|
||||||
project/nimbuildconfigurationfactory.cpp \
|
project/nimbuildconfigurationfactory.cpp \
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ QtcPlugin {
|
|||||||
"nimcompilercleanstepconfigwidget.h", "nimcompilercleanstepconfigwidget.cpp", "nimcompilercleanstepconfigwidget.ui",
|
"nimcompilercleanstepconfigwidget.h", "nimcompilercleanstepconfigwidget.cpp", "nimcompilercleanstepconfigwidget.ui",
|
||||||
"nimcompilercleanstepfactory.h", "nimcompilercleanstepfactory.cpp",
|
"nimcompilercleanstepfactory.h", "nimcompilercleanstepfactory.cpp",
|
||||||
"nimproject.h", "nimproject.cpp",
|
"nimproject.h", "nimproject.cpp",
|
||||||
"nimprojectmanager.h", "nimprojectmanager.cpp",
|
|
||||||
"nimprojectnode.h", "nimprojectnode.cpp",
|
"nimprojectnode.h", "nimprojectnode.cpp",
|
||||||
"nimrunconfiguration.h", "nimrunconfiguration.cpp",
|
"nimrunconfiguration.h", "nimrunconfiguration.cpp",
|
||||||
"nimrunconfigurationfactory.h", "nimrunconfigurationfactory.cpp",
|
"nimrunconfigurationfactory.h", "nimrunconfigurationfactory.cpp",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "project/nimbuildconfigurationfactory.h"
|
#include "project/nimbuildconfigurationfactory.h"
|
||||||
#include "project/nimcompilerbuildstepfactory.h"
|
#include "project/nimcompilerbuildstepfactory.h"
|
||||||
#include "project/nimcompilercleanstepfactory.h"
|
#include "project/nimcompilercleanstepfactory.h"
|
||||||
#include "project/nimprojectmanager.h"
|
#include "project/nimproject.h"
|
||||||
#include "project/nimrunconfigurationfactory.h"
|
#include "project/nimrunconfigurationfactory.h"
|
||||||
#include "project/nimruncontrolfactory.h"
|
#include "project/nimruncontrolfactory.h"
|
||||||
#include "project/nimtoolchainfactory.h"
|
#include "project/nimtoolchainfactory.h"
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "settings/nimsnippetprovider.h"
|
#include "settings/nimsnippetprovider.h"
|
||||||
|
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
@@ -71,7 +72,6 @@ bool NimPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
addAutoReleasedObject(new NimSettings);
|
addAutoReleasedObject(new NimSettings);
|
||||||
addAutoReleasedObject(new NimSnippetProvider);
|
addAutoReleasedObject(new NimSnippetProvider);
|
||||||
addAutoReleasedObject(new NimEditorFactory);
|
addAutoReleasedObject(new NimEditorFactory);
|
||||||
addAutoReleasedObject(new NimProjectManager);
|
|
||||||
addAutoReleasedObject(new NimBuildConfigurationFactory);
|
addAutoReleasedObject(new NimBuildConfigurationFactory);
|
||||||
addAutoReleasedObject(new NimRunConfigurationFactory);
|
addAutoReleasedObject(new NimRunConfigurationFactory);
|
||||||
addAutoReleasedObject(new NimCompilerBuildStepFactory);
|
addAutoReleasedObject(new NimCompilerBuildStepFactory);
|
||||||
@@ -81,6 +81,8 @@ bool NimPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
addAutoReleasedObject(new NimCodeStylePreferencesFactory);
|
addAutoReleasedObject(new NimCodeStylePreferencesFactory);
|
||||||
addAutoReleasedObject(new NimToolChainFactory);
|
addAutoReleasedObject(new NimToolChainFactory);
|
||||||
|
|
||||||
|
ProjectExplorer::ProjectManager::registerProjectType<NimProject>(Constants::C_NIM_PROJECT_MIMETYPE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "nimproject.h"
|
#include "nimproject.h"
|
||||||
#include "nimbuildconfiguration.h"
|
#include "nimbuildconfiguration.h"
|
||||||
#include "nimprojectnode.h"
|
#include "nimprojectnode.h"
|
||||||
#include "nimprojectmanager.h"
|
|
||||||
#include "nimtoolchain.h"
|
#include "nimtoolchain.h"
|
||||||
|
|
||||||
#include "../nimconstants.h"
|
#include "../nimconstants.h"
|
||||||
@@ -54,12 +53,12 @@ namespace Nim {
|
|||||||
|
|
||||||
const int MIN_TIME_BETWEEN_PROJECT_SCANS = 4500;
|
const int MIN_TIME_BETWEEN_PROJECT_SCANS = 4500;
|
||||||
|
|
||||||
NimProject::NimProject(const QString &fileName)
|
NimProject::NimProject(const FileName &fileName)
|
||||||
{
|
{
|
||||||
setId(Constants::C_NIMPROJECT_ID);
|
setId(Constants::C_NIMPROJECT_ID);
|
||||||
setDocument(new TextEditor::TextDocument);
|
setDocument(new TextEditor::TextDocument);
|
||||||
document()->setFilePath(FileName::fromString(fileName));
|
document()->setFilePath(fileName);
|
||||||
QFileInfo fi = QFileInfo(fileName);
|
QFileInfo fi = fileName.toFileInfo();
|
||||||
QDir dir = fi.dir();
|
QDir dir = fi.dir();
|
||||||
setRootProjectNode(new NimProjectNode(*this, FileName::fromString(dir.absolutePath())));
|
setRootProjectNode(new NimProjectNode(*this, FileName::fromString(dir.absolutePath())));
|
||||||
rootProjectNode()->setDisplayName(dir.dirName());
|
rootProjectNode()->setDisplayName(dir.dirName());
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class NimProject : public ProjectExplorer::Project
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NimProject(const QString &fileName);
|
explicit NimProject(const Utils::FileName &fileName);
|
||||||
|
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
QStringList files(FilesMode) const override;
|
QStringList files(FilesMode) const override;
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
|
||||||
** Contact: http://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 "nimprojectmanager.h"
|
|
||||||
#include "nimproject.h"
|
|
||||||
|
|
||||||
#include "../nimconstants.h"
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
|
|
||||||
namespace Nim {
|
|
||||||
|
|
||||||
QString NimProjectManager::mimeType() const
|
|
||||||
{
|
|
||||||
return QLatin1String(Constants::C_NIM_PROJECT_MIMETYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Project *NimProjectManager::openProject(const QString &fileName)
|
|
||||||
{
|
|
||||||
return new NimProject(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
|
||||||
** Contact: http://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 Nim {
|
|
||||||
|
|
||||||
class NimProjectManager : public ProjectExplorer::IProjectManager
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
QString mimeType() const override;
|
|
||||||
|
|
||||||
ProjectExplorer::Project *openProject(const QString &fileName) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -26,10 +26,10 @@
|
|||||||
#include "jsonkitspage.h"
|
#include "jsonkitspage.h"
|
||||||
#include "jsonwizard.h"
|
#include "jsonwizard.h"
|
||||||
|
|
||||||
#include "../iprojectmanager.h"
|
|
||||||
#include "../kit.h"
|
#include "../kit.h"
|
||||||
#include "../project.h"
|
#include "../project.h"
|
||||||
#include "../projectexplorer.h"
|
#include "../projectexplorer.h"
|
||||||
|
#include "../projectmanager.h"
|
||||||
|
|
||||||
#include <coreplugin/featureprovider.h>
|
#include <coreplugin/featureprovider.h>
|
||||||
|
|
||||||
@@ -102,19 +102,16 @@ void JsonKitsPage::setPreferredFeatures(const QVariant &data)
|
|||||||
|
|
||||||
void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files)
|
void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files)
|
||||||
{
|
{
|
||||||
Project *project = nullptr;
|
|
||||||
|
|
||||||
for (const JsonWizard::GeneratorFile &f : files) {
|
for (const JsonWizard::GeneratorFile &f : files) {
|
||||||
if (f.file.attributes() & GeneratedFile::OpenProjectAttribute) {
|
if (f.file.attributes() & GeneratedFile::OpenProjectAttribute) {
|
||||||
const QFileInfo fi(f.file.path());
|
const QFileInfo fi(f.file.path());
|
||||||
const QString path = fi.absoluteFilePath();
|
const QString path = fi.absoluteFilePath();
|
||||||
IProjectManager *manager = IProjectManager::managerForMimeType(Utils::mimeTypeForFile(fi));
|
Project *project = ProjectManager::openProject(Utils::mimeTypeForFile(fi),
|
||||||
project = manager ? manager->openProject(path) : nullptr;
|
Utils::FileName::fromString(path));
|
||||||
if (project) {
|
if (project) {
|
||||||
if (setupProject(project))
|
if (setupProject(project))
|
||||||
project->saveSettings();
|
project->saveSettings();
|
||||||
delete project;
|
delete project;
|
||||||
project = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "jsonwizardscannergenerator.h"
|
#include "jsonwizardscannergenerator.h"
|
||||||
|
|
||||||
#include "../projectexplorer.h"
|
#include "../projectexplorer.h"
|
||||||
#include "../iprojectmanager.h"
|
#include "../projectmanager.h"
|
||||||
#include "jsonwizard.h"
|
#include "jsonwizard.h"
|
||||||
#include "jsonwizardfactory.h"
|
#include "jsonwizardfactory.h"
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ Core::GeneratedFiles JsonWizardScannerGenerator::fileList(Utils::MacroExpander *
|
|||||||
for (auto it = result.begin(); it != result.end(); ++it) {
|
for (auto it = result.begin(); it != result.end(); ++it) {
|
||||||
const QString relPath = project.relativeFilePath(it->path());
|
const QString relPath = project.relativeFilePath(it->path());
|
||||||
it->setBinary(binaryPattern.match(relPath).hasMatch());
|
it->setBinary(binaryPattern.match(relPath).hasMatch());
|
||||||
bool found = IProjectManager::managerForMimeType(Utils::mimeTypeForFile(relPath));
|
bool found = ProjectManager::canOpenProjectForMimeType(Utils::mimeTypeForFile(relPath));
|
||||||
if (found && !(onlyFirst && projectCount++))
|
if (found && !(onlyFirst && projectCount++))
|
||||||
it->setAttributes(it->attributes() | Core::GeneratedFile::OpenProjectAttribute);
|
it->setAttributes(it->attributes() | Core::GeneratedFile::OpenProjectAttribute);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectexplorersettings.h"
|
#include "projectexplorersettings.h"
|
||||||
#include "projectexplorersettingspage.h"
|
#include "projectexplorersettingspage.h"
|
||||||
|
#include "projectmanager.h"
|
||||||
#include "removetaskhandler.h"
|
#include "removetaskhandler.h"
|
||||||
#include "kitfeatureprovider.h"
|
#include "kitfeatureprovider.h"
|
||||||
#include "kitmanager.h"
|
#include "kitmanager.h"
|
||||||
@@ -62,11 +63,11 @@
|
|||||||
#include "codestylesettingspropertiespage.h"
|
#include "codestylesettingspropertiespage.h"
|
||||||
#include "dependenciespanel.h"
|
#include "dependenciespanel.h"
|
||||||
#include "foldernavigationwidget.h"
|
#include "foldernavigationwidget.h"
|
||||||
#include "iprojectmanager.h"
|
|
||||||
#include "appoutputpane.h"
|
#include "appoutputpane.h"
|
||||||
#include "processstep.h"
|
#include "processstep.h"
|
||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
#include "projectfilewizardextension.h"
|
#include "projectfilewizardextension.h"
|
||||||
|
#include "projectmanager.h"
|
||||||
#include "projecttreewidget.h"
|
#include "projecttreewidget.h"
|
||||||
#include "projectwindow.h"
|
#include "projectwindow.h"
|
||||||
#include "runsettingspropertiespage.h"
|
#include "runsettingspropertiespage.h"
|
||||||
@@ -340,7 +341,7 @@ public:
|
|||||||
QStringList m_profileMimeTypes;
|
QStringList m_profileMimeTypes;
|
||||||
AppOutputPane *m_outputPane = nullptr;
|
AppOutputPane *m_outputPane = nullptr;
|
||||||
|
|
||||||
Utils::ObjectPool<IProjectManager> m_projectManagers;
|
QHash<QString, std::function<Project *(const Utils::FileName &)>> m_projectCreators;
|
||||||
QList<QPair<QString, QString> > m_recentProjects; // pair of filename, displayname
|
QList<QPair<QString, QString> > m_recentProjects; // pair of filename, displayname
|
||||||
static const int m_maxRecentProjects = 25;
|
static const int m_maxRecentProjects = 25;
|
||||||
|
|
||||||
@@ -1472,15 +1473,13 @@ void ProjectExplorerPlugin::extensionsInitialized()
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory->addMimeType(QStringLiteral("inode/directory"));
|
factory->addMimeType(QStringLiteral("inode/directory"));
|
||||||
dd->m_projectManagers.forEachObject([&](IProjectManager *manager) {
|
for (const QString &mimeType : dd->m_projectCreators.keys()) {
|
||||||
const QString mimeType = manager->mimeType();
|
|
||||||
factory->addMimeType(mimeType);
|
factory->addMimeType(mimeType);
|
||||||
Utils::MimeType mime = Utils::mimeTypeForName(mimeType);
|
Utils::MimeType mime = Utils::mimeTypeForName(mimeType);
|
||||||
allGlobPatterns.append(mime.globPatterns());
|
allGlobPatterns.append(mime.globPatterns());
|
||||||
filterStrings.append(mime.filterString());
|
filterStrings.append(mime.filterString());
|
||||||
|
|
||||||
dd->m_profileMimeTypes += mimeType;
|
dd->m_profileMimeTypes += mimeType;
|
||||||
});
|
}
|
||||||
|
|
||||||
addAutoReleasedObject(factory);
|
addAutoReleasedObject(factory);
|
||||||
|
|
||||||
@@ -1693,11 +1692,11 @@ ProjectExplorerPlugin::OpenProjectResult ProjectExplorerPlugin::openProjects(con
|
|||||||
|
|
||||||
Utils::MimeType mt = Utils::mimeTypeForFile(fileName);
|
Utils::MimeType mt = Utils::mimeTypeForFile(fileName);
|
||||||
if (mt.isValid()) {
|
if (mt.isValid()) {
|
||||||
if (IProjectManager *manager = IProjectManager::managerForMimeType(mt)) {
|
if (ProjectManager::canOpenProjectForMimeType(mt)) {
|
||||||
if (!QFileInfo(filePath).isFile()) {
|
if (!QFileInfo(filePath).isFile()) {
|
||||||
appendError(errorString,
|
appendError(errorString,
|
||||||
tr("Failed opening project \"%1\": Project is not a file").arg(fileName));
|
tr("Failed opening project \"%1\": Project is not a file").arg(fileName));
|
||||||
} else if (Project *pro = manager->openProject(filePath)) {
|
} else if (Project *pro = ProjectManager::openProject(mt, Utils::FileName::fromString(filePath))) {
|
||||||
QObject::connect(pro, &Project::parsingFinished, [pro]() {
|
QObject::connect(pro, &Project::parsingFinished, [pro]() {
|
||||||
emit SessionManager::instance()->projectFinishedParsing(pro);
|
emit SessionManager::instance()->projectFinishedParsing(pro);
|
||||||
});
|
});
|
||||||
@@ -1785,8 +1784,8 @@ void ProjectExplorerPluginPrivate::determineSessionToRestoreAtStartup()
|
|||||||
QStringList ProjectExplorerPlugin::projectFileGlobs()
|
QStringList ProjectExplorerPlugin::projectFileGlobs()
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
foreach (const IProjectManager *ipm, ExtensionSystem::PluginManager::getObjects<IProjectManager>()) {
|
for (const QString &mt : dd->m_projectCreators.keys()) {
|
||||||
Utils::MimeType mimeType = Utils::mimeTypeForName(ipm->mimeType());
|
Utils::MimeType mimeType = Utils::mimeTypeForName(mt);
|
||||||
if (mimeType.isValid()) {
|
if (mimeType.isValid()) {
|
||||||
const QStringList patterns = mimeType.globPatterns();
|
const QStringList patterns = mimeType.globPatterns();
|
||||||
if (!patterns.isEmpty())
|
if (!patterns.isEmpty())
|
||||||
@@ -3386,11 +3385,11 @@ ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings()
|
|||||||
QStringList ProjectExplorerPlugin::projectFilePatterns()
|
QStringList ProjectExplorerPlugin::projectFilePatterns()
|
||||||
{
|
{
|
||||||
QStringList patterns;
|
QStringList patterns;
|
||||||
dd->m_projectManagers.forEachObject([&](IProjectManager *pm) {
|
for (const QString &mime : dd->m_projectCreators.keys()) {
|
||||||
Utils::MimeType mt = Utils::mimeTypeForName(pm->mimeType());
|
Utils::MimeType mt = Utils::mimeTypeForName(mime);
|
||||||
if (mt.isValid())
|
if (mt.isValid())
|
||||||
patterns.append(mt.globPatterns());
|
patterns.append(mt.globPatterns());
|
||||||
});
|
}
|
||||||
return patterns;
|
return patterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3407,17 +3406,32 @@ QList<QPair<QString, QString> > ProjectExplorerPlugin::recentProjects()
|
|||||||
return dd->recentProjects();
|
return dd->recentProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
IProjectManager::IProjectManager()
|
void ProjectManager::registerProjectCreator(const QString &mimeType,
|
||||||
|
const std::function<Project *(const Utils::FileName &)> &creator)
|
||||||
{
|
{
|
||||||
dd->m_projectManagers.addObject(this);
|
dd->m_projectCreators[mimeType] = creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
IProjectManager *IProjectManager::managerForMimeType(const Utils::MimeType &mt)
|
Project *ProjectManager::openProject(const Utils::MimeType &mt, const Utils::FileName &fileName)
|
||||||
{
|
{
|
||||||
if (!mt.isValid())
|
if (mt.isValid()) {
|
||||||
return nullptr;
|
for (const QString &mimeType : dd->m_projectCreators.keys()) {
|
||||||
auto pred = [mt](IProjectManager *m) { return mt.matchesName(m->mimeType()); };
|
if (mt.matchesName(mimeType))
|
||||||
return dd->m_projectManagers.findObject(pred);
|
return dd->m_projectCreators[mimeType](fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProjectManager::canOpenProjectForMimeType(const Utils::MimeType &mt)
|
||||||
|
{
|
||||||
|
if (mt.isValid()) {
|
||||||
|
for (const QString &mimeType : dd->m_projectCreators.keys()) {
|
||||||
|
if (mt.matchesName(mimeType))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ HEADERS += projectexplorer.h \
|
|||||||
projectexplorerconstants.h \
|
projectexplorerconstants.h \
|
||||||
projectexplorersettings.h \
|
projectexplorersettings.h \
|
||||||
project.h \
|
project.h \
|
||||||
iprojectmanager.h \
|
projectmanager.h \
|
||||||
currentprojectfilter.h \
|
currentprojectfilter.h \
|
||||||
allprojectsfind.h \
|
allprojectsfind.h \
|
||||||
buildstep.h \
|
buildstep.h \
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ Project {
|
|||||||
"importwidget.cpp", "importwidget.h",
|
"importwidget.cpp", "importwidget.h",
|
||||||
"ioutputparser.cpp", "ioutputparser.h",
|
"ioutputparser.cpp", "ioutputparser.h",
|
||||||
"ipotentialkit.h",
|
"ipotentialkit.h",
|
||||||
"iprojectmanager.h",
|
|
||||||
"itaskhandler.h",
|
"itaskhandler.h",
|
||||||
"kit.cpp", "kit.h",
|
"kit.cpp", "kit.h",
|
||||||
"kitchooser.cpp", "kitchooser.h",
|
"kitchooser.cpp", "kitchooser.h",
|
||||||
@@ -117,6 +116,7 @@ Project {
|
|||||||
"projectfilewizardextension.cpp", "projectfilewizardextension.h",
|
"projectfilewizardextension.cpp", "projectfilewizardextension.h",
|
||||||
"projectimporter.cpp", "projectimporter.h",
|
"projectimporter.cpp", "projectimporter.h",
|
||||||
"projectmacroexpander.cpp", "projectmacroexpander.h",
|
"projectmacroexpander.cpp", "projectmacroexpander.h",
|
||||||
|
"projectmanager.h",
|
||||||
"projectmodels.cpp", "projectmodels.h",
|
"projectmodels.cpp", "projectmodels.h",
|
||||||
"projectnodes.cpp", "projectnodes.h",
|
"projectnodes.cpp", "projectnodes.h",
|
||||||
"projectpanelfactory.cpp", "projectpanelfactory.h",
|
"projectpanelfactory.cpp", "projectpanelfactory.h",
|
||||||
|
|||||||
+18
-12
@@ -27,26 +27,32 @@
|
|||||||
|
|
||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
#include <QObject>
|
namespace Utils {
|
||||||
|
class FileName;
|
||||||
namespace Utils { class MimeType; }
|
class MimeType;
|
||||||
|
} // Utils
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class Project;
|
class Project;
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IProjectManager : public QObject
|
class PROJECTEXPLORER_EXPORT ProjectManager
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IProjectManager();
|
static bool canOpenProjectForMimeType(const Utils::MimeType &mt);
|
||||||
// Finds a IProjectManager matching the passed MimeType.
|
static Project *openProject(const Utils::MimeType &mt, const Utils::FileName &fileName);
|
||||||
static IProjectManager *managerForMimeType(const Utils::MimeType &mt);
|
|
||||||
|
|
||||||
virtual QString mimeType() const = 0;
|
template <typename T>
|
||||||
// FileName is a canonical path of a checked-to-exist file.
|
static void registerProjectType(const QString &mimeType)
|
||||||
virtual Project *openProject(const QString &fileName) = 0;
|
{
|
||||||
|
ProjectManager::registerProjectCreator(mimeType, [](const Utils::FileName &fileName) {
|
||||||
|
return new T(fileName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void registerProjectCreator(const QString &mimeType,
|
||||||
|
const std::function<Project *(const Utils::FileName &)> &);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
@@ -43,10 +43,10 @@
|
|||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <projectexplorer/runconfigurationaspects.h>
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
|
#include <projectexplorer/projectnodes.h>
|
||||||
#include <projectexplorer/runnables.h>
|
#include <projectexplorer/runnables.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/iprojectmanager.h>
|
|
||||||
#include <projectexplorer/projectnodes.h>
|
|
||||||
|
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
|
||||||
@@ -77,7 +77,6 @@ const char PythonProjectContext[] = "PythonProjectContext";
|
|||||||
|
|
||||||
class PythonRunConfiguration;
|
class PythonRunConfiguration;
|
||||||
class PythonProjectFile;
|
class PythonProjectFile;
|
||||||
class PythonProject;
|
|
||||||
|
|
||||||
static QString scriptFromId(Core::Id id)
|
static QString scriptFromId(Core::Id id)
|
||||||
{
|
{
|
||||||
@@ -92,7 +91,7 @@ static Core::Id idFromScript(const QString &target)
|
|||||||
class PythonProject : public Project
|
class PythonProject : public Project
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PythonProject(const QString &filename);
|
explicit PythonProject(const Utils::FileName &filename);
|
||||||
|
|
||||||
QString displayName() const override { return m_projectName; }
|
QString displayName() const override { return m_projectName; }
|
||||||
|
|
||||||
@@ -123,11 +122,11 @@ private:
|
|||||||
class PythonProjectFile : public Core::IDocument
|
class PythonProjectFile : public Core::IDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PythonProjectFile(PythonProject *parent, QString fileName) : m_project(parent)
|
PythonProjectFile(PythonProject *parent, const FileName &fileName) : m_project(parent)
|
||||||
{
|
{
|
||||||
setId("Generic.ProjectFile");
|
setId("Generic.ProjectFile");
|
||||||
setMimeType(PythonMimeType);
|
setMimeType(PythonMimeType);
|
||||||
setFilePath(FileName::fromString(fileName));
|
setFilePath(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override
|
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override
|
||||||
@@ -350,13 +349,6 @@ PythonRunConfigurationWidget::PythonRunConfigurationWidget(PythonRunConfiguratio
|
|||||||
setEnabled(runConfiguration->isEnabled());
|
setEnabled(runConfiguration->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
class PythonProjectManager : public IProjectManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QString mimeType() const override { return QLatin1String(PythonMimeType); }
|
|
||||||
Project *openProject(const QString &fileName) override { return new PythonProject(fileName); }
|
|
||||||
};
|
|
||||||
|
|
||||||
class PythonRunConfigurationFactory : public IRunConfigurationFactory
|
class PythonRunConfigurationFactory : public IRunConfigurationFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -427,7 +419,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PythonProject::PythonProject(const QString &fileName)
|
PythonProject::PythonProject(const FileName &fileName)
|
||||||
{
|
{
|
||||||
setId(PythonProjectId);
|
setId(PythonProjectId);
|
||||||
setDocument(new PythonProjectFile(this, fileName));
|
setDocument(new PythonProjectFile(this, fileName));
|
||||||
@@ -858,7 +850,8 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
|
|||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
addAutoReleasedObject(new PythonProjectManager);
|
ProjectManager::registerProjectType<PythonProject>(PythonMimeType);
|
||||||
|
|
||||||
addAutoReleasedObject(new PythonEditorFactory);
|
addAutoReleasedObject(new PythonEditorFactory);
|
||||||
addAutoReleasedObject(new PythonRunConfigurationFactory);
|
addAutoReleasedObject(new PythonRunConfigurationFactory);
|
||||||
addAutoReleasedObject(new PythonRunControlFactory);
|
addAutoReleasedObject(new PythonRunControlFactory);
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ private:
|
|||||||
// QbsProject:
|
// QbsProject:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsProject::QbsProject(const QString &fileName) :
|
QbsProject::QbsProject(const FileName &fileName) :
|
||||||
m_projectName(QFileInfo(fileName).completeBaseName()),
|
m_projectName(fileName.toFileInfo().completeBaseName()),
|
||||||
m_qbsProjectParser(0),
|
m_qbsProjectParser(0),
|
||||||
m_qbsUpdateFutureInterface(0),
|
m_qbsUpdateFutureInterface(0),
|
||||||
m_parsingScheduled(false),
|
m_parsingScheduled(false),
|
||||||
@@ -766,7 +766,7 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
|
|||||||
}
|
}
|
||||||
QSet<IDocument *> toAdd;
|
QSet<IDocument *> toAdd;
|
||||||
foreach (const QString &f, filesToAdd)
|
foreach (const QString &f, filesToAdd)
|
||||||
toAdd.insert(new QbsProjectFile(this, f));
|
toAdd.insert(new QbsProjectFile(this, FileName::fromString(f)));
|
||||||
|
|
||||||
DocumentManager::addDocuments(toAdd.toList());
|
DocumentManager::addDocuments(toAdd.toList());
|
||||||
m_qbsDocuments.unite(toAdd);
|
m_qbsDocuments.unite(toAdd);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class QbsProject : public ProjectExplorer::Project
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsProject(const QString &filename);
|
explicit QbsProject(const Utils::FileName &filename);
|
||||||
~QbsProject() override;
|
~QbsProject() override;
|
||||||
|
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|||||||
@@ -31,12 +31,12 @@
|
|||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QbsProjectFile::QbsProjectFile(QbsProject *parent, QString fileName) : Core::IDocument(parent),
|
QbsProjectFile::QbsProjectFile(QbsProject *parent, const Utils::FileName &fileName) : Core::IDocument(parent),
|
||||||
m_project(parent)
|
m_project(parent)
|
||||||
{
|
{
|
||||||
setId("Qbs.ProjectFile");
|
setId("Qbs.ProjectFile");
|
||||||
setMimeType(QLatin1String(Constants::MIME_TYPE));
|
setMimeType(Constants::MIME_TYPE);
|
||||||
setFilePath(Utils::FileName::fromString(fileName));
|
setFilePath(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IDocument::ReloadBehavior QbsProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
Core::IDocument::ReloadBehavior QbsProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class QbsProject;
|
|||||||
class QbsProjectFile : public Core::IDocument
|
class QbsProjectFile : public Core::IDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QbsProjectFile(QbsProject *parent, QString fileName);
|
QbsProjectFile(QbsProject *parent, const Utils::FileName &fileName);
|
||||||
|
|
||||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||||
|
|||||||
@@ -100,16 +100,6 @@ QbsManager::~QbsManager()
|
|||||||
m_instance = nullptr;
|
m_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsManager::mimeType() const
|
|
||||||
{
|
|
||||||
return QLatin1String(QmlJSTools::Constants::QBS_MIMETYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::Project *QbsManager::openProject(const QString &fileName)
|
|
||||||
{
|
|
||||||
return new QbsProject(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QbsManager::profileForKit(const ProjectExplorer::Kit *k)
|
QString QbsManager::profileForKit(const ProjectExplorer::Kit *k)
|
||||||
{
|
{
|
||||||
if (!k)
|
if (!k)
|
||||||
|
|||||||
@@ -27,8 +27,6 @@
|
|||||||
|
|
||||||
#include "qbsprojectmanager_global.h"
|
#include "qbsprojectmanager_global.h"
|
||||||
|
|
||||||
#include <projectexplorer/iprojectmanager.h>
|
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
@@ -45,7 +43,7 @@ namespace Internal {
|
|||||||
class DefaultPropertyProvider;
|
class DefaultPropertyProvider;
|
||||||
class QbsLogSink;
|
class QbsLogSink;
|
||||||
|
|
||||||
class QbsManager : public ProjectExplorer::IProjectManager
|
class QbsManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -53,9 +51,6 @@ public:
|
|||||||
QbsManager();
|
QbsManager();
|
||||||
~QbsManager();
|
~QbsManager();
|
||||||
|
|
||||||
QString mimeType() const override;
|
|
||||||
ProjectExplorer::Project *openProject(const QString &fileName) override;
|
|
||||||
|
|
||||||
// QBS profiles management:
|
// QBS profiles management:
|
||||||
static QString profileForKit(const ProjectExplorer::Kit *k);
|
static QString profileForKit(const ProjectExplorer::Kit *k);
|
||||||
void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k);
|
void setProfileForKit(const QString &name, const ProjectExplorer::Kit *k);
|
||||||
|
|||||||
@@ -46,14 +46,18 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildmanager.h>
|
#include <projectexplorer/buildmanager.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projecttree.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
|
#include <projectexplorer/projecttree.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -87,6 +91,8 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
|||||||
|
|
||||||
Core::FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QT, "qbs");
|
Core::FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QT, "qbs");
|
||||||
|
|
||||||
|
ProjectManager::registerProjectType<QbsProject>(QmlJSTools::Constants::QBS_MIMETYPE);
|
||||||
|
|
||||||
//create and register objects
|
//create and register objects
|
||||||
addAutoReleasedObject(new QbsManager);
|
addAutoReleasedObject(new QbsManager);
|
||||||
addAutoReleasedObject(new QbsBuildConfigurationFactory);
|
addAutoReleasedObject(new QbsBuildConfigurationFactory);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Internal {
|
|||||||
class QmakeProjectFile : public Core::IDocument
|
class QmakeProjectFile : public Core::IDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmakeProjectFile(const QString &filePath);
|
explicit QmakeProjectFile(const FileName &fileName);
|
||||||
|
|
||||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||||
@@ -158,11 +158,11 @@ QDebug operator<<(QDebug d, const QmakeProjectFiles &f)
|
|||||||
|
|
||||||
// ----------- QmakeProjectFile
|
// ----------- QmakeProjectFile
|
||||||
|
|
||||||
QmakeProjectFile::QmakeProjectFile(const QString &filePath)
|
QmakeProjectFile::QmakeProjectFile(const FileName &fileName)
|
||||||
{
|
{
|
||||||
setId("Qmake.ProFile");
|
setId("Qmake.ProFile");
|
||||||
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
|
setMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
|
||||||
setFilePath(FileName::fromString(filePath));
|
setFilePath(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IDocument::ReloadBehavior QmakeProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
Core::IDocument::ReloadBehavior QmakeProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||||
@@ -190,7 +190,7 @@ static QList<QmakeProject *> s_projects;
|
|||||||
QmakeProject manages information about an individual Qt 4 (.pro) project file.
|
QmakeProject manages information about an individual Qt 4 (.pro) project file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QmakeProject::QmakeProject(const QString &fileName) :
|
QmakeProject::QmakeProject(const FileName &fileName) :
|
||||||
m_projectFiles(new QmakeProjectFiles),
|
m_projectFiles(new QmakeProjectFiles),
|
||||||
m_qmakeVfs(new QMakeVfs),
|
m_qmakeVfs(new QMakeVfs),
|
||||||
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeProject : public ProjectExplorer::Project
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmakeProject(const QString &proFile);
|
explicit QmakeProject(const Utils::FileName &proFile);
|
||||||
~QmakeProject() final;
|
~QmakeProject() final;
|
||||||
|
|
||||||
QmakeProFile *rootProFile() const;
|
QmakeProFile *rootProFile() const;
|
||||||
|
|||||||
@@ -53,16 +53,6 @@ using namespace TextEditor;
|
|||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
|
|
||||||
QString QmakeManager::mimeType() const
|
|
||||||
{
|
|
||||||
return QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::Project *QmakeManager::openProject(const QString &fileName)
|
|
||||||
{
|
|
||||||
return new QmakeProject(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
Node *QmakeManager::contextNode()
|
Node *QmakeManager::contextNode()
|
||||||
{
|
{
|
||||||
return ProjectTree::currentNode();
|
return ProjectTree::currentNode();
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "qmakeprojectmanager_global.h"
|
#include "qmakeprojectmanager_global.h"
|
||||||
|
|
||||||
#include <projectexplorer/iprojectmanager.h>
|
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
|
|
||||||
namespace Core { class IEditor; }
|
namespace Core { class IEditor; }
|
||||||
@@ -41,14 +40,12 @@ class ToolChain;
|
|||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
|
|
||||||
class QMAKEPROJECTMANAGER_EXPORT QmakeManager : public ProjectExplorer::IProjectManager
|
class QMAKEPROJECTMANAGER_EXPORT QmakeManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void notifyChanged(const Utils::FileName &name);
|
void notifyChanged(const Utils::FileName &name);
|
||||||
QString mimeType() const override;
|
|
||||||
ProjectExplorer::Project *openProject(const QString &fileName) override;
|
|
||||||
|
|
||||||
// Context information used in the slot implementations
|
// Context information used in the slot implementations
|
||||||
static ProjectExplorer::Node *contextNode();
|
static ProjectExplorer::Node *contextNode();
|
||||||
|
|||||||
@@ -45,18 +45,22 @@
|
|||||||
#include "profilehighlighter.h"
|
#include "profilehighlighter.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/buildmanager.h>
|
|
||||||
#include <projectexplorer/session.h>
|
|
||||||
#include <projectexplorer/projecttree.h>
|
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/buildmanager.h>
|
||||||
|
#include <projectexplorer/session.h>
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
|
#include <projectexplorer/projecttree.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <texteditor/texteditoractionhandler.h>
|
#include <texteditor/texteditoractionhandler.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
|
|
||||||
@@ -82,6 +86,8 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
|||||||
m_qmakeProjectManager = new QmakeManager;
|
m_qmakeProjectManager = new QmakeManager;
|
||||||
addAutoReleasedObject(m_qmakeProjectManager);
|
addAutoReleasedObject(m_qmakeProjectManager);
|
||||||
|
|
||||||
|
ProjectManager::registerProjectType<QmakeProject>(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
|
||||||
|
|
||||||
ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation);
|
ProjectExplorer::KitManager::registerKitInformation(new QmakeKitInformation);
|
||||||
|
|
||||||
IWizardFactory::registerFactoryCreator([] {
|
IWizardFactory::registerFactoryCreator([] {
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ bool BaseQmakeProjectWizardDialog::writeUserFile(const QString &proFileName) con
|
|||||||
if (!m_targetSetupPage)
|
if (!m_targetSetupPage)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QmakeProject *pro = new QmakeProject(proFileName);
|
QmakeProject *pro = new QmakeProject(Utils::FileName::fromString(proFileName));
|
||||||
bool success = m_targetSetupPage->setupProject(pro);
|
bool success = m_targetSetupPage->setupProject(pro);
|
||||||
if (success)
|
if (success)
|
||||||
pro->saveSettings();
|
pro->saveSettings();
|
||||||
|
|||||||
@@ -30,19 +30,20 @@
|
|||||||
#include "qmlprojectrunconfiguration.h"
|
#include "qmlprojectrunconfiguration.h"
|
||||||
#include "qmlprojectconstants.h"
|
#include "qmlprojectconstants.h"
|
||||||
#include "qmlprojectnodes.h"
|
#include "qmlprojectnodes.h"
|
||||||
#include "qmlprojectmanager.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <qtsupport/baseqtversion.h>
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
|
#include <qtsupport/baseqtversion.h>
|
||||||
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
|
|
||||||
#include <utils/algorithm.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 \
|
HEADERS += qmlproject.h \
|
||||||
qmlprojectenvironmentaspect.h \
|
qmlprojectenvironmentaspect.h \
|
||||||
qmlprojectplugin.h \
|
qmlprojectplugin.h \
|
||||||
qmlprojectmanager.h \
|
|
||||||
qmlprojectconstants.h \
|
qmlprojectconstants.h \
|
||||||
qmlprojectnodes.h \
|
qmlprojectnodes.h \
|
||||||
qmlprojectfile.h \
|
qmlprojectfile.h \
|
||||||
@@ -20,7 +19,6 @@ HEADERS += qmlproject.h \
|
|||||||
SOURCES += qmlproject.cpp \
|
SOURCES += qmlproject.cpp \
|
||||||
qmlprojectenvironmentaspect.cpp \
|
qmlprojectenvironmentaspect.cpp \
|
||||||
qmlprojectplugin.cpp \
|
qmlprojectplugin.cpp \
|
||||||
qmlprojectmanager.cpp \
|
|
||||||
qmlprojectnodes.cpp \
|
qmlprojectnodes.cpp \
|
||||||
qmlprojectfile.cpp \
|
qmlprojectfile.cpp \
|
||||||
qmlprojectrunconfiguration.cpp \
|
qmlprojectrunconfiguration.cpp \
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ QtcPlugin {
|
|||||||
"qmlprojectconstants.h",
|
"qmlprojectconstants.h",
|
||||||
"qmlprojectenvironmentaspect.cpp", "qmlprojectenvironmentaspect.h",
|
"qmlprojectenvironmentaspect.cpp", "qmlprojectenvironmentaspect.h",
|
||||||
"qmlprojectfile.cpp", "qmlprojectfile.h",
|
"qmlprojectfile.cpp", "qmlprojectfile.h",
|
||||||
"qmlprojectmanager.cpp", "qmlprojectmanager.h",
|
|
||||||
"qmlprojectmanager_global.h",
|
"qmlprojectmanager_global.h",
|
||||||
"qmlprojectmanagerconstants.h",
|
"qmlprojectmanagerconstants.h",
|
||||||
"qmlprojectnodes.cpp", "qmlprojectnodes.h",
|
"qmlprojectnodes.cpp", "qmlprojectnodes.h",
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlprojectplugin.h"
|
#include "qmlprojectplugin.h"
|
||||||
#include "qmlprojectmanager.h"
|
|
||||||
#include "qmlproject.h"
|
#include "qmlproject.h"
|
||||||
#include "qmlprojectrunconfigurationfactory.h"
|
#include "qmlprojectrunconfigurationfactory.h"
|
||||||
#include "fileformat/qmlprojectfileformat.h"
|
#include "fileformat/qmlprojectfileformat.h"
|
||||||
@@ -32,7 +31,9 @@
|
|||||||
#include <coreplugin/fileiconprovider.h>
|
#include <coreplugin/fileiconprovider.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <projectexplorer/projectmanager.h>
|
||||||
|
|
||||||
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
|
|
||||||
QmlProjectPlugin::QmlProjectPlugin()
|
QmlProjectPlugin::QmlProjectPlugin()
|
||||||
@@ -53,9 +56,9 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
addAutoReleasedObject(new Internal::Manager);
|
|
||||||
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
|
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
|
||||||
|
|
||||||
|
ProjectManager::registerProjectType<QmlProject>(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
|
||||||
Core::FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png", "qmlproject");
|
Core::FileIconProvider::registerIconOverlayForSuffix(":/qmlproject/images/qmlproject.png", "qmlproject");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user