ProjectNodes: Refactor runConfigurationsFor()

Rename to runConfigurations() and remove the node argument which is
available as 'this'. Adjust const-ness of node argument in
RunConfigurationFactory::runConfigurationsForNode

Change-Id: Icb63e96a305152f90135a2656536de2581faafaf
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
hjk
2014-04-29 08:35:00 +02:00
parent f0a8f4d918
commit 2e757deab4
22 changed files with 24 additions and 54 deletions

View File

@@ -131,7 +131,7 @@ bool AndroidRunConfigurationFactory::canHandle(Target *t) const
return AndroidManager::supportsAndroid(t); return AndroidManager::supportsAndroid(t);
} }
QList<RunConfiguration *> AndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n) QList<RunConfiguration *> AndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
{ {
QList<ProjectExplorer::RunConfiguration *> result; QList<ProjectExplorer::RunConfiguration *> result;
foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())

View File

@@ -61,7 +61,7 @@ public:
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); const ProjectExplorer::Node *n);
private: private:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;

View File

@@ -103,9 +103,3 @@ bool AutotoolsProjectNode::renameFile(const QString &filePath,
Q_UNUSED(newFilePath); Q_UNUSED(newFilePath);
return false; return false;
} }
QList<RunConfiguration *> AutotoolsProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node);
return QList<RunConfiguration *>();
}

View File

@@ -67,7 +67,6 @@ public:
bool deleteFiles(const QStringList &filePaths); bool deleteFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath, bool renameFile(const QString &filePath,
const QString &newFilePath); const QString &newFilePath);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
private: private:
AutotoolsProject *m_project; AutotoolsProject *m_project;

View File

@@ -93,9 +93,3 @@ bool CMakeProjectNode::renameFile(const QString &filePath, const QString &newFil
Q_UNUSED(newFilePath) Q_UNUSED(newFilePath)
return false; return false;
} }
QList<ProjectExplorer::RunConfiguration *> CMakeProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node)
return QList<ProjectExplorer::RunConfiguration *>();
}

View File

@@ -55,7 +55,6 @@ public:
virtual bool deleteFiles(const QStringList &filePaths); virtual bool deleteFiles(const QStringList &filePaths);
virtual bool renameFile(const QString &filePath, virtual bool renameFile(const QString &filePath,
const QString &newFilePath); const QString &newFilePath);
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -284,11 +284,5 @@ bool GenericProjectNode::renameFile(const QString &filePath, const QString &newF
return m_project->renameFile(filePath, newFilePath); return m_project->renameFile(filePath, newFilePath);
} }
QList<RunConfiguration *> GenericProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node)
return QList<RunConfiguration *>();
}
} // namespace Internal } // namespace Internal
} // namespace GenericProjectManager } // namespace GenericProjectManager

View File

@@ -65,8 +65,6 @@ public:
bool deleteFiles(const QStringList &filePaths); bool deleteFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath, const QString &newFilePath); bool renameFile(const QString &filePath, const QString &newFilePath);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
void refresh(QSet<QString> oldFileList = QSet<QString>()); void refresh(QSet<QString> oldFileList = QSet<QString>());
private: private:

View File

@@ -127,7 +127,7 @@ bool IosRunConfigurationFactory::canHandle(Target *t) const
return IosManager::supportsIos(t); return IosManager::supportsIos(t);
} }
QList<RunConfiguration *> IosRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n) QList<RunConfiguration *> IosRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
{ {
QList<ProjectExplorer::RunConfiguration *> result; QList<ProjectExplorer::RunConfiguration *> result;
foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations()) foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())

View File

@@ -64,7 +64,7 @@ public:
bool canHandle(ProjectExplorer::Target *t) const QTC_OVERRIDE; bool canHandle(ProjectExplorer::Target *t) const QTC_OVERRIDE;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n const ProjectExplorer::Node *n
) QTC_OVERRIDE; ) QTC_OVERRIDE;
private: private:
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent,

View File

