forked from qt-creator/qt-creator
SessionManager: Apply 'static' pattern
Change-Id: I370f72fcf7a24216ee189979ce6b5c8bfc5f4140 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -240,24 +240,18 @@ CppModelManager::CppModelManager(QObject *parent)
|
||||
|
||||
m_dirty = true;
|
||||
|
||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
QTC_ASSERT(pe, return);
|
||||
|
||||
m_delayedGcTimer = new QTimer(this);
|
||||
m_delayedGcTimer->setSingleShot(true);
|
||||
connect(m_delayedGcTimer, SIGNAL(timeout()), this, SLOT(GC()));
|
||||
|
||||
ProjectExplorer::SessionManager *session = pe->session();
|
||||
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||
QObject *sessionManager = ProjectExplorer::SessionManager::instance();
|
||||
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||
this, SLOT(onProjectAdded(ProjectExplorer::Project*)));
|
||||
|
||||
connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
||||
connect(sessionManager, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
||||
this, SLOT(onAboutToRemoveProject(ProjectExplorer::Project*)));
|
||||
|
||||
connect(session, SIGNAL(aboutToLoadSession(QString)),
|
||||
connect(sessionManager, SIGNAL(aboutToLoadSession(QString)),
|
||||
this, SLOT(onAboutToLoadSession()));
|
||||
|
||||
connect(session, SIGNAL(aboutToUnloadSession(QString)),
|
||||
connect(sessionManager, SIGNAL(aboutToUnloadSession(QString)),
|
||||
this, SLOT(onAboutToUnloadSession()));
|
||||
|
||||
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
#endif
|
||||
|
||||
using namespace CppTools::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
typedef CPlusPlus::Document Document;
|
||||
typedef CppTools::CppModelManagerInterface::ProjectInfo ProjectInfo;
|
||||
typedef CppTools::ProjectPart ProjectPart;
|
||||
typedef CppTools::ProjectFile ProjectFile;
|
||||
typedef ProjectExplorer::Project Project;
|
||||
|
||||
Q_DECLARE_METATYPE(QList<ProjectFile>)
|
||||
|
||||
@@ -119,7 +119,7 @@ class ExampleProjectConfigurator
|
||||
{
|
||||
public:
|
||||
ExampleProjectConfigurator(const QString &projectFile,
|
||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorer)
|
||||
ProjectExplorerPlugin *projectExplorer)
|
||||
{
|
||||
const QString projectUserFile = projectFile + QLatin1String(".user");
|
||||
QVERIFY(!QFileInfo(projectUserFile).exists());
|
||||
@@ -142,13 +142,13 @@ public:
|
||||
QVERIFY(QFile::remove(m_fileToRemove));
|
||||
}
|
||||
|
||||
ProjectExplorer::Project *project() const
|
||||
Project *project() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
|
||||
private:
|
||||
ProjectExplorer::Project *m_project;
|
||||
Project *m_project;
|
||||
QString m_fileToRemove;
|
||||
};
|
||||
|
||||
@@ -661,7 +661,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
|
||||
const QString projectFile = testDataDirectory.file(QLatin1String("testdata_guiproject1.pro"));
|
||||
|
||||
// Open project with *.ui file
|
||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||
ExampleProjectConfigurator exampleProjectConfigurator(projectFile, pe);
|
||||
Project *project = exampleProjectConfigurator.project();
|
||||
|
||||
@@ -698,8 +698,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
|
||||
QCOMPARE(QFileInfo(includedFiles.at(1)).fileName(), QLatin1String("ui_mainwindow.h"));
|
||||
|
||||
// Close Project
|
||||
ProjectExplorer::SessionManager *sm = pe->session();
|
||||
sm->removeProject(project);
|
||||
SessionManager::removeProject(project);
|
||||
helper.waitForFinishedGc();
|
||||
}
|
||||
|
||||
|
||||
@@ -133,10 +133,8 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search)
|
||||
SymbolSearcher::Parameters parameters = search->userData().value<SymbolSearcher::Parameters>();
|
||||
QSet<QString> projectFileNames;
|
||||
if (parameters.scope == SymbolSearcher::SearchProjectsOnly) {
|
||||
foreach (ProjectExplorer::Project *project,
|
||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects()) {
|
||||
foreach (ProjectExplorer::Project *project, ProjectExplorer::SessionManager::projects())
|
||||
projectFileNames += project->files(ProjectExplorer::Project::AllFiles).toSet();
|
||||
}
|
||||
}
|
||||
|
||||
QFutureWatcher<Find::SearchResultItem> *watcher = new QFutureWatcher<Find::SearchResultItem>();
|
||||
|
||||
Reference in New Issue
Block a user