From 9ac92e6fadfe57bb221961e2be824c3c84a62cf3 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Tue, 31 Jan 2012 13:40:59 +0100 Subject: [PATCH] Remove class SessionNodeImpl, just use SessionNode directly The class added nothing over SessionNode. Change-Id: I137c274514b2c5897a591b7e093ba84e1a91e9d7 Reviewed-by: Tobias Hunger --- .../projectexplorer/projectexplorer.pro | 2 - src/plugins/projectexplorer/projectnodes.cpp | 4 +- src/plugins/projectexplorer/projectnodes.h | 4 +- src/plugins/projectexplorer/session.cpp | 8 +-- src/plugins/projectexplorer/session.h | 2 +- .../projectexplorer/sessionnodeimpl.cpp | 64 ------------------- src/plugins/projectexplorer/sessionnodeimpl.h | 60 ----------------- 7 files changed, 10 insertions(+), 134 deletions(-) delete mode 100644 src/plugins/projectexplorer/sessionnodeimpl.cpp delete mode 100644 src/plugins/projectexplorer/sessionnodeimpl.h diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 2862a0c64c4..5c7dfe9d197 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -94,7 +94,6 @@ HEADERS += projectexplorer.h \ taskhub.h \ localapplicationruncontrol.h \ customexecutableconfigurationwidget.h \ - sessionnodeimpl.h \ metatypedeclarations.h \ publishing/publishingwizardselectiondialog.h \ publishing/ipublishingwizardfactory.h \ @@ -185,7 +184,6 @@ SOURCES += projectexplorer.cpp \ processparameters.cpp \ localapplicationruncontrol.cpp \ customexecutableconfigurationwidget.cpp \ - sessionnodeimpl.cpp \ publishing/publishingwizardselectiondialog.cpp \ appoutputpane.cpp \ codestylesettingspropertiespage.cpp \ diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index 6469d6a688f..ee7b90aff29 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -595,8 +595,8 @@ bool ProjectNode::sortNodesByPath(Node *n1, Node *n2) { \class ProjectExplorer::SessionNode */ -SessionNode::SessionNode(const QString &sessionPath, QObject *parentObject) - : FolderNode(sessionPath) +SessionNode::SessionNode(QObject *parentObject) + : FolderNode(QLatin1String("session")) { setParent(parentObject); setNodeType(SessionNodeType); diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index 1fa0fe4fc53..81f02fba5be 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -77,6 +77,7 @@ class FolderNode; class ProjectNode; class NodesWatcher; class NodesVisitor; +class SessionManager; // Documentation inside. class PROJECTEXPLORER_EXPORT Node : public QObject { @@ -245,8 +246,9 @@ private: // Documentation inside. class PROJECTEXPLORER_EXPORT SessionNode : public FolderNode { Q_OBJECT + friend class SessionManager; public: - SessionNode(const QString &sessionFilePath, QObject *parentObject); + SessionNode(QObject *parentObject); QList projectNodes() const; diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index b4c27c5659d..9bbe2a285cd 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -31,13 +31,13 @@ **************************************************************************/ #include "session.h" -#include "sessionnodeimpl.h" #include "project.h" #include "projectexplorer.h" #include "projectexplorerconstants.h" #include "nodesvisitor.h" #include "editorconfiguration.h" +#include "projectnodes.h" #include #include @@ -323,7 +323,7 @@ void SessionFile::clearFailedProjectFileNames() SessionManager::SessionManager(QObject *parent) : QObject(parent), m_file(new SessionFile), - m_sessionNode(new Internal::SessionNodeImpl(this)), + m_sessionNode(new SessionNode(this)), m_virginSession(true) { connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), @@ -502,7 +502,7 @@ void SessionManager::addProjects(const QList &projects) if (!m_file->m_projects.contains(pro)) { clearedList.append(pro); m_file->m_projects.append(pro); - m_sessionNode->addProjectNode(pro->rootProjectNode()); + m_sessionNode->addProjectNodes(QList() << pro->rootProjectNode()); connect(pro, SIGNAL(fileListChanged()), this, SLOT(clearProjectFileCache())); @@ -918,7 +918,7 @@ void SessionManager::removeProjects(QList remove) if (debug) qDebug() << "SessionManager - emitting projectRemoved(" << pro->displayName() << ")"; - m_sessionNode->removeProjectNode(pro->rootProjectNode()); + m_sessionNode->removeProjectNodes(QList() << pro->rootProjectNode()); emit projectRemoved(pro); delete pro; } diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h index 58b04ea2935..220c1a5e991 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -163,7 +163,7 @@ private: void updateName(const QString &session); Internal::SessionFile *m_file; - Internal::SessionNodeImpl *m_sessionNode; + SessionNode *m_sessionNode; QString m_sessionName; bool m_virginSession; diff --git a/src/plugins/projectexplorer/sessionnodeimpl.cpp b/src/plugins/projectexplorer/sessionnodeimpl.cpp deleted file mode 100644 index dd1713d2188..00000000000 --- a/src/plugins/projectexplorer/sessionnodeimpl.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "sessionnodeimpl.h" -#include "session.h" - -namespace ProjectExplorer { -namespace Internal { - -SessionNodeImpl::SessionNodeImpl(SessionManager *manager) - : ProjectExplorer::SessionNode( - manager->sessionNameToFileName(manager->currentSession()), - manager) -{ - setFileName(QLatin1String("session")); -} - -void SessionNodeImpl::addProjectNode(ProjectNode *projectNode) -{ - addProjectNodes(QList() << projectNode); -} - -void SessionNodeImpl::removeProjectNode(ProjectNode *projectNode) -{ - removeProjectNodes(QList() << projectNode); -} - -void SessionNodeImpl::setFileName(const QString &fileName) -{ - setPath(fileName); - setDisplayName(fileName); -} - -} // namespace Internal -} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/sessionnodeimpl.h b/src/plugins/projectexplorer/sessionnodeimpl.h deleted file mode 100644 index 1fe7c523ce4..00000000000 --- a/src/plugins/projectexplorer/sessionnodeimpl.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef SESSIONNODEIMPL_H -#define SESSIONNODEIMPL_H - -#include "projectnodes.h" - -namespace ProjectExplorer { -class SessionManager; - -namespace Internal { - -// Must be in a header as otherwise moc has issues -// with ProjectExplorer::SessionNode on msvc2005 -class SessionNodeImpl : public ProjectExplorer::SessionNode -{ - Q_OBJECT -public: - explicit SessionNodeImpl(SessionManager *manager); - - void addProjectNode(ProjectNode *projectNode); - void removeProjectNode(ProjectNode *projectNode); - - void setFileName(const QString &fileName); -}; - -} // namespace Internal -} // namespace ProjectExplorer - -#endif // SESSIONNODEIMPL_H