@@ -2711,7 +2711,7 @@ void ProjectExplorerPlugin::updateContextMenuActions()
if (pn == d->m_currentProject->rootProjectNode()) { if (pn == d->m_currentProject->rootProjectNode()) {
d->m_runActionContextMenu->setVisible(true); d->m_runActionContextMenu->setVisible(true);
} else { } else {
QList<RunConfiguration *> runConfigs = pn->runConfigurationsFor(pn); QList<RunConfiguration *> runConfigs = pn->runConfigurations();
if (runConfigs.count() == 1) { if (runConfigs.count() == 1) {
d->m_runActionContextMenu->setVisible(true); d->m_runActionContextMenu->setVisible(true);
d->m_runActionContextMenu->setData(QVariant::fromValue(runConfigs.first())); d->m_runActionContextMenu->setData(QVariant::fromValue(runConfigs.first()));

View File

@@ -615,6 +615,16 @@ bool ProjectNode::deploysFolder(const QString &folder) const
return false; return false;
} }
/*!
\function bool ProjectNode::runConfigurations() const
Returns a list of \c RunConfiguration suitable for this node.
*/
QList<RunConfiguration *> ProjectNode::runConfigurations() const
{
return QList<RunConfiguration *>();
}
QList<NodesWatcher*> ProjectNode::watchers() const QList<NodesWatcher*> ProjectNode::watchers() const
{ {
return m_watchers; return m_watchers;

View File

@@ -249,8 +249,7 @@ public:
// by default returns false // by default returns false
virtual bool deploysFolder(const QString &folder) const; virtual bool deploysFolder(const QString &folder) const;
// TODO node parameter not really needed virtual QList<ProjectExplorer::RunConfiguration *> runConfigurations() const;
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node) = 0;
QList<NodesWatcher*> watchers() const; QList<NodesWatcher*> watchers() const;

View File

@@ -306,12 +306,6 @@ bool QbsBaseProjectNode::renameFile(const QString &filePath, const QString &newF
return false; return false;
} }
QList<ProjectExplorer::RunConfiguration *> QbsBaseProjectNode::runConfigurationsFor(ProjectExplorer::Node *node)
{
Q_UNUSED(node);
return QList<ProjectExplorer::RunConfiguration *>();
}
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// QbsGroupNode: // QbsGroupNode:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -548,9 +542,8 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData prd)
emitNodeUpdated(); emitNodeUpdated();
} }
QList<ProjectExplorer::RunConfiguration *> QbsProductNode::runConfigurationsFor(ProjectExplorer::Node *node) QList<ProjectExplorer::RunConfiguration *> QbsProductNode::runConfigurations() const
{ {
Q_UNUSED(node);
QList<ProjectExplorer::RunConfiguration *> result; QList<ProjectExplorer::RunConfiguration *> result;
QbsProjectNode *pn = qobject_cast<QbsProjectNode *>(projectNode()); QbsProjectNode *pn = qobject_cast<QbsProjectNode *>(projectNode());
if (!isEnabled() || !pn || !pn->qbsProject().isValid() if (!isEnabled() || !pn || !pn->qbsProject().isValid()

View File

@@ -89,8 +89,6 @@ public:
bool deleteFiles(const QStringList &filePaths); bool deleteFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath, const QString &newFilePath); bool renameFile(const QString &filePath, const QString &newFilePath);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
private: private:
friend class QbsGroupNode; friend class QbsGroupNode;
}; };
@@ -143,7 +141,7 @@ public:
void setQbsProductData(const qbs::ProductData prd); void setQbsProductData(const qbs::ProductData prd);
const qbs::ProductData qbsProductData() const { return m_qbsProductData; } const qbs::ProductData qbsProductData() const { return m_qbsProductData; }
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node); QList<ProjectExplorer::RunConfiguration *> runConfigurations() const;
private: private:
QbsGroupNode *findGroupNode(const QString &name); QbsGroupNode *findGroupNode(const QString &name);

View File

@@ -695,7 +695,7 @@ bool DesktopQmakeRunConfigurationFactory::canHandle(Target *t) const
return devType == Constants::DESKTOP_DEVICE_TYPE; return devType == Constants::DESKTOP_DEVICE_TYPE;
} }
QList<RunConfiguration *> DesktopQmakeRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n) QList<RunConfiguration *> DesktopQmakeRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
{ {
QList<RunConfiguration *> result; QList<RunConfiguration *> result;
foreach (RunConfiguration *rc, t->runConfigurations()) foreach (RunConfiguration *rc, t->runConfigurations())

View File

@@ -197,7 +197,7 @@ public:
QString displayNameForId(const Core::Id id) const; QString displayNameForId(const Core::Id id) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); const ProjectExplorer::Node *n);
private: private:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;

View File

@@ -817,11 +817,11 @@ bool QmakePriFileNode::deploysFolder(const QString &folder) const
return false; return false;
} }
QList<ProjectExplorer::RunConfiguration *> QmakePriFileNode::runConfigurationsFor(Node *node) QList<ProjectExplorer::RunConfiguration *> QmakePriFileNode::runConfigurations() const
{ {
QmakeRunConfigurationFactory *factory = QmakeRunConfigurationFactory::find(m_project->activeTarget()); QmakeRunConfigurationFactory *factory = QmakeRunConfigurationFactory::find(m_project->activeTarget());
if (factory) if (factory)
return factory->runConfigurationsForNode(m_project->activeTarget(), node); return factory->runConfigurationsForNode(m_project->activeTarget(), this);
return QList<ProjectExplorer::RunConfiguration *>(); return QList<ProjectExplorer::RunConfiguration *>();
} }

View File

@@ -168,7 +168,7 @@ public:
bool folderChanged(const QString &changedFolder, const QSet<Utils::FileName> &newFiles); bool folderChanged(const QString &changedFolder, const QSet<Utils::FileName> &newFiles);
bool deploysFolder(const QString &folder) const; bool deploysFolder(const QString &folder) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node); QList<ProjectExplorer::RunConfiguration *> runConfigurations() const;
QmakeProFileNode *proFileNode() const; QmakeProFileNode *proFileNode() const;
QList<QmakePriFileNode*> subProjectNodesExact() const; QList<QmakePriFileNode*> subProjectNodesExact() const;

View File

@@ -47,7 +47,7 @@ public:
virtual bool canHandle(ProjectExplorer::Target *t) const = 0; virtual bool canHandle(ProjectExplorer::Target *t) const = 0;
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n) = 0; const ProjectExplorer::Node *n) = 0;
static QmakeRunConfigurationFactory *find(ProjectExplorer::Target *t); static QmakeRunConfigurationFactory *find(ProjectExplorer::Target *t);
}; };

View File

@@ -221,11 +221,5 @@ bool QmlProjectNode::renameFile(const QString & /*filePath*/, const QString & /*
return true; return true;
} }
QList<ProjectExplorer::RunConfiguration *> QmlProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node)
return QList<ProjectExplorer::RunConfiguration *>();
}
} // namespace Internal } // namespace Internal
} // namespace QmlProjectManager } // namespace QmlProjectManager

View File

@@ -65,8 +65,6 @@ public:
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0); virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
virtual bool deleteFiles(const QStringList &filePaths); virtual bool deleteFiles(const QStringList &filePaths);
virtual bool renameFile(const QString &filePath, const QString &newFilePath); virtual bool renameFile(const QString &filePath, const QString &newFilePath);
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
void refresh(); void refresh();