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:
hjk
2017-02-28 15:13:16 +01:00
parent 7194e968a8
commit 4d3d2d0dfb
19 changed files with 21 additions and 33 deletions

View File

@@ -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

View File

@@ -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));

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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

View File

@@ -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));

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);

View File

@@ -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;

View File

@@ -44,7 +44,7 @@ Project *NimProjectManager::openProject(const QString &fileName, QString *errorS
return nullptr;
}
return new NimProject(this, fileName);
return new NimProject(fileName);
}
}

View File

@@ -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);
});

View File

@@ -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));

View File

@@ -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));

View File

@@ -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;

View File

@@ -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)

View File

@@ -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))

View File

@@ -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;