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:
@@ -48,6 +48,7 @@
|
|||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <utils/fancymainwindow.h>
|
#include <utils/fancymainwindow.h>
|
||||||
@@ -425,7 +426,7 @@ bool AnalyzerManagerPrivate::isActionRunnable(AnalyzerAction *action) const
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
return pe->canRun(pe->startupProject(), action->tool()->runMode());
|
return pe->canRun(SessionManager::startupProject(), action->tool()->runMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerManagerPrivate::startTool()
|
void AnalyzerManagerPrivate::startTool()
|
||||||
@@ -578,7 +579,7 @@ void AnalyzerManagerPrivate::saveToolSettings(AnalyzerAction *action)
|
|||||||
void AnalyzerManagerPrivate::updateRunActions()
|
void AnalyzerManagerPrivate::updateRunActions()
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
Project *project = pe->startupProject();
|
Project *project = SessionManager::startupProject();
|
||||||
|
|
||||||
QString disabledReason;
|
QString disabledReason;
|
||||||
if (m_isRunning)
|
if (m_isRunning)
|
||||||
|
@@ -65,6 +65,7 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Android;
|
using namespace Android;
|
||||||
using namespace Android::Internal;
|
using namespace Android::Internal;
|
||||||
|
|
||||||
@@ -78,15 +79,14 @@ bool checkPackageName(const QString &packageName)
|
|||||||
return QRegExp(packageNameRegExp).exactMatch(packageName);
|
return QRegExp(packageNameRegExp).exactMatch(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Project *androidProject(const QString &file)
|
Project *androidProject(const QString &file)
|
||||||
{
|
{
|
||||||
ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
|
||||||
Utils::FileName fileName = Utils::FileName::fromString(file);
|
Utils::FileName fileName = Utils::FileName::fromString(file);
|
||||||
foreach (ProjectExplorer::Project *project, session->projects()) {
|
foreach (Project *project, SessionManager::projects()) {
|
||||||
if (!project->activeTarget())
|
if (!project->activeTarget())
|
||||||
continue;
|
continue;
|
||||||
ProjectExplorer::Kit *kit = project->activeTarget()->kit();
|
Kit *kit = project->activeTarget()->kit();
|
||||||
if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(kit) == Constants::ANDROID_DEVICE_TYPE
|
if (DeviceTypeKitInformation::deviceTypeId(kit) == Android::Constants::ANDROID_DEVICE_TYPE
|
||||||
&& fileName.isChildOf(Utils::FileName::fromString(project->projectDirectory())))
|
&& fileName.isChildOf(Utils::FileName::fromString(project->projectDirectory())))
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
@@ -355,7 +355,7 @@ BookmarkManager::BookmarkManager() :
|
|||||||
connect(Core::ICore::instance(), SIGNAL(contextChanged(QList<Core::IContext*>,Core::Context)),
|
connect(Core::ICore::instance(), SIGNAL(contextChanged(QList<Core::IContext*>,Core::Context)),
|
||||||
this, SLOT(updateActionStatus()));
|
this, SLOT(updateActionStatus()));
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance()->session(), SIGNAL(sessionLoaded(QString)),
|
connect(SessionManager::instance(), SIGNAL(sessionLoaded(QString)),
|
||||||
this, SLOT(loadBookmarks()));
|
this, SLOT(loadBookmarks()));
|
||||||
|
|
||||||
updateActionStatus();
|
updateActionStatus();
|
||||||
@@ -645,12 +645,6 @@ TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
|
|||||||
return qobject_cast<TextEditor::ITextEditor *>(currEditor);
|
return qobject_cast<TextEditor::ITextEditor *>(currEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the current session. */
|
|
||||||
SessionManager *BookmarkManager::sessionManager() const
|
|
||||||
{
|
|
||||||
return ProjectExplorerPlugin::instance()->session();
|
|
||||||
}
|
|
||||||
|
|
||||||
BookmarkManager::State BookmarkManager::state() const
|
BookmarkManager::State BookmarkManager::state() const
|
||||||
{
|
{
|
||||||
if (m_bookmarksMap.empty())
|
if (m_bookmarksMap.empty())
|
||||||
@@ -826,7 +820,7 @@ void BookmarkManager::saveBookmarks()
|
|||||||
foreach (const Bookmark *bookmark, m_bookmarksList)
|
foreach (const Bookmark *bookmark, m_bookmarksList)
|
||||||
list << bookmarkToString(bookmark);
|
list << bookmarkToString(bookmark);
|
||||||
|
|
||||||
sessionManager()->setValue(QLatin1String("Bookmarks"), list);
|
SessionManager::setValue(QLatin1String("Bookmarks"), list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark)
|
void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark)
|
||||||
@@ -844,7 +838,7 @@ void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const
|
|||||||
void BookmarkManager::loadBookmarks()
|
void BookmarkManager::loadBookmarks()
|
||||||
{
|
{
|
||||||
removeAllBookmarks();
|
removeAllBookmarks();
|
||||||
const QStringList &list = sessionManager()->value(QLatin1String("Bookmarks")).toStringList();
|
const QStringList &list = SessionManager::value(QLatin1String("Bookmarks")).toStringList();
|
||||||
foreach (const QString &bookmarkString, list)
|
foreach (const QString &bookmarkString, list)
|
||||||
addBookmark(bookmarkString);
|
addBookmark(bookmarkString);
|
||||||
|
|
||||||
|
@@ -42,14 +42,6 @@
|
|||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class SessionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class IEditor;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Bookmarks {
|
namespace Bookmarks {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -124,7 +116,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TextEditor::ITextEditor *currentTextEditor() const;
|
TextEditor::ITextEditor *currentTextEditor() const;
|
||||||
ProjectExplorer::SessionManager* sessionManager() const;
|
|
||||||
|
|
||||||
void documentPrevNext(bool next);
|
void documentPrevNext(bool next);
|
||||||
|
|
||||||
|
@@ -227,8 +227,7 @@ void Manager::initialize()
|
|||||||
connect(this, SIGNAL(stateChanged(bool)), SLOT(onStateChanged(bool)), Qt::QueuedConnection);
|
connect(this, SIGNAL(stateChanged(bool)), SLOT(onStateChanged(bool)), Qt::QueuedConnection);
|
||||||
|
|
||||||
// connections to enable/disable navi widget factory
|
// connections to enable/disable navi widget factory
|
||||||
ProjectExplorer::SessionManager *sessionManager =
|
QObject *sessionManager = ProjectExplorer::SessionManager::instance();
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
|
||||||
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
SLOT(onProjectListChanged()), Qt::QueuedConnection);
|
SLOT(onProjectListChanged()), Qt::QueuedConnection);
|
||||||
connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
|
@@ -58,6 +58,8 @@
|
|||||||
|
|
||||||
enum { debug = false };
|
enum { debug = false };
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace ClassView {
|
namespace ClassView {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -274,8 +276,7 @@ ParserTreeItem::ConstPtr Parser::parse()
|
|||||||
ParserTreeItem::Ptr rootItem(new ParserTreeItem());
|
ParserTreeItem::Ptr rootItem(new ParserTreeItem());
|
||||||
|
|
||||||
// check all projects
|
// check all projects
|
||||||
QList<ProjectExplorer::Project *> projects = getProjectList();
|
foreach (const Project *prj, SessionManager::projects()) {
|
||||||
foreach (const ProjectExplorer::Project *prj, projects) {
|
|
||||||
if (!prj)
|
if (!prj)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -293,7 +294,7 @@ ParserTreeItem::ConstPtr Parser::parse()
|
|||||||
|
|
||||||
if (d->flatMode) {
|
if (d->flatMode) {
|
||||||
// use prj path (prjType) as a project id
|
// use prj path (prjType) as a project id
|
||||||
// addProject(item, prj->files(ProjectExplorer::Project::ExcludeGeneratedFiles), prjType);
|
// addProject(item, prj->files(Project::ExcludeGeneratedFiles), prjType);
|
||||||
//! \todo return back, works too long
|
//! \todo return back, works too long
|
||||||
ParserTreeItem::Ptr flatItem = createFlatTree(projectList);
|
ParserTreeItem::Ptr flatItem = createFlatTree(projectList);
|
||||||
item.swap(flatItem);
|
item.swap(flatItem);
|
||||||
@@ -673,10 +674,9 @@ void Parser::resetData(const CPlusPlus::Snapshot &snapshot)
|
|||||||
QStringList fileList;
|
QStringList fileList;
|
||||||
|
|
||||||
// check all projects
|
// check all projects
|
||||||
QList<ProjectExplorer::Project *> projects = getProjectList();
|
foreach (const Project *prj, SessionManager::projects()) {
|
||||||
foreach (const ProjectExplorer::Project *prj, projects) {
|
|
||||||
if (prj)
|
if (prj)
|
||||||
fileList += prj->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
|
fileList += prj->files(Project::ExcludeGeneratedFiles);
|
||||||
}
|
}
|
||||||
setFileList(fileList);
|
setFileList(fileList);
|
||||||
|
|
||||||
@@ -819,22 +819,5 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item,
|
|||||||
return projectList;
|
return projectList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the current project list.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QList<ProjectExplorer::Project *> Parser::getProjectList() const
|
|
||||||
{
|
|
||||||
QList<ProjectExplorer::Project *> list;
|
|
||||||
|
|
||||||
// check all projects
|
|
||||||
ProjectExplorer::SessionManager *sessionManager
|
|
||||||
= ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
|
||||||
|
|
||||||
list = sessionManager->projects();
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ClassView
|
} // namespace ClassView
|
||||||
|
@@ -118,8 +118,6 @@ protected:
|
|||||||
|
|
||||||
QStringList projectNodeFileList(const ProjectExplorer::FolderNode *node) const;
|
QStringList projectNodeFileList(const ProjectExplorer::FolderNode *node) const;
|
||||||
|
|
||||||
QList<ProjectExplorer::Project *> getProjectList() const;
|
|
||||||
|
|
||||||
ParserTreeItem::Ptr createFlatTree(const QStringList &projectList);
|
ParserTreeItem::Ptr createFlatTree(const QStringList &projectList);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -94,9 +94,7 @@ void CMakeEditor::markAsChanged()
|
|||||||
|
|
||||||
void CMakeEditor::build()
|
void CMakeEditor::build()
|
||||||
{
|
{
|
||||||
QList<ProjectExplorer::Project *> projects =
|
foreach (ProjectExplorer::Project *p, ProjectExplorer::SessionManager::projects()) {
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects();
|
|
||||||
foreach (ProjectExplorer::Project *p, projects) {
|
|
||||||
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
|
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
|
||||||
if (cmakeProject) {
|
if (cmakeProject) {
|
||||||
if (cmakeProject->isProjectFile(document()->filePath())) {
|
if (cmakeProject->isProjectFile(document()->filePath())) {
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
CMakeLocatorFilter::CMakeLocatorFilter()
|
CMakeLocatorFilter::CMakeLocatorFilter()
|
||||||
@@ -49,10 +50,9 @@ CMakeLocatorFilter::CMakeLocatorFilter()
|
|||||||
setDisplayName(tr("Build CMake target"));
|
setDisplayName(tr("Build CMake target"));
|
||||||
setShortcutString(QLatin1String("cm"));
|
setShortcutString(QLatin1String("cm"));
|
||||||
|
|
||||||
ProjectExplorer::SessionManager *sm = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
connect(SessionManager::instance(), SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
connect(sm, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
|
||||||
this, SLOT(slotProjectListUpdated()));
|
this, SLOT(slotProjectListUpdated()));
|
||||||
connect(sm, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
connect(SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
this, SLOT(slotProjectListUpdated()));
|
this, SLOT(slotProjectListUpdated()));
|
||||||
|
|
||||||
// Initialize the filter
|
// Initialize the filter
|
||||||
@@ -69,9 +69,7 @@ QList<Locator::FilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Loca
|
|||||||
Q_UNUSED(future)
|
Q_UNUSED(future)
|
||||||
QList<Locator::FilterEntry> result;
|
QList<Locator::FilterEntry> result;
|
||||||
|
|
||||||
QList<ProjectExplorer::Project *> projects =
|
foreach (Project *p, SessionManager::projects()) {
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects();
|
|
||||||
foreach (ProjectExplorer::Project *p, projects) {
|
|
||||||
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
|
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
|
||||||
if (cmakeProject) {
|
if (cmakeProject) {
|
||||||
foreach (const CMakeBuildTarget &ct, cmakeProject->buildTargets()) {
|
foreach (const CMakeBuildTarget &ct, cmakeProject->buildTargets()) {
|
||||||
@@ -93,9 +91,7 @@ void CMakeLocatorFilter::accept(Locator::FilterEntry selection) const
|
|||||||
// Get the project containing the target selected
|
// Get the project containing the target selected
|
||||||
CMakeProject *cmakeProject = 0;
|
CMakeProject *cmakeProject = 0;
|
||||||
|
|
||||||
QList<ProjectExplorer::Project *> projects =
|
foreach (Project *p, SessionManager::projects()) {
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects();
|
|
||||||
foreach (ProjectExplorer::Project *p, projects) {
|
|
||||||
cmakeProject = qobject_cast<CMakeProject *>(p);
|
cmakeProject = qobject_cast<CMakeProject *>(p);
|
||||||
if (cmakeProject && cmakeProject->projectFilePath() == selection.internalData.toString())
|
if (cmakeProject && cmakeProject->projectFilePath() == selection.internalData.toString())
|
||||||
break;
|
break;
|
||||||
@@ -136,9 +132,7 @@ void CMakeLocatorFilter::slotProjectListUpdated()
|
|||||||
{
|
{
|
||||||
CMakeProject *cmakeProject = 0;
|
CMakeProject *cmakeProject = 0;
|
||||||
|
|
||||||
QList<ProjectExplorer::Project *> projects =
|
foreach (Project *p, SessionManager::projects()) {
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects();
|
|
||||||
foreach (ProjectExplorer::Project *p, projects) {
|
|
||||||
cmakeProject = qobject_cast<CMakeProject *>(p);
|
cmakeProject = qobject_cast<CMakeProject *>(p);
|
||||||
if (cmakeProject)
|
if (cmakeProject)
|
||||||
break;
|
break;
|
||||||
|
@@ -240,24 +240,18 @@ CppModelManager::CppModelManager(QObject *parent)
|
|||||||
|
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
|
||||||
QTC_ASSERT(pe, return);
|
|
||||||
|
|
||||||
m_delayedGcTimer = new QTimer(this);
|
m_delayedGcTimer = new QTimer(this);
|
||||||
m_delayedGcTimer->setSingleShot(true);
|
m_delayedGcTimer->setSingleShot(true);
|
||||||
connect(m_delayedGcTimer, SIGNAL(timeout()), this, SLOT(GC()));
|
connect(m_delayedGcTimer, SIGNAL(timeout()), this, SLOT(GC()));
|
||||||
|
|
||||||
ProjectExplorer::SessionManager *session = pe->session();
|
QObject *sessionManager = ProjectExplorer::SessionManager::instance();
|
||||||
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
this, SLOT(onProjectAdded(ProjectExplorer::Project*)));
|
this, SLOT(onProjectAdded(ProjectExplorer::Project*)));
|
||||||
|
connect(sessionManager, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
||||||
connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
|
||||||
this, SLOT(onAboutToRemoveProject(ProjectExplorer::Project*)));
|
this, SLOT(onAboutToRemoveProject(ProjectExplorer::Project*)));
|
||||||
|
connect(sessionManager, SIGNAL(aboutToLoadSession(QString)),
|
||||||
connect(session, SIGNAL(aboutToLoadSession(QString)),
|
|
||||||
this, SLOT(onAboutToLoadSession()));
|
this, SLOT(onAboutToLoadSession()));
|
||||||
|
connect(sessionManager, SIGNAL(aboutToUnloadSession(QString)),
|
||||||
connect(session, SIGNAL(aboutToUnloadSession(QString)),
|
|
||||||
this, SLOT(onAboutToUnloadSession()));
|
this, SLOT(onAboutToUnloadSession()));
|
||||||
|
|
||||||
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
|
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
|
||||||
|
@@ -49,12 +49,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
typedef CPlusPlus::Document Document;
|
typedef CPlusPlus::Document Document;
|
||||||
typedef CppTools::CppModelManagerInterface::ProjectInfo ProjectInfo;
|
typedef CppTools::CppModelManagerInterface::ProjectInfo ProjectInfo;
|
||||||
typedef CppTools::ProjectPart ProjectPart;
|
typedef CppTools::ProjectPart ProjectPart;
|
||||||
typedef CppTools::ProjectFile ProjectFile;
|
typedef CppTools::ProjectFile ProjectFile;
|
||||||
typedef ProjectExplorer::Project Project;
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QList<ProjectFile>)
|
Q_DECLARE_METATYPE(QList<ProjectFile>)
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ class ExampleProjectConfigurator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ExampleProjectConfigurator(const QString &projectFile,
|
ExampleProjectConfigurator(const QString &projectFile,
|
||||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorer)
|
ProjectExplorerPlugin *projectExplorer)
|
||||||
{
|
{
|
||||||
const QString projectUserFile = projectFile + QLatin1String(".user");
|
const QString projectUserFile = projectFile + QLatin1String(".user");
|
||||||
QVERIFY(!QFileInfo(projectUserFile).exists());
|
QVERIFY(!QFileInfo(projectUserFile).exists());
|
||||||
@@ -142,13 +142,13 @@ public:
|
|||||||
QVERIFY(QFile::remove(m_fileToRemove));
|
QVERIFY(QFile::remove(m_fileToRemove));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Project *project() const
|
Project *project() const
|
||||||
{
|
{
|
||||||
return m_project;
|
return m_project;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorer::Project *m_project;
|
Project *m_project;
|
||||||
QString m_fileToRemove;
|
QString m_fileToRemove;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -661,7 +661,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
|
|||||||
const QString projectFile = testDataDirectory.file(QLatin1String("testdata_guiproject1.pro"));
|
const QString projectFile = testDataDirectory.file(QLatin1String("testdata_guiproject1.pro"));
|
||||||
|
|
||||||
// Open project with *.ui file
|
// Open project with *.ui file
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
ExampleProjectConfigurator exampleProjectConfigurator(projectFile, pe);
|
ExampleProjectConfigurator exampleProjectConfigurator(projectFile, pe);
|
||||||
Project *project = exampleProjectConfigurator.project();
|
Project *project = exampleProjectConfigurator.project();
|
||||||
|
|
||||||
@@ -698,8 +698,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
|
|||||||
QCOMPARE(QFileInfo(includedFiles.at(1)).fileName(), QLatin1String("ui_mainwindow.h"));
|
QCOMPARE(QFileInfo(includedFiles.at(1)).fileName(), QLatin1String("ui_mainwindow.h"));
|
||||||
|
|
||||||
// Close Project
|
// Close Project
|
||||||
ProjectExplorer::SessionManager *sm = pe->session();
|
SessionManager::removeProject(project);
|
||||||
sm->removeProject(project);
|
|
||||||
helper.waitForFinishedGc();
|
helper.waitForFinishedGc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -133,11 +133,9 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search)
|
|||||||
SymbolSearcher::Parameters parameters = search->userData().value<SymbolSearcher::Parameters>();
|
SymbolSearcher::Parameters parameters = search->userData().value<SymbolSearcher::Parameters>();
|
||||||
QSet<QString> projectFileNames;
|
QSet<QString> projectFileNames;
|
||||||
if (parameters.scope == SymbolSearcher::SearchProjectsOnly) {
|
if (parameters.scope == SymbolSearcher::SearchProjectsOnly) {
|
||||||
foreach (ProjectExplorer::Project *project,
|
foreach (ProjectExplorer::Project *project, ProjectExplorer::SessionManager::projects())
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects()) {
|
|
||||||
projectFileNames += project->files(ProjectExplorer::Project::AllFiles).toSet();
|
projectFileNames += project->files(ProjectExplorer::Project::AllFiles).toSet();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QFutureWatcher<Find::SearchResultItem> *watcher = new QFutureWatcher<Find::SearchResultItem>();
|
QFutureWatcher<Find::SearchResultItem> *watcher = new QFutureWatcher<Find::SearchResultItem>();
|
||||||
m_watchers.insert(watcher, search);
|
m_watchers.insert(watcher, search);
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
#include <coreplugin/rightpane.h>
|
#include <coreplugin/rightpane.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
@@ -469,8 +468,7 @@ void DebuggerMainWindow::addStagedMenuEntries()
|
|||||||
|
|
||||||
QWidget *DebuggerMainWindow::createContents(IMode *mode)
|
QWidget *DebuggerMainWindow::createContents(IMode *mode)
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
connect(SessionManager::instance(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
|
||||||
d, SLOT(updateUiForProject(ProjectExplorer::Project*)));
|
d, SLOT(updateUiForProject(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
d->m_viewsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
|
d->m_viewsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
|
||||||
|
@@ -425,11 +425,6 @@ void addTcfOptionPages(QList<IOptionsPage*> *opts);
|
|||||||
void addLldbOptionPages(QList<IOptionsPage*> *opts);
|
void addLldbOptionPages(QList<IOptionsPage*> *opts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SessionManager *sessionManager()
|
|
||||||
{
|
|
||||||
return ProjectExplorerPlugin::instance()->session();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QToolButton *toolButton(QAction *action)
|
static QToolButton *toolButton(QAction *action)
|
||||||
{
|
{
|
||||||
QToolButton *button = new QToolButton;
|
QToolButton *button = new QToolButton;
|
||||||
@@ -1565,23 +1560,20 @@ void DebuggerPluginPrivate::languagesChanged()
|
|||||||
|
|
||||||
void DebuggerPluginPrivate::debugProject()
|
void DebuggerPluginPrivate::debugProject()
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
if (Project *pro = SessionManager::startupProject())
|
||||||
if (Project *pro = pe->startupProject())
|
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunMode);
|
||||||
pe->runProject(pro, DebugRunMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
|
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
if (Project *pro = SessionManager::startupProject())
|
||||||
if (Project *pro = pe->startupProject())
|
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunMode, true);
|
||||||
pe->runProject(pro, DebugRunMode, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::debugProjectBreakMain()
|
void DebuggerPluginPrivate::debugProjectBreakMain()
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
if (Project *pro = SessionManager::startupProject())
|
||||||
if (Project *pro = pe->startupProject())
|
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunModeWithBreakOnMain);
|
||||||
pe->runProject(pro, DebugRunModeWithBreakOnMain);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::startAndDebugApplication()
|
void DebuggerPluginPrivate::startAndDebugApplication()
|
||||||
@@ -1776,11 +1768,10 @@ void DebuggerPluginPrivate::attachToQmlPort()
|
|||||||
//
|
//
|
||||||
// get files from all the projects in the session
|
// get files from all the projects in the session
|
||||||
//
|
//
|
||||||
SessionManager *sessionManager = ProjectExplorerPlugin::instance()->session();
|
QList<Project *> projects = SessionManager::projects();
|
||||||
QList<Project *> projects = sessionManager->projects();
|
if (Project *startupProject = SessionManager::startupProject()) {
|
||||||
if (Project *startupProject = ProjectExplorerPlugin::instance()->startupProject()) {
|
|
||||||
// startup project first
|
// startup project first
|
||||||
projects.removeOne(ProjectExplorerPlugin::instance()->startupProject());
|
projects.removeOne(startupProject);
|
||||||
projects.insert(0, startupProject);
|
projects.insert(0, startupProject);
|
||||||
}
|
}
|
||||||
QStringList sourceFiles;
|
QStringList sourceFiles;
|
||||||
@@ -2354,7 +2345,7 @@ void DebuggerPluginPrivate::updateDebugActions()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
Project *project = pe->startupProject();
|
Project *project = SessionManager::startupProject();
|
||||||
const bool canRun = pe->canRun(project, DebugRunMode);
|
const bool canRun = pe->canRun(project, DebugRunMode);
|
||||||
m_startAction->setEnabled(canRun);
|
m_startAction->setEnabled(canRun);
|
||||||
m_startAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, DebugRunMode));
|
m_startAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, DebugRunMode));
|
||||||
@@ -2507,14 +2498,12 @@ const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
|
|||||||
|
|
||||||
void DebuggerCore::setSessionValue(const QByteArray &key, const QVariant &value)
|
void DebuggerCore::setSessionValue(const QByteArray &key, const QVariant &value)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(sessionManager(), return);
|
SessionManager::setValue(QString::fromUtf8(key), value);
|
||||||
sessionManager()->setValue(QString::fromUtf8(key), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant DebuggerCore::sessionValue(const QByteArray &key)
|
QVariant DebuggerCore::sessionValue(const QByteArray &key)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(sessionManager(), return QVariant());
|
return SessionManager::value(QString::fromUtf8(key));
|
||||||
return sessionManager()->value(QString::fromUtf8(key));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
|
void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
|
||||||
@@ -3198,11 +3187,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
|||||||
SLOT(fontSettingsChanged(TextEditor::FontSettings)));
|
SLOT(fontSettingsChanged(TextEditor::FontSettings)));
|
||||||
|
|
||||||
// ProjectExplorer
|
// ProjectExplorer
|
||||||
connect(sessionManager(), SIGNAL(sessionLoaded(QString)),
|
connect(SessionManager::instance(), SIGNAL(sessionLoaded(QString)),
|
||||||
SLOT(sessionLoaded()));
|
SLOT(sessionLoaded()));
|
||||||
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
|
connect(SessionManager::instance(), SIGNAL(aboutToSaveSession()),
|
||||||
SLOT(aboutToSaveSession()));
|
SLOT(aboutToSaveSession()));
|
||||||
connect(sessionManager(), SIGNAL(aboutToUnloadSession(QString)),
|
connect(SessionManager::instance(), SIGNAL(aboutToUnloadSession(QString)),
|
||||||
SLOT(aboutToUnloadSession()));
|
SLOT(aboutToUnloadSession()));
|
||||||
connect(ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()),
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()),
|
||||||
SLOT(updateDebugActions()));
|
SLOT(updateDebugActions()));
|
||||||
@@ -3273,7 +3262,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
|||||||
setInitialState();
|
setInitialState();
|
||||||
connectEngine(0);
|
connectEngine(0);
|
||||||
|
|
||||||
connect(sessionManager(),
|
connect(SessionManager::instance(),
|
||||||
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
|
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
@@ -3370,7 +3359,7 @@ void DebuggerPluginPrivate::showModuleSections(const QString &moduleName,
|
|||||||
void DebuggerPluginPrivate::aboutToShutdown()
|
void DebuggerPluginPrivate::aboutToShutdown()
|
||||||
{
|
{
|
||||||
m_plugin->removeObject(this);
|
m_plugin->removeObject(this);
|
||||||
disconnect(sessionManager(),
|
disconnect(SessionManager::instance(),
|
||||||
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, 0);
|
this, 0);
|
||||||
}
|
}
|
||||||
|
@@ -50,8 +50,7 @@ static const char setupUiC[] = "setupUi";
|
|||||||
// Find the generated "ui_form.h" header of the form via project.
|
// Find the generated "ui_form.h" header of the form via project.
|
||||||
static QString generatedHeaderOf(const QString &uiFileName)
|
static QString generatedHeaderOf(const QString &uiFileName)
|
||||||
{
|
{
|
||||||
const ProjectExplorer::SessionManager *sessionMgr = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
if (const ProjectExplorer::Project *uiProject = ProjectExplorer::SessionManager::projectForFile(uiFileName))
|
||||||
if (const ProjectExplorer::Project *uiProject = sessionMgr->projectForFile(uiFileName))
|
|
||||||
return uiProject->generatedUiHeader(uiFileName);
|
return uiProject->generatedUiHeader(uiFileName);
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@@ -60,6 +60,7 @@ enum { indentation = 4 };
|
|||||||
using namespace Designer::Internal;
|
using namespace Designer::Internal;
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
static QString msgClassNotFound(const QString &uiClassName, const QList<Document::Ptr> &docList)
|
static QString msgClassNotFound(const QString &uiClassName, const QList<Document::Ptr> &docList)
|
||||||
{
|
{
|
||||||
@@ -535,12 +536,11 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
|||||||
// Retrieve code model snapshot restricted to project of ui file or the working copy.
|
// Retrieve code model snapshot restricted to project of ui file or the working copy.
|
||||||
Snapshot docTable = CppTools::CppModelManagerInterface::instance()->snapshot();
|
Snapshot docTable = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||||
Snapshot newDocTable;
|
Snapshot newDocTable;
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
const Project *uiProject = SessionManager::projectForFile(currentUiFile);
|
||||||
const ProjectExplorer::Project *uiProject = pe->session()->projectForFile(currentUiFile);
|
|
||||||
if (uiProject) {
|
if (uiProject) {
|
||||||
Snapshot::const_iterator end = docTable.end();
|
Snapshot::const_iterator end = docTable.end();
|
||||||
for (Snapshot::iterator it = docTable.begin(); it != end; ++it) {
|
for (Snapshot::iterator it = docTable.begin(); it != end; ++it) {
|
||||||
const ProjectExplorer::Project *project = pe->session()->projectForFile(it.key());
|
const Project *project = SessionManager::projectForFile(it.key());
|
||||||
if (project == uiProject)
|
if (project == uiProject)
|
||||||
newDocTable.insert(it.value());
|
newDocTable.insert(it.value());
|
||||||
}
|
}
|
||||||
|
@@ -45,10 +45,7 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using ProjectExplorer::NodesVisitor;
|
using namespace ProjectExplorer;
|
||||||
using ProjectExplorer::ProjectNode;
|
|
||||||
using ProjectExplorer::FolderNode;
|
|
||||||
using ProjectExplorer::FileNode;
|
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -100,8 +97,8 @@ void ResourceHandler::ensureInitialized()
|
|||||||
{
|
{
|
||||||
if (m_sessionNode)
|
if (m_sessionNode)
|
||||||
return;
|
return;
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
|
||||||
m_sessionNode = pe->session()->sessionNode();
|
m_sessionNode = ProjectExplorer::SessionManager::sessionNode();
|
||||||
m_sessionWatcher = new ProjectExplorer::NodesWatcher();
|
m_sessionWatcher = new ProjectExplorer::NodesWatcher();
|
||||||
|
|
||||||
connect(m_sessionWatcher, SIGNAL(filesAdded()), this, SLOT(updateResources()));
|
connect(m_sessionWatcher, SIGNAL(filesAdded()), this, SLOT(updateResources()));
|
||||||
@@ -137,9 +134,8 @@ void ResourceHandler::updateResources()
|
|||||||
if (Designer::Constants::Internal::debug)
|
if (Designer::Constants::Internal::debug)
|
||||||
qDebug() << "ResourceHandler::updateResources()" << fileName;
|
qDebug() << "ResourceHandler::updateResources()" << fileName;
|
||||||
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
// Filename could change in the meantime.
|
||||||
// filename could change in the meantime.
|
Project *project = SessionManager::projectForFile(fileName);
|
||||||
ProjectExplorer::Project *project = pe->session()->projectForFile(fileName);
|
|
||||||
|
|
||||||
// Does the file belong to a project?
|
// Does the file belong to a project?
|
||||||
if (project) {
|
if (project) {
|
||||||
|
@@ -107,12 +107,12 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent)
|
|||||||
this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
|
this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
|
||||||
|
|
||||||
// listen to project add, remove and startup changes to udate start button
|
// listen to project add, remove and startup changes to udate start button
|
||||||
SessionManager *session = ProjectExplorerPlugin::instance()->session();
|
QObject *sessionManager = SessionManager::instance();
|
||||||
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)), this,
|
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)), this,
|
||||||
SLOT(projectAdded(ProjectExplorer::Project*)));
|
SLOT(projectAdded(ProjectExplorer::Project*)));
|
||||||
connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), this,
|
connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)), this,
|
||||||
SLOT(projectRemoved(ProjectExplorer::Project*)));
|
SLOT(projectRemoved(ProjectExplorer::Project*)));
|
||||||
connect(session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(projectChanged(ProjectExplorer::Project*)));
|
this, SLOT(projectChanged(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
connect(m_qemuProcess, SIGNAL(error(QProcess::ProcessError)), this,
|
connect(m_qemuProcess, SIGNAL(error(QProcess::ProcessError)), this,
|
||||||
@@ -283,10 +283,8 @@ void MaemoQemuManager::systemChanged()
|
|||||||
void MaemoQemuManager::environmentChanged()
|
void MaemoQemuManager::environmentChanged()
|
||||||
{
|
{
|
||||||
// likely to happen when the Qt version changes the build config is using
|
// likely to happen when the Qt version changes the build config is using
|
||||||
if (ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance()) {
|
if (Project *project = SessionManager::startupProject())
|
||||||
if (Project *project = explorer->session()->startupProject())
|
|
||||||
toggleStarterButton(project->activeTarget());
|
toggleStarterButton(project->activeTarget());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoQemuManager::deviceConfigurationChanged(ProjectExplorer::Target *target)
|
void MaemoQemuManager::deviceConfigurationChanged(ProjectExplorer::Target *target)
|
||||||
@@ -297,7 +295,7 @@ void MaemoQemuManager::deviceConfigurationChanged(ProjectExplorer::Target *targe
|
|||||||
void MaemoQemuManager::startRuntime()
|
void MaemoQemuManager::startRuntime()
|
||||||
{
|
{
|
||||||
m_userTerminated = false;
|
m_userTerminated = false;
|
||||||
Project *p = ProjectExplorerPlugin::instance()->session()->startupProject();
|
Project *p = SessionManager::startupProject();
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
BaseQtVersion *version;
|
BaseQtVersion *version;
|
||||||
@@ -470,8 +468,7 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
|
|||||||
if (m_runningQtId == uniqueId)
|
if (m_runningQtId == uniqueId)
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
||||||
const Project * const p
|
const Project * const p = SessionManager::startupProject();
|
||||||
= ProjectExplorerPlugin::instance()->session()->startupProject();
|
|
||||||
const bool qemuButtonEnabled
|
const bool qemuButtonEnabled
|
||||||
= p && p->activeTarget() && MaemoGlobal::hasMaemoDevice(target->kit())
|
= p && p->activeTarget() && MaemoGlobal::hasMaemoDevice(target->kit())
|
||||||
&& m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid()
|
&& m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid()
|
||||||
@@ -482,9 +479,7 @@ void MaemoQemuManager::toggleStarterButton(Target *target)
|
|||||||
|
|
||||||
bool MaemoQemuManager::sessionHasMaemoTarget() const
|
bool MaemoQemuManager::sessionHasMaemoTarget() const
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance();
|
foreach (const Project *p, SessionManager::projects()) {
|
||||||
const QList<Project*> &projects = explorer->session()->projects();
|
|
||||||
foreach (const Project *p, projects) {
|
|
||||||
foreach (const Target * const target, p->targets()) {
|
foreach (const Target * const target, p->targets()) {
|
||||||
if (MaemoGlobal::hasMaemoDevice(target->kit()))
|
if (MaemoGlobal::hasMaemoDevice(target->kit()))
|
||||||
return true;
|
return true;
|
||||||
|
@@ -37,8 +37,7 @@ using namespace Locator;
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
|
AllProjectsFilter::AllProjectsFilter() : m_filesUpToDate(false)
|
||||||
: m_projectExplorer(pe), m_filesUpToDate(false)
|
|
||||||
{
|
{
|
||||||
setId("Files in any project");
|
setId("Files in any project");
|
||||||
setDisplayName(tr("Files in Any Project"));
|
setDisplayName(tr("Files in Any Project"));
|
||||||
@@ -46,7 +45,7 @@ AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
|
|||||||
setPriority(Low);
|
setPriority(Low);
|
||||||
setIncludedByDefault(true);
|
setIncludedByDefault(true);
|
||||||
|
|
||||||
connect(m_projectExplorer, SIGNAL(fileListChanged()),
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(fileListChanged()),
|
||||||
this, SLOT(markFilesAsOutOfDate()));
|
this, SLOT(markFilesAsOutOfDate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +60,7 @@ void AllProjectsFilter::updateFiles()
|
|||||||
return;
|
return;
|
||||||
m_filesUpToDate = true;
|
m_filesUpToDate = true;
|
||||||
files().clear();
|
files().clear();
|
||||||
foreach (Project *project, m_projectExplorer->session()->projects())
|
foreach (Project *project, SessionManager::projects())
|
||||||
files().append(project->files(Project::AllFiles));
|
files().append(project->files(Project::AllFiles));
|
||||||
qSort(files());
|
qSort(files());
|
||||||
generateFileNames();
|
generateFileNames();
|
||||||
|
@@ -35,9 +35,6 @@
|
|||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class ProjectExplorerPlugin;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AllProjectsFilter : public Locator::BaseFileFilter
|
class AllProjectsFilter : public Locator::BaseFileFilter
|
||||||
@@ -45,7 +42,7 @@ class AllProjectsFilter : public Locator::BaseFileFilter
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AllProjectsFilter(ProjectExplorerPlugin *pe);
|
AllProjectsFilter();
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -53,8 +50,8 @@ protected:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void markFilesAsOutOfDate();
|
void markFilesAsOutOfDate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorerPlugin *m_projectExplorer;
|
|
||||||
bool m_filesUpToDate;
|
bool m_filesUpToDate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -48,11 +48,10 @@ using namespace ProjectExplorer;
|
|||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
AllProjectsFind::AllProjectsFind(ProjectExplorerPlugin *plugin)
|
AllProjectsFind::AllProjectsFind()
|
||||||
: m_plugin(plugin),
|
: m_configWidget(0)
|
||||||
m_configWidget(0)
|
|
||||||
{
|
{
|
||||||
connect(m_plugin, SIGNAL(fileListChanged()), this, SLOT(handleFileListChanged()));
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(fileListChanged()), this, SLOT(handleFileListChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AllProjectsFind::id() const
|
QString AllProjectsFind::id() const
|
||||||
@@ -67,15 +66,14 @@ QString AllProjectsFind::displayName() const
|
|||||||
|
|
||||||
bool AllProjectsFind::isEnabled() const
|
bool AllProjectsFind::isEnabled() const
|
||||||
{
|
{
|
||||||
return BaseFileFind::isEnabled()
|
return BaseFileFind::isEnabled() && SessionManager::hasProjects();
|
||||||
&& m_plugin->session()->projects().count() > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileIterator *AllProjectsFind::files(const QStringList &nameFilters,
|
Utils::FileIterator *AllProjectsFind::files(const QStringList &nameFilters,
|
||||||
const QVariant &additionalParameters) const
|
const QVariant &additionalParameters) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(additionalParameters)
|
Q_UNUSED(additionalParameters)
|
||||||
return filesForProjects(nameFilters, m_plugin->session()->projects());
|
return filesForProjects(nameFilters, SessionManager::projects());
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFilters,
|
Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFilters,
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class ProjectExplorerPlugin;
|
|
||||||
class Project;
|
class Project;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -46,7 +45,7 @@ class AllProjectsFind : public TextEditor::BaseFileFind
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AllProjectsFind(ProjectExplorerPlugin *plugin);
|
AllProjectsFind();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
@@ -71,7 +70,6 @@ private slots:
|
|||||||
void handleFileListChanged();
|
void handleFileListChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorerPlugin *m_plugin;
|
|
||||||
QPointer<QWidget> m_configWidget;
|
QPointer<QWidget> m_configWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -167,7 +167,7 @@ AppOutputPane::AppOutputPane() :
|
|||||||
|
|
||||||
m_mainWidget->setLayout(layout);
|
m_mainWidget->setLayout(layout);
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance()->session(), SIGNAL(aboutToUnloadSession(QString)),
|
connect(SessionManager::instance(), SIGNAL(aboutToUnloadSession(QString)),
|
||||||
this, SLOT(aboutToUnloadSession()));
|
this, SLOT(aboutToUnloadSession()));
|
||||||
connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
||||||
this, SLOT(updateFromSettings()));
|
this, SLOT(updateFromSettings()));
|
||||||
|
@@ -111,7 +111,7 @@ BuildManagerPrivate::BuildManagerPrivate() :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAction)
|
BuildManager::BuildManager(QObject *parent, QAction *cancelBuildAction)
|
||||||
: QObject(parent), d(new BuildManagerPrivate)
|
: QObject(parent), d(new BuildManagerPrivate)
|
||||||
{
|
{
|
||||||
connect(&d->m_watcher, SIGNAL(finished()),
|
connect(&d->m_watcher, SIGNAL(finished()),
|
||||||
@@ -124,7 +124,7 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAc
|
|||||||
connect(&d->m_watcher, SIGNAL(progressRangeChanged(int,int)),
|
connect(&d->m_watcher, SIGNAL(progressRangeChanged(int,int)),
|
||||||
this, SLOT(progressChanged()));
|
this, SLOT(progressChanged()));
|
||||||
|
|
||||||
connect(parent->session(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
connect(SessionManager::instance(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
||||||
this, SLOT(aboutToRemoveProject(ProjectExplorer::Project*)));
|
this, SLOT(aboutToRemoveProject(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
d->m_outputWindow = new Internal::CompileOutputWindow(this, cancelBuildAction);
|
d->m_outputWindow = new Internal::CompileOutputWindow(this, cancelBuildAction);
|
||||||
|
@@ -48,7 +48,7 @@ class PROJECTEXPLORER_EXPORT BuildManager : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAction);
|
explicit BuildManager(QObject *parent, QAction *cancelBuildAction);
|
||||||
virtual ~BuildManager();
|
virtual ~BuildManager();
|
||||||
|
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
@@ -38,8 +38,8 @@ using namespace Locator;
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe)
|
CurrentProjectFilter::CurrentProjectFilter()
|
||||||
: BaseFileFilter(), m_projectExplorer(pe), m_project(0), m_filesUpToDate(false)
|
: BaseFileFilter(), m_project(0), m_filesUpToDate(false)
|
||||||
{
|
{
|
||||||
setId("Files in current project");
|
setId("Files in current project");
|
||||||
setDisplayName(tr("Files in Current Project"));
|
setDisplayName(tr("Files in Current Project"));
|
||||||
@@ -47,7 +47,7 @@ CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe)
|
|||||||
setShortcutString(QString(QLatin1Char('p')));
|
setShortcutString(QString(QLatin1Char('p')));
|
||||||
setIncludedByDefault(false);
|
setIncludedByDefault(false);
|
||||||
|
|
||||||
connect(m_projectExplorer, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(currentProjectChanged(ProjectExplorer::Project*)));
|
this, SLOT(currentProjectChanged(ProjectExplorer::Project*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class ProjectExplorerPlugin;
|
|
||||||
class Project;
|
class Project;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -46,7 +45,7 @@ class CurrentProjectFilter : public Locator::BaseFileFilter
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CurrentProjectFilter(ProjectExplorerPlugin *pe);
|
CurrentProjectFilter();
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -57,7 +56,6 @@ private slots:
|
|||||||
void markFilesAsOutOfDate();
|
void markFilesAsOutOfDate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorerPlugin *m_projectExplorer;
|
|
||||||
Project *m_project;
|
Project *m_project;
|
||||||
bool m_filesUpToDate;
|
bool m_filesUpToDate;
|
||||||
};
|
};
|
||||||
|
@@ -44,15 +44,13 @@ using namespace ProjectExplorer;
|
|||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
CurrentProjectFind::CurrentProjectFind(ProjectExplorerPlugin *plugin)
|
CurrentProjectFind::CurrentProjectFind()
|
||||||
: AllProjectsFind(plugin),
|
|
||||||
m_plugin(plugin)
|
|
||||||
{
|
{
|
||||||
connect(m_plugin, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(handleProjectChanged()));
|
this, SLOT(handleProjectChanged()));
|
||||||
connect(m_plugin->session(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
connect(SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
this, SLOT(handleProjectChanged()));
|
this, SLOT(handleProjectChanged()));
|
||||||
connect(m_plugin->session(), SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
connect(SessionManager::instance(), SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
this, SLOT(handleProjectChanged()));
|
this, SLOT(handleProjectChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +81,8 @@ Utils::FileIterator *CurrentProjectFind::files(const QStringList &nameFilters,
|
|||||||
const QVariant &additionalParameters) const
|
const QVariant &additionalParameters) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(additionalParameters.isValid(), return new Utils::FileIterator());
|
QTC_ASSERT(additionalParameters.isValid(), return new Utils::FileIterator());
|
||||||
QList<Project *> allProjects = m_plugin->session()->projects();
|
|
||||||
QString projectFile = additionalParameters.toString();
|
QString projectFile = additionalParameters.toString();
|
||||||
foreach (Project *project, allProjects) {
|
foreach (Project *project, SessionManager::projects()) {
|
||||||
if (project->document() && projectFile == project->projectFilePath())
|
if (project->document() && projectFile == project->projectFilePath())
|
||||||
return filesForProjects(nameFilters, QList<Project *>() << project);
|
return filesForProjects(nameFilters, QList<Project *>() << project);
|
||||||
}
|
}
|
||||||
@@ -109,8 +106,7 @@ void CurrentProjectFind::recheckEnabled()
|
|||||||
if (!search)
|
if (!search)
|
||||||
return;
|
return;
|
||||||
QString projectFile = getAdditionalParameters(search).toString();
|
QString projectFile = getAdditionalParameters(search).toString();
|
||||||
QList<Project *> allProjects = m_plugin->session()->projects();
|
foreach (Project *project, SessionManager::projects()) {
|
||||||
foreach (Project *project, allProjects) {
|
|
||||||
if (projectFile == project->projectFilePath()) {
|
if (projectFile == project->projectFilePath()) {
|
||||||
search->setSearchAgainEnabled(true);
|
search->setSearchAgainEnabled(true);
|
||||||
return;
|
return;
|
||||||
|
@@ -32,13 +32,8 @@
|
|||||||
|
|
||||||
#include "allprojectsfind.h"
|
#include "allprojectsfind.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QWidget;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class ProjectExplorerPlugin;
|
|
||||||
class Project;
|
class Project;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -48,7 +43,7 @@ class CurrentProjectFind : public AllProjectsFind
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CurrentProjectFind(ProjectExplorerPlugin *plugin);
|
CurrentProjectFind();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
@@ -67,9 +62,6 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
void handleProjectChanged();
|
void handleProjectChanged();
|
||||||
void recheckEnabled();
|
void recheckEnabled();
|
||||||
|
|
||||||
private:
|
|
||||||
ProjectExplorerPlugin *m_plugin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -248,12 +248,11 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
|
|||||||
d->m_useGlobal = use;
|
d->m_useGlobal = use;
|
||||||
d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal
|
d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal
|
||||||
? TextEditorSettings::instance()->codeStyle() : 0);
|
? TextEditorSettings::instance()->codeStyle() : 0);
|
||||||
const SessionManager *session = ProjectExplorerPlugin::instance()->session();
|
|
||||||
QList<Core::IEditor *> opened = Core::EditorManager::documentModel()->editorsForDocuments(
|
QList<Core::IEditor *> opened = Core::EditorManager::documentModel()->editorsForDocuments(
|
||||||
Core::EditorManager::documentModel()->openedDocuments());
|
Core::EditorManager::documentModel()->openedDocuments());
|
||||||
foreach (Core::IEditor *editor, opened) {
|
foreach (Core::IEditor *editor, opened) {
|
||||||
if (BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(editor->widget())) {
|
if (BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(editor->widget())) {
|
||||||
Project *project = session->projectForFile(editor->document()->filePath());
|
Project *project = SessionManager::projectForFile(editor->document()->filePath());
|
||||||
if (project && project->editorConfiguration() == this)
|
if (project && project->editorConfiguration() == this)
|
||||||
switchSettings(baseTextEditor);
|
switchSettings(baseTextEditor);
|
||||||
}
|
}
|
||||||
@@ -326,18 +325,13 @@ void EditorConfiguration::setTextCodec(QTextCodec *textCodec)
|
|||||||
d->m_textCodec = textCodec;
|
d->m_textCodec = textCodec;
|
||||||
}
|
}
|
||||||
|
|
||||||
TabSettings actualTabSettings(const QString &fileName,
|
TabSettings actualTabSettings(const QString &fileName, const BaseTextEditorWidget *baseTextEditor)
|
||||||
const BaseTextEditorWidget *baseTextEditor)
|
|
||||||
{
|
{
|
||||||
if (baseTextEditor) {
|
if (baseTextEditor)
|
||||||
return baseTextEditor->tabSettings();
|
return baseTextEditor->tabSettings();
|
||||||
} else {
|
if (Project *project = SessionManager::projectForFile(fileName))
|
||||||
const SessionManager *session = ProjectExplorerPlugin::instance()->session();
|
|
||||||
if (Project *project = session->projectForFile(fileName))
|
|
||||||
return project->editorConfiguration()->codeStyle()->tabSettings();
|
return project->editorConfiguration()->codeStyle()->tabSettings();
|
||||||
else
|
|
||||||
return TextEditorSettings::instance()->codeStyle()->tabSettings();
|
return TextEditorSettings::instance()->codeStyle()->tabSettings();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ProjectExplorer
|
} // ProjectExplorer
|
||||||
|
@@ -267,7 +267,7 @@ void ProjectListWidget::addProject(Project *project)
|
|||||||
item->setText(displayName);
|
item->setText(displayName);
|
||||||
insertItem(pos, item);
|
insertItem(pos, item);
|
||||||
|
|
||||||
if (project == ProjectExplorerPlugin::instance()->startupProject())
|
if (project == SessionManager::startupProject())
|
||||||
setCurrentItem(item);
|
setCurrentItem(item);
|
||||||
|
|
||||||
QFontMetrics fn(font());
|
QFontMetrics fn(font());
|
||||||
@@ -1389,10 +1389,10 @@ void MiniProjectTargetSelector::updateActionAndSummary()
|
|||||||
QString runConfig;
|
QString runConfig;
|
||||||
QIcon targetIcon = style()->standardIcon(QStyle::SP_ComputerIcon);
|
QIcon targetIcon = style()->standardIcon(QStyle::SP_ComputerIcon);
|
||||||
|
|
||||||
Project *project = ProjectExplorerPlugin::instance()->startupProject();
|
Project *project = SessionManager::startupProject();
|
||||||
if (project) {
|
if (project) {
|
||||||
projectName = project->displayName();
|
projectName = project->displayName();
|
||||||
foreach (Project *p, ProjectExplorerPlugin::instance()->session()->projects()) {
|
foreach (Project *p, SessionManager::projects()) {
|
||||||
if (p != project && p->displayName() == projectName) {
|
if (p != project && p->displayName() == projectName) {
|
||||||
fileName = project->projectFilePath();
|
fileName = project->projectFilePath();
|
||||||
break;
|
break;
|
||||||
|
@@ -408,11 +408,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
connect(d->m_outputPane, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)),
|
connect(d->m_outputPane, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)),
|
||||||
this, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)));
|
this, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)));
|
||||||
|
|
||||||
AllProjectsFilter *allProjectsFilter = new AllProjectsFilter(this);
|
addAutoReleasedObject(new AllProjectsFilter);
|
||||||
addAutoReleasedObject(allProjectsFilter);
|
addAutoReleasedObject(new CurrentProjectFilter);
|
||||||
|
|
||||||
CurrentProjectFilter *currentProjectFilter = new CurrentProjectFilter(this);
|
|
||||||
addAutoReleasedObject(currentProjectFilter);
|
|
||||||
|
|
||||||
addAutoReleasedObject(new BuildSettingsPanelFactory);
|
addAutoReleasedObject(new BuildSettingsPanelFactory);
|
||||||
addAutoReleasedObject(new RunSettingsPanelFactory);
|
addAutoReleasedObject(new RunSettingsPanelFactory);
|
||||||
@@ -420,14 +417,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
addAutoReleasedObject(new CodeStyleSettingsPanelFactory);
|
addAutoReleasedObject(new CodeStyleSettingsPanelFactory);
|
||||||
addAutoReleasedObject(new DependenciesPanelFactory(d->m_session));
|
addAutoReleasedObject(new DependenciesPanelFactory(d->m_session));
|
||||||
|
|
||||||
ProcessStepFactory *processStepFactory = new ProcessStepFactory;
|
addAutoReleasedObject(new ProcessStepFactory);
|
||||||
addAutoReleasedObject(processStepFactory);
|
|
||||||
|
|
||||||
AllProjectsFind *allProjectsFind = new AllProjectsFind(this);
|
addAutoReleasedObject(new AllProjectsFind);
|
||||||
addAutoReleasedObject(allProjectsFind);
|
addAutoReleasedObject(new CurrentProjectFind);
|
||||||
|
|
||||||
CurrentProjectFind *currentProjectFind = new CurrentProjectFind(this);
|
|
||||||
addAutoReleasedObject(currentProjectFind);
|
|
||||||
|
|
||||||
addAutoReleasedObject(new LocalApplicationRunControlFactory);
|
addAutoReleasedObject(new LocalApplicationRunControlFactory);
|
||||||
|
|
||||||
@@ -1353,7 +1346,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
|
|||||||
QFileInfo fi = QFileInfo(fileName);
|
QFileInfo fi = QFileInfo(fileName);
|
||||||
QString canonicalFilePath = fi.canonicalFilePath();
|
QString canonicalFilePath = fi.canonicalFilePath();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach (ProjectExplorer::Project *pi, session()->projects()) {
|
foreach (Project *pi, SessionManager::projects()) {
|
||||||
if (canonicalFilePath == pi->projectFilePath()) {
|
if (canonicalFilePath == pi->projectFilePath()) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@@ -1451,19 +1444,6 @@ void ProjectExplorerPlugin::setCurrentNode(Node *node)
|
|||||||
setCurrent(d->m_session->projectForNode(node), QString(), node);
|
setCurrent(d->m_session->projectForNode(node), QString(), node);
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionManager *ProjectExplorerPlugin::session() const
|
|
||||||
{
|
|
||||||
return d->m_session;
|
|
||||||
}
|
|
||||||
|
|
||||||
Project *ProjectExplorerPlugin::startupProject() const
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
qDebug() << "ProjectExplorerPlugin::startupProject";
|
|
||||||
|
|
||||||
return d->m_session->startupProject();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProjectExplorerPlugin::updateWelcomePage()
|
void ProjectExplorerPlugin::updateWelcomePage()
|
||||||
{
|
{
|
||||||
d->m_welcomePage->reloadWelcomeScreenData();
|
d->m_welcomePage->reloadWelcomeScreenData();
|
||||||
@@ -1848,11 +1828,12 @@ void ProjectExplorerPlugin::updateActions()
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "ProjectExplorerPlugin::updateActions";
|
qDebug() << "ProjectExplorerPlugin::updateActions";
|
||||||
|
|
||||||
QPair<bool, QString> buildActionState = buildSettingsEnabled(startupProject());
|
Project *project = SessionManager::startupProject();
|
||||||
|
|
||||||
|
QPair<bool, QString> buildActionState = buildSettingsEnabled(project);
|
||||||
QPair<bool, QString> buildActionContextState = buildSettingsEnabled(d->m_currentProject);
|
QPair<bool, QString> buildActionContextState = buildSettingsEnabled(d->m_currentProject);
|
||||||
QPair<bool, QString> buildSessionState = buildSettingsEnabledForSession();
|
QPair<bool, QString> buildSessionState = buildSettingsEnabledForSession();
|
||||||
|
|
||||||
Project *project = startupProject();
|
|
||||||
QString projectName = project ? project->displayName() : QString();
|
QString projectName = project ? project->displayName() : QString();
|
||||||
QString projectNameContextMenu = d->m_currentProject ? d->m_currentProject->displayName() : QString();
|
QString projectNameContextMenu = d->m_currentProject ? d->m_currentProject->displayName() : QString();
|
||||||
|
|
||||||
@@ -1875,7 +1856,7 @@ void ProjectExplorerPlugin::updateActions()
|
|||||||
// Context menu actions
|
// Context menu actions
|
||||||
d->m_setStartupProjectAction->setParameter(projectNameContextMenu);
|
d->m_setStartupProjectAction->setParameter(projectNameContextMenu);
|
||||||
|
|
||||||
bool hasDependencies = session()->projectOrder(d->m_currentProject).size() > 1;
|
bool hasDependencies = SessionManager::projectOrder(d->m_currentProject).size() > 1;
|
||||||
if (hasDependencies) {
|
if (hasDependencies) {
|
||||||
d->m_buildActionContextMenu->setText(tr("Build Without Dependencies"));
|
d->m_buildActionContextMenu->setText(tr("Build Without Dependencies"));
|
||||||
d->m_rebuildActionContextMenu->setText(tr("Rebuild Without Dependencies"));
|
d->m_rebuildActionContextMenu->setText(tr("Rebuild Without Dependencies"));
|
||||||
@@ -1929,9 +1910,10 @@ void ProjectExplorerPlugin::updateActions()
|
|||||||
}
|
}
|
||||||
d->m_publishAction->setEnabled(canPublish);
|
d->m_publishAction->setEnabled(canPublish);
|
||||||
|
|
||||||
d->m_projectSelectorAction->setEnabled(!session()->projects().isEmpty());
|
const bool hasProjects = SessionManager::hasProjects();
|
||||||
d->m_projectSelectorActionMenu->setEnabled(!session()->projects().isEmpty());
|
d->m_projectSelectorAction->setEnabled(hasProjects);
|
||||||
d->m_projectSelectorActionQuick->setEnabled(!session()->projects().isEmpty());
|
d->m_projectSelectorActionMenu->setEnabled(hasProjects);
|
||||||
|
d->m_projectSelectorActionQuick->setEnabled(hasProjects);
|
||||||
|
|
||||||
updateDeployActions();
|
updateDeployActions();
|
||||||
updateRunWithoutDeployMenu();
|
updateRunWithoutDeployMenu();
|
||||||
@@ -1945,7 +1927,7 @@ QStringList ProjectExplorerPlugin::allFilesWithDependencies(Project *pro)
|
|||||||
qDebug() << "ProjectExplorerPlugin::allFilesWithDependencies(" << pro->projectFilePath() << ")";
|
qDebug() << "ProjectExplorerPlugin::allFilesWithDependencies(" << pro->projectFilePath() << ")";
|
||||||
|
|
||||||
QStringList filesToSave;
|
QStringList filesToSave;
|
||||||
foreach (Project *p, d->m_session->projectOrder(pro)) {
|
foreach (Project *p, SessionManager::projectOrder(pro)) {
|
||||||
FindAllFilesVisitor filesVisitor;
|
FindAllFilesVisitor filesVisitor;
|
||||||
p->rootProjectNode()->accept(&filesVisitor);
|
p->rootProjectNode()->accept(&filesVisitor);
|
||||||
filesToSave << filesVisitor.filePaths();
|
filesToSave << filesVisitor.filePaths();
|
||||||
@@ -2054,7 +2036,7 @@ int ProjectExplorerPlugin::queue(QList<Project *> projects, QList<Id> stepIds)
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::buildProjectOnly()
|
void ProjectExplorerPlugin::buildProjectOnly()
|
||||||
{
|
{
|
||||||
queue(QList<Project *>() << session()->startupProject(), QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
|
queue(QList<Project *>() << SessionManager::startupProject(), QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::buildProject(ProjectExplorer::Project *p)
|
void ProjectExplorerPlugin::buildProject(ProjectExplorer::Project *p)
|
||||||
@@ -2070,7 +2052,7 @@ void ProjectExplorerPlugin::requestProjectModeUpdate(Project *p)
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::buildProject()
|
void ProjectExplorerPlugin::buildProject()
|
||||||
{
|
{
|
||||||
queue(d->m_session->projectOrder(session()->startupProject()),
|
queue(SessionManager::projectOrder(SessionManager::startupProject()),
|
||||||
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
|
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2088,13 +2070,13 @@ void ProjectExplorerPlugin::buildSession()
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::rebuildProjectOnly()
|
void ProjectExplorerPlugin::rebuildProjectOnly()
|
||||||
{
|
{
|
||||||
queue(QList<Project *>() << session()->startupProject(),
|
queue(QList<Project *>() << SessionManager::startupProject(),
|
||||||
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
|
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::rebuildProject()
|
void ProjectExplorerPlugin::rebuildProject()
|
||||||
{
|
{
|
||||||
queue(d->m_session->projectOrder(session()->startupProject()),
|
queue(SessionManager::projectOrder(SessionManager::startupProject()),
|
||||||
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
|
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2106,18 +2088,18 @@ void ProjectExplorerPlugin::rebuildProjectContextMenu()
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::rebuildSession()
|
void ProjectExplorerPlugin::rebuildSession()
|
||||||
{
|
{
|
||||||
queue(d->m_session->projectOrder(),
|
queue(SessionManager::projectOrder(),
|
||||||
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
|
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN) << Id(Constants::BUILDSTEPS_BUILD));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::deployProjectOnly()
|
void ProjectExplorerPlugin::deployProjectOnly()
|
||||||
{
|
{
|
||||||
deploy(QList<Project *>() << session()->startupProject());
|
deploy(QList<Project *>() << SessionManager::startupProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::deployProject()
|
void ProjectExplorerPlugin::deployProject()
|
||||||
{
|
{
|
||||||
deploy(d->m_session->projectOrder(session()->startupProject()));
|
deploy(SessionManager::projectOrder(SessionManager::startupProject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::deployProjectContextMenu()
|
void ProjectExplorerPlugin::deployProjectContextMenu()
|
||||||
@@ -2132,13 +2114,13 @@ void ProjectExplorerPlugin::deploySession()
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::cleanProjectOnly()
|
void ProjectExplorerPlugin::cleanProjectOnly()
|
||||||
{
|
{
|
||||||
queue(QList<Project *>() << session()->startupProject(),
|
queue(QList<Project *>() << SessionManager::startupProject(),
|
||||||
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
|
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::cleanProject()
|
void ProjectExplorerPlugin::cleanProject()
|
||||||
{
|
{
|
||||||
queue(d->m_session->projectOrder(session()->startupProject()),
|
queue(SessionManager::projectOrder(SessionManager::startupProject()),
|
||||||
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
|
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2156,12 +2138,12 @@ void ProjectExplorerPlugin::cleanSession()
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::runProject()
|
void ProjectExplorerPlugin::runProject()
|
||||||
{
|
{
|
||||||
runProject(startupProject(), NormalRunMode);
|
runProject(SessionManager::startupProject(), NormalRunMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::runProjectWithoutDeploy()
|
void ProjectExplorerPlugin::runProjectWithoutDeploy()
|
||||||
{
|
{
|
||||||
runProject(startupProject(), NormalRunMode, true);
|
runProject(SessionManager::startupProject(), NormalRunMode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::runProjectContextMenu()
|
void ProjectExplorerPlugin::runProjectContextMenu()
|
||||||
@@ -2342,7 +2324,7 @@ void ProjectExplorerPlugin::projectAdded(ProjectExplorer::Project *pro)
|
|||||||
void ProjectExplorerPlugin::projectRemoved(ProjectExplorer::Project * pro)
|
void ProjectExplorerPlugin::projectRemoved(ProjectExplorer::Project * pro)
|
||||||
{
|
{
|
||||||
if (d->m_projectsMode)
|
if (d->m_projectsMode)
|
||||||
d->m_projectsMode->setEnabled(!session()->projects().isEmpty());
|
d->m_projectsMode->setEnabled(SessionManager::hasProjects());
|
||||||
// more specific action en and disabling ?
|
// more specific action en and disabling ?
|
||||||
disconnect(pro, SIGNAL(buildConfigurationEnabledChanged()),
|
disconnect(pro, SIGNAL(buildConfigurationEnabledChanged()),
|
||||||
this, SLOT(updateActions()));
|
this, SLOT(updateActions()));
|
||||||
@@ -2357,7 +2339,7 @@ void ProjectExplorerPlugin::projectDisplayNameChanged(Project *pro)
|
|||||||
void ProjectExplorerPlugin::startupProjectChanged()
|
void ProjectExplorerPlugin::startupProjectChanged()
|
||||||
{
|
{
|
||||||
static QPointer<Project> previousStartupProject = 0;
|
static QPointer<Project> previousStartupProject = 0;
|
||||||
Project *project = startupProject();
|
Project *project = SessionManager::startupProject();
|
||||||
if (project == previousStartupProject)
|
if (project == previousStartupProject)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2381,8 +2363,9 @@ void ProjectExplorerPlugin::activeTargetChanged()
|
|||||||
{
|
{
|
||||||
static QPointer<Target> previousTarget = 0;
|
static QPointer<Target> previousTarget = 0;
|
||||||
Target *target = 0;
|
Target *target = 0;
|
||||||
if (startupProject())
|
Project *startupProject = SessionManager::startupProject();
|
||||||
target = startupProject()->activeTarget();
|
if (startupProject)
|
||||||
|
target = startupProject->activeTarget();
|
||||||
if (target == previousTarget)
|
if (target == previousTarget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2404,8 +2387,9 @@ void ProjectExplorerPlugin::activeRunConfigurationChanged()
|
|||||||
{
|
{
|
||||||
static QPointer<RunConfiguration> previousRunConfiguration = 0;
|
static QPointer<RunConfiguration> previousRunConfiguration = 0;
|
||||||
RunConfiguration *rc = 0;
|
RunConfiguration *rc = 0;
|
||||||
if (startupProject() && startupProject()->activeTarget())
|
Project *startupProject = SessionManager::startupProject();
|
||||||
rc = startupProject()->activeTarget()->activeRunConfiguration();
|
if (startupProject && startupProject->activeTarget())
|
||||||
|
rc = startupProject->activeTarget()->activeRunConfiguration();
|
||||||
if (rc == previousRunConfiguration)
|
if (rc == previousRunConfiguration)
|
||||||
return;
|
return;
|
||||||
if (previousRunConfiguration) {
|
if (previousRunConfiguration) {
|
||||||
@@ -2432,7 +2416,7 @@ IRunControlFactory *ProjectExplorerPlugin::findRunControlFactory(RunConfiguratio
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::updateDeployActions()
|
void ProjectExplorerPlugin::updateDeployActions()
|
||||||
{
|
{
|
||||||
Project *project = startupProject();
|
Project *project = SessionManager::startupProject();
|
||||||
|
|
||||||
bool enableDeployActions = project
|
bool enableDeployActions = project
|
||||||
&& ! (d->m_buildManager->isBuilding(project))
|
&& ! (d->m_buildManager->isBuilding(project))
|
||||||
@@ -2451,8 +2435,7 @@ void ProjectExplorerPlugin::updateDeployActions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QString projectName = project ? project->displayName() : QString();
|
const QString projectName = project ? project->displayName() : QString();
|
||||||
const QString projectNameContextMenu = d->m_currentProject ? d->m_currentProject->displayName() : QString();
|
bool hasProjects = SessionManager::hasProjects();
|
||||||
bool hasProjects = !d->m_session->projects().isEmpty();
|
|
||||||
|
|
||||||
d->m_deployAction->setParameter(projectName);
|
d->m_deployAction->setParameter(projectName);
|
||||||
d->m_deployAction->setEnabled(enableDeployActions);
|
d->m_deployAction->setEnabled(enableDeployActions);
|
||||||
@@ -2547,7 +2530,7 @@ QString ProjectExplorerPlugin::cannotRunReason(Project *project, RunMode runMode
|
|||||||
|
|
||||||
void ProjectExplorerPlugin::slotUpdateRunActions()
|
void ProjectExplorerPlugin::slotUpdateRunActions()
|
||||||
{
|
{
|
||||||
Project *project = startupProject();
|
Project *project = SessionManager::startupProject();
|
||||||
const bool state = canRun(project, NormalRunMode);
|
const bool state = canRun(project, NormalRunMode);
|
||||||
d->m_runAction->setEnabled(state);
|
d->m_runAction->setEnabled(state);
|
||||||
d->m_runAction->setToolTip(cannotRunReason(project, NormalRunMode));
|
d->m_runAction->setToolTip(cannotRunReason(project, NormalRunMode));
|
||||||
|
@@ -51,7 +51,6 @@ class Id;
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class BuildManager;
|
class BuildManager;
|
||||||
class RunControl;
|
class RunControl;
|
||||||
class SessionManager;
|
|
||||||
class RunConfiguration;
|
class RunConfiguration;
|
||||||
class IRunControlFactory;
|
class IRunControlFactory;
|
||||||
class Project;
|
class Project;
|
||||||
@@ -81,16 +80,12 @@ public:
|
|||||||
Q_SLOT void openProjectWelcomePage(const QString &fileName);
|
Q_SLOT void openProjectWelcomePage(const QString &fileName);
|
||||||
void unloadProject(Project *project);
|
void unloadProject(Project *project);
|
||||||
|
|
||||||
SessionManager *session() const;
|
|
||||||
|
|
||||||
static Project *currentProject();
|
static Project *currentProject();
|
||||||
Node *currentNode() const;
|
Node *currentNode() const;
|
||||||
|
|
||||||
void setCurrentFile(Project *project, const QString &file);
|
void setCurrentFile(Project *project, const QString &file);
|
||||||
void setCurrentNode(Node *node);
|
void setCurrentNode(Node *node);
|
||||||
|
|
||||||
Project *startupProject() const;
|
|
||||||
|
|
||||||
BuildManager *buildManager() const;
|
BuildManager *buildManager() const;
|
||||||
|
|
||||||
bool saveModifiedFiles();
|
bool saveModifiedFiles();
|
||||||
|
@@ -107,7 +107,7 @@ private:
|
|||||||
ProjectNodeList AllProjectNodesVisitor::allProjects(ProjectNode::ProjectAction action)
|
ProjectNodeList AllProjectNodesVisitor::allProjects(ProjectNode::ProjectAction action)
|
||||||
{
|
{
|
||||||
AllProjectNodesVisitor visitor(action);
|
AllProjectNodesVisitor visitor(action);
|
||||||
ProjectExplorerPlugin::instance()->session()->sessionNode()->accept(&visitor);
|
SessionManager::sessionNode()->accept(&visitor);
|
||||||
return visitor.m_projectNodes;
|
return visitor.m_projectNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,8 +557,7 @@ void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const
|
|||||||
if (projectIndex >= 0 && projectIndex < m_context->projects.size())
|
if (projectIndex >= 0 && projectIndex < m_context->projects.size())
|
||||||
project = m_context->projects.at(projectIndex).node;
|
project = m_context->projects.at(projectIndex).node;
|
||||||
|
|
||||||
ProjectExplorer::Project *baseProject
|
Project *baseProject = SessionManager::projectForNode(project);
|
||||||
= ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForNode(project);
|
|
||||||
|
|
||||||
TextEditor::ICodeStylePreferencesFactory *factory
|
TextEditor::ICodeStylePreferencesFactory *factory
|
||||||
= TextEditor::TextEditorSettings::instance()->codeStyleFactory(languageId);
|
= TextEditor::TextEditorSettings::instance()->codeStyleFactory(languageId);
|
||||||
|
@@ -112,12 +112,12 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
|
|||||||
m_autoSync(false),
|
m_autoSync(false),
|
||||||
m_autoExpand(true)
|
m_autoExpand(true)
|
||||||
{
|
{
|
||||||
m_model = new FlatModel(m_explorer->session()->sessionNode(), this);
|
m_model = new FlatModel(SessionManager::sessionNode(), this);
|
||||||
Project *pro = m_explorer->session()->startupProject();
|
Project *pro = SessionManager::startupProject();
|
||||||
if (pro)
|
if (pro)
|
||||||
m_model->setStartupProject(pro->rootProjectNode());
|
m_model->setStartupProject(pro->rootProjectNode());
|
||||||
NodesWatcher *watcher = new NodesWatcher(this);
|
NodesWatcher *watcher = new NodesWatcher(this);
|
||||||
m_explorer->session()->sessionNode()->registerWatcher(watcher);
|
SessionManager::sessionNode()->registerWatcher(watcher);
|
||||||
|
|
||||||
connect(watcher, SIGNAL(foldersAboutToBeRemoved(FolderNode*,QList<FolderNode*>)),
|
connect(watcher, SIGNAL(foldersAboutToBeRemoved(FolderNode*,QList<FolderNode*>)),
|
||||||
this, SLOT(foldersAboutToBeRemoved(FolderNode*,QList<FolderNode*>)));
|
this, SLOT(foldersAboutToBeRemoved(FolderNode*,QList<FolderNode*>)));
|
||||||
@@ -154,16 +154,18 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
|
|||||||
this, SLOT(handleCurrentItemChange(QModelIndex)));
|
this, SLOT(handleCurrentItemChange(QModelIndex)));
|
||||||
connect(m_view, SIGNAL(customContextMenuRequested(QPoint)),
|
connect(m_view, SIGNAL(customContextMenuRequested(QPoint)),
|
||||||
this, SLOT(showContextMenu(QPoint)));
|
this, SLOT(showContextMenu(QPoint)));
|
||||||
connect(m_explorer->session(), SIGNAL(singleProjectAdded(ProjectExplorer::Project*)),
|
|
||||||
|
QObject *sessionManager = SessionManager::instance();
|
||||||
|
connect(sessionManager, SIGNAL(singleProjectAdded(ProjectExplorer::Project*)),
|
||||||
this, SLOT(handleProjectAdded(ProjectExplorer::Project*)));
|
this, SLOT(handleProjectAdded(ProjectExplorer::Project*)));
|
||||||
connect(m_explorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
this, SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
connect(m_explorer->session(), SIGNAL(aboutToLoadSession(QString)),
|
connect(sessionManager, SIGNAL(aboutToLoadSession(QString)),
|
||||||
this, SLOT(disableAutoExpand()));
|
this, SLOT(disableAutoExpand()));
|
||||||
connect(m_explorer->session(), SIGNAL(sessionLoaded(QString)),
|
connect(sessionManager, SIGNAL(sessionLoaded(QString)),
|
||||||
this, SLOT(loadExpandData()));
|
this, SLOT(loadExpandData()));
|
||||||
connect(m_explorer->session(), SIGNAL(aboutToSaveSession()),
|
connect(sessionManager, SIGNAL(aboutToSaveSession()),
|
||||||
this, SLOT(saveExpandData()));
|
this, SLOT(saveExpandData()));
|
||||||
|
|
||||||
m_toggleSync = new QToolButton;
|
m_toggleSync = new QToolButton;
|
||||||
@@ -184,7 +186,7 @@ void ProjectTreeWidget::disableAutoExpand()
|
|||||||
void ProjectTreeWidget::loadExpandData()
|
void ProjectTreeWidget::loadExpandData()
|
||||||
{
|
{
|
||||||
m_autoExpand = true;
|
m_autoExpand = true;
|
||||||
QStringList data = m_explorer->session()->value(QLatin1String("ProjectTree.ExpandData")).toStringList();
|
QStringList data = SessionManager::value(QLatin1String("ProjectTree.ExpandData")).toStringList();
|
||||||
recursiveLoadExpandData(m_view->rootIndex(), data.toSet());
|
recursiveLoadExpandData(m_view->rootIndex(), data.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +205,7 @@ void ProjectTreeWidget::saveExpandData()
|
|||||||
QStringList data;
|
QStringList data;
|
||||||
recursiveSaveExpandData(m_view->rootIndex(), &data);
|
recursiveSaveExpandData(m_view->rootIndex(), &data);
|
||||||
// TODO if there are multiple ProjectTreeWidgets, the last one saves the data
|
// TODO if there are multiple ProjectTreeWidgets, the last one saves the data
|
||||||
m_explorer->session()->setValue(QLatin1String("ProjectTree.ExpandData"), data);
|
SessionManager::setValue(QLatin1String("ProjectTree.ExpandData"), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectTreeWidget::recursiveSaveExpandData(const QModelIndex &index, QStringList *data)
|
void ProjectTreeWidget::recursiveSaveExpandData(const QModelIndex &index, QStringList *data)
|
||||||
|
@@ -49,8 +49,8 @@
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
SessionModel::SessionModel(SessionManager *manager, QObject *parent)
|
SessionModel::SessionModel(QObject *parent)
|
||||||
: QAbstractListModel(parent), m_manager(manager)
|
: QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roleNames;
|
QHash<int, QByteArray> roleNames;
|
||||||
roleNames[Qt::DisplayRole] = "sessionName";
|
roleNames[Qt::DisplayRole] = "sessionName";
|
||||||
@@ -60,12 +60,12 @@ SessionModel::SessionModel(SessionManager *manager, QObject *parent)
|
|||||||
roleNames[ProjectsPathRole] = "projectsPath";
|
roleNames[ProjectsPathRole] = "projectsPath";
|
||||||
roleNames[ProjectsDisplayRole] = "projectsName";
|
roleNames[ProjectsDisplayRole] = "projectsName";
|
||||||
setRoleNames(roleNames);
|
setRoleNames(roleNames);
|
||||||
connect(manager, SIGNAL(sessionLoaded(QString)), SLOT(resetSessions()));
|
connect(SessionManager::instance(), SIGNAL(sessionLoaded(QString)), SLOT(resetSessions()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int SessionModel::rowCount(const QModelIndex &) const
|
int SessionModel::rowCount(const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return m_manager->sessions().count();
|
return SessionManager::sessions().count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList pathsToBaseNames(const QStringList &paths)
|
QStringList pathsToBaseNames(const QStringList &paths)
|
||||||
@@ -90,26 +90,26 @@ QVariant SessionModel::data(const QModelIndex &index, int role) const
|
|||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole || role == DefaultSessionRole ||
|
if (role == Qt::DisplayRole || role == DefaultSessionRole ||
|
||||||
role == LastSessionRole || role == ActiveSessionRole || role == ProjectsPathRole || role == ProjectsDisplayRole) {
|
role == LastSessionRole || role == ActiveSessionRole || role == ProjectsPathRole || role == ProjectsDisplayRole) {
|
||||||
QString sessionName = m_manager->sessions().at(index.row());
|
QString sessionName = SessionManager::sessions().at(index.row());
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
return sessionName;
|
return sessionName;
|
||||||
else if (role == DefaultSessionRole)
|
else if (role == DefaultSessionRole)
|
||||||
return m_manager->isDefaultSession(sessionName);
|
return SessionManager::isDefaultSession(sessionName);
|
||||||
else if (role == LastSessionRole)
|
else if (role == LastSessionRole)
|
||||||
return m_manager->lastSession() == sessionName;
|
return SessionManager::lastSession() == sessionName;
|
||||||
else if (role == ActiveSessionRole)
|
else if (role == ActiveSessionRole)
|
||||||
return m_manager->activeSession() == sessionName;
|
return SessionManager::activeSession() == sessionName;
|
||||||
else if (role == ProjectsPathRole)
|
else if (role == ProjectsPathRole)
|
||||||
return pathsWithTildeHomePath(m_manager->projectsForSessionName(sessionName));
|
return pathsWithTildeHomePath(SessionManager::projectsForSessionName(sessionName));
|
||||||
else if (role == ProjectsDisplayRole)
|
else if (role == ProjectsDisplayRole)
|
||||||
return pathsToBaseNames(m_manager->projectsForSessionName(sessionName));
|
return pathsToBaseNames(SessionManager::projectsForSessionName(sessionName));
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionModel::isDefaultVirgin() const
|
bool SessionModel::isDefaultVirgin() const
|
||||||
{
|
{
|
||||||
return m_manager->isDefaultVirgin();
|
return SessionManager::isDefaultVirgin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionModel::resetSessions()
|
void SessionModel::resetSessions()
|
||||||
@@ -120,48 +120,48 @@ void SessionModel::resetSessions()
|
|||||||
|
|
||||||
void SessionModel::cloneSession(const QString &session)
|
void SessionModel::cloneSession(const QString &session)
|
||||||
{
|
{
|
||||||
SessionNameInputDialog newSessionInputDialog(m_manager->sessions(), 0);
|
SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), 0);
|
||||||
newSessionInputDialog.setWindowTitle(tr("New session name"));
|
newSessionInputDialog.setWindowTitle(tr("New session name"));
|
||||||
newSessionInputDialog.setValue(session + QLatin1String(" (2)"));
|
newSessionInputDialog.setValue(session + QLatin1String(" (2)"));
|
||||||
|
|
||||||
if (newSessionInputDialog.exec() == QDialog::Accepted) {
|
if (newSessionInputDialog.exec() == QDialog::Accepted) {
|
||||||
QString newSession = newSessionInputDialog.value();
|
QString newSession = newSessionInputDialog.value();
|
||||||
if (newSession.isEmpty() || m_manager->sessions().contains(newSession))
|
if (newSession.isEmpty() || SessionManager::sessions().contains(newSession))
|
||||||
return;
|
return;
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_manager->cloneSession(session, newSession);
|
SessionManager::cloneSession(session, newSession);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
if (newSessionInputDialog.isSwitchToRequested())
|
if (newSessionInputDialog.isSwitchToRequested())
|
||||||
m_manager->loadSession(newSession);
|
SessionManager::loadSession(newSession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionModel::deleteSession(const QString &session)
|
void SessionModel::deleteSession(const QString &session)
|
||||||
{
|
{
|
||||||
if (!m_manager->confirmSessionDelete(session))
|
if (!SessionManager::confirmSessionDelete(session))
|
||||||
return;
|
return;
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_manager->deleteSession(session);
|
SessionManager::deleteSession(session);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionModel::renameSession(const QString &session)
|
void SessionModel::renameSession(const QString &session)
|
||||||
{
|
{
|
||||||
SessionNameInputDialog newSessionInputDialog(m_manager->sessions(), 0);
|
SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), 0);
|
||||||
newSessionInputDialog.setWindowTitle(tr("New session name"));
|
newSessionInputDialog.setWindowTitle(tr("New session name"));
|
||||||
newSessionInputDialog.setValue(session);
|
newSessionInputDialog.setValue(session);
|
||||||
|
|
||||||
if (newSessionInputDialog.exec() == QDialog::Accepted) {
|
if (newSessionInputDialog.exec() == QDialog::Accepted) {
|
||||||
QString newSession = newSessionInputDialog.value();
|
QString newSession = newSessionInputDialog.value();
|
||||||
if (newSession.isEmpty() || m_manager->sessions().contains(newSession))
|
if (newSession.isEmpty() || SessionManager::sessions().contains(newSession))
|
||||||
return;
|
return;
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_manager->renameSession(session, newSession);
|
SessionManager::renameSession(session, newSession);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
if (newSessionInputDialog.isSwitchToRequested())
|
if (newSessionInputDialog.isSwitchToRequested())
|
||||||
m_manager->loadSession(newSession);
|
SessionManager::loadSession(newSession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,9 +214,8 @@ ProjectWelcomePage::ProjectWelcomePage() :
|
|||||||
|
|
||||||
void ProjectWelcomePage::facilitateQml(QDeclarativeEngine *engine)
|
void ProjectWelcomePage::facilitateQml(QDeclarativeEngine *engine)
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *pePlugin = ProjectExplorer::ProjectExplorerPlugin::instance();
|
m_sessionModel = new SessionModel(this);
|
||||||
m_sessionModel = new SessionModel(pePlugin->session(), this);
|
m_projectModel = new ProjectModel(ProjectExplorerPlugin::instance(), this);
|
||||||
m_projectModel = new ProjectModel(pePlugin, this);
|
|
||||||
|
|
||||||
QDeclarativeContext *ctx = engine->rootContext();
|
QDeclarativeContext *ctx = engine->rootContext();
|
||||||
ctx->setContextProperty(QLatin1String("sessionList"), m_sessionModel);
|
ctx->setContextProperty(QLatin1String("sessionList"), m_sessionModel);
|
||||||
|
@@ -41,7 +41,6 @@ QT_END_NAMESPACE
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class ProjectExplorerPlugin;
|
class ProjectExplorerPlugin;
|
||||||
class SessionManager;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ class SessionModel : public QAbstractListModel
|
|||||||
public:
|
public:
|
||||||
enum { DefaultSessionRole = Qt::UserRole+1, LastSessionRole, ActiveSessionRole, ProjectsPathRole, ProjectsDisplayRole };
|
enum { DefaultSessionRole = Qt::UserRole+1, LastSessionRole, ActiveSessionRole, ProjectsPathRole, ProjectsDisplayRole };
|
||||||
|
|
||||||
SessionModel(SessionManager* manager, QObject* parent = 0);
|
explicit SessionModel(QObject *parent = 0);
|
||||||
int rowCount(const QModelIndex &parent) const;
|
int rowCount(const QModelIndex &parent) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
|
||||||
@@ -62,9 +61,6 @@ public slots:
|
|||||||
void cloneSession(const QString &session);
|
void cloneSession(const QString &session);
|
||||||
void deleteSession(const QString &session);
|
void deleteSession(const QString &session);
|
||||||
void renameSession(const QString &session);
|
void renameSession(const QString &session);
|
||||||
|
|
||||||
private:
|
|
||||||
SessionManager *m_manager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -228,8 +228,6 @@ ProjectWindow::ProjectWindow(QWidget *parent)
|
|||||||
m_currentWidget(0),
|
m_currentWidget(0),
|
||||||
m_previousTargetSubIndex(-1)
|
m_previousTargetSubIndex(-1)
|
||||||
{
|
{
|
||||||
ProjectExplorer::SessionManager *session = ProjectExplorerPlugin::instance()->session();
|
|
||||||
|
|
||||||
// Setup overall layout:
|
// Setup overall layout:
|
||||||
QVBoxLayout *viewLayout = new QVBoxLayout(this);
|
QVBoxLayout *viewLayout = new QVBoxLayout(this);
|
||||||
viewLayout->setMargin(0);
|
viewLayout->setMargin(0);
|
||||||
@@ -242,19 +240,20 @@ ProjectWindow::ProjectWindow(QWidget *parent)
|
|||||||
m_centralWidget = new QStackedWidget(this);
|
m_centralWidget = new QStackedWidget(this);
|
||||||
viewLayout->addWidget(m_centralWidget);
|
viewLayout->addWidget(m_centralWidget);
|
||||||
|
|
||||||
// connects:
|
// Connections
|
||||||
connect(m_tabWidget, SIGNAL(currentIndexChanged(int,int)),
|
connect(m_tabWidget, SIGNAL(currentIndexChanged(int,int)),
|
||||||
this, SLOT(showProperties(int,int)));
|
this, SLOT(showProperties(int,int)));
|
||||||
|
|
||||||
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
QObject *sessionManager = SessionManager::instance();
|
||||||
|
connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
this, SLOT(registerProject(ProjectExplorer::Project*)));
|
this, SLOT(registerProject(ProjectExplorer::Project*)));
|
||||||
connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
|
||||||
this, SLOT(deregisterProject(ProjectExplorer::Project*)));
|
this, SLOT(deregisterProject(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
connect(session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
this, SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
connect(session, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
|
connect(sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(projectUpdated(ProjectExplorer::Project*)));
|
this, SLOT(projectUpdated(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
// Update properties to empty project for now:
|
// Update properties to empty project for now:
|
||||||
@@ -274,7 +273,7 @@ void ProjectWindow::aboutToShutdown()
|
|||||||
{
|
{
|
||||||
showProperties(-1, -1); // that's a bit stupid, but otherwise stuff is still
|
showProperties(-1, -1); // that's a bit stupid, but otherwise stuff is still
|
||||||
// connected to the session
|
// connected to the session
|
||||||
disconnect(ProjectExplorerPlugin::instance()->session(), 0, this, 0);
|
disconnect(SessionManager::instance(), 0, this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectWindow::removedTarget(Target *)
|
void ProjectWindow::removedTarget(Target *)
|
||||||
@@ -434,7 +433,7 @@ void ProjectWindow::showProperties(int index, int subIndex)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorerPlugin::instance()->session()->setStartupProject(project);
|
SessionManager::setStartupProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectWindow::removeCurrentWidget()
|
void ProjectWindow::removeCurrentWidget()
|
||||||
|
@@ -53,17 +53,14 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
namespace {
|
namespace { bool debug = false; }
|
||||||
bool debug = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using Utils::PersistentSettingsReader;
|
using namespace Utils;
|
||||||
using Utils::PersistentSettingsWriter;
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ProjectExplorer::SessionManager
|
\class ProjectExplorer::SessionManager
|
||||||
|
|
||||||
@@ -75,15 +72,61 @@ using namespace ProjectExplorer::Internal;
|
|||||||
This could be improved.
|
This could be improved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SessionManager::SessionManager(QObject *parent)
|
class SessionManagerPrivate
|
||||||
: QObject(parent),
|
{
|
||||||
m_sessionNode(new SessionNode(this)),
|
public:
|
||||||
|
SessionManagerPrivate() :
|
||||||
m_sessionName(QLatin1String("default")),
|
m_sessionName(QLatin1String("default")),
|
||||||
m_virginSession(true),
|
m_virginSession(true),
|
||||||
m_loadingSession(false),
|
m_loadingSession(false),
|
||||||
m_startupProject(0),
|
m_startupProject(0),
|
||||||
m_writer(0)
|
m_writer(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool projectContainsFile(Project *p, const QString &fileName) const;
|
||||||
|
void restoreValues(const PersistentSettingsReader &reader);
|
||||||
|
void restoreDependencies(const PersistentSettingsReader &reader);
|
||||||
|
void restoreStartupProject(const PersistentSettingsReader &reader);
|
||||||
|
void restoreEditors(const PersistentSettingsReader &reader);
|
||||||
|
void restoreProjects(const QStringList &fileList);
|
||||||
|
void askUserAboutFailedProjects();
|
||||||
|
void sessionLoadingProgress();
|
||||||
|
|
||||||
|
bool recursiveDependencyCheck(const QString &newDep, const QString &checkDep) const;
|
||||||
|
QStringList dependencies(const QString &proName) const;
|
||||||
|
QStringList dependenciesOrder() const;
|
||||||
|
void dependencies(const QString &proName, QStringList &result) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SessionNode *m_sessionNode;
|
||||||
|
QString m_sessionName;
|
||||||
|
bool m_virginSession;
|
||||||
|
|
||||||
|
mutable QStringList m_sessions;
|
||||||
|
|
||||||
|
mutable QHash<Project *, QStringList> m_projectFileCache;
|
||||||
|
bool m_loadingSession;
|
||||||
|
|
||||||
|
Project *m_startupProject;
|
||||||
|
QList<Project *> m_projects;
|
||||||
|
QStringList m_failedProjects;
|
||||||
|
QMap<QString, QStringList> m_depMap;
|
||||||
|
QMap<QString, QVariant> m_values;
|
||||||
|
QFutureInterface<void> m_future;
|
||||||
|
PersistentSettingsWriter *m_writer;
|
||||||
|
};
|
||||||
|
|
||||||
|
static SessionManager *m_instance = 0;
|
||||||
|
static SessionManagerPrivate *d = 0;
|
||||||
|
|
||||||
|
SessionManager::SessionManager(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
m_instance = this;
|
||||||
|
d = new SessionManagerPrivate;
|
||||||
|
|
||||||
|
d->m_sessionNode = new SessionNode(this);
|
||||||
|
|
||||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
||||||
this, SLOT(saveActiveMode(Core::IMode*)));
|
this, SLOT(saveActiveMode(Core::IMode*)));
|
||||||
|
|
||||||
@@ -99,18 +142,22 @@ SessionManager::SessionManager(QObject *parent)
|
|||||||
|
|
||||||
SessionManager::~SessionManager()
|
SessionManager::~SessionManager()
|
||||||
{
|
{
|
||||||
emit aboutToUnloadSession(m_sessionName);
|
emit m_instance->aboutToUnloadSession(d->m_sessionName);
|
||||||
delete m_writer;
|
delete d->m_writer;
|
||||||
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject *SessionManager::instance()
|
||||||
bool SessionManager::isDefaultVirgin() const
|
|
||||||
{
|
{
|
||||||
return isDefaultSession(m_sessionName)
|
return m_instance;
|
||||||
&& m_virginSession;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionManager::isDefaultSession(const QString &session) const
|
bool SessionManager::isDefaultVirgin()
|
||||||
|
{
|
||||||
|
return isDefaultSession(d->m_sessionName) && d->m_virginSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SessionManager::isDefaultSession(const QString &session)
|
||||||
{
|
{
|
||||||
return session == QLatin1String("default");
|
return session == QLatin1String("default");
|
||||||
}
|
}
|
||||||
@@ -125,22 +172,21 @@ void SessionManager::clearProjectFileCache()
|
|||||||
{
|
{
|
||||||
// If triggered by the fileListChanged signal of one project
|
// If triggered by the fileListChanged signal of one project
|
||||||
// only invalidate cache for this project
|
// only invalidate cache for this project
|
||||||
Project *pro = qobject_cast<Project*>(sender());
|
Project *pro = qobject_cast<Project*>(m_instance->sender());
|
||||||
if (pro)
|
if (pro)
|
||||||
m_projectFileCache.remove(pro);
|
d->m_projectFileCache.remove(pro);
|
||||||
else
|
else
|
||||||
m_projectFileCache.clear();
|
d->m_projectFileCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionManager::recursiveDependencyCheck(const QString &newDep, const QString &checkDep) const
|
bool SessionManagerPrivate::recursiveDependencyCheck(const QString &newDep, const QString &checkDep) const
|
||||||
{
|
{
|
||||||
if (newDep == checkDep)
|
if (newDep == checkDep)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (const QString &dependency, m_depMap.value(checkDep)) {
|
foreach (const QString &dependency, m_depMap.value(checkDep))
|
||||||
if (!recursiveDependencyCheck(newDep, dependency))
|
if (!recursiveDependencyCheck(newDep, dependency))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -152,10 +198,10 @@ bool SessionManager::recursiveDependencyCheck(const QString &newDep, const QStri
|
|||||||
* filenames when saving.
|
* filenames when saving.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QList<Project *> SessionManager::dependencies(const Project *project) const
|
QList<Project *> SessionManager::dependencies(const Project *project)
|
||||||
{
|
{
|
||||||
const QString &proName = project->projectFilePath();
|
const QString proName = project->projectFilePath();
|
||||||
const QStringList &proDeps = m_depMap.value(proName);
|
const QStringList proDeps = d->m_depMap.value(proName);
|
||||||
|
|
||||||
QList<Project *> projects;
|
QList<Project *> projects;
|
||||||
foreach (const QString &dep, proDeps) {
|
foreach (const QString &dep, proDeps) {
|
||||||
@@ -166,54 +212,54 @@ QList<Project *> SessionManager::dependencies(const Project *project) const
|
|||||||
return projects;
|
return projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionManager::hasDependency(const Project *project, const Project *depProject) const
|
bool SessionManager::hasDependency(const Project *project, const Project *depProject)
|
||||||
{
|
{
|
||||||
const QString &proName = project->projectFilePath();
|
const QString proName = project->projectFilePath();
|
||||||
const QString &depName = depProject->projectFilePath();
|
const QString depName = depProject->projectFilePath();
|
||||||
|
|
||||||
const QStringList &proDeps = m_depMap.value(proName);
|
const QStringList proDeps = d->m_depMap.value(proName);
|
||||||
return proDeps.contains(depName);
|
return proDeps.contains(depName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionManager::canAddDependency(const Project *project, const Project *depProject) const
|
bool SessionManager::canAddDependency(const Project *project, const Project *depProject)
|
||||||
{
|
{
|
||||||
const QString &newDep = project->projectFilePath();
|
const QString newDep = project->projectFilePath();
|
||||||
const QString &checkDep = depProject->projectFilePath();
|
const QString checkDep = depProject->projectFilePath();
|
||||||
|
|
||||||
return recursiveDependencyCheck(newDep, checkDep);
|
return d->recursiveDependencyCheck(newDep, checkDep);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionManager::addDependency(Project *project, Project *depProject)
|
bool SessionManager::addDependency(Project *project, Project *depProject)
|
||||||
{
|
{
|
||||||
const QString &proName = project->projectFilePath();
|
const QString proName = project->projectFilePath();
|
||||||
const QString &depName = depProject->projectFilePath();
|
const QString depName = depProject->projectFilePath();
|
||||||
|
|
||||||
// check if this dependency is valid
|
// check if this dependency is valid
|
||||||
if (!recursiveDependencyCheck(proName, depName))
|
if (!d->recursiveDependencyCheck(proName, depName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QStringList proDeps = m_depMap.value(proName);
|
QStringList proDeps = d->m_depMap.value(proName);
|
||||||
if (!proDeps.contains(depName)) {
|
if (!proDeps.contains(depName)) {
|
||||||
proDeps.append(depName);
|
proDeps.append(depName);
|
||||||
m_depMap[proName] = proDeps;
|
d->m_depMap[proName] = proDeps;
|
||||||
}
|
}
|
||||||
emit dependencyChanged(project, depProject);
|
emit m_instance->dependencyChanged(project, depProject);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::removeDependency(Project *project, Project *depProject)
|
void SessionManager::removeDependency(Project *project, Project *depProject)
|
||||||
{
|
{
|
||||||
const QString &proName = project->projectFilePath();
|
const QString proName = project->projectFilePath();
|
||||||
const QString &depName = depProject->projectFilePath();
|
const QString depName = depProject->projectFilePath();
|
||||||
|
|
||||||
QStringList proDeps = m_depMap.value(proName);
|
QStringList proDeps = d->m_depMap.value(proName);
|
||||||
proDeps.removeAll(depName);
|
proDeps.removeAll(depName);
|
||||||
if (proDeps.isEmpty())
|
if (proDeps.isEmpty())
|
||||||
m_depMap.remove(proName);
|
d->m_depMap.remove(proName);
|
||||||
else
|
else
|
||||||
m_depMap[proName] = proDeps;
|
d->m_depMap[proName] = proDeps;
|
||||||
emit dependencyChanged(project, depProject);
|
emit m_instance->dependencyChanged(project, depProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::setStartupProject(Project *startupProject)
|
void SessionManager::setStartupProject(Project *startupProject)
|
||||||
@@ -222,19 +268,19 @@ void SessionManager::setStartupProject(Project *startupProject)
|
|||||||
qDebug() << Q_FUNC_INFO << (startupProject ? startupProject->displayName() : QLatin1String("0"));
|
qDebug() << Q_FUNC_INFO << (startupProject ? startupProject->displayName() : QLatin1String("0"));
|
||||||
|
|
||||||
if (startupProject) {
|
if (startupProject) {
|
||||||
Q_ASSERT(m_projects.contains(startupProject));
|
Q_ASSERT(d->m_projects.contains(startupProject));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_startupProject == startupProject)
|
if (d->m_startupProject == startupProject)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_startupProject = startupProject;
|
d->m_startupProject = startupProject;
|
||||||
emit startupProjectChanged(startupProject);
|
emit m_instance->startupProjectChanged(startupProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
Project *SessionManager::startupProject() const
|
Project *SessionManager::startupProject()
|
||||||
{
|
{
|
||||||
return m_startupProject;
|
return d->m_startupProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::addProject(Project *project)
|
void SessionManager::addProject(Project *project)
|
||||||
@@ -244,36 +290,35 @@ void SessionManager::addProject(Project *project)
|
|||||||
|
|
||||||
void SessionManager::addProjects(const QList<Project*> &projects)
|
void SessionManager::addProjects(const QList<Project*> &projects)
|
||||||
{
|
{
|
||||||
m_virginSession = false;
|
d->m_virginSession = false;
|
||||||
QList<Project*> clearedList;
|
QList<Project*> clearedList;
|
||||||
foreach (Project *pro, projects) {
|
foreach (Project *pro, projects) {
|
||||||
if (!m_projects.contains(pro)) {
|
if (!d->m_projects.contains(pro)) {
|
||||||
clearedList.append(pro);
|
clearedList.append(pro);
|
||||||
m_projects.append(pro);
|
d->m_projects.append(pro);
|
||||||
m_sessionNode->addProjectNodes(QList<ProjectNode *>() << pro->rootProjectNode());
|
d->m_sessionNode->addProjectNodes(QList<ProjectNode *>() << pro->rootProjectNode());
|
||||||
|
|
||||||
connect(pro, SIGNAL(fileListChanged()),
|
connect(pro, SIGNAL(fileListChanged()),
|
||||||
this, SLOT(clearProjectFileCache()));
|
m_instance, SLOT(clearProjectFileCache()));
|
||||||
|
|
||||||
connect(pro, SIGNAL(displayNameChanged()),
|
connect(pro, SIGNAL(displayNameChanged()),
|
||||||
this, SLOT(projectDisplayNameChanged()));
|
m_instance, SLOT(projectDisplayNameChanged()));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionManager - adding project " << pro->displayName();
|
qDebug() << "SessionManager - adding project " << pro->displayName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Project *pro, clearedList) {
|
foreach (Project *pro, clearedList)
|
||||||
emit projectAdded(pro);
|
emit m_instance->projectAdded(pro);
|
||||||
}
|
|
||||||
|
|
||||||
if (clearedList.count() == 1)
|
if (clearedList.count() == 1)
|
||||||
emit singleProjectAdded(clearedList.first());
|
emit m_instance->singleProjectAdded(clearedList.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::removeProject(Project *project)
|
void SessionManager::removeProject(Project *project)
|
||||||
{
|
{
|
||||||
m_virginSession = false;
|
d->m_virginSession = false;
|
||||||
if (project == 0) {
|
if (project == 0) {
|
||||||
qDebug() << "SessionManager::removeProject(0) ... THIS SHOULD NOT HAPPEN";
|
qDebug() << "SessionManager::removeProject(0) ... THIS SHOULD NOT HAPPEN";
|
||||||
return;
|
return;
|
||||||
@@ -283,28 +328,28 @@ void SessionManager::removeProject(Project *project)
|
|||||||
|
|
||||||
bool SessionManager::loadingSession()
|
bool SessionManager::loadingSession()
|
||||||
{
|
{
|
||||||
return m_loadingSession;
|
return d->m_loadingSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionManager::save()
|
bool SessionManager::save()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionManager - saving session" << m_sessionName;
|
qDebug() << "SessionManager - saving session" << d->m_sessionName;
|
||||||
|
|
||||||
emit aboutToSaveSession();
|
emit m_instance->aboutToSaveSession();
|
||||||
|
|
||||||
if (!m_writer || m_writer->fileName() != sessionNameToFileName(m_sessionName)) {
|
if (!d->m_writer || d->m_writer->fileName() != sessionNameToFileName(d->m_sessionName)) {
|
||||||
delete m_writer;
|
delete d->m_writer;
|
||||||
m_writer = new Utils::PersistentSettingsWriter(sessionNameToFileName(m_sessionName),
|
d->m_writer = new PersistentSettingsWriter(sessionNameToFileName(d->m_sessionName),
|
||||||
QLatin1String("QtCreatorSession"));
|
QLatin1String("QtCreatorSession"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap data;
|
QVariantMap data;
|
||||||
// save the startup project
|
// save the startup project
|
||||||
if (m_startupProject)
|
if (d->m_startupProject)
|
||||||
data.insert(QLatin1String("StartupProject"), m_startupProject->projectFilePath());
|
data.insert(QLatin1String("StartupProject"), d->m_startupProject->projectFilePath());
|
||||||
|
|
||||||
QColor c = Utils::StyleHelper::requestedBaseColor();
|
QColor c = StyleHelper::requestedBaseColor();
|
||||||
if (c.isValid()) {
|
if (c.isValid()) {
|
||||||
QString tmp = QString::fromLatin1("#%1%2%3")
|
QString tmp = QString::fromLatin1("#%1%2%3")
|
||||||
.arg(c.red(), 2, 16, QLatin1Char('0'))
|
.arg(c.red(), 2, 16, QLatin1Char('0'))
|
||||||
@@ -314,20 +359,20 @@ bool SessionManager::save()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList projectFiles;
|
QStringList projectFiles;
|
||||||
foreach (Project *pro, m_projects)
|
foreach (Project *pro, d->m_projects)
|
||||||
projectFiles << pro->projectFilePath();
|
projectFiles << pro->projectFilePath();
|
||||||
|
|
||||||
// Restore infromation on projects that failed to load:
|
// Restore infromation on projects that failed to load:
|
||||||
// don't readd projects to the list, which the user loaded
|
// don't readd projects to the list, which the user loaded
|
||||||
foreach (const QString &failed, m_failedProjects)
|
foreach (const QString &failed, d->m_failedProjects)
|
||||||
if (!projectFiles.contains(failed))
|
if (!projectFiles.contains(failed))
|
||||||
projectFiles << failed;
|
projectFiles << failed;
|
||||||
|
|
||||||
data.insert(QLatin1String("ProjectList"), projectFiles);
|
data.insert(QLatin1String("ProjectList"), projectFiles);
|
||||||
|
|
||||||
QMap<QString, QVariant> depMap;
|
QMap<QString, QVariant> depMap;
|
||||||
QMap<QString, QStringList>::const_iterator i = m_depMap.constBegin();
|
QMap<QString, QStringList>::const_iterator i = d->m_depMap.constBegin();
|
||||||
while (i != m_depMap.constEnd()) {
|
while (i != d->m_depMap.constEnd()) {
|
||||||
QString key = i.key();
|
QString key = i.key();
|
||||||
QStringList values;
|
QStringList values;
|
||||||
foreach (const QString &value, i.value()) {
|
foreach (const QString &value, i.value()) {
|
||||||
@@ -339,20 +384,19 @@ bool SessionManager::save()
|
|||||||
data.insert(QLatin1String("ProjectDependencies"), QVariant(depMap));
|
data.insert(QLatin1String("ProjectDependencies"), QVariant(depMap));
|
||||||
data.insert(QLatin1String("EditorSettings"), EditorManager::saveState().toBase64());
|
data.insert(QLatin1String("EditorSettings"), EditorManager::saveState().toBase64());
|
||||||
|
|
||||||
QMap<QString, QVariant>::const_iterator it, end;
|
QMap<QString, QVariant>::const_iterator it, end = d->m_values.constEnd();
|
||||||
end = m_values.constEnd();
|
|
||||||
QStringList keys;
|
QStringList keys;
|
||||||
for (it = m_values.constBegin(); it != end; ++it) {
|
for (it = d->m_values.constBegin(); it != end; ++it) {
|
||||||
data.insert(QLatin1String("value-") + it.key(), it.value());
|
data.insert(QLatin1String("value-") + it.key(), it.value());
|
||||||
keys << it.key();
|
keys << it.key();
|
||||||
}
|
}
|
||||||
|
|
||||||
data.insert(QLatin1String("valueKeys"), keys);
|
data.insert(QLatin1String("valueKeys"), keys);
|
||||||
|
|
||||||
bool result = m_writer->save(data, Core::ICore::mainWindow());
|
bool result = d->m_writer->save(data, Core::ICore::mainWindow());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
QMessageBox::warning(0, tr("Error while saving session"),
|
QMessageBox::warning(0, tr("Error while saving session"),
|
||||||
tr("Could not save session to file %1").arg(m_writer->fileName().toUserOutput()));
|
tr("Could not save session to file %1").arg(d->m_writer->fileName().toUserOutput()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@@ -370,19 +414,24 @@ void SessionManager::closeAllProjects()
|
|||||||
removeProjects(projects());
|
removeProjects(projects());
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<Project *> &SessionManager::projects() const
|
const QList<Project *> &SessionManager::projects()
|
||||||
{
|
{
|
||||||
return m_projects;
|
return d->m_projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SessionManager::dependencies(const QString &proName) const
|
bool SessionManager::hasProjects()
|
||||||
|
{
|
||||||
|
return !d->m_projects.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList SessionManagerPrivate::dependencies(const QString &proName) const
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
dependencies(proName, result);
|
dependencies(proName, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::dependencies(const QString &proName, QStringList &result) const
|
void SessionManagerPrivate::dependencies(const QString &proName, QStringList &result) const
|
||||||
{
|
{
|
||||||
QStringList depends = m_depMap.value(proName);
|
QStringList depends = m_depMap.value(proName);
|
||||||
|
|
||||||
@@ -393,16 +442,15 @@ void SessionManager::dependencies(const QString &proName, QStringList &result) c
|
|||||||
result.append(proName);
|
result.append(proName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SessionManager::dependenciesOrder() const
|
QStringList SessionManagerPrivate::dependenciesOrder() const
|
||||||
{
|
{
|
||||||
QList<QPair<QString, QStringList> > unordered;
|
QList<QPair<QString, QStringList> > unordered;
|
||||||
QStringList ordered;
|
QStringList ordered;
|
||||||
|
|
||||||
// copy the map to a temporary list
|
// copy the map to a temporary list
|
||||||
foreach (Project *pro, projects()) {
|
foreach (Project *pro, m_projects) {
|
||||||
const QString &proName = pro->projectFilePath();
|
const QString &proName = pro->projectFilePath();
|
||||||
unordered << QPair<QString, QStringList>
|
unordered << QPair<QString, QStringList>(proName, m_depMap.value(proName));
|
||||||
(proName, m_depMap.value(proName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!unordered.isEmpty()) {
|
while (!unordered.isEmpty()) {
|
||||||
@@ -427,15 +475,15 @@ QStringList SessionManager::dependenciesOrder() const
|
|||||||
return ordered;
|
return ordered;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Project *> SessionManager::projectOrder(Project *project) const
|
QList<Project *> SessionManager::projectOrder(Project *project)
|
||||||
{
|
{
|
||||||
QList<Project *> result;
|
QList<Project *> result;
|
||||||
|
|
||||||
QStringList pros;
|
QStringList pros;
|
||||||
if (project)
|
if (project)
|
||||||
pros = dependencies(project->projectFilePath());
|
pros = d->dependencies(project->projectFilePath());
|
||||||
else
|
else
|
||||||
pros = dependenciesOrder();
|
pros = d->dependenciesOrder();
|
||||||
|
|
||||||
foreach (const QString &proFile, pros) {
|
foreach (const QString &proFile, pros) {
|
||||||
foreach (Project *pro, projects()) {
|
foreach (Project *pro, projects()) {
|
||||||
@@ -449,37 +497,33 @@ QList<Project *> SessionManager::projectOrder(Project *project) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Project *SessionManager::projectForNode(Node *node) const
|
Project *SessionManager::projectForNode(Node *node)
|
||||||
{
|
{
|
||||||
if (!node)
|
if (!node)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Project *project = 0;
|
|
||||||
|
|
||||||
FolderNode *rootProjectNode = qobject_cast<FolderNode*>(node);
|
FolderNode *rootProjectNode = qobject_cast<FolderNode*>(node);
|
||||||
if (!rootProjectNode)
|
if (!rootProjectNode)
|
||||||
rootProjectNode = node->parentFolderNode();
|
rootProjectNode = node->parentFolderNode();
|
||||||
while (rootProjectNode && rootProjectNode->parentFolderNode() != m_sessionNode)
|
|
||||||
|
while (rootProjectNode && rootProjectNode->parentFolderNode() != d->m_sessionNode)
|
||||||
rootProjectNode = rootProjectNode->parentFolderNode();
|
rootProjectNode = rootProjectNode->parentFolderNode();
|
||||||
|
|
||||||
Q_ASSERT(rootProjectNode);
|
Q_ASSERT(rootProjectNode);
|
||||||
|
|
||||||
QList<Project *> projectList = projects();
|
foreach (Project *p, d->m_projects)
|
||||||
foreach (Project *p, projectList) {
|
if (p->rootProjectNode() == rootProjectNode)
|
||||||
if (p->rootProjectNode() == rootProjectNode) {
|
return p;
|
||||||
project = p;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return project;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *SessionManager::nodeForFile(const QString &fileName, Project *project) const
|
Node *SessionManager::nodeForFile(const QString &fileName, Project *project)
|
||||||
{
|
{
|
||||||
Node *node = 0;
|
Node *node = 0;
|
||||||
if (!project)
|
if (!project)
|
||||||
project = projectForFile(fileName);
|
project = projectForFile(fileName);
|
||||||
|
|
||||||
if (project) {
|
if (project) {
|
||||||
FindNodesForFileVisitor findNodes(fileName);
|
FindNodesForFileVisitor findNodes(fileName);
|
||||||
project->rootProjectNode()->accept(&findNodes);
|
project->rootProjectNode()->accept(&findNodes);
|
||||||
@@ -494,7 +538,7 @@ Node *SessionManager::nodeForFile(const QString &fileName, Project *project) con
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
Project *SessionManager::projectForFile(const QString &fileName) const
|
Project *SessionManager::projectForFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionManager::projectForFile(" << fileName << ")";
|
qDebug() << "SessionManager::projectForFile(" << fileName << ")";
|
||||||
@@ -503,16 +547,17 @@ Project *SessionManager::projectForFile(const QString &fileName) const
|
|||||||
|
|
||||||
// Check current project first
|
// Check current project first
|
||||||
Project *currentProject = ProjectExplorerPlugin::currentProject();
|
Project *currentProject = ProjectExplorerPlugin::currentProject();
|
||||||
if (currentProject && projectContainsFile(currentProject, fileName))
|
if (currentProject && d->projectContainsFile(currentProject, fileName))
|
||||||
return currentProject;
|
return currentProject;
|
||||||
|
|
||||||
foreach (Project *p, projectList)
|
foreach (Project *p, projectList)
|
||||||
if (p != currentProject && projectContainsFile(p, fileName))
|
if (p != currentProject && d->projectContainsFile(p, fileName))
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SessionManager::projectContainsFile(Project *p, const QString &fileName) const
|
bool SessionManagerPrivate::projectContainsFile(Project *p, const QString &fileName) const
|
||||||
{
|
{
|
||||||
if (!m_projectFileCache.contains(p))
|
if (!m_projectFileCache.contains(p))
|
||||||
m_projectFileCache.insert(p, p->files(Project::AllFiles));
|
m_projectFileCache.insert(p, p->files(Project::AllFiles));
|
||||||
@@ -532,13 +577,13 @@ void SessionManager::configureEditor(Core::IEditor *editor, const QString &fileN
|
|||||||
|
|
||||||
void SessionManager::updateWindowTitle()
|
void SessionManager::updateWindowTitle()
|
||||||
{
|
{
|
||||||
if (isDefaultSession(m_sessionName)) {
|
if (isDefaultSession(d->m_sessionName)) {
|
||||||
if (Project *currentProject = ProjectExplorerPlugin::currentProject())
|
if (Project *currentProject = ProjectExplorerPlugin::currentProject())
|
||||||
EditorManager::setWindowTitleAddition(currentProject->displayName());
|
EditorManager::setWindowTitleAddition(currentProject->displayName());
|
||||||
else
|
else
|
||||||
EditorManager::setWindowTitleAddition(QString());
|
EditorManager::setWindowTitleAddition(QString());
|
||||||
} else {
|
} else {
|
||||||
QString sessionName = m_sessionName;
|
QString sessionName = d->m_sessionName;
|
||||||
if (sessionName.isEmpty())
|
if (sessionName.isEmpty())
|
||||||
sessionName = tr("Untitled");
|
sessionName = tr("Untitled");
|
||||||
EditorManager::setWindowTitleAddition(sessionName);
|
EditorManager::setWindowTitleAddition(sessionName);
|
||||||
@@ -552,7 +597,7 @@ void SessionManager::removeProjects(QList<Project *> remove)
|
|||||||
foreach (Project *pro, remove) {
|
foreach (Project *pro, remove) {
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionManager - emitting aboutToRemoveProject(" << pro->displayName() << ")";
|
qDebug() << "SessionManager - emitting aboutToRemoveProject(" << pro->displayName() << ")";
|
||||||
emit aboutToRemoveProject(pro);
|
emit m_instance->aboutToRemoveProject(pro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -566,7 +611,7 @@ void SessionManager::removeProjects(QList<Project *> remove)
|
|||||||
QSet<QString>::const_iterator i = projectFiles.begin();
|
QSet<QString>::const_iterator i = projectFiles.begin();
|
||||||
while (i != projectFiles.end()) {
|
while (i != projectFiles.end()) {
|
||||||
QStringList dependencies;
|
QStringList dependencies;
|
||||||
foreach (const QString &dependency, m_depMap.value(*i)) {
|
foreach (const QString &dependency, d->m_depMap.value(*i)) {
|
||||||
if (projectFiles.contains(dependency))
|
if (projectFiles.contains(dependency))
|
||||||
dependencies << dependency;
|
dependencies << dependency;
|
||||||
}
|
}
|
||||||
@@ -575,32 +620,31 @@ void SessionManager::removeProjects(QList<Project *> remove)
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_depMap = resMap;
|
d->m_depMap = resMap;
|
||||||
|
|
||||||
// TODO: Clear m_modelProjectHash
|
// TODO: Clear m_modelProjectHash
|
||||||
|
|
||||||
// Delete projects
|
// Delete projects
|
||||||
foreach (Project *pro, remove) {
|
foreach (Project *pro, remove) {
|
||||||
pro->saveSettings();
|
pro->saveSettings();
|
||||||
m_projects.removeOne(pro);
|
d->m_projects.removeOne(pro);
|
||||||
|
|
||||||
if (pro == m_startupProject)
|
if (pro == d->m_startupProject)
|
||||||
setStartupProject(0);
|
setStartupProject(0);
|
||||||
|
|
||||||
disconnect(pro, SIGNAL(fileListChanged()),
|
disconnect(pro, SIGNAL(fileListChanged()), m_instance, SLOT(clearProjectFileCache()));
|
||||||
this, SLOT(clearProjectFileCache()));
|
d->m_projectFileCache.remove(pro);
|
||||||
m_projectFileCache.remove(pro);
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "SessionManager - emitting projectRemoved(" << pro->displayName() << ")";
|
qDebug() << "SessionManager - emitting projectRemoved(" << pro->displayName() << ")";
|
||||||
m_sessionNode->removeProjectNodes(QList<ProjectNode *>() << pro->rootProjectNode());
|
d->m_sessionNode->removeProjectNodes(QList<ProjectNode *>() << pro->rootProjectNode());
|
||||||
emit projectRemoved(pro);
|
emit m_instance->projectRemoved(pro);
|
||||||
delete pro;
|
delete pro;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startupProject() == 0)
|
if (startupProject() == 0)
|
||||||
if (!m_projects.isEmpty())
|
if (!d->m_projects.isEmpty())
|
||||||
setStartupProject(m_projects.first());
|
setStartupProject(d->m_projects.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -609,41 +653,41 @@ void SessionManager::removeProjects(QList<Project *> remove)
|
|||||||
|
|
||||||
void SessionManager::setValue(const QString &name, const QVariant &value)
|
void SessionManager::setValue(const QString &name, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (m_values.value(name) == value)
|
if (d->m_values.value(name) == value)
|
||||||
return;
|
return;
|
||||||
m_values.insert(name, value);
|
d->m_values.insert(name, value);
|
||||||
markSessionFileDirty(false);
|
markSessionFileDirty(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SessionManager::value(const QString &name)
|
QVariant SessionManager::value(const QString &name)
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant>::const_iterator it = m_values.find(name);
|
QMap<QString, QVariant>::const_iterator it = d->m_values.find(name);
|
||||||
return (it == m_values.constEnd()) ? QVariant() : *it;
|
return (it == d->m_values.constEnd()) ? QVariant() : *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SessionManager::activeSession() const
|
QString SessionManager::activeSession()
|
||||||
{
|
{
|
||||||
return m_sessionName;
|
return d->m_sessionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SessionManager::sessions() const
|
QStringList SessionManager::sessions()
|
||||||
{
|
{
|
||||||
if (m_sessions.isEmpty()) {
|
if (d->m_sessions.isEmpty()) {
|
||||||
// We are not initialized yet, so do that now
|
// We are not initialized yet, so do that now
|
||||||
QDir sessionDir(Core::ICore::userResourcePath());
|
QDir sessionDir(Core::ICore::userResourcePath());
|
||||||
QList<QFileInfo> sessionFiles = sessionDir.entryInfoList(QStringList() << QLatin1String("*.qws"), QDir::NoFilter, QDir::Time);
|
QList<QFileInfo> sessionFiles = sessionDir.entryInfoList(QStringList() << QLatin1String("*.qws"), QDir::NoFilter, QDir::Time);
|
||||||
Q_FOREACH(const QFileInfo& fileInfo, sessionFiles) {
|
foreach (const QFileInfo &fileInfo, sessionFiles) {
|
||||||
if (fileInfo.completeBaseName() != QLatin1String("default"))
|
if (fileInfo.completeBaseName() != QLatin1String("default"))
|
||||||
m_sessions << fileInfo.completeBaseName();
|
d->m_sessions << fileInfo.completeBaseName();
|
||||||
}
|
}
|
||||||
m_sessions.prepend(QLatin1String("default"));
|
d->m_sessions.prepend(QLatin1String("default"));
|
||||||
}
|
}
|
||||||
return m_sessions;
|
return d->m_sessions;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName SessionManager::sessionNameToFileName(const QString &session) const
|
FileName SessionManager::sessionNameToFileName(const QString &session)
|
||||||
{
|
{
|
||||||
return Utils::FileName::fromString(ICore::userResourcePath() + QLatin1Char('/') + session + QLatin1String(".qws"));
|
return FileName::fromString(ICore::userResourcePath() + QLatin1Char('/') + session + QLatin1String(".qws"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -654,8 +698,8 @@ bool SessionManager::createSession(const QString &session)
|
|||||||
{
|
{
|
||||||
if (sessions().contains(session))
|
if (sessions().contains(session))
|
||||||
return false;
|
return false;
|
||||||
Q_ASSERT(m_sessions.size() > 0);
|
Q_ASSERT(d->m_sessions.size() > 0);
|
||||||
m_sessions.insert(1, session);
|
d->m_sessions.insert(1, session);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,9 +729,9 @@ bool SessionManager::confirmSessionDelete(const QString &session)
|
|||||||
*/
|
*/
|
||||||
bool SessionManager::deleteSession(const QString &session)
|
bool SessionManager::deleteSession(const QString &session)
|
||||||
{
|
{
|
||||||
if (!m_sessions.contains(session))
|
if (!d->m_sessions.contains(session))
|
||||||
return false;
|
return false;
|
||||||
m_sessions.removeOne(session);
|
d->m_sessions.removeOne(session);
|
||||||
QFile fi(sessionNameToFileName(session).toString());
|
QFile fi(sessionNameToFileName(session).toString());
|
||||||
if (fi.exists())
|
if (fi.exists())
|
||||||
return fi.remove();
|
return fi.remove();
|
||||||
@@ -696,29 +740,29 @@ bool SessionManager::deleteSession(const QString &session)
|
|||||||
|
|
||||||
bool SessionManager::cloneSession(const QString &original, const QString &clone)
|
bool SessionManager::cloneSession(const QString &original, const QString &clone)
|
||||||
{
|
{
|
||||||
if (!m_sessions.contains(original))
|
if (!d->m_sessions.contains(original))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QFile fi(sessionNameToFileName(original).toString());
|
QFile fi(sessionNameToFileName(original).toString());
|
||||||
// If the file does not exist, we can still clone
|
// If the file does not exist, we can still clone
|
||||||
if (!fi.exists() || fi.copy(sessionNameToFileName(clone).toString())) {
|
if (!fi.exists() || fi.copy(sessionNameToFileName(clone).toString())) {
|
||||||
Q_ASSERT(m_sessions.size() > 0);
|
Q_ASSERT(d->m_sessions.size() > 0);
|
||||||
m_sessions.insert(1, clone);
|
d->m_sessions.insert(1, clone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::restoreValues(const Utils::PersistentSettingsReader &reader)
|
void SessionManagerPrivate::restoreValues(const PersistentSettingsReader &reader)
|
||||||
{
|
{
|
||||||
const QStringList &keys = reader.restoreValue(QLatin1String("valueKeys")).toStringList();
|
const QStringList keys = reader.restoreValue(QLatin1String("valueKeys")).toStringList();
|
||||||
foreach (const QString &key, keys) {
|
foreach (const QString &key, keys) {
|
||||||
QVariant value = reader.restoreValue(QLatin1String("value-") + key);
|
QVariant value = reader.restoreValue(QLatin1String("value-") + key);
|
||||||
m_values.insert(key, value);
|
m_values.insert(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::restoreDependencies(const Utils::PersistentSettingsReader &reader)
|
void SessionManagerPrivate::restoreDependencies(const PersistentSettingsReader &reader)
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> depMap = reader.restoreValue(QLatin1String("ProjectDependencies")).toMap();
|
QMap<QString, QVariant> depMap = reader.restoreValue(QLatin1String("ProjectDependencies")).toMap();
|
||||||
QMap<QString, QVariant>::const_iterator i = depMap.constBegin();
|
QMap<QString, QVariant>::const_iterator i = depMap.constBegin();
|
||||||
@@ -736,18 +780,18 @@ void SessionManager::restoreDependencies(const Utils::PersistentSettingsReader &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::askUserAboutFailedProjects()
|
void SessionManagerPrivate::askUserAboutFailedProjects()
|
||||||
{
|
{
|
||||||
QStringList failedProjects = m_failedProjects;
|
QStringList failedProjects = m_failedProjects;
|
||||||
if (!failedProjects.isEmpty()) {
|
if (!failedProjects.isEmpty()) {
|
||||||
QString fileList =
|
QString fileList =
|
||||||
QDir::toNativeSeparators(failedProjects.join(QLatin1String("<br>")));
|
QDir::toNativeSeparators(failedProjects.join(QLatin1String("<br>")));
|
||||||
QMessageBox * box = new QMessageBox(QMessageBox::Warning,
|
QMessageBox * box = new QMessageBox(QMessageBox::Warning,
|
||||||
tr("Failed to restore project files"),
|
SessionManager::tr("Failed to restore project files"),
|
||||||
tr("Could not restore the following project files:<br><b>%1</b>").
|
SessionManager::tr("Could not restore the following project files:<br><b>%1</b>").
|
||||||
arg(fileList));
|
arg(fileList));
|
||||||
QPushButton * keepButton = new QPushButton(tr("Keep projects in Session"), box);
|
QPushButton * keepButton = new QPushButton(SessionManager::tr("Keep projects in Session"), box);
|
||||||
QPushButton * removeButton = new QPushButton(tr("Remove projects from Session"), box);
|
QPushButton * removeButton = new QPushButton(SessionManager::tr("Remove projects from Session"), box);
|
||||||
box->addButton(keepButton, QMessageBox::AcceptRole);
|
box->addButton(keepButton, QMessageBox::AcceptRole);
|
||||||
box->addButton(removeButton, QMessageBox::DestructiveRole);
|
box->addButton(removeButton, QMessageBox::DestructiveRole);
|
||||||
|
|
||||||
@@ -758,27 +802,27 @@ void SessionManager::askUserAboutFailedProjects()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::restoreStartupProject(const Utils::PersistentSettingsReader &reader)
|
void SessionManagerPrivate::restoreStartupProject(const PersistentSettingsReader &reader)
|
||||||
{
|
{
|
||||||
const QString startupProject = reader.restoreValue(QLatin1String("StartupProject")).toString();
|
const QString startupProject = reader.restoreValue(QLatin1String("StartupProject")).toString();
|
||||||
if (!startupProject.isEmpty()) {
|
if (!startupProject.isEmpty()) {
|
||||||
foreach (Project *pro, m_projects) {
|
foreach (Project *pro, d->m_projects) {
|
||||||
if (QDir::cleanPath(pro->projectFilePath()) == startupProject) {
|
if (QDir::cleanPath(pro->projectFilePath()) == startupProject) {
|
||||||
setStartupProject(pro);
|
m_instance->setStartupProject(pro);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_startupProject) {
|
if (!m_startupProject) {
|
||||||
qWarning() << "Could not find startup project" << startupProject;
|
qWarning() << "Could not find startup project" << startupProject;
|
||||||
if (!projects().isEmpty())
|
if (!m_projects.isEmpty())
|
||||||
setStartupProject(projects().first());
|
m_instance->setStartupProject(m_projects.first());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::restoreEditors(const Utils::PersistentSettingsReader &reader)
|
void SessionManagerPrivate::restoreEditors(const PersistentSettingsReader &reader)
|
||||||
{
|
{
|
||||||
const QVariant &editorsettings = reader.restoreValue(QLatin1String("EditorSettings"));
|
const QVariant editorsettings = reader.restoreValue(QLatin1String("EditorSettings"));
|
||||||
if (editorsettings.isValid()) {
|
if (editorsettings.isValid()) {
|
||||||
EditorManager::restoreState(QByteArray::fromBase64(editorsettings.toByteArray()));
|
EditorManager::restoreState(QByteArray::fromBase64(editorsettings.toByteArray()));
|
||||||
sessionLoadingProgress();
|
sessionLoadingProgress();
|
||||||
@@ -788,7 +832,7 @@ void SessionManager::restoreEditors(const Utils::PersistentSettingsReader &reade
|
|||||||
/*!
|
/*!
|
||||||
\brief Loads a session, takes a session name (not filename).
|
\brief Loads a session, takes a session name (not filename).
|
||||||
*/
|
*/
|
||||||
void SessionManager::restoreProjects(const QStringList &fileList)
|
void SessionManagerPrivate::restoreProjects(const QStringList &fileList)
|
||||||
{
|
{
|
||||||
// indirectly adds projects to session
|
// indirectly adds projects to session
|
||||||
// Keep projects that failed to load in the session!
|
// Keep projects that failed to load in the session!
|
||||||
@@ -797,7 +841,7 @@ void SessionManager::restoreProjects(const QStringList &fileList)
|
|||||||
QString errors;
|
QString errors;
|
||||||
QList<Project *> projects = ProjectExplorerPlugin::instance()->openProjects(fileList, &errors);
|
QList<Project *> projects = ProjectExplorerPlugin::instance()->openProjects(fileList, &errors);
|
||||||
if (!errors.isEmpty())
|
if (!errors.isEmpty())
|
||||||
QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errors);
|
QMessageBox::critical(Core::ICore::mainWindow(), SessionManager::tr("Failed to open project"), errors);
|
||||||
foreach (Project *p, projects)
|
foreach (Project *p, projects)
|
||||||
m_failedProjects.removeAll(p->projectFilePath());
|
m_failedProjects.removeAll(p->projectFilePath());
|
||||||
}
|
}
|
||||||
@@ -808,14 +852,14 @@ bool SessionManager::loadSession(const QString &session)
|
|||||||
// Do nothing if we have that session already loaded,
|
// Do nothing if we have that session already loaded,
|
||||||
// exception if the session is the default virgin session
|
// exception if the session is the default virgin session
|
||||||
// we still want to be able to load the default session
|
// we still want to be able to load the default session
|
||||||
if (session == m_sessionName && !isDefaultVirgin())
|
if (session == d->m_sessionName && !isDefaultVirgin())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!sessions().contains(session))
|
if (!sessions().contains(session))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Try loading the file
|
// Try loading the file
|
||||||
Utils::FileName fileName = sessionNameToFileName(session);
|
FileName fileName = sessionNameToFileName(session);
|
||||||
PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
if (fileName.toFileInfo().exists()) {
|
if (fileName.toFileInfo().exists()) {
|
||||||
if (!reader.load(fileName)) {
|
if (!reader.load(fileName)) {
|
||||||
@@ -825,68 +869,68 @@ bool SessionManager::loadSession(const QString &session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_loadingSession = true;
|
d->m_loadingSession = true;
|
||||||
|
|
||||||
// Allow everyone to set something in the session and before saving
|
// Allow everyone to set something in the session and before saving
|
||||||
emit aboutToUnloadSession(m_sessionName);
|
emit m_instance->aboutToUnloadSession(d->m_sessionName);
|
||||||
|
|
||||||
if (!isDefaultVirgin()) {
|
if (!isDefaultVirgin()) {
|
||||||
if (!save()) {
|
if (!save()) {
|
||||||
m_loadingSession = false;
|
d->m_loadingSession = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
if (!EditorManager::closeAllEditors()) {
|
if (!EditorManager::closeAllEditors()) {
|
||||||
m_loadingSession = false;
|
d->m_loadingSession = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setStartupProject(0);
|
setStartupProject(0);
|
||||||
removeProjects(projects());
|
removeProjects(projects());
|
||||||
|
|
||||||
m_failedProjects.clear();
|
d->m_failedProjects.clear();
|
||||||
m_depMap.clear();
|
d->m_depMap.clear();
|
||||||
m_values.clear();
|
d->m_values.clear();
|
||||||
|
|
||||||
m_sessionName = session;
|
d->m_sessionName = session;
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
|
|
||||||
if (fileName.toFileInfo().exists()) {
|
if (fileName.toFileInfo().exists()) {
|
||||||
m_virginSession = false;
|
d->m_virginSession = false;
|
||||||
|
|
||||||
ProgressManager::addTask(m_future.future(), tr("Session"),
|
ProgressManager::addTask(d->m_future.future(), tr("Session"),
|
||||||
"ProjectExplorer.SessionFile.Load");
|
"ProjectExplorer.SessionFile.Load");
|
||||||
|
|
||||||
m_future.setProgressRange(0, 1);
|
d->m_future.setProgressRange(0, 1);
|
||||||
m_future.setProgressValue(0);
|
d->m_future.setProgressValue(0);
|
||||||
|
|
||||||
restoreValues(reader);
|
d->restoreValues(reader);
|
||||||
emit aboutToLoadSession(session);
|
emit m_instance->aboutToLoadSession(session);
|
||||||
|
|
||||||
QColor c = QColor(reader.restoreValue(QLatin1String("Color")).toString());
|
QColor c = QColor(reader.restoreValue(QLatin1String("Color")).toString());
|
||||||
if (c.isValid())
|
if (c.isValid())
|
||||||
Utils::StyleHelper::setBaseColor(c);
|
StyleHelper::setBaseColor(c);
|
||||||
|
|
||||||
QStringList fileList =
|
QStringList fileList =
|
||||||
reader.restoreValue(QLatin1String("ProjectList")).toStringList();
|
reader.restoreValue(QLatin1String("ProjectList")).toStringList();
|
||||||
|
|
||||||
m_future.setProgressRange(0, fileList.count() + 1/*initialization above*/ + 1/*editors*/);
|
d->m_future.setProgressRange(0, fileList.count() + 1/*initialization above*/ + 1/*editors*/);
|
||||||
m_future.setProgressValue(1);
|
d->m_future.setProgressValue(1);
|
||||||
|
|
||||||
// if one processEvents doesn't get the job done
|
// if one processEvents doesn't get the job done
|
||||||
// just use two!
|
// just use two!
|
||||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
restoreProjects(fileList);
|
d->restoreProjects(fileList);
|
||||||
sessionLoadingProgress();
|
d->sessionLoadingProgress();
|
||||||
restoreDependencies(reader);
|
d->restoreDependencies(reader);
|
||||||
restoreStartupProject(reader);
|
d->restoreStartupProject(reader);
|
||||||
restoreEditors(reader);
|
d->restoreEditors(reader);
|
||||||
|
|
||||||
m_future.reportFinished();
|
d->m_future.reportFinished();
|
||||||
m_future = QFutureInterface<void>();
|
d->m_future = QFutureInterface<void>();
|
||||||
|
|
||||||
// restore the active mode
|
// restore the active mode
|
||||||
Id modeId = Id::fromSetting(value(QLatin1String("ActiveMode")));
|
Id modeId = Id::fromSetting(value(QLatin1String("ActiveMode")));
|
||||||
@@ -899,36 +943,36 @@ bool SessionManager::loadSession(const QString &session)
|
|||||||
ModeManager::activateMode(Id(Core::Constants::MODE_EDIT));
|
ModeManager::activateMode(Id(Core::Constants::MODE_EDIT));
|
||||||
ModeManager::setFocusToCurrentMode();
|
ModeManager::setFocusToCurrentMode();
|
||||||
}
|
}
|
||||||
emit sessionLoaded(session);
|
emit m_instance->sessionLoaded(session);
|
||||||
|
|
||||||
// Starts a event loop, better do that at the very end
|
// Starts a event loop, better do that at the very end
|
||||||
askUserAboutFailedProjects();
|
d->askUserAboutFailedProjects();
|
||||||
m_loadingSession = false;
|
d->m_loadingSession = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SessionManager::lastSession() const
|
QString SessionManager::lastSession()
|
||||||
{
|
{
|
||||||
return ICore::settings()->value(QLatin1String("ProjectExplorer/StartupSession")).toString();
|
return ICore::settings()->value(QLatin1String("ProjectExplorer/StartupSession")).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionNode *SessionManager::sessionNode() const
|
SessionNode *SessionManager::sessionNode()
|
||||||
{
|
{
|
||||||
return m_sessionNode;
|
return d->m_sessionNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::reportProjectLoadingProgress()
|
void SessionManager::reportProjectLoadingProgress()
|
||||||
{
|
{
|
||||||
sessionLoadingProgress();
|
d->sessionLoadingProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::markSessionFileDirty(bool makeDefaultVirginDirty)
|
void SessionManager::markSessionFileDirty(bool makeDefaultVirginDirty)
|
||||||
{
|
{
|
||||||
if (makeDefaultVirginDirty)
|
if (makeDefaultVirginDirty)
|
||||||
m_virginSession = false;
|
d->m_virginSession = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionManager::sessionLoadingProgress()
|
void SessionManagerPrivate::sessionLoadingProgress()
|
||||||
{
|
{
|
||||||
m_future.setProgressValue(m_future.progressValue() + 1);
|
m_future.setProgressValue(m_future.progressValue() + 1);
|
||||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
@@ -936,7 +980,7 @@ void SessionManager::sessionLoadingProgress()
|
|||||||
|
|
||||||
void SessionManager::projectDisplayNameChanged()
|
void SessionManager::projectDisplayNameChanged()
|
||||||
{
|
{
|
||||||
Project *pro = qobject_cast<Project*>(sender());
|
Project *pro = qobject_cast<Project*>(m_instance->sender());
|
||||||
if (pro) {
|
if (pro) {
|
||||||
Node *currentNode = 0;
|
Node *currentNode = 0;
|
||||||
if (ProjectExplorerPlugin::currentProject() == pro)
|
if (ProjectExplorerPlugin::currentProject() == pro)
|
||||||
@@ -945,19 +989,19 @@ void SessionManager::projectDisplayNameChanged()
|
|||||||
// Fix node sorting
|
// Fix node sorting
|
||||||
QList<ProjectNode *> nodes;
|
QList<ProjectNode *> nodes;
|
||||||
nodes << pro->rootProjectNode();
|
nodes << pro->rootProjectNode();
|
||||||
m_sessionNode->removeProjectNodes(nodes);
|
d->m_sessionNode->removeProjectNodes(nodes);
|
||||||
m_sessionNode->addProjectNodes(nodes);
|
d->m_sessionNode->addProjectNodes(nodes);
|
||||||
|
|
||||||
if (currentNode)
|
if (currentNode)
|
||||||
ProjectExplorerPlugin::instance()->setCurrentNode(currentNode);
|
ProjectExplorerPlugin::instance()->setCurrentNode(currentNode);
|
||||||
|
|
||||||
emit projectDisplayNameChanged(pro);
|
emit m_instance->projectDisplayNameChanged(pro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ProjectExplorer::SessionManager::projectsForSessionName(const QString &session) const
|
QStringList SessionManager::projectsForSessionName(const QString &session)
|
||||||
{
|
{
|
||||||
const Utils::FileName fileName = sessionNameToFileName(session);
|
const FileName fileName = sessionNameToFileName(session);
|
||||||
PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
if (fileName.toFileInfo().exists()) {
|
if (fileName.toFileInfo().exists()) {
|
||||||
if (!reader.load(fileName)) {
|
if (!reader.load(fileName)) {
|
||||||
@@ -967,3 +1011,5 @@ QStringList ProjectExplorer::SessionManager::projectsForSessionName(const QStrin
|
|||||||
}
|
}
|
||||||
return reader.restoreValue(QLatin1String("ProjectList")).toStringList();
|
return reader.restoreValue(QLatin1String("ProjectList")).toStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace ProjectExplorer
|
||||||
|
@@ -66,62 +66,66 @@ public:
|
|||||||
explicit SessionManager(QObject *parent = 0);
|
explicit SessionManager(QObject *parent = 0);
|
||||||
~SessionManager();
|
~SessionManager();
|
||||||
|
|
||||||
|
static QObject *instance();
|
||||||
|
|
||||||
// higher level session management
|
// higher level session management
|
||||||
QString activeSession() const;
|
static QString activeSession();
|
||||||
QString lastSession() const;
|
static QString lastSession();
|
||||||
QStringList sessions() const;
|
static QStringList sessions();
|
||||||
|
|
||||||
bool createSession(const QString &session);
|
static bool createSession(const QString &session);
|
||||||
|
|
||||||
bool confirmSessionDelete(const QString &session);
|
static bool confirmSessionDelete(const QString &session);
|
||||||
bool deleteSession(const QString &session);
|
static bool deleteSession(const QString &session);
|
||||||
|
|
||||||
bool cloneSession(const QString &original, const QString &clone);
|
static bool cloneSession(const QString &original, const QString &clone);
|
||||||
bool renameSession(const QString &original, const QString &newName);
|
static bool renameSession(const QString &original, const QString &newName);
|
||||||
|
|
||||||
bool loadSession(const QString &session);
|
static bool loadSession(const QString &session);
|
||||||
|
|
||||||
bool save();
|
static bool save();
|
||||||
void closeAllProjects();
|
static void closeAllProjects();
|
||||||
|
|
||||||
void addProject(Project *project);
|
static void addProject(Project *project);
|
||||||
void addProjects(const QList<Project*> &projects);
|
static void addProjects(const QList<Project*> &projects);
|
||||||
void removeProject(Project *project);
|
static void removeProject(Project *project);
|
||||||
void removeProjects(QList<Project *> remove);
|
static void removeProjects(QList<Project *> remove);
|
||||||
|
|
||||||
void setStartupProject(Project *startupProject);
|
static void setStartupProject(Project *startupProject);
|
||||||
|
|
||||||
QList<Project *> dependencies(const Project *project) const;
|
static QList<Project *> dependencies(const Project *project);
|
||||||
bool hasDependency(const Project *project, const Project *depProject) const;
|
static bool hasDependency(const Project *project, const Project *depProject);
|
||||||
bool canAddDependency(const Project *project, const Project *depProject) const;
|
static bool canAddDependency(const Project *project, const Project *depProject);
|
||||||
bool addDependency(Project *project, Project *depProject);
|
static bool addDependency(Project *project, Project *depProject);
|
||||||
void removeDependency(Project *project, Project *depProject);
|
static void removeDependency(Project *project, Project *depProject);
|
||||||
|
|
||||||
Utils::FileName sessionNameToFileName(const QString &session) const;
|
static Utils::FileName sessionNameToFileName(const QString &session);
|
||||||
Project *startupProject() const;
|
static Project *startupProject();
|
||||||
|
|
||||||
const QList<Project *> &projects() const;
|
static const QList<Project *> &projects();
|
||||||
|
static bool hasProjects();
|
||||||
|
|
||||||
bool isDefaultVirgin() const;
|
static bool isDefaultVirgin();
|
||||||
bool isDefaultSession(const QString &session) const;
|
static bool isDefaultSession(const QString &session);
|
||||||
|
|
||||||
// Let other plugins store persistent values within the session file
|
// Let other plugins store persistent values within the session file
|
||||||
void setValue(const QString &name, const QVariant &value);
|
static void setValue(const QString &name, const QVariant &value);
|
||||||
QVariant value(const QString &name);
|
static QVariant value(const QString &name);
|
||||||
|
|
||||||
// NBS rewrite projectOrder (dependency management)
|
// NBS rewrite projectOrder (dependency management)
|
||||||
QList<Project *> projectOrder(Project *project = 0) const;
|
static QList<Project *> projectOrder(Project *project = 0);
|
||||||
|
|
||||||
SessionNode *sessionNode() const;
|
static SessionNode *sessionNode();
|
||||||
|
|
||||||
Project *projectForNode(ProjectExplorer::Node *node) const;
|
static Project *projectForNode(ProjectExplorer::Node *node);
|
||||||
Node *nodeForFile(const QString &fileName, Project *project = 0) const;
|
static Node *nodeForFile(const QString &fileName, Project *project = 0);
|
||||||
Project *projectForFile(const QString &fileName) const;
|
static Project *projectForFile(const QString &fileName);
|
||||||
|
|
||||||
QStringList projectsForSessionName(const QString &session) const;
|
static QStringList projectsForSessionName(const QString &session);
|
||||||
|
|
||||||
|
static void reportProjectLoadingProgress();
|
||||||
|
static bool loadingSession();
|
||||||
|
|
||||||
void reportProjectLoadingProgress();
|
|
||||||
bool loadingSession();
|
|
||||||
signals:
|
signals:
|
||||||
void projectAdded(ProjectExplorer::Project *project);
|
void projectAdded(ProjectExplorer::Project *project);
|
||||||
void singleProjectAdded(ProjectExplorer::Project *project);
|
void singleProjectAdded(ProjectExplorer::Project *project);
|
||||||
@@ -138,46 +142,12 @@ signals:
|
|||||||
void dependencyChanged(ProjectExplorer::Project *a, ProjectExplorer::Project *b);
|
void dependencyChanged(ProjectExplorer::Project *a, ProjectExplorer::Project *b);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void saveActiveMode(Core::IMode *mode);
|
static void saveActiveMode(Core::IMode *mode);
|
||||||
void clearProjectFileCache();
|
static void clearProjectFileCache();
|
||||||
void configureEditor(Core::IEditor *editor, const QString &fileName);
|
static void configureEditor(Core::IEditor *editor, const QString &fileName);
|
||||||
void updateWindowTitle();
|
static void updateWindowTitle();
|
||||||
|
static void markSessionFileDirty(bool makeDefaultVirginDirty = true);
|
||||||
void markSessionFileDirty(bool makeDefaultVirginDirty = true);
|
static void projectDisplayNameChanged();
|
||||||
void sessionLoadingProgress();
|
|
||||||
|
|
||||||
void projectDisplayNameChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool projectContainsFile(Project *p, const QString &fileName) const;
|
|
||||||
void restoreValues(const Utils::PersistentSettingsReader &reader);
|
|
||||||
void restoreDependencies(const Utils::PersistentSettingsReader &reader);
|
|
||||||
void restoreStartupProject(const Utils::PersistentSettingsReader &reader);
|
|
||||||
void restoreEditors(const Utils::PersistentSettingsReader &reader);
|
|
||||||
void restoreProjects(const QStringList &fileList);
|
|
||||||
void askUserAboutFailedProjects();
|
|
||||||
|
|
||||||
bool recursiveDependencyCheck(const QString &newDep, const QString &checkDep) const;
|
|
||||||
QStringList dependencies(const QString &proName) const;
|
|
||||||
QStringList dependenciesOrder() const;
|
|
||||||
void dependencies(const QString &proName, QStringList &result) const;
|
|
||||||
|
|
||||||
SessionNode *m_sessionNode;
|
|
||||||
QString m_sessionName;
|
|
||||||
bool m_virginSession;
|
|
||||||
|
|
||||||
mutable QStringList m_sessions;
|
|
||||||
|
|
||||||
mutable QHash<Project *, QStringList> m_projectFileCache;
|
|
||||||
bool m_loadingSession;
|
|
||||||
|
|
||||||
Project *m_startupProject;
|
|
||||||
QList<Project *> m_projects;
|
|
||||||
QStringList m_failedProjects;
|
|
||||||
QMap<QString, QStringList> m_depMap;
|
|
||||||
QMap<QString, QVariant> m_values;
|
|
||||||
QFutureInterface<void> m_future;
|
|
||||||
Utils::PersistentSettingsWriter *m_writer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -113,8 +113,8 @@ Kit *ClassWizard::kitForWizard(const ClassWizardDialog *wizard) const
|
|||||||
const QString nodePath = wizard->extraValues().value(key).toString();
|
const QString nodePath = wizard->extraValues().value(key).toString();
|
||||||
|
|
||||||
// projectForFile doesn't find project if project file path passed
|
// projectForFile doesn't find project if project file path passed
|
||||||
Node *node = ProjectExplorerPlugin::instance()->session()->nodeForFile(nodePath);
|
Node *node = SessionManager::nodeForFile(nodePath);
|
||||||
Project *proj = ProjectExplorerPlugin::instance()->session()->projectForNode(node);
|
Project *proj = SessionManager::projectForNode(node);
|
||||||
if (proj && proj->activeTarget())
|
if (proj && proj->activeTarget())
|
||||||
return proj->activeTarget()->kit();
|
return proj->activeTarget()->kit();
|
||||||
|
|
||||||
|
@@ -60,6 +60,8 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -239,10 +241,8 @@ void QbsProjectManagerPlugin::updateBuildActions()
|
|||||||
|
|
||||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
||||||
file = currentDocument->filePath();
|
file = currentDocument->filePath();
|
||||||
ProjectExplorer::SessionManager *session = m_projectExplorer->session();
|
Node *node = SessionManager::nodeForFile(file);
|
||||||
ProjectExplorer::Node *node = session->nodeForFile(file);
|
Project *project = qobject_cast<QbsProject *>(SessionManager::projectForFile(file));
|
||||||
ProjectExplorer::Project *project
|
|
||||||
= qobject_cast<QbsProject *>(session->projectForFile(file));
|
|
||||||
|
|
||||||
m_buildFile->setParameter(QFileInfo(file).fileName());
|
m_buildFile->setParameter(QFileInfo(file).fileName());
|
||||||
fileVisible = project && node && qobject_cast<QbsBaseProjectNode *>(node->projectNode());
|
fileVisible = project && node && qobject_cast<QbsBaseProjectNode *>(node->projectNode());
|
||||||
@@ -310,7 +310,7 @@ void QbsProjectManagerPlugin::buildFile()
|
|||||||
QbsProject *project = 0;
|
QbsProject *project = 0;
|
||||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
||||||
file = currentDocument->filePath();
|
file = currentDocument->filePath();
|
||||||
project = qobject_cast<QbsProject *>(m_projectExplorer->session()->projectForFile(file));
|
project = qobject_cast<QbsProject *>(SessionManager::projectForFile(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!project || file.isEmpty())
|
if (!project || file.isEmpty())
|
||||||
@@ -333,10 +333,9 @@ void QbsProjectManagerPlugin::buildProduct()
|
|||||||
QbsProductNode *product = 0;
|
QbsProductNode *product = 0;
|
||||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
||||||
const QString file = currentDocument->filePath();
|
const QString file = currentDocument->filePath();
|
||||||
ProjectExplorer::SessionManager *session = m_projectExplorer->session();
|
|
||||||
|
|
||||||
project = qobject_cast<QbsProject *>(session->projectForFile(file));
|
project = qobject_cast<QbsProject *>(SessionManager::projectForFile(file));
|
||||||
product = qobject_cast<QbsProductNode *>(session->nodeForFile(file)->projectNode());
|
product = qobject_cast<QbsProductNode *>(SessionManager::nodeForFile(file)->projectNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!project || !product)
|
if (!project || !product)
|
||||||
|
@@ -273,8 +273,7 @@ void ModelManager::delayedInitialization()
|
|||||||
this, SLOT(maybeQueueCppQmlTypeUpdate(CPlusPlus::Document::Ptr)), Qt::DirectConnection);
|
this, SLOT(maybeQueueCppQmlTypeUpdate(CPlusPlus::Document::Ptr)), Qt::DirectConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::SessionManager *sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
connect(ProjectExplorer::SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
|
||||||
this, SLOT(removeProjectInfo(ProjectExplorer::Project*)));
|
this, SLOT(removeProjectInfo(ProjectExplorer::Project*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1111,8 +1110,7 @@ ModelManager::CppDataHash ModelManager::cppData() const
|
|||||||
|
|
||||||
LibraryInfo ModelManager::builtins(const Document::Ptr &doc) const
|
LibraryInfo ModelManager::builtins(const Document::Ptr &doc) const
|
||||||
{
|
{
|
||||||
ProjectExplorer::SessionManager *sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(doc->fileName());
|
||||||
ProjectExplorer::Project *project = sessionManager->projectForFile(doc->fileName());
|
|
||||||
if (!project)
|
if (!project)
|
||||||
return LibraryInfo();
|
return LibraryInfo();
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "qmljsmodelmanager.h"
|
#include "qmljsmodelmanager.h"
|
||||||
|
|
||||||
#include <qmljs/qmljsinterpreter.h>
|
#include <qmljs/qmljsinterpreter.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <utils/filesystemwatcher.h>
|
#include <utils/filesystemwatcher.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
@@ -437,7 +437,7 @@ void PluginDumper::dump(const Plugin &plugin)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Project *activeProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
|
ProjectExplorer::Project *activeProject = ProjectExplorer::SessionManager::startupProject();
|
||||||
if (!activeProject)
|
if (!activeProject)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -297,11 +297,10 @@ void QmlProfilerTool::populateFileFinder(QString projectDirectory, QString activ
|
|||||||
{
|
{
|
||||||
// Initialize filefinder with some sensible default
|
// Initialize filefinder with some sensible default
|
||||||
QStringList sourceFiles;
|
QStringList sourceFiles;
|
||||||
SessionManager *sessionManager = ProjectExplorerPlugin::instance()->session();
|
QList<Project *> projects = SessionManager::projects();
|
||||||
QList<Project *> projects = sessionManager->projects();
|
if (Project *startupProject = SessionManager::startupProject()) {
|
||||||
if (Project *startupProject = ProjectExplorerPlugin::instance()->startupProject()) {
|
|
||||||
// startup project first
|
// startup project first
|
||||||
projects.removeOne(ProjectExplorerPlugin::instance()->startupProject());
|
projects.removeOne(startupProject);
|
||||||
projects.insert(0, startupProject);
|
projects.insert(0, startupProject);
|
||||||
}
|
}
|
||||||
foreach (Project *project, projects)
|
foreach (Project *project, projects)
|
||||||
@@ -459,10 +458,9 @@ void QmlProfilerTool::startTool(StartMode mode)
|
|||||||
AnalyzerManager::showMode();
|
AnalyzerManager::showMode();
|
||||||
|
|
||||||
if (mode == StartLocal) {
|
if (mode == StartLocal) {
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
||||||
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
|
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
|
||||||
Project *pro = pe->startupProject();
|
Project *pro = SessionManager::startupProject();
|
||||||
pe->runProject(pro, runMode());
|
ProjectExplorerPlugin::instance()->runProject(pro, runMode());
|
||||||
} else if (mode == StartRemote) {
|
} else if (mode == StartRemote) {
|
||||||
startRemoteTool(this, mode);
|
startRemoteTool(this, mode);
|
||||||
}
|
}
|
||||||
|
@@ -54,8 +54,7 @@ namespace Internal {
|
|||||||
// Figure out the Qt4 project used by the file if any
|
// Figure out the Qt4 project used by the file if any
|
||||||
static Qt4Project *qt4ProjectFor(const QString &fileName)
|
static Qt4Project *qt4ProjectFor(const QString &fileName)
|
||||||
{
|
{
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
if (ProjectExplorer::Project *baseProject = ProjectExplorer::SessionManager::projectForFile(fileName))
|
||||||
if (ProjectExplorer::Project *baseProject = pe->session()->projectForFile(fileName))
|
|
||||||
if (Qt4Project *project = qobject_cast<Qt4Project*>(baseProject))
|
if (Qt4Project *project = qobject_cast<Qt4Project*>(baseProject))
|
||||||
return project;
|
return project;
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ LibraryDetailsController::LibraryDetailsController(
|
|||||||
if (!Utils::HostOsInfo::isLinuxHost()) {
|
if (!Utils::HostOsInfo::isLinuxHost()) {
|
||||||
// project for which we are going to insert the snippet
|
// project for which we are going to insert the snippet
|
||||||
const ProjectExplorer::Project *project =
|
const ProjectExplorer::Project *project =
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile);
|
ProjectExplorer::SessionManager::projectForFile(proFile);
|
||||||
// if its tool chain is maemo behave the same as we would be on linux
|
// if its tool chain is maemo behave the same as we would be on linux
|
||||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(project->activeTarget()->kit());
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(project->activeTarget()->kit());
|
||||||
if (tc
|
if (tc
|
||||||
@@ -816,8 +817,7 @@ QString PackageLibraryDetailsController::snippet() const
|
|||||||
|
|
||||||
bool PackageLibraryDetailsController::isLinkPackageGenerated() const
|
bool PackageLibraryDetailsController::isLinkPackageGenerated() const
|
||||||
{
|
{
|
||||||
const ProjectExplorer::Project *project =
|
const Project *project = SessionManager::projectForFile(proFile());
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile());
|
|
||||||
if (!project)
|
if (!project)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -969,8 +969,7 @@ void InternalLibraryDetailsController::updateProFile()
|
|||||||
m_proFileNodes.clear();
|
m_proFileNodes.clear();
|
||||||
libraryDetailsWidget()->libraryComboBox->clear();
|
libraryDetailsWidget()->libraryComboBox->clear();
|
||||||
|
|
||||||
const ProjectExplorer::Project *project =
|
const Project *project = SessionManager::projectForFile(proFile());
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile());
|
|
||||||
if (!project)
|
if (!project)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1053,8 +1052,7 @@ QString InternalLibraryDetailsController::snippet() const
|
|||||||
const QString proRelavitePath = rootDir.relativeFilePath(proFile());
|
const QString proRelavitePath = rootDir.relativeFilePath(proFile());
|
||||||
|
|
||||||
// project for which we insert the snippet
|
// project for which we insert the snippet
|
||||||
const ProjectExplorer::Project *project =
|
const Project *project = SessionManager::projectForFile(proFile());
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(proFile());
|
|
||||||
|
|
||||||
// the build directory of the active build configuration
|
// the build directory of the active build configuration
|
||||||
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
|
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
|
||||||
|
@@ -51,17 +51,10 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
using ProjectExplorer::BuildStep;
|
|
||||||
using ProjectExplorer::FileType;
|
|
||||||
using ProjectExplorer::HeaderType;
|
|
||||||
using ProjectExplorer::SourceType;
|
|
||||||
using ProjectExplorer::FormType;
|
|
||||||
using ProjectExplorer::ResourceType;
|
|
||||||
using ProjectExplorer::UnknownFileType;
|
|
||||||
|
|
||||||
// Known file types of a Qt 4 project
|
// Known file types of a Qt 4 project
|
||||||
static const char *qt4FileTypes[] = {
|
static const char *qt4FileTypes[] = {
|
||||||
"CppHeaderFiles",
|
"CppHeaderFiles",
|
||||||
@@ -198,7 +191,7 @@ void Qt4Manager::addLibrary(const QString &fileName, ProFileEditorWidget *editor
|
|||||||
|
|
||||||
void Qt4Manager::runQMake()
|
void Qt4Manager::runQMake()
|
||||||
{
|
{
|
||||||
runQMake(projectExplorer()->startupProject(), 0);
|
runQMake(SessionManager::startupProject(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4Manager::runQMakeContextMenu()
|
void Qt4Manager::runQMakeContextMenu()
|
||||||
@@ -257,13 +250,11 @@ void Qt4Manager::buildFile()
|
|||||||
{
|
{
|
||||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
||||||
QString file = currentDocument->filePath();
|
QString file = currentDocument->filePath();
|
||||||
ProjectExplorer::SessionManager *session = projectExplorer()->session();
|
FileNode *node = qobject_cast<FileNode *>(SessionManager::nodeForFile(file));
|
||||||
ProjectExplorer::FileNode *node = qobject_cast<FileNode *>(session->nodeForFile(file));
|
Project *project = SessionManager::projectForFile(file);
|
||||||
ProjectExplorer::Project *project = session->projectForFile(file);
|
|
||||||
|
|
||||||
if (project && node)
|
if (project && node)
|
||||||
handleSubDirContextMenu(BUILD, true, project, node->projectNode(), node);
|
handleSubDirContextMenu(BUILD, true, project, node->projectNode(), node);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using ProjectExplorer::Project;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
Qt4ProjectManagerPlugin::Qt4ProjectManagerPlugin()
|
Qt4ProjectManagerPlugin::Qt4ProjectManagerPlugin()
|
||||||
: m_previousStartupProject(0), m_previousTarget(0)
|
: m_previousStartupProject(0), m_previousTarget(0)
|
||||||
@@ -259,7 +259,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
|||||||
|
|
||||||
connect(m_projectExplorer->buildManager(), SIGNAL(buildStateChanged(ProjectExplorer::Project*)),
|
connect(m_projectExplorer->buildManager(), SIGNAL(buildStateChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(buildStateChanged(ProjectExplorer::Project*)));
|
this, SLOT(buildStateChanged(ProjectExplorer::Project*)));
|
||||||
connect(m_projectExplorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
connect(SessionManager::instance(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(startupProjectChanged()));
|
this, SLOT(startupProjectChanged()));
|
||||||
connect(m_projectExplorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)),
|
connect(m_projectExplorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)),
|
||||||
this, SLOT(updateContextActions(ProjectExplorer::Node*,ProjectExplorer::Project*)));
|
this, SLOT(updateContextActions(ProjectExplorer::Node*,ProjectExplorer::Project*)));
|
||||||
@@ -306,7 +306,7 @@ void Qt4ProjectManagerPlugin::startupProjectChanged()
|
|||||||
disconnect(m_previousStartupProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
disconnect(m_previousStartupProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
||||||
this, SLOT(activeTargetChanged()));
|
this, SLOT(activeTargetChanged()));
|
||||||
|
|
||||||
m_previousStartupProject = qobject_cast<Qt4Project *>(m_projectExplorer->session()->startupProject());
|
m_previousStartupProject = qobject_cast<Qt4Project *>(SessionManager::startupProject());
|
||||||
|
|
||||||
if (m_previousStartupProject)
|
if (m_previousStartupProject)
|
||||||
connect(m_previousStartupProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
connect(m_previousStartupProject, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
||||||
@@ -415,12 +415,10 @@ void Qt4ProjectManagerPlugin::updateBuildFileAction()
|
|||||||
bool visible = false;
|
bool visible = false;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
|
|
||||||
QString file;
|
|
||||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
||||||
file = currentDocument->filePath();
|
QString file = currentDocument->filePath();
|
||||||
ProjectExplorer::SessionManager *session = m_projectExplorer->session();
|
Node *node = SessionManager::nodeForFile(file);
|
||||||
ProjectExplorer::Node *node = session->nodeForFile(file);
|
Project *project = SessionManager::projectForFile(file);
|
||||||
ProjectExplorer::Project *project = session->projectForFile(file);
|
|
||||||
m_buildFileAction->setParameter(QFileInfo(file).fileName());
|
m_buildFileAction->setParameter(QFileInfo(file).fileName());
|
||||||
visible = qobject_cast<Qt4Project *>(project)
|
visible = qobject_cast<Qt4Project *>(project)
|
||||||
&& node
|
&& node
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
@@ -194,15 +195,15 @@ void TargetSetupPageWrapper::keyReleaseEvent(QKeyEvent *event)
|
|||||||
|
|
||||||
void TargetSetupPageWrapper::cancel()
|
void TargetSetupPageWrapper::cancel()
|
||||||
{
|
{
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->unloadProject(m_project);
|
ProjectExplorerPlugin::instance()->unloadProject(m_project);
|
||||||
if (ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projects().isEmpty())
|
if (!SessionManager::hasProjects())
|
||||||
Core::ModeManager::activateMode(Core::Constants::MODE_WELCOME);
|
Core::ModeManager::activateMode(Core::Constants::MODE_WELCOME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetSetupPageWrapper::done()
|
void TargetSetupPageWrapper::done()
|
||||||
{
|
{
|
||||||
m_targetSetupPage->setupProject(m_project);
|
m_targetSetupPage->setupProject(m_project);
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(m_project);
|
ProjectExplorerPlugin::instance()->requestProjectModeUpdate(m_project);
|
||||||
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -314,7 +314,7 @@ UiCodeModelManager::UiCodeModelManager() :
|
|||||||
= ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager();
|
= ProjectExplorer::ProjectExplorerPlugin::instance()->buildManager();
|
||||||
connect(bm, SIGNAL(buildStateChanged(ProjectExplorer::Project*)),
|
connect(bm, SIGNAL(buildStateChanged(ProjectExplorer::Project*)),
|
||||||
this, SLOT(buildStateHasChanged(ProjectExplorer::Project*)));
|
this, SLOT(buildStateHasChanged(ProjectExplorer::Project*)));
|
||||||
connect(ProjectExplorer::ProjectExplorerPlugin::instance()->session(),
|
connect(ProjectExplorer::SessionManager::instance(),
|
||||||
SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
SIGNAL(projectRemoved(ProjectExplorer::Project*)),
|
||||||
this, SLOT(projectWasRemoved(ProjectExplorer::Project*)));
|
this, SLOT(projectWasRemoved(ProjectExplorer::Project*)));
|
||||||
|
|
||||||
|
@@ -95,6 +95,7 @@ private:
|
|||||||
Manager();
|
Manager();
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
int foo();
|
||||||
|
|
||||||
bool m_isDownloadingDefinitionsSpec;
|
bool m_isDownloadingDefinitionsSpec;
|
||||||
QList<DefinitionDownloader *> m_downloaders;
|
QList<DefinitionDownloader *> m_downloaders;
|
||||||
|
@@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Todo {
|
namespace Todo {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -150,12 +152,10 @@ void TodoItemsProvider::updateListTimeoutElapsed()
|
|||||||
|
|
||||||
void TodoItemsProvider::setupStartupProjectBinding()
|
void TodoItemsProvider::setupStartupProjectBinding()
|
||||||
{
|
{
|
||||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorerPlugin = ProjectExplorer::ProjectExplorerPlugin::instance();
|
m_startupProject = SessionManager::startupProject();
|
||||||
|
connect(SessionManager::instance(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
m_startupProject = projectExplorerPlugin->startupProject();
|
|
||||||
connect(projectExplorerPlugin->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
|
||||||
SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
||||||
connect(projectExplorerPlugin, SIGNAL(fileListChanged()), SLOT(projectsFilesChanged()));
|
connect(ProjectExplorerPlugin::instance(), SIGNAL(fileListChanged()), SLOT(projectsFilesChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TodoItemsProvider::setupCurrentEditorBinding()
|
void TodoItemsProvider::setupCurrentEditorBinding()
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/session.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -185,8 +186,7 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo,
|
|||||||
static QString relativeToPath()
|
static QString relativeToPath()
|
||||||
{
|
{
|
||||||
// The project for which we insert the snippet.
|
// The project for which we insert the snippet.
|
||||||
const ProjectExplorer::Project *project =
|
const ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
|
|
||||||
|
|
||||||
QString relativeTo(project ? project->projectDirectory() : QDir::homePath());
|
QString relativeTo(project ? project->projectDirectory() : QDir::homePath());
|
||||||
if (!relativeTo.endsWith(QDir::separator()))
|
if (!relativeTo.endsWith(QDir::separator()))
|
||||||
|
@@ -139,9 +139,8 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel
|
|||||||
if (m_filterExternalIssues && !error.stacks().isEmpty()) {
|
if (m_filterExternalIssues && !error.stacks().isEmpty()) {
|
||||||
// ALGORITHM: look at last five stack frames, if none of these is inside any open projects,
|
// ALGORITHM: look at last five stack frames, if none of these is inside any open projects,
|
||||||
// assume this error was created by an external library
|
// assume this error was created by an external library
|
||||||
SessionManager *session = ProjectExplorerPlugin::instance()->session();
|
|
||||||
QSet<QString> validFolders;
|
QSet<QString> validFolders;
|
||||||
foreach (Project *project, session->projects()) {
|
foreach (Project *project, SessionManager::projects()) {
|
||||||
validFolders << project->projectDirectory();
|
validFolders << project->projectDirectory();
|
||||||
foreach (Target *target, project->targets()) {
|
foreach (Target *target, project->targets()) {
|
||||||
foreach (BuildConfiguration *config, target->buildConfigurations())
|
foreach (BuildConfiguration *config, target->buildConfigurations())
|
||||||
@@ -227,8 +226,7 @@ void MemcheckTool::settingsDestroyed(QObject *settings)
|
|||||||
void MemcheckTool::maybeActiveRunConfigurationChanged()
|
void MemcheckTool::maybeActiveRunConfigurationChanged()
|
||||||
{
|
{
|
||||||
ValgrindBaseSettings *settings = 0;
|
ValgrindBaseSettings *settings = 0;
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
if (Project *project = SessionManager::startupProject())
|
||||||
if (Project *project = pe->startupProject())
|
|
||||||
if (Target *target = project->activeTarget())
|
if (Target *target = project->activeTarget())
|
||||||
if (RunConfiguration *rc = target->activeRunConfiguration())
|
if (RunConfiguration *rc = target->activeRunConfiguration())
|
||||||
if (IRunConfigurationAspect *aspect = rc->extraAspect(ANALYZER_VALGRIND_SETTINGS))
|
if (IRunConfigurationAspect *aspect = rc->extraAspect(ANALYZER_VALGRIND_SETTINGS))
|
||||||
|
@@ -211,9 +211,8 @@ void SuppressionDialog::accept()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Add file to project if there is a project containing this file on the file system.
|
// Add file to project if there is a project containing this file on the file system.
|
||||||
ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
if (!ProjectExplorer::SessionManager::projectForFile(path)) {
|
||||||
if (!session->projectForFile(path)) {
|
foreach (ProjectExplorer::Project *p, ProjectExplorer::SessionManager::projects()) {
|
||||||
foreach (ProjectExplorer::Project *p, session->projects()) {
|
|
||||||
if (path.startsWith(p->projectDirectory())) {
|
if (path.startsWith(p->projectDirectory())) {
|
||||||
p->rootProjectNode()->addFiles(QStringList() << path);
|
p->rootProjectNode()->addFiles(QStringList() << path);
|
||||||
break;
|
break;
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -83,10 +84,8 @@ static void startLocalTool(IAnalyzerTool *tool)
|
|||||||
// Make sure mode is shown.
|
// Make sure mode is shown.
|
||||||
AnalyzerManager::showMode();
|
AnalyzerManager::showMode();
|
||||||
|
|
||||||
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
|
||||||
|
|
||||||
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
|
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
|
||||||
Project *pro = pe->startupProject();
|
Project *pro = SessionManager::startupProject();
|
||||||
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
|
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
|
||||||
if (pro) {
|
if (pro) {
|
||||||
if (const Target *target = pro->activeTarget()) {
|
if (const Target *target = pro->activeTarget()) {
|
||||||
@@ -147,7 +146,7 @@ static void startLocalTool(IAnalyzerTool *tool)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pe->runProject(pro, tool->runMode());
|
ProjectExplorerPlugin::instance()->runProject(pro, tool->runMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void startRemoteTool(IAnalyzerTool *tool)
|
static void startRemoteTool(IAnalyzerTool *tool)
|
||||||
|
@@ -1206,8 +1206,7 @@ static QTextCodec *findProjectCodec(const QString &dir)
|
|||||||
{
|
{
|
||||||
typedef QList<ProjectExplorer::Project*> ProjectList;
|
typedef QList<ProjectExplorer::Project*> ProjectList;
|
||||||
// Try to find a project under which file tree the file is.
|
// Try to find a project under which file tree the file is.
|
||||||
const ProjectExplorer::SessionManager *sm = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
const ProjectList projects = ProjectExplorer::SessionManager::projects();
|
||||||
const ProjectList projects = sm->projects();
|
|
||||||
if (!projects.empty()) {
|
if (!projects.empty()) {
|
||||||
const ProjectList::const_iterator pcend = projects.constEnd();
|
const ProjectList::const_iterator pcend = projects.constEnd();
|
||||||
for (ProjectList::const_iterator it = projects.constBegin(); it != pcend; ++it)
|
for (ProjectList::const_iterator it = projects.constBegin(); it != pcend; ++it)
|
||||||
|
Reference in New Issue
Block a user