forked from qt-creator/qt-creator
ProjectExplorer: Remove Project manager parameter from some constructors
Can be done generically when creating projects. The only wart is the use from BaseQmakeProjectWizardDialog::writeUserFile. Change-Id: Ie98c9f88ec142e82443e204a0075e3ae9e163752 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -50,7 +50,7 @@ Project *AutotoolsManager::openProject(const QString &fileName, QString *errorSt
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new AutotoolsProject(this, fileName);
|
||||
return new AutotoolsProject(fileName);
|
||||
}
|
||||
|
||||
QString AutotoolsManager::mimeType() const
|
||||
|
@@ -69,12 +69,11 @@ using namespace AutotoolsProjectManager;
|
||||
using namespace AutotoolsProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fileName) :
|
||||
AutotoolsProject::AutotoolsProject(const QString &fileName) :
|
||||
m_fileWatcher(new Utils::FileSystemWatcher(this)),
|
||||
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
{
|
||||
setId(Constants::AUTOTOOLS_PROJECT_ID);
|
||||
setProjectManager(manager);
|
||||
setDocument(new AutotoolsProjectFile(fileName));
|
||||
setRootProjectNode(new AutotoolsProjectNode(projectDirectory()));
|
||||
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
|
||||
|
@@ -66,7 +66,7 @@ class AutotoolsProject : public ProjectExplorer::Project
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AutotoolsProject(AutotoolsManager *manager, const QString &fileName);
|
||||
AutotoolsProject(const QString &fileName);
|
||||
~AutotoolsProject() override;
|
||||
|
||||
QString displayName() const override;
|
||||
|
@@ -73,11 +73,10 @@ using namespace Internal;
|
||||
/*!
|
||||
\class CMakeProject
|
||||
*/
|
||||
CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
|
||||
CMakeProject::CMakeProject(const FileName &fileName)
|
||||
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
{
|
||||
setId(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
|
||||
setProjectManager(manager);
|
||||
setDocument(new TextEditor::TextDocument);
|
||||
document()->setFilePath(fileName);
|
||||
|
||||
|
@@ -50,7 +50,6 @@ namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
class CMakeBuildConfiguration;
|
||||
class CMakeBuildSettingsWidget;
|
||||
class CMakeManager;
|
||||
} // namespace Internal
|
||||
|
||||
enum TargetType {
|
||||
@@ -84,7 +83,7 @@ class CMAKE_EXPORT CMakeProject : public ProjectExplorer::Project
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMakeProject(Internal::CMakeManager *manager, const Utils::FileName &filename);
|
||||
explicit CMakeProject(const Utils::FileName &filename);
|
||||
~CMakeProject() final;
|
||||
|
||||
QString displayName() const final;
|
||||
|
@@ -166,7 +166,7 @@ Project *CMakeManager::openProject(const QString &fileName, QString *errorString
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new CMakeProject(this, file);
|
||||
return new CMakeProject(file);
|
||||
}
|
||||
|
||||
QString CMakeManager::mimeType() const
|
||||
|
@@ -65,11 +65,10 @@ namespace Internal {
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericProject::GenericProject(Manager *manager, const QString &fileName)
|
||||
GenericProject::GenericProject(const QString &fileName)
|
||||
: m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
{
|
||||
setId(Constants::GENERICPROJECT_ID);
|
||||
setProjectManager(manager);
|
||||
setDocument(new GenericProjectFile(this, fileName, GenericProject::Everything));
|
||||
setRootProjectNode(new GenericProjectNode(this));
|
||||
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
|
||||
|
@@ -49,7 +49,7 @@ class GenericProject : public ProjectExplorer::Project
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GenericProject(Manager *manager, const QString &filename);
|
||||
explicit GenericProject(const QString &filename);
|
||||
~GenericProject() override;
|
||||
|
||||
QString filesFileName() const;
|
||||
|
@@ -51,7 +51,7 @@ ProjectExplorer::Project *Manager::openProject(const QString &fileName, QString
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new GenericProject(this, fileName);
|
||||
return new GenericProject(fileName);
|
||||
}
|
||||
|
||||
void Manager::registerProject(GenericProject *project)
|
||||
|
@@ -54,10 +54,9 @@ namespace Nim {
|
||||
|
||||
const int MIN_TIME_BETWEEN_PROJECT_SCANS = 4500;
|
||||
|
||||
NimProject::NimProject(NimProjectManager *projectManager, const QString &fileName)
|
||||
NimProject::NimProject(const QString &fileName)
|
||||
{
|
||||
setId(Constants::C_NIMPROJECT_ID);
|
||||
setProjectManager(projectManager);
|
||||
setDocument(new TextEditor::TextDocument);
|
||||
document()->setFilePath(FileName::fromString(fileName));
|
||||
QFileInfo fi = QFileInfo(fileName);
|
||||
|
@@ -29,23 +29,17 @@
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QFutureWatcher>
|
||||
#include <QTimer>
|
||||
|
||||
namespace TextEditor { class TextDocument; }
|
||||
|
||||
namespace Nim {
|
||||
|
||||
class NimProjectManager;
|
||||
class NimProjectNode;
|
||||
|
||||
class NimProject : public ProjectExplorer::Project
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NimProject(NimProjectManager *projectManager, const QString &fileName);
|
||||
explicit NimProject(const QString &fileName);
|
||||
|
||||
QString displayName() const override;
|
||||
QStringList files(FilesMode) const override;
|
||||
|
@@ -44,7 +44,7 @@ Project *NimProjectManager::openProject(const QString &fileName, QString *errorS
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new NimProject(this, fileName);
|
||||
return new NimProject(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1709,6 +1709,7 @@ ProjectExplorerPlugin::OpenProjectResult ProjectExplorerPlugin::openProjects(con
|
||||
foundProjectManager = true;
|
||||
QString tmp;
|
||||
if (Project *pro = manager->openProject(filePath, &tmp)) {
|
||||
pro->setProjectManager(manager);
|
||||
QObject::connect(pro, &Project::parsingFinished, [pro]() {
|
||||
emit SessionManager::instance()->projectFinishedParsing(pro);
|
||||
});
|
||||
|
@@ -100,7 +100,7 @@ public:
|
||||
class PythonProject : public Project
|
||||
{
|
||||
public:
|
||||
PythonProject(PythonProjectManager *manager, const QString &filename);
|
||||
explicit PythonProject(const QString &filename);
|
||||
|
||||
QString displayName() const override { return m_projectName; }
|
||||
PythonProjectManager *projectManager() const override;
|
||||
@@ -370,7 +370,7 @@ Project *PythonProjectManager::openProject(const QString &fileName, QString *err
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new PythonProject(this, fileName);
|
||||
return new PythonProject(fileName);
|
||||
}
|
||||
|
||||
class PythonRunConfigurationFactory : public IRunConfigurationFactory
|
||||
@@ -443,10 +443,9 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
PythonProject::PythonProject(PythonProjectManager *manager, const QString &fileName)
|
||||
PythonProject::PythonProject(const QString &fileName)
|
||||
{
|
||||
setId(PythonProjectId);
|
||||
setProjectManager(manager);
|
||||
setDocument(new PythonProjectFile(this, fileName));
|
||||
DocumentManager::addDocument(document());
|
||||
setRootProjectNode(new PythonProjectNode(this));
|
||||
|
@@ -117,7 +117,7 @@ private:
|
||||
// QbsProject:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
|
||||
QbsProject::QbsProject(const QString &fileName) :
|
||||
m_projectName(QFileInfo(fileName).completeBaseName()),
|
||||
m_qbsProjectParser(0),
|
||||
m_qbsUpdateFutureInterface(0),
|
||||
@@ -130,7 +130,6 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
|
||||
m_parsingDelay.setInterval(1000); // delay parsing by 1s.
|
||||
|
||||
setId(Constants::PROJECT_ID);
|
||||
setProjectManager(manager);
|
||||
setDocument(new QbsProjectFile(this, fileName));
|
||||
DocumentManager::addDocument(document());
|
||||
setRootProjectNode(new QbsRootProjectNode(this));
|
||||
|
@@ -60,7 +60,7 @@ class QbsProject : public ProjectExplorer::Project
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QbsProject(QbsManager *manager, const QString &filename);
|
||||
explicit QbsProject(const QString &filename);
|
||||
~QbsProject() override;
|
||||
|
||||
QString displayName() const override;
|
||||
|
@@ -114,7 +114,7 @@ ProjectExplorer::Project *QbsManager::openProject(const QString &fileName, QStri
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new QbsProject(this, fileName);
|
||||
return new QbsProject(fileName);
|
||||
}
|
||||
|
||||
QString QbsManager::profileForKit(const ProjectExplorer::Kit *k)
|
||||
|
@@ -246,7 +246,7 @@ bool QmakeProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType
|
||||
QmakeProject manages information about an individual Qt 4 (.pro) project file.
|
||||
*/
|
||||
|
||||
QmakeProject::QmakeProject(QmakeManager *manager, const QString &fileName) :
|
||||
QmakeProject::QmakeProject(IProjectManager *manager, const QString &fileName) :
|
||||
m_projectFiles(new QmakeProjectFiles),
|
||||
m_qmakeVfs(new QMakeVfs),
|
||||
m_cppCodeModelUpdater(new CppTools::CppProjectUpdater(this))
|
||||
|
@@ -62,7 +62,7 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeProject : public ProjectExplorer::Project
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmakeProject(QmakeManager *manager, const QString &proFile);
|
||||
QmakeProject(ProjectExplorer::IProjectManager *manager, const QString &proFile);
|
||||
~QmakeProject() final;
|
||||
|
||||
QmakeProFile *rootProFile() const;
|
||||
|
Reference in New Issue
Block a user