forked from qt-creator/qt-creator
ProjectExplorer: Provide ProjectDocument and use it in all projects
Change-Id: I6e054ebf1043bd1f6748f1567f35c68394bd6528 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include "autotoolsbuildconfiguration.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
#include "autotoolsprojectnode.h"
|
||||
#include "autotoolsprojectfile.h"
|
||||
#include "autotoolsopenprojectwizard.h"
|
||||
#include "makestep.h"
|
||||
#include "makefileparserthread.h"
|
||||
@@ -73,7 +72,7 @@ AutotoolsProject::AutotoolsProject(const Utils::FileName &fileName) :
|
||||
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
{
|
||||
setId(Constants::AUTOTOOLS_PROJECT_ID);
|
||||
setDocument(new AutotoolsProjectFile(fileName));
|
||||
setDocument(new ProjectExplorer::ProjectDocument(Constants::MAKEFILE_MIMETYPE, fileName));
|
||||
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
|
||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
}
|
||||
|
@@ -1,43 +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 "autotoolsprojectfile.h"
|
||||
#include "autotoolsproject.h"
|
||||
#include "autotoolsprojectconstants.h"
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
AutotoolsProjectFile::AutotoolsProjectFile(const Utils::FileName &fileName)
|
||||
{
|
||||
setId("Autotools.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
} // 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 <coreplugin/idocument.h>
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
/**
|
||||
* @brief Implementation of the Core::IDocument interface.
|
||||
*
|
||||
* Is used in AutotoolsProject and describes the root
|
||||
* of a project. In the context of autotools the implementation
|
||||
* is mostly empty, as the modification of a project is
|
||||
* done by several Makefile.am files and the configure.ac file.
|
||||
*
|
||||
* @see AutotoolsProject
|
||||
*/
|
||||
class AutotoolsProjectFile : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
AutotoolsProjectFile(const Utils::FileName &fileName);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace AutotoolsProjectManager
|
@@ -2,7 +2,6 @@ include(../../qtcreatorplugin.pri)
|
||||
|
||||
HEADERS = autotoolsprojectplugin.h\
|
||||
autotoolsopenprojectwizard.h\
|
||||
autotoolsprojectfile.h\
|
||||
autotoolsprojectnode.h\
|
||||
autotoolsproject.h\
|
||||
autotoolsbuildsettingswidget.h\
|
||||
@@ -16,7 +15,6 @@ HEADERS = autotoolsprojectplugin.h\
|
||||
makefileparser.h
|
||||
SOURCES = autotoolsprojectplugin.cpp\
|
||||
autotoolsopenprojectwizard.cpp\
|
||||
autotoolsprojectfile.cpp\
|
||||
autotoolsprojectnode.cpp\
|
||||
autotoolsproject.cpp\
|
||||
autotoolsbuildsettingswidget.cpp\
|
||||
|
@@ -25,8 +25,6 @@ QtcPlugin {
|
||||
"autotoolsproject.cpp",
|
||||
"autotoolsproject.h",
|
||||
"autotoolsprojectconstants.h",
|
||||
"autotoolsprojectfile.cpp",
|
||||
"autotoolsprojectfile.h",
|
||||
"autotoolsprojectnode.cpp",
|
||||
"autotoolsprojectnode.h",
|
||||
"autotoolsprojectplugin.cpp",
|
||||
|
@@ -77,9 +77,7 @@ CMakeProject::CMakeProject(const FileName &fileName)
|
||||
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
{
|
||||
setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
|
||||
auto doc = new TextEditor::TextDocument;
|
||||
doc->setFilePath(fileName);
|
||||
setDocument(doc);
|
||||
setDocument(new ProjectDocument(CMakeProjectManager::Constants::CMAKEMIMETYPE, fileName));
|
||||
|
||||
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
|
||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
|
@@ -69,7 +69,8 @@ GenericProject::GenericProject(const Utils::FileName &fileName)
|
||||
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
{
|
||||
setId(Constants::GENERICPROJECT_ID);
|
||||
setDocument(new GenericProjectFile(this, fileName, GenericProject::Everything));
|
||||
setDocument(new ProjectDocument(Constants::GENERICMIMETYPE, fileName,
|
||||
[this]() { refresh(Everything); }));
|
||||
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
|
||||
@@ -82,14 +83,15 @@ GenericProject::GenericProject(const Utils::FileName &fileName)
|
||||
m_includesFileName = QFileInfo(dir, projectName + ".includes").absoluteFilePath();
|
||||
m_configFileName = QFileInfo(dir, projectName + ".config").absoluteFilePath();
|
||||
|
||||
m_filesIDocument = new GenericProjectFile(this, FileName::fromString(m_filesFileName), GenericProject::Files);
|
||||
m_includesIDocument = new GenericProjectFile(this, FileName::fromString(m_includesFileName), GenericProject::Configuration);
|
||||
m_configIDocument = new GenericProjectFile(this, FileName::fromString(m_configFileName), GenericProject::Configuration);
|
||||
|
||||
DocumentManager::addDocument(document());
|
||||
DocumentManager::addDocument(m_filesIDocument);
|
||||
DocumentManager::addDocument(m_includesIDocument);
|
||||
DocumentManager::addDocument(m_configIDocument);
|
||||
m_filesIDocument
|
||||
= new ProjectDocument(Constants::GENERICMIMETYPE, FileName::fromString(m_filesFileName),
|
||||
[this]() { refresh(Files); });
|
||||
m_includesIDocument
|
||||
= new ProjectDocument(Constants::GENERICMIMETYPE, FileName::fromString(m_includesFileName),
|
||||
[this]() { refresh(Configuration); });
|
||||
m_configIDocument
|
||||
= new ProjectDocument(Constants::GENERICMIMETYPE, FileName::fromString(m_configFileName),
|
||||
[this]() { refresh(Configuration); });
|
||||
}
|
||||
|
||||
GenericProject::~GenericProject()
|
||||
@@ -441,38 +443,5 @@ Project::RestoreResult GenericProject::fromMap(const QVariantMap &map, QString *
|
||||
return RestoreResult::Ok;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GenericProjectFile
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericProjectFile::GenericProjectFile(GenericProject *parent, const Utils::FileName &fileName,
|
||||
GenericProject::RefreshOptions options) :
|
||||
m_project(parent),
|
||||
m_options(options)
|
||||
{
|
||||
setId("Generic.ProjectFile");
|
||||
setMimeType(Constants::GENERICMIMETYPE);
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
IDocument::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
Q_UNUSED(type);
|
||||
return BehaviorSilent;
|
||||
}
|
||||
|
||||
bool GenericProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
Q_UNUSED(flag);
|
||||
if (type == TypePermissions)
|
||||
return true;
|
||||
m_project->refresh(m_options);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace GenericProjectManager
|
||||
|
@@ -41,8 +41,6 @@ namespace CppTools { class CppProjectUpdater; }
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class GenericProjectFile;
|
||||
|
||||
class GenericProject : public ProjectExplorer::Project
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -91,9 +89,9 @@ private:
|
||||
QString m_filesFileName;
|
||||
QString m_includesFileName;
|
||||
QString m_configFileName;
|
||||
GenericProjectFile *m_filesIDocument;
|
||||
GenericProjectFile *m_includesIDocument;
|
||||
GenericProjectFile *m_configIDocument;
|
||||
ProjectExplorer::ProjectDocument *m_filesIDocument;
|
||||
ProjectExplorer::ProjectDocument *m_includesIDocument;
|
||||
ProjectExplorer::ProjectDocument *m_configIDocument;
|
||||
QStringList m_rawFileList;
|
||||
QStringList m_files;
|
||||
QHash<QString, QString> m_rawListEntries;
|
||||
@@ -105,19 +103,5 @@ private:
|
||||
ProjectExplorer::Target *m_activeTarget = nullptr;
|
||||
};
|
||||
|
||||
class GenericProjectFile : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
GenericProjectFile(GenericProject *parent, const Utils::FileName &fileName,
|
||||
GenericProject::RefreshOptions options);
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||
|
||||
private:
|
||||
GenericProject *m_project;
|
||||
GenericProject::RefreshOptions m_options;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace GenericProjectManager
|
||||
|
@@ -57,9 +57,7 @@ const int MIN_TIME_BETWEEN_PROJECT_SCANS = 4500;
|
||||
NimProject::NimProject(const FileName &fileName)
|
||||
{
|
||||
setId(Constants::C_NIMPROJECT_ID);
|
||||
auto doc = new TextEditor::TextDocument;
|
||||
doc->setFilePath(fileName);
|
||||
setDocument(doc);
|
||||
setDocument(new ProjectDocument(Constants::C_NIM_MIMETYPE, fileName));
|
||||
|
||||
m_projectScanTimer.setSingleShot(true);
|
||||
connect(&m_projectScanTimer, &QTimer::timeout, this, &NimProject::collectProjectFiles);
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "settingsaccessor.h"
|
||||
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
@@ -84,6 +85,41 @@ const char PLUGIN_SETTINGS_KEY[] = "ProjectExplorer.Project.PluginSettings";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// ProjectDocument:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
ProjectDocument::ProjectDocument(const QString &mimeType, const Utils::FileName &fileName,
|
||||
const ProjectDocument::ProjectCallback &callback) :
|
||||
m_callback(callback)
|
||||
{
|
||||
setFilePath(fileName);
|
||||
setMimeType(mimeType);
|
||||
if (m_callback)
|
||||
Core::DocumentManager::addDocument(this);
|
||||
}
|
||||
|
||||
Core::IDocument::ReloadBehavior
|
||||
ProjectDocument::reloadBehavior(Core::IDocument::ChangeTrigger state,
|
||||
Core::IDocument::ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
Q_UNUSED(type);
|
||||
return BehaviorSilent;
|
||||
}
|
||||
|
||||
bool ProjectDocument::reload(QString *errorString, Core::IDocument::ReloadFlag flag,
|
||||
Core::IDocument::ChangeType type)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
Q_UNUSED(flag);
|
||||
Q_UNUSED(type);
|
||||
|
||||
if (m_callback)
|
||||
m_callback();
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Project
|
||||
// -------------------------------------------------------------------------
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "kit.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
@@ -38,11 +39,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace Core {
|
||||
class IDocument;
|
||||
class Context;
|
||||
}
|
||||
|
||||
namespace Core { class Context; }
|
||||
namespace Utils { class MacroExpander; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -58,6 +55,24 @@ class ProjectPrivate;
|
||||
class Session;
|
||||
class Target;
|
||||
|
||||
// Auto-registers with the DocumentManager if a callback is set!
|
||||
class PROJECTEXPLORER_EXPORT ProjectDocument : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
using ProjectCallback = std::function<void()>;
|
||||
|
||||
ProjectDocument(const QString &mimeType, const Utils::FileName &fileName,
|
||||
const ProjectCallback &callback = {});
|
||||
|
||||
Core::IDocument::ReloadBehavior reloadBehavior(Core::IDocument::ChangeTrigger state,
|
||||
Core::IDocument::ChangeType type) const final;
|
||||
bool reload(QString *errorString, Core::IDocument::ReloadFlag flag,
|
||||
Core::IDocument::ChangeType type) final;
|
||||
|
||||
private:
|
||||
ProjectCallback m_callback;
|
||||
};
|
||||
|
||||
// Documentation inside.
|
||||
class PROJECTEXPLORER_EXPORT Project : public QObject
|
||||
{
|
||||
|
@@ -116,37 +116,6 @@ private:
|
||||
QHash<QString, QString> m_rawListEntries;
|
||||
};
|
||||
|
||||
class PythonProjectFile : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
PythonProjectFile(PythonProject *parent, const FileName &fileName) : m_project(parent)
|
||||
{
|
||||
setId("Generic.ProjectFile");
|
||||
setMimeType(PythonMimeType);
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override
|
||||
{
|
||||
Q_UNUSED(state)
|
||||
Q_UNUSED(type)
|
||||
return BehaviorSilent;
|
||||
}
|
||||
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override
|
||||
{
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(flag)
|
||||
if (type == TypePermissions)
|
||||
return true;
|
||||
m_project->refresh();
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
PythonProject *m_project;
|
||||
};
|
||||
|
||||
class PythonProjectNode : public ProjectNode
|
||||
{
|
||||
public:
|
||||
@@ -409,8 +378,7 @@ private:
|
||||
PythonProject::PythonProject(const FileName &fileName)
|
||||
{
|
||||
setId(PythonProjectId);
|
||||
setDocument(new PythonProjectFile(this, fileName));
|
||||
DocumentManager::addDocument(document());
|
||||
setDocument(new ProjectDocument(Constants::C_PY_MIMETYPE, fileName, [this]() { refresh(); }));
|
||||
|
||||
setProjectContext(Context(PythonProjectContext));
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include "qbsbuildconfiguration.h"
|
||||
#include "qbslogsink.h"
|
||||
#include "qbspmlogging.h"
|
||||
#include "qbsprojectfile.h"
|
||||
#include "qbsprojectparser.h"
|
||||
#include "qbsprojectmanagerconstants.h"
|
||||
#include "qbsnodes.h"
|
||||
@@ -128,8 +127,7 @@ QbsProject::QbsProject(const FileName &fileName) :
|
||||
m_parsingDelay.setInterval(1000); // delay parsing by 1s.
|
||||
|
||||
setId(Constants::PROJECT_ID);
|
||||
setDocument(new QbsProjectFile(this, fileName));
|
||||
DocumentManager::addDocument(document());
|
||||
setDocument(new ProjectDocument(Constants::MIME_TYPE, fileName, [this]() { delayParsing(); }));
|
||||
|
||||
setProjectContext(Context(Constants::PROJECT_ID));
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
@@ -710,9 +708,9 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
|
||||
}
|
||||
QSet<IDocument *> toAdd;
|
||||
foreach (const QString &f, filesToAdd)
|
||||
toAdd.insert(new QbsProjectFile(this, FileName::fromString(f)));
|
||||
toAdd.insert(new ProjectDocument(Constants::MIME_TYPE, FileName::fromString(f),
|
||||
[this]() { delayParsing(); }));
|
||||
|
||||
DocumentManager::addDocuments(toAdd.toList());
|
||||
m_qbsDocuments.unite(toAdd);
|
||||
}
|
||||
|
||||
|
@@ -1,61 +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 "qbsprojectfile.h"
|
||||
|
||||
#include "qbsproject.h"
|
||||
#include "qbsprojectmanagerconstants.h"
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QbsProjectFile::QbsProjectFile(QbsProject *parent, const Utils::FileName &fileName) : Core::IDocument(parent),
|
||||
m_project(parent)
|
||||
{
|
||||
setId("Qbs.ProjectFile");
|
||||
setMimeType(Constants::MIME_TYPE);
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
Core::IDocument::ReloadBehavior QbsProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
Q_UNUSED(type);
|
||||
return BehaviorSilent;
|
||||
}
|
||||
|
||||
bool QbsProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
{
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(flag)
|
||||
if (type == TypePermissions)
|
||||
return true;
|
||||
m_project->delayParsing();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
@@ -1,48 +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 <coreplugin/idocument.h>
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QbsProject;
|
||||
|
||||
class QbsProjectFile : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
QbsProjectFile(QbsProject *parent, const Utils::FileName &fileName);
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||
|
||||
private:
|
||||
QbsProject *m_project;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
@@ -34,7 +34,6 @@ HEADERS = \
|
||||
qbspmlogging.h \
|
||||
qbsprofilessettingspage.h \
|
||||
qbsproject.h \
|
||||
qbsprojectfile.h \
|
||||
qbsprojectmanager.h \
|
||||
qbsprojectmanager_global.h \
|
||||
qbsprojectmanagerconstants.h \
|
||||
@@ -59,7 +58,6 @@ SOURCES = \
|
||||
qbspmlogging.cpp \
|
||||
qbsprofilessettingspage.cpp \
|
||||
qbsproject.cpp \
|
||||
qbsprojectfile.cpp \
|
||||
qbsprojectmanager.cpp \
|
||||
qbsprojectmanagerplugin.cpp \
|
||||
qbsprojectmanagersettings.cpp \
|
||||
|
@@ -94,8 +94,6 @@ QtcPlugin {
|
||||
"qbsprofilessettingswidget.ui",
|
||||
"qbsproject.cpp",
|
||||
"qbsproject.h",
|
||||
"qbsprojectfile.cpp",
|
||||
"qbsprojectfile.h",
|
||||
"qbsprojectmanager.cpp",
|
||||
"qbsprojectmanager.h",
|
||||
"qbsprojectmanager.qrc",
|
||||
|
@@ -74,15 +74,6 @@ using namespace Utils;
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QmakeProjectFile : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
explicit QmakeProjectFile(const FileName &fileName);
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||
};
|
||||
|
||||
/// Watches folders for QmakePriFile nodes
|
||||
/// use one file system watcher to watch all folders
|
||||
/// such minimizing system ressouce usage
|
||||
@@ -156,30 +147,6 @@ QDebug operator<<(QDebug d, const QmakeProjectFiles &f)
|
||||
return d;
|
||||
}
|
||||
|
||||
// ----------- QmakeProjectFile
|
||||
|
||||
QmakeProjectFile::QmakeProjectFile(const FileName &fileName)
|
||||
{
|
||||
setId("Qmake.ProFile");
|
||||
setMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
Core::IDocument::ReloadBehavior QmakeProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state)
|
||||
Q_UNUSED(type)
|
||||
return BehaviorSilent;
|
||||
}
|
||||
|
||||
bool QmakeProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
{
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(flag)
|
||||
Q_UNUSED(type)
|
||||
return true;
|
||||
}
|
||||
|
||||
static QList<QmakeProject *> s_projects;
|
||||
|
||||
} // namespace Internal
|
||||
@@ -196,7 +163,7 @@ QmakeProject::QmakeProject(const FileName &fileName) :
|
||||
{
|
||||
s_projects.append(this);
|
||||
setId(Constants::QMAKEPROJECT_ID);
|
||||
setDocument(new QmakeProjectFile(fileName));
|
||||
setDocument(new ProjectDocument(QmakeProjectManager::Constants::PROFILE_MIMETYPE, fileName));
|
||||
setProjectContext(Core::Context(QmakeProjectManager::Constants::PROJECT_ID));
|
||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
setRequiredKitPredicate(QtSupport::QtKitInformation::qtVersionPredicate());
|
||||
|
@@ -24,7 +24,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectfile.h"
|
||||
#include "fileformat/qmlprojectfileformat.h"
|
||||
#include "fileformat/qmlprojectitem.h"
|
||||
#include "qmlprojectrunconfiguration.h"
|
||||
@@ -59,8 +58,8 @@ QmlProject::QmlProject(const Utils::FileName &fileName) :
|
||||
m_defaultImport(UnknownImport)
|
||||
{
|
||||
setId("QmlProjectManager.QmlProject");
|
||||
setDocument(new Internal::QmlProjectFile(this, fileName));
|
||||
DocumentManager::addDocument(document(), true);
|
||||
setDocument(new ProjectDocument(QString::fromLatin1(Constants::QMLPROJECT_MIMETYPE), fileName,
|
||||
[this]() { refreshProjectFile(); }));
|
||||
|
||||
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID));
|
||||
|
@@ -1,63 +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 "qmlprojectfile.h"
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QmlProjectFile::QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName) :
|
||||
m_project(parent)
|
||||
{
|
||||
QTC_CHECK(m_project);
|
||||
QTC_CHECK(!fileName.isEmpty());
|
||||
setId("Qml.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
|
||||
setFilePath(fileName);
|
||||
}
|
||||
|
||||
Core::IDocument::ReloadBehavior QmlProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state)
|
||||
Q_UNUSED(type)
|
||||
return BehaviorSilent;
|
||||
}
|
||||
|
||||
bool QmlProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
|
||||
{
|
||||
Q_UNUSED(errorString)
|
||||
Q_UNUSED(flag)
|
||||
|
||||
if (type == TypeContents)
|
||||
m_project->refreshProjectFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
@@ -1,49 +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 <coreplugin/idocument.h>
|
||||
|
||||
namespace QmlProjectManager {
|
||||
|
||||
class QmlProject;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QmlProjectFile : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName);
|
||||
|
||||
ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;
|
||||
bool reload(QString *errorString, ReloadFlag flag, ChangeType type) override;
|
||||
|
||||
private:
|
||||
QmlProject *m_project;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
@@ -9,7 +9,6 @@ HEADERS += qmlproject.h \
|
||||
qmlprojectplugin.h \
|
||||
qmlprojectconstants.h \
|
||||
qmlprojectnodes.h \
|
||||
qmlprojectfile.h \
|
||||
qmlprojectrunconfiguration.h \
|
||||
qmlprojectrunconfigurationfactory.h \
|
||||
qmlprojectmanager_global.h \
|
||||
@@ -20,7 +19,6 @@ SOURCES += qmlproject.cpp \
|
||||
qmlprojectenvironmentaspect.cpp \
|
||||
qmlprojectplugin.cpp \
|
||||
qmlprojectnodes.cpp \
|
||||
qmlprojectfile.cpp \
|
||||
qmlprojectrunconfiguration.cpp \
|
||||
qmlprojectrunconfigurationfactory.cpp \
|
||||
qmlprojectrunconfigurationwidget.cpp
|
||||
|
@@ -18,7 +18,6 @@ QtcPlugin {
|
||||
"qmlproject.qrc",
|
||||
"qmlprojectconstants.h",
|
||||
"qmlprojectenvironmentaspect.cpp", "qmlprojectenvironmentaspect.h",
|
||||
"qmlprojectfile.cpp", "qmlprojectfile.h",
|
||||
"qmlprojectmanager_global.h",
|
||||
"qmlprojectmanagerconstants.h",
|
||||
"qmlprojectnodes.cpp", "qmlprojectnodes.h",
|
||||
|
Reference in New Issue
Block a user