Commit 2e757dea authored by hjk's avatar hjk

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: default avatarDaniel Teske <daniel.teske@digia.com>
parent f0a8f4d9
......@@ -131,7 +131,7 @@ bool AndroidRunConfigurationFactory::canHandle(Target *t) const
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;
foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
......
......@@ -61,7 +61,7 @@ public:
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n);
const ProjectExplorer::Node *n);
private:
bool canHandle(ProjectExplorer::Target *t) const;
......
......@@ -103,9 +103,3 @@ bool AutotoolsProjectNode::renameFile(const QString &filePath,
Q_UNUSED(newFilePath);
return false;
}
QList<RunConfiguration *> AutotoolsProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node);
return QList<RunConfiguration *>();
}
......@@ -67,7 +67,6 @@ public:
bool deleteFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath,
const QString &newFilePath);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
private:
AutotoolsProject *m_project;
......
......@@ -93,9 +93,3 @@ bool CMakeProjectNode::renameFile(const QString &filePath, const QString &newFil
Q_UNUSED(newFilePath)
return false;
}
QList<ProjectExplorer::RunConfiguration *> CMakeProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node)
return QList<ProjectExplorer::RunConfiguration *>();
}
......@@ -55,7 +55,6 @@ public:
virtual bool deleteFiles(const QStringList &filePaths);
virtual bool renameFile(const QString &filePath,
const QString &newFilePath);
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
};
} // namespace Internal
......
......@@ -284,11 +284,5 @@ bool GenericProjectNode::renameFile(const QString &filePath, const QString &newF
return m_project->renameFile(filePath, newFilePath);
}
QList<RunConfiguration *> GenericProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node)
return QList<RunConfiguration *>();
}
} // namespace Internal
} // namespace GenericProjectManager
......@@ -65,8 +65,6 @@ public:
bool deleteFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath, const QString &newFilePath);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
void refresh(QSet<QString> oldFileList = QSet<QString>());
private:
......
......@@ -127,7 +127,7 @@ bool IosRunConfigurationFactory::canHandle(Target *t) const
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;
foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
......
......@@ -64,7 +64,7 @@ public:
bool canHandle(ProjectExplorer::Target *t) const QTC_OVERRIDE;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n
const ProjectExplorer::Node *n
) QTC_OVERRIDE;
private:
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent,
......
......@@ -2711,7 +2711,7 @@ void ProjectExplorerPlugin::updateContextMenuActions()
if (pn == d->m_currentProject->rootProjectNode()) {
d->m_runActionContextMenu->setVisible(true);
} else {
QList<RunConfiguration *> runConfigs = pn->runConfigurationsFor(pn);
QList<RunConfiguration *> runConfigs = pn->runConfigurations();
if (runConfigs.count() == 1) {
d->m_runActionContextMenu->setVisible(true);
d->m_runActionContextMenu->setData(QVariant::fromValue(runConfigs.first()));
......
......@@ -615,6 +615,16 @@ bool ProjectNode::deploysFolder(const QString &folder) const
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
{
return m_watchers;
......
......@@ -249,8 +249,7 @@ public:
// by default returns false
virtual bool deploysFolder(const QString &folder) const;
// TODO node parameter not really needed
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node) = 0;
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurations() const;
QList<NodesWatcher*> watchers() const;
......
......@@ -306,12 +306,6 @@ bool QbsBaseProjectNode::renameFile(const QString &filePath, const QString &newF
return false;
}
QList<ProjectExplorer::RunConfiguration *> QbsBaseProjectNode::runConfigurationsFor(ProjectExplorer::Node *node)
{
Q_UNUSED(node);
return QList<ProjectExplorer::RunConfiguration *>();
}
// --------------------------------------------------------------------
// QbsGroupNode:
// --------------------------------------------------------------------
......@@ -548,9 +542,8 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData prd)
emitNodeUpdated();
}
QList<ProjectExplorer::RunConfiguration *> QbsProductNode::runConfigurationsFor(ProjectExplorer::Node *node)
QList<ProjectExplorer::RunConfiguration *> QbsProductNode::runConfigurations() const
{
Q_UNUSED(node);
QList<ProjectExplorer::RunConfiguration *> result;
QbsProjectNode *pn = qobject_cast<QbsProjectNode *>(projectNode());
if (!isEnabled() || !pn || !pn->qbsProject().isValid()
......
......@@ -89,8 +89,6 @@ public:
bool deleteFiles(const QStringList &filePaths);
bool renameFile(const QString &filePath, const QString &newFilePath);
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
private:
friend class QbsGroupNode;
};
......@@ -143,7 +141,7 @@ public:
void setQbsProductData(const qbs::ProductData prd);
const qbs::ProductData qbsProductData() const { return m_qbsProductData; }
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
QList<ProjectExplorer::RunConfiguration *> runConfigurations() const;
private:
QbsGroupNode *findGroupNode(const QString &name);
......
......@@ -695,7 +695,7 @@ bool DesktopQmakeRunConfigurationFactory::canHandle(Target *t) const
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;
foreach (RunConfiguration *rc, t->runConfigurations())
......
......@@ -197,7 +197,7 @@ public:
QString displayNameForId(const Core::Id id) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n);
const ProjectExplorer::Node *n);
private:
bool canHandle(ProjectExplorer::Target *t) const;
......
......@@ -817,11 +817,11 @@ bool QmakePriFileNode::deploysFolder(const QString &folder) const
return false;
}
QList<ProjectExplorer::RunConfiguration *> QmakePriFileNode::runConfigurationsFor(Node *node)
QList<ProjectExplorer::RunConfiguration *> QmakePriFileNode::runConfigurations() const
{
QmakeRunConfigurationFactory *factory = QmakeRunConfigurationFactory::find(m_project->activeTarget());
if (factory)
return factory->runConfigurationsForNode(m_project->activeTarget(), node);
return factory->runConfigurationsForNode(m_project->activeTarget(), this);
return QList<ProjectExplorer::RunConfiguration *>();
}
......
......@@ -168,7 +168,7 @@ public:
bool folderChanged(const QString &changedFolder, const QSet<Utils::FileName> &newFiles);
bool deploysFolder(const QString &folder) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
QList<ProjectExplorer::RunConfiguration *> runConfigurations() const;
QmakeProFileNode *proFileNode() const;
QList<QmakePriFileNode*> subProjectNodesExact() const;
......
......@@ -47,7 +47,7 @@ public:
virtual bool canHandle(ProjectExplorer::Target *t) const = 0;
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n) = 0;
const ProjectExplorer::Node *n) = 0;
static QmakeRunConfigurationFactory *find(ProjectExplorer::Target *t);
};
......
......@@ -221,11 +221,5 @@ bool QmlProjectNode::renameFile(const QString & /*filePath*/, const QString & /*
return true;
}
QList<ProjectExplorer::RunConfiguration *> QmlProjectNode::runConfigurationsFor(Node *node)
{
Q_UNUSED(node)
return QList<ProjectExplorer::RunConfiguration *>();
}
} // namespace Internal
} // namespace QmlProjectManager
......@@ -65,8 +65,6 @@ public:
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
virtual bool deleteFiles(const QStringList &filePaths);
virtual bool renameFile(const QString &filePath, const QString &newFilePath);
virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
void refresh();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment