aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2013-09-05 12:35:19 +0200
committerhjk <hjk121@nokiamail.com>2013-09-05 13:13:06 +0200
commit9fe9706803d5910c3047c6b1eebe6d7c4abb0be0 (patch)
treec8506bb0f29d5e2074e126442e3e27e8cdcb5a85 /src
parent0126672336accf729c4124c4af2b9b1c4fe8577a (diff)
ProjectExplorer: Clean up remaining SessionManager uses
Change-Id: I170edc81cc2bcb4de4168c5ec38d3897c2e7c7e8 Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/projectexplorer/dependenciespanel.cpp51
-rw-r--r--src/plugins/projectexplorer/dependenciespanel.h33
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.cpp56
-rw-r--r--src/plugins/projectexplorer/miniprojecttargetselector.h7
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp132
-rw-r--r--src/plugins/projectexplorer/session.h2
-rw-r--r--src/plugins/projectexplorer/sessiondialog.cpp38
-rw-r--r--src/plugins/projectexplorer/sessiondialog.h11
8 files changed, 147 insertions, 183 deletions
diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp
index a130d95aac..1bcb15d228 100644
--- a/src/plugins/projectexplorer/dependenciespanel.cpp
+++ b/src/plugins/projectexplorer/dependenciespanel.cpp
@@ -46,34 +46,28 @@
namespace ProjectExplorer {
namespace Internal {
-DependenciesModel::DependenciesModel(SessionManager *session,
- Project *project,
- QObject *parent)
+DependenciesModel::DependenciesModel(Project *project, QObject *parent)
: QAbstractListModel(parent)
- , m_session(session)
, m_project(project)
- , m_projects(session->projects())
+ , m_projects(SessionManager::projects())
{
// We can't select ourselves as a dependency
m_projects.removeAll(m_project);
- connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
+
+ QObject *sessionManager = SessionManager::instance();
+ connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(resetModel()));
- connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(resetModel()));
- connect(session, SIGNAL(sessionLoaded(QString)),
+ connect(sessionManager, SIGNAL(sessionLoaded(QString)),
this, SLOT(resetModel()));
// qDebug()<<"Dependencies Model"<<this<<"for project"<<project<<"("<<project->file()->fileName()<<")";
}
-DependenciesModel::~DependenciesModel()
-{
-// qDebug()<<"~DependenciesModel"<<this;
-}
-
void DependenciesModel::resetModel()
{
beginResetModel();
- m_projects = m_session->projects();
+ m_projects = SessionManager::projects();
m_projects.removeAll(m_project);
endResetModel();
}
@@ -101,7 +95,7 @@ QVariant DependenciesModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
return p->displayName();
case Qt::CheckStateRole:
- return m_session->hasDependency(m_project, p) ? Qt::Checked : Qt::Unchecked;
+ return SessionManager::hasDependency(m_project, p) ? Qt::Checked : Qt::Unchecked;
case Qt::DecorationRole:
return Core::FileIconProvider::instance()->icon(QFileInfo(p->projectFilePath()));
default:
@@ -116,7 +110,7 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value,
const Qt::CheckState c = static_cast<Qt::CheckState>(value.toInt());
if (c == Qt::Checked) {
- if (m_session->addDependency(m_project, p)) {
+ if (SessionManager::addDependency(m_project, p)) {
emit dataChanged(index, index);
return true;
} else {
@@ -124,8 +118,8 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value,
QCoreApplication::translate("DependenciesModel", "This would create a circular dependency."));
}
} else if (c == Qt::Unchecked) {
- if (m_session->hasDependency(m_project, p)) {
- m_session->removeDependency(m_project, p);
+ if (SessionManager::hasDependency(m_project, p)) {
+ SessionManager::removeDependency(m_project, p);
emit dataChanged(index, index);
return true;
}
@@ -157,11 +151,6 @@ DependenciesView::DependenciesView(QWidget *parent)
setRootIsDecorated(false);
}
-DependenciesView::~DependenciesView()
-{
-
-}
-
QSize DependenciesView::sizeHint() const
{
return m_sizeHint;
@@ -219,13 +208,10 @@ void DependenciesView::updateSizeHint()
// DependenciesWidget
//
-DependenciesWidget::DependenciesWidget(SessionManager *session,
- Project *project,
- QWidget *parent)
+DependenciesWidget::DependenciesWidget(Project *project, QWidget *parent)
: QWidget(parent)
- , m_session(session)
, m_project(project)
- , m_model(new DependenciesModel(session, project, this))
+ , m_model(new DependenciesModel(project, this))
{
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setContentsMargins(0, 0, 0, 0);
@@ -248,14 +234,9 @@ DependenciesWidget::DependenciesWidget(SessionManager *session,
// DependenciesPanelFactory
//
-DependenciesPanelFactory::DependenciesPanelFactory(SessionManager *session)
- : m_session(session)
-{
-}
-
QString DependenciesPanelFactory::id() const
{
- return QLatin1String(DEPENDENCIES_PANEL_ID);
+ return QLatin1String("ProjectExplorer.DependenciesPanel");
}
QString DependenciesPanelFactory::displayName() const
@@ -277,7 +258,7 @@ bool DependenciesPanelFactory::supports(Project *project)
PropertiesPanel *DependenciesPanelFactory::createPanel(Project *project)
{
PropertiesPanel *panel = new PropertiesPanel;
- panel->setWidget(new DependenciesWidget(m_session, project));
+ panel->setWidget(new DependenciesWidget(project));
panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/ProjectDependencies.png")));
panel->setDisplayName(QCoreApplication::translate("DependenciesPanel", "Dependencies"));
return panel;
diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h
index 9fc7e041e7..b7cada2237 100644
--- a/src/plugins/projectexplorer/dependenciespanel.h
+++ b/src/plugins/projectexplorer/dependenciespanel.h
@@ -36,33 +36,24 @@
#include <QTreeView>
-namespace Utils {
- class DetailsWidget;
-}
+namespace Utils { class DetailsWidget; }
namespace ProjectExplorer {
class Project;
-class SessionManager;
namespace Internal {
-const char DEPENDENCIES_PANEL_ID[] = "ProjectExplorer.DependenciesPanel";
-
-class DependenciesWidget;
-
class DependenciesPanelFactory : public IProjectPanelFactory
{
public:
- DependenciesPanelFactory(SessionManager *session);
+ DependenciesPanelFactory() {}
QString id() const;
QString displayName() const;
int priority() const;
bool supports(Project *project);
PropertiesPanel *createPanel(Project *project);
-private:
- SessionManager *m_session;
};
@@ -73,9 +64,9 @@ private:
class DependenciesModel : public QAbstractListModel
{
Q_OBJECT
+
public:
- DependenciesModel(SessionManager *session, Project *project, QObject *parent = 0);
- ~DependenciesModel();
+ explicit DependenciesModel(Project *project, QObject *parent = 0);
int rowCount(const QModelIndex &index) const;
int columnCount(const QModelIndex &index) const;
@@ -87,7 +78,6 @@ public slots:
void resetModel();
private:
- SessionManager *m_session;
Project *m_project;
QList<Project *> m_projects;
};
@@ -95,13 +85,16 @@ private:
class DependenciesView : public QTreeView
{
Q_OBJECT
+
public:
DependenciesView(QWidget *parent);
- ~DependenciesView();
- virtual QSize sizeHint() const;
- virtual void setModel(QAbstractItemModel *model);
+
+ QSize sizeHint() const;
+ void setModel(QAbstractItemModel *model);
+
private slots:
void updateSizeHint();
+
private:
QSize m_sizeHint;
};
@@ -109,11 +102,11 @@ private:
class DependenciesWidget : public QWidget
{
Q_OBJECT
+
public:
- DependenciesWidget(SessionManager *session, Project *project,
- QWidget *parent = 0);
+ explicit DependenciesWidget(Project *project, QWidget *parent = 0);
+
private:
- SessionManager *m_session;
Project *m_project;
DependenciesModel *m_model;
Utils::DetailsWidget *m_detailsContainer;
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
index ebdfcf5ef2..ae9aa9b1c1 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp
@@ -209,16 +209,17 @@ int ListWidget::padding()
////////
// ProjectListWidget
////////
-ProjectListWidget::ProjectListWidget(SessionManager *sessionManager, QWidget *parent)
- : ListWidget(parent), m_sessionManager(sessionManager), m_ignoreIndexChange(false)
+ProjectListWidget::ProjectListWidget(QWidget *parent)
+ : ListWidget(parent), m_ignoreIndexChange(false)
{
- connect(m_sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
+ QObject *sessionManager = SessionManager::instance();
+ connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(addProject(ProjectExplorer::Project*)));
- connect(m_sessionManager, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
this, SLOT(removeProject(ProjectExplorer::Project*)));
- connect(m_sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
this, SLOT(changeStartupProject(ProjectExplorer::Project*)));
- connect(m_sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
this, SLOT(projectDisplayNameChanged(ProjectExplorer::Project*)));
connect(this, SIGNAL(currentRowChanged(int)),
this, SLOT(setProject(int)));
@@ -363,7 +364,7 @@ void ProjectListWidget::setProject(int index)
if (index < 0)
return;
Project *p = item(index)->data(Qt::UserRole).value<Project *>();
- m_sessionManager->setStartupProject(p);
+ SessionManager::setStartupProject(p);
}
void ProjectListWidget::changeStartupProject(Project *project)
@@ -539,8 +540,8 @@ QWidget *MiniProjectTargetSelector::createTitleLabel(const QString &text)
return bar;
}
-MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorAction, SessionManager *sessionManager, QWidget *parent) :
- QWidget(parent), m_projectAction(targetSelectorAction), m_sessionManager(sessionManager),
+MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorAction, QWidget *parent) :
+ QWidget(parent), m_projectAction(targetSelectorAction),
m_project(0),
m_target(0),
m_buildConfiguration(0),
@@ -570,7 +571,7 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
m_listWidgets[PROJECT] = 0; //project is not a generic list widget
m_titleWidgets[PROJECT] = createTitleLabel(tr("Project"));
- m_projectListWidget = new ProjectListWidget(m_sessionManager, this);
+ m_projectListWidget = new ProjectListWidget(this);
QStringList titles;
titles << tr("Kit") << tr("Build")
@@ -581,21 +582,23 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
m_listWidgets[i] = new GenericListWidget(this);
}
- changeStartupProject(m_sessionManager->startupProject());
- if (m_sessionManager->startupProject())
- activeTargetChanged(m_sessionManager->startupProject()->activeTarget());
+ Project *startup = SessionManager::startupProject();
+ changeStartupProject(startup);
+ if (startup)
+ activeTargetChanged(startup->activeTarget());
connect(m_summaryLabel, SIGNAL(linkActivated(QString)),
this, SLOT(switchToProjectsMode()));
- connect(m_sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
+ QObject *sessionManager = SessionManager::instance();
+ connect(sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
this, SLOT(changeStartupProject(ProjectExplorer::Project*)));
- connect(m_sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(projectAdded(ProjectExplorer::Project*)));
- connect(m_sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(projectRemoved(ProjectExplorer::Project*)));
- connect(m_sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
this, SLOT(updateActionAndSummary()));
// for icon changes:
@@ -760,7 +763,7 @@ void MiniProjectTargetSelector::doLayout(bool keepSize)
onlySummary = true;
} else {
if (visibleLineCount < 3) {
- foreach (Project *p, m_sessionManager->projects()) {
+ foreach (Project *p, SessionManager::projects()) {
if (p->needsConfiguration()) {
visibleLineCount = 3;
break;
@@ -1063,10 +1066,11 @@ void MiniProjectTargetSelector::slotRemovedRunConfiguration(ProjectExplorer::Run
void MiniProjectTargetSelector::updateProjectListVisible()
{
- bool visible = m_sessionManager->projects().size() > 1;
+ int count = SessionManager::projects().size();
+ bool visible = count > 1;
m_projectListWidget->setVisible(visible);
- m_projectListWidget->setMaxCount(m_sessionManager->projects().size());
+ m_projectListWidget->setMaxCount(count);
m_titleWidgets[PROJECT]->setVisible(visible);
updateSummary();
@@ -1075,7 +1079,7 @@ void MiniProjectTargetSelector::updateProjectListVisible()
void MiniProjectTargetSelector::updateTargetListVisible()
{
int maxCount = 0;
- foreach (Project *p, m_sessionManager->projects())
+ foreach (Project *p, SessionManager::projects())
maxCount = qMax(p->targets().size(), maxCount);
bool visible = maxCount > 1;
@@ -1088,7 +1092,7 @@ void MiniProjectTargetSelector::updateTargetListVisible()
void MiniProjectTargetSelector::updateBuildListVisible()
{
int maxCount = 0;
- foreach (Project *p, m_sessionManager->projects())
+ foreach (Project *p, SessionManager::projects())
foreach (Target *t, p->targets())
maxCount = qMax(t->buildConfigurations().size(), maxCount);
@@ -1102,7 +1106,7 @@ void MiniProjectTargetSelector::updateBuildListVisible()
void MiniProjectTargetSelector::updateDeployListVisible()
{
int maxCount = 0;
- foreach (Project *p, m_sessionManager->projects())
+ foreach (Project *p, SessionManager::projects())
foreach (Target *t, p->targets())
maxCount = qMax(t->deployConfigurations().size(), maxCount);
@@ -1116,7 +1120,7 @@ void MiniProjectTargetSelector::updateDeployListVisible()
void MiniProjectTargetSelector::updateRunListVisible()
{
int maxCount = 0;
- foreach (Project *p, m_sessionManager->projects())
+ foreach (Project *p, SessionManager::projects())
foreach (Target *t, p->targets())
maxCount = qMax(t->runConfigurations().size(), maxCount);
@@ -1444,10 +1448,10 @@ void MiniProjectTargetSelector::updateActionAndSummary()
void MiniProjectTargetSelector::updateSummary()
{
QString summary;
- if (Project *startupProject = m_sessionManager->startupProject()) {
+ if (Project *startupProject = SessionManager::startupProject()) {
if (!m_projectListWidget->isVisibleTo(this))
summary.append(tr("Project: <b>%1</b><br/>").arg(startupProject->displayName()));
- if (Target *activeTarget = m_sessionManager->startupProject()->activeTarget()) {
+ if (Target *activeTarget = startupProject->activeTarget()) {
if (!m_listWidgets[TARGET]->isVisibleTo(this))
summary.append(tr("Kit: <b>%1</b><br/>").arg( activeTarget->displayName()));
if (!m_listWidgets[BUILD]->isVisibleTo(this) && activeTarget->activeBuildConfiguration())
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.h b/src/plugins/projectexplorer/miniprojecttargetselector.h
index f7b3aa90ca..80342a3c26 100644
--- a/src/plugins/projectexplorer/miniprojecttargetselector.h
+++ b/src/plugins/projectexplorer/miniprojecttargetselector.h
@@ -47,7 +47,6 @@ class BuildConfiguration;
class DeployConfiguration;
class ProjectConfiguration;
class RunConfiguration;
-class SessionManager;
namespace Internal {
@@ -75,7 +74,7 @@ class ProjectListWidget : public ListWidget
{
Q_OBJECT
public:
- explicit ProjectListWidget(SessionManager *sessionManager, QWidget *parent = 0);
+ explicit ProjectListWidget(QWidget *parent = 0);
private slots:
void addProject(ProjectExplorer::Project *project);
void removeProject(ProjectExplorer::Project *project);
@@ -85,7 +84,6 @@ private slots:
private:
QListWidgetItem *itemForProject(Project *project);
QString fullName(ProjectExplorer::Project *project);
- SessionManager *m_sessionManager;
bool m_ignoreIndexChange;
};
@@ -114,7 +112,7 @@ class MiniProjectTargetSelector : public QWidget
{
Q_OBJECT
public:
- explicit MiniProjectTargetSelector(QAction *projectAction, SessionManager *sessionManager, QWidget *parent = 0);
+ explicit MiniProjectTargetSelector(QAction *projectAction, QWidget *parent = 0);
void setVisible(bool visible);
void keyPressEvent(QKeyEvent *ke);
@@ -175,7 +173,6 @@ private:
QWidget *createTitleLabel(const QString &text);
QAction *m_projectAction;
- SessionManager *m_sessionManager;
enum TYPES { PROJECT = 0, TARGET = 1, BUILD = 2, DEPLOY = 3, RUN = 4, LAST = 5 };
ProjectListWidget *m_projectListWidget;
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 46ade8317d..b478f4a321 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -209,7 +209,6 @@ struct ProjectExplorerPluginPrivate {
QAction *m_runSubProject;
Internal::ProjectWindow *m_proWindow;
- SessionManager *m_session;
QString m_sessionToRestoreAtStartup;
Project *m_currentProject;
@@ -358,27 +357,27 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(DocumentManager::instance(), SIGNAL(currentFileChanged(QString)),
this, SLOT(setCurrentFile(QString)));
- d->m_session = new SessionManager(this);
+ QObject *sessionManager = new SessionManager(this);
- connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SIGNAL(fileListChanged()));
- connect(d->m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)),
this, SLOT(invalidateProject(ProjectExplorer::Project*)));
- connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SIGNAL(fileListChanged()));
- connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(projectAdded(ProjectExplorer::Project*)));
- connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(projectRemoved(ProjectExplorer::Project*)));
- connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
this, SLOT(startupProjectChanged()));
- connect(d->m_session, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(projectDisplayNameChanged(ProjectExplorer::Project*)),
this, SLOT(projectDisplayNameChanged(ProjectExplorer::Project*)));
- connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
+ connect(sessionManager, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
this, SLOT(updateActions()));
- connect(d->m_session, SIGNAL(sessionLoaded(QString)),
+ connect(sessionManager, SIGNAL(sessionLoaded(QString)),
this, SLOT(updateActions()));
- connect(d->m_session, SIGNAL(sessionLoaded(QString)),
+ connect(sessionManager, SIGNAL(sessionLoaded(QString)),
this, SLOT(updateWelcomePage()));
d->m_proWindow = new ProjectWindow;
@@ -400,7 +399,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_outputPane = new AppOutputPane;
addAutoReleasedObject(d->m_outputPane);
- connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
+ connect(SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
d->m_outputPane, SLOT(projectRemoved()));
connect(d->m_outputPane, SIGNAL(runControlStarted(ProjectExplorer::RunControl*)),
@@ -415,7 +414,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new RunSettingsPanelFactory);
addAutoReleasedObject(new EditorSettingsPanelFactory);
addAutoReleasedObject(new CodeStyleSettingsPanelFactory);
- addAutoReleasedObject(new DependenciesPanelFactory(d->m_session));
+ addAutoReleasedObject(new DependenciesPanelFactory);
addAutoReleasedObject(new ProcessStepFactory);
@@ -861,7 +860,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_projectSelectorAction->setCheckable(true);
d->m_projectSelectorAction->setEnabled(false);
QWidget *mainWindow = ICore::mainWindow();
- d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, d->m_session, mainWindow);
+ d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, mainWindow);
connect(d->m_projectSelectorAction, SIGNAL(triggered()), d->m_targetSelector, SLOT(show()));
ModeManager::addProjectSelector(d->m_projectSelectorAction);
@@ -1073,7 +1072,7 @@ void ProjectExplorerPlugin::unloadProject()
void ProjectExplorerPlugin::unloadProject(Project *project)
{
- d->m_session->removeProject(project);
+ SessionManager::removeProject(project);
updateActions();
}
@@ -1085,7 +1084,7 @@ void ProjectExplorerPlugin::closeAllProjects()
if (!EditorManager::closeAllEditors())
return; // Action has been cancelled
- d->m_session->closeAllProjects();
+ SessionManager::closeAllProjects();
updateActions();
ModeManager::activateMode(Core::Constants::MODE_WELCOME);
@@ -1175,7 +1174,7 @@ void ProjectExplorerPlugin::updateRunWithoutDeployMenu()
ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
{
d->m_proWindow->aboutToShutdown(); // disconnect from session
- d->m_session->closeAllProjects();
+ SessionManager::closeAllProjects();
d->m_projectsMode = 0;
d->m_shuttingDown = true;
// Attempt to synchronously shutdown all run controls.
@@ -1203,12 +1202,12 @@ void ProjectExplorerPlugin::showSessionManager()
if (debug)
qDebug() << "ProjectExplorerPlugin::showSessionManager";
- if (d->m_session->isDefaultVirgin()) {
+ if (SessionManager::isDefaultVirgin()) {
// do not save new virgin default sessions
} else {
- d->m_session->save();
+ SessionManager::save();
}
- SessionDialog sessionDialog(d->m_session, ICore::mainWindow());
+ SessionDialog sessionDialog(ICore::mainWindow());
sessionDialog.setAutoLoadSession(d->m_projectExplorerSettings.autorestoreLastSession);
sessionDialog.exec();
d->m_projectExplorerSettings.autorestoreLastSession = sessionDialog.autoLoadSession();
@@ -1227,13 +1226,13 @@ void ProjectExplorerPlugin::setStartupProject(Project *project)
if (!project)
return;
- d->m_session->setStartupProject(project);
+ SessionManager::setStartupProject(project);
updateActions();
}
void ProjectExplorerPlugin::publishProject()
{
- const Project * const project = d->m_session->startupProject();
+ const Project * const project = SessionManager::startupProject();
QTC_ASSERT(project, return);
PublishingWizardSelectionDialog selectionDialog(project);
if (selectionDialog.exec() == QDialog::Accepted) {
@@ -1252,19 +1251,19 @@ void ProjectExplorerPlugin::savePersistentSettings()
if (d->m_shuttingDown)
return;
- if (!d->m_session->loadingSession()) {
- foreach (Project *pro, d->m_session->projects())
+ if (!SessionManager::loadingSession()) {
+ foreach (Project *pro, SessionManager::projects())
pro->saveSettings();
- if (d->m_session->isDefaultVirgin()) {
+ if (SessionManager::isDefaultVirgin()) {
// do not save new virgin default sessions
} else {
- d->m_session->save();
+ SessionManager::save();
}
}
QSettings *s = ICore::settings();
- s->setValue(QLatin1String("ProjectExplorer/StartupSession"), d->m_session->activeSession());
+ s->setValue(QLatin1String("ProjectExplorer/StartupSession"), SessionManager::activeSession());
s->remove(QLatin1String("ProjectExplorer/RecentProjects/Files"));
QStringList fileNames;
@@ -1311,7 +1310,7 @@ Project *ProjectExplorerPlugin::openProject(const QString &fileName, QString *er
QList<Project *> list = openProjects(QStringList() << fileName, errorString);
if (!list.isEmpty()) {
addToRecentProjects(fileName, list.first()->displayName());
- d->m_session->setStartupProject(list.first());
+ SessionManager::setStartupProject(list.first());
return list.first();
}
return 0;
@@ -1355,7 +1354,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
if (found) {
appendError(errorString, tr("Failed opening project '%1': Project already open")
.arg(QDir::toNativeSeparators(fileName)));
- d->m_session->reportProjectLoadingProgress();
+ SessionManager::reportProjectLoadingProgress();
continue;
}
@@ -1366,7 +1365,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
if (Project *pro = manager->openProject(canonicalFilePath, &tmp)) {
if (pro->restoreSettings()) {
connect(pro, SIGNAL(fileListChanged()), this, SIGNAL(fileListChanged()));
- d->m_session->addProject(pro);
+ SessionManager::addProject(pro);
// Make sure we always have a current project / node
if (!d->m_currentProject && !openedPro.isEmpty())
setCurrentNode(pro->rootProjectNode());
@@ -1381,7 +1380,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
}
}
}
- d->m_session->reportProjectLoadingProgress();
+ SessionManager::reportProjectLoadingProgress();
}
updateActions();
@@ -1430,7 +1429,7 @@ void ProjectExplorerPlugin::setCurrentFile(const QString &filePath)
{
if (d->m_ignoreDocumentManagerChangedFile)
return;
- Project *project = d->m_session->projectForFile(filePath);
+ Project *project = SessionManager::projectForFile(filePath);
// If the file is not in any project, stay with the current project
// e.g. on opening a git diff buffer, git log buffer, we don't change the project
// I'm not 100% sure this is correct
@@ -1441,7 +1440,7 @@ void ProjectExplorerPlugin::setCurrentFile(const QString &filePath)
void ProjectExplorerPlugin::setCurrentNode(Node *node)
{
- setCurrent(d->m_session->projectForNode(node), QString(), node);
+ setCurrent(SessionManager::projectForNode(node), QString(), node);
}
void ProjectExplorerPlugin::updateWelcomePage()
@@ -1460,10 +1459,10 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
{
// Process command line arguments first:
if (pluginSpec()->arguments().contains(QLatin1String("-lastsession")))
- d->m_sessionToRestoreAtStartup = d->m_session->lastSession();
+ d->m_sessionToRestoreAtStartup = SessionManager::lastSession();
QStringList arguments = ExtensionSystem::PluginManager::arguments();
if (d->m_sessionToRestoreAtStartup.isNull()) {
- QStringList sessions = d->m_session->sessions();
+ QStringList sessions = SessionManager::sessions();
// We have command line arguments, try to find a session in them
// Default to no session loading
foreach (const QString &arg, arguments) {
@@ -1477,7 +1476,7 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
// Handle settings only after command line arguments:
if (d->m_sessionToRestoreAtStartup.isNull()
&& d->m_projectExplorerSettings.autorestoreLastSession)
- d->m_sessionToRestoreAtStartup = d->m_session->lastSession();
+ d->m_sessionToRestoreAtStartup = SessionManager::lastSession();
if (!d->m_sessionToRestoreAtStartup.isNull())
ModeManager::activateMode(Core::Constants::MODE_EDIT);
@@ -1522,7 +1521,7 @@ void ProjectExplorerPlugin::restoreSession()
// In addition, convert "filename" "+45" or "filename" ":23" into
// "filename+45" and "filename:23".
if (!arguments.isEmpty()) {
- const QStringList sessions = d->m_session->sessions();
+ const QStringList sessions = SessionManager::sessions();
QStringList projectGlobs = projectFileGlobs();
for (int a = 0; a < arguments.size(); ) {
const QString &arg = arguments.at(a);
@@ -1561,7 +1560,7 @@ void ProjectExplorerPlugin::restoreSession()
} // !arguments.isEmpty()
// Restore latest session or what was passed on the command line
if (!d->m_sessionToRestoreAtStartup.isEmpty())
- d->m_session->loadSession(d->m_sessionToRestoreAtStartup);
+ SessionManager::loadSession(d->m_sessionToRestoreAtStartup);
// update welcome page
connect(ModeManager::instance(),
@@ -1585,7 +1584,7 @@ void ProjectExplorerPlugin::loadSession(const QString &session)
{
if (debug)
qDebug() << "ProjectExplorerPlugin::loadSession" << session;
- d->m_session->loadSession(session);
+ SessionManager::loadSession(session);
}
@@ -1594,16 +1593,16 @@ void ProjectExplorerPlugin::showContextMenu(QWidget *view, const QPoint &globalP
QMenu *contextMenu = 0;
if (!node)
- node = d->m_session->sessionNode();
+ node = SessionManager::sessionNode();
if (node->nodeType() != SessionNodeType) {
- Project *project = d->m_session->projectForNode(node);
+ Project *project = SessionManager::projectForNode(node);
setCurrentNode(node);
emit aboutToShowContextMenu(project, node);
switch (node->nodeType()) {
case ProjectNodeType:
- if (node->parentFolderNode() == d->m_session->sessionNode())
+ if (node->parentFolderNode() == SessionManager::sessionNode())
contextMenu = d->m_projectMenu;
else
contextMenu = d->m_subProjectMenu;
@@ -1779,7 +1778,7 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
if (node)
filePath = node->path();
else
- node = d->m_session->nodeForFile(filePath, project);
+ node = SessionManager::nodeForFile(filePath, project);
bool projectChanged = false;
if (d->m_currentProject != project) {
@@ -1885,7 +1884,7 @@ void ProjectExplorerPlugin::updateActions()
d->m_cleanProjectOnlyAction->setToolTip(buildActionState.second);
// Session actions
- d->m_closeAllProjects->setEnabled(!d->m_session->projects().isEmpty());
+ d->m_closeAllProjects->setEnabled(SessionManager::hasProjects());
d->m_buildSessionAction->setEnabled(buildSessionState.first);
d->m_rebuildSessionAction->setEnabled(buildSessionState.first);
@@ -2039,9 +2038,9 @@ void ProjectExplorerPlugin::buildProjectOnly()
queue(QList<Project *>() << SessionManager::startupProject(), QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
-void ProjectExplorerPlugin::buildProject(ProjectExplorer::Project *p)
+void ProjectExplorerPlugin::buildProject(Project *p)
{
- queue(d->m_session->projectOrder(p),
+ queue(SessionManager::projectOrder(p),
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
@@ -2064,7 +2063,7 @@ void ProjectExplorerPlugin::buildProjectContextMenu()
void ProjectExplorerPlugin::buildSession()
{
- queue(d->m_session->projectOrder(),
+ queue(SessionManager::projectOrder(),
QList<Id>() << Id(Constants::BUILDSTEPS_BUILD));
}
@@ -2109,7 +2108,7 @@ void ProjectExplorerPlugin::deployProjectContextMenu()
void ProjectExplorerPlugin::deploySession()
{
- deploy(d->m_session->projectOrder());
+ deploy(SessionManager::projectOrder());
}
void ProjectExplorerPlugin::cleanProjectOnly()
@@ -2132,7 +2131,7 @@ void ProjectExplorerPlugin::cleanProjectContextMenu()
void ProjectExplorerPlugin::cleanSession()
{
- queue(d->m_session->projectOrder(),
+ queue(SessionManager::projectOrder(),
QList<Id>() << Id(Constants::BUILDSTEPS_CLEAN));
}
@@ -2164,8 +2163,7 @@ void ProjectExplorerPlugin::runProjectContextMenu()
bool ProjectExplorerPlugin::hasBuildSettings(Project *pro)
{
- const QList<Project *> & projects = d->m_session->projectOrder(pro);
- foreach (Project *project, projects)
+ foreach (Project *project, SessionManager::projectOrder(pro))
if (project
&& project->activeTarget()
&& project->activeTarget()->activeBuildConfiguration())
@@ -2190,7 +2188,7 @@ QPair<bool, QString> ProjectExplorerPlugin::buildSettingsEnabled(Project *pro)
result.first = false;
result.second = tr("Project has no build settings.");
} else {
- const QList<Project *> & projects = d->m_session->projectOrder(pro);
+ const QList<Project *> & projects = SessionManager::projectOrder(pro);
foreach (Project *project, projects) {
if (project
&& project->activeTarget()
@@ -2210,7 +2208,7 @@ QPair<bool, QString> ProjectExplorerPlugin::buildSettingsEnabledForSession()
{
QPair<bool, QString> result;
result.first = true;
- if (d->m_session->projects().isEmpty()) {
+ if (!SessionManager::hasProjects()) {
result.first = false;
result.second = tr("No project loaded");
} else if (d->m_buildManager->isBuilding()) {
@@ -2220,8 +2218,7 @@ QPair<bool, QString> ProjectExplorerPlugin::buildSettingsEnabledForSession()
result.first = false;
result.second = tr("Project has no build settings");
} else {
- const QList<Project *> & projects = d->m_session->projectOrder(0);
- foreach (Project *project, projects) {
+ foreach (Project *project, SessionManager::projectOrder(0)) {
if (project
&& project->activeTarget()
&& project->activeTarget()->activeBuildConfiguration()
@@ -2257,8 +2254,7 @@ bool ProjectExplorerPlugin::coreAboutToClose()
bool ProjectExplorerPlugin::hasDeploySettings(Project *pro)
{
- const QList<Project *> & projects = d->m_session->projectOrder(pro);
- foreach (Project *project, projects)
+ foreach (Project *project, SessionManager::projectOrder(pro))
if (project->activeTarget()
&& project->activeTarget()->activeDeployConfiguration()
&& !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty())
@@ -2276,7 +2272,7 @@ void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool fo
runRunConfiguration(rc, mode, forceSkipDeploy);
}
-void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguration *rc,
+void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
RunMode runMode,
const bool forceSkipDeploy)
{
@@ -2291,8 +2287,7 @@ void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguratio
}
Project *pro = rc->target()->project();
- const QList<Project *> &projects = d->m_session->projectOrder(pro);
- int queueCount = queue(projects, stepIds);
+ int queueCount = queue(SessionManager::projectOrder(pro), stepIds);
if (queueCount < 0) // something went wrong
return;
@@ -2446,8 +2441,7 @@ void ProjectExplorerPlugin::updateDeployActions()
bool enableDeploySessionAction = true;
if (d->m_projectExplorerSettings.buildBeforeDeploy) {
- const QList<Project *> & projects = d->m_session->projectOrder(0);
- foreach (Project *project, projects) {
+ foreach (Project *project, SessionManager::projectOrder(0)) {
if (project
&& project->activeTarget()
&& project->activeTarget()->activeBuildConfiguration()
@@ -2958,7 +2952,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
.arg(newFilePath)
.arg(projectNode->displayName()));
} else {
- setCurrent(d->m_session->projectForFile(newFilePath), newFilePath, 0);
+ setCurrent(SessionManager::projectForFile(newFilePath), newFilePath, 0);
}
}
}
@@ -2978,8 +2972,8 @@ void ProjectExplorerPlugin::updateSessionMenu()
d->m_sessionMenu->clear();
QActionGroup *ag = new QActionGroup(d->m_sessionMenu);
connect(ag, SIGNAL(triggered(QAction*)), this, SLOT(setSession(QAction*)));
- const QString &activeSession = d->m_session->activeSession();
- foreach (const QString &session, d->m_session->sessions()) {
+ const QString activeSession = SessionManager::activeSession();
+ foreach (const QString &session, SessionManager::sessions()) {
QAction *act = ag->addAction(session);
act->setCheckable(true);
if (session == activeSession)
@@ -2992,11 +2986,11 @@ void ProjectExplorerPlugin::updateSessionMenu()
void ProjectExplorerPlugin::setSession(QAction *action)
{
QString session = action->text();
- if (session != d->m_session->activeSession())
- d->m_session->loadSession(session);
+ if (session != SessionManager::activeSession())
+ SessionManager::loadSession(session);
}
-void ProjectExplorerPlugin::setProjectExplorerSettings(const ProjectExplorer::Internal::ProjectExplorerSettings &pes)
+void ProjectExplorerPlugin::setProjectExplorerSettings(const ProjectExplorerSettings &pes)
{
QTC_ASSERT(d->m_projectExplorerSettings.environmentId == pes.environmentId, return);
diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h
index 0348f33ed3..d5dd205b2d 100644
--- a/src/plugins/projectexplorer/session.h
+++ b/src/plugins/projectexplorer/session.h
@@ -48,7 +48,6 @@ QT_END_NAMESPACE
namespace Core {
class IMode;
class IEditor;
-class IDocument;
}
namespace ProjectExplorer {
@@ -56,7 +55,6 @@ namespace ProjectExplorer {
class Project;
class Node;
class SessionNode;
-class SessionManager;
class PROJECTEXPLORER_EXPORT SessionManager : public QObject
{
diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp
index 75ac0a6af2..0aa6b5be98 100644
--- a/src/plugins/projectexplorer/sessiondialog.cpp
+++ b/src/plugins/projectexplorer/sessiondialog.cpp
@@ -122,8 +122,8 @@ bool SessionNameInputDialog::isSwitchToRequested() const
}
-SessionDialog::SessionDialog(SessionManager *sessionManager, QWidget *parent)
- : QDialog(parent), m_sessionManager(sessionManager)
+SessionDialog::SessionDialog(QWidget *parent)
+ : QDialog(parent)
{
m_ui.setupUi(this);
@@ -161,10 +161,10 @@ bool SessionDialog::autoLoadSession() const
void SessionDialog::addItems(bool setDefaultSession)
{
- QStringList sessions = m_sessionManager->sessions();
+ QStringList sessions = SessionManager::sessions();
foreach (const QString &session, sessions) {
m_ui.sessionList->addItem(session);
- if (setDefaultSession && session == m_sessionManager->activeSession())
+ if (setDefaultSession && session == SessionManager::activeSession())
m_ui.sessionList->setCurrentRow(m_ui.sessionList->count() - 1);
}
}
@@ -174,11 +174,11 @@ void SessionDialog::markItems()
QListWidgetItem *item = m_ui.sessionList->item(i);
QFont f = item->font();
QString session = item->data(Qt::DisplayRole).toString();
- if (m_sessionManager->isDefaultSession(session))
+ if (SessionManager::isDefaultSession(session))
f.setItalic(true);
else
f.setItalic(false);
- if (m_sessionManager->activeSession() == session && !m_sessionManager->isDefaultVirgin())
+ if (SessionManager::activeSession() == session && !SessionManager::isDefaultVirgin())
f.setBold(true);
else
f.setBold(false);
@@ -190,7 +190,7 @@ void SessionDialog::updateActions()
{
if (m_ui.sessionList->currentItem()) {
bool isDefault = (m_ui.sessionList->currentItem()->text() == QLatin1String("default"));
- bool isActive = (m_ui.sessionList->currentItem()->text() == m_sessionManager->activeSession());
+ bool isActive = (m_ui.sessionList->currentItem()->text() == SessionManager::activeSession());
m_ui.btDelete->setEnabled(!isActive && !isDefault);
m_ui.btRename->setEnabled(!isDefault);
m_ui.btClone->setEnabled(true);
@@ -205,17 +205,17 @@ void SessionDialog::updateActions()
void SessionDialog::createNew()
{
- SessionNameInputDialog newSessionInputDialog(m_sessionManager->sessions(), this);
+ SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), this);
newSessionInputDialog.setWindowTitle(tr("New session name"));
if (newSessionInputDialog.exec() == QDialog::Accepted) {
QString newSession = newSessionInputDialog.value();
- if (newSession.isEmpty() || m_sessionManager->sessions().contains(newSession))
+ if (newSession.isEmpty() || SessionManager::sessions().contains(newSession))
return;
- m_sessionManager->createSession(newSession);
+ SessionManager::createSession(newSession);
m_ui.sessionList->clear();
- QStringList sessions = m_sessionManager->sessions();
+ QStringList sessions = SessionManager::sessions();
m_ui.sessionList->addItems(sessions);
m_ui.sessionList->setCurrentRow(sessions.indexOf(newSession));
markItems();
@@ -226,15 +226,15 @@ void SessionDialog::createNew()
void SessionDialog::clone()
{
- SessionNameInputDialog newSessionInputDialog(m_sessionManager->sessions(), this);
+ SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), this);
newSessionInputDialog.setValue(m_ui.sessionList->currentItem()->text());
newSessionInputDialog.setWindowTitle(tr("New session name"));
if (newSessionInputDialog.exec() == QDialog::Accepted) {
QString newSession = newSessionInputDialog.value();
- if (m_sessionManager->cloneSession(m_ui.sessionList->currentItem()->text(), newSession)) {
+ if (SessionManager::cloneSession(m_ui.sessionList->currentItem()->text(), newSession)) {
m_ui.sessionList->clear();
- QStringList sessions = m_sessionManager->sessions();
+ QStringList sessions = SessionManager::sessions();
m_ui.sessionList->addItems(sessions);
m_ui.sessionList->setCurrentRow(sessions.indexOf(newSession));
markItems();
@@ -246,9 +246,9 @@ void SessionDialog::remove()
{
const QString name = m_ui.sessionList->currentItem()->text();
- if (!m_sessionManager->confirmSessionDelete(name))
+ if (!SessionManager::confirmSessionDelete(name))
return;
- m_sessionManager->deleteSession(name);
+ SessionManager::deleteSession(name);
m_ui.sessionList->clear();
addItems(false);
markItems();
@@ -256,12 +256,12 @@ void SessionDialog::remove()
void SessionDialog::rename()
{
- SessionNameInputDialog newSessionInputDialog(m_sessionManager->sessions(), this);
+ SessionNameInputDialog newSessionInputDialog(SessionManager::sessions(), this);
newSessionInputDialog.setValue(m_ui.sessionList->currentItem()->text());
newSessionInputDialog.setWindowTitle(tr("Rename session"));
if (newSessionInputDialog.exec() == QDialog::Accepted) {
- m_sessionManager->renameSession(m_ui.sessionList->currentItem()->text(), newSessionInputDialog.value());
+ SessionManager::renameSession(m_ui.sessionList->currentItem()->text(), newSessionInputDialog.value());
m_ui.sessionList->clear();
addItems(false);
markItems();
@@ -271,7 +271,7 @@ void SessionDialog::rename()
void SessionDialog::switchToSession()
{
QString session = m_ui.sessionList->currentItem()->text();
- m_sessionManager->loadSession(session);
+ SessionManager::loadSession(session);
markItems();
updateActions();
reject();
diff --git a/src/plugins/projectexplorer/sessiondialog.h b/src/plugins/projectexplorer/sessiondialog.h
index 5ce4e35676..a00cff6e17 100644
--- a/src/plugins/projectexplorer/sessiondialog.h
+++ b/src/plugins/projectexplorer/sessiondialog.h
@@ -30,27 +30,25 @@
#ifndef SESSIONDIALOG_H
#define SESSIONDIALOG_H
+#include "ui_sessiondialog.h"
+
#include <QString>
#include <QDialog>
-#include "ui_sessiondialog.h"
-
QT_BEGIN_NAMESPACE
class QLineEdit;
class QPushButton;
QT_END_NAMESPACE
namespace ProjectExplorer {
-
-class SessionManager;
-
namespace Internal {
class SessionDialog : public QDialog
{
Q_OBJECT
+
public:
- SessionDialog(SessionManager *sessionManager, QWidget *parent = 0);
+ explicit SessionDialog(QWidget *parent = 0);
void setAutoLoadSession(bool);
bool autoLoadSession() const;
@@ -68,7 +66,6 @@ private:
void addItems(bool setDefaultSession);
void markItems();
Ui::SessionDialog m_ui;
- SessionManager *m_sessionManager;
};
class SessionNameInputDialog : public QDialog