ProjectExplorer: Remove RunConfiguration::canRunForNode()

All implementations that were returning true effectively did that
in case of node->buildKey() == rc->buildKey(), either directly or
in disguise of qmake's projectPath, so this is the check that is
used now in the two places where this is used.

The new global has the theoretical potential of return true in
cases where it did not before.

Change-Id: Ic5829de5fef0f9a04d516a3d9207685055823775
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-22 13:11:25 +01:00
parent f844f54cb7
commit c1c3f74dee
8 changed files with 2 additions and 24 deletions

View File

@@ -157,11 +157,6 @@ void IosRunConfiguration::updateEnabledState()
return RunConfiguration::updateEnabledState(); return RunConfiguration::updateEnabledState();
} }
bool IosRunConfiguration::canRunForNode(const Node *node) const
{
return node->filePath().toString() == buildKey();
}
QString IosRunConfiguration::applicationName() const QString IosRunConfiguration::applicationName() const
{ {
Project *project = target()->project(); Project *project = target()->project();

View File

@@ -57,7 +57,6 @@ private:
friend class IosDeviceTypeAspect; friend class IosDeviceTypeAspect;
void updateDisplayNames(); void updateDisplayNames();
void updateEnabledState() final; void updateEnabledState() final;
bool canRunForNode(const ProjectExplorer::Node *node) const final;
IosDeviceTypeAspect *m_deviceTypeAspect = nullptr; IosDeviceTypeAspect *m_deviceTypeAspect = nullptr;
}; };

View File

@@ -3176,8 +3176,9 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
} else { } else {
QList<RunConfiguration *> runConfigs; QList<RunConfiguration *> runConfigs;
if (Target *t = project->activeTarget()) { if (Target *t = project->activeTarget()) {
const QString buildKey = pn->buildKey();
for (RunConfiguration *rc : t->runConfigurations()) { for (RunConfiguration *rc : t->runConfigurations()) {
if (rc->canRunForNode(pn)) if (rc->buildKey() == buildKey)
runConfigs.append(rc); runConfigs.append(rc);
} }
} }

View File

@@ -182,7 +182,6 @@ public:
BuildTargetInfo buildTargetInfo() const; BuildTargetInfo buildTargetInfo() const;
static RunConfiguration *startupRunConfiguration(); static RunConfiguration *startupRunConfiguration();
virtual bool canRunForNode(const ProjectExplorer::Node *) const { return false; }
template <class T = ISettingsAspect> T *currentSettings(Core::Id id) const template <class T = ISettingsAspect> T *currentSettings(Core::Id id) const
{ {

View File

@@ -163,14 +163,6 @@ void QbsRunConfiguration::updateTargetInformation()
emit enabledChanged(); emit enabledChanged();
} }
bool QbsRunConfiguration::canRunForNode(const Node *node) const
{
if (auto pn = dynamic_cast<const QbsProductNode *>(node))
return buildKey() == pn->buildKey();
return false;
}
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// QbsRunConfigurationFactory: // QbsRunConfigurationFactory:
// -------------------------------------------------------------------- // --------------------------------------------------------------------

View File

@@ -48,7 +48,6 @@ private:
QVariantMap toMap() const final; QVariantMap toMap() const final;
bool fromMap(const QVariantMap &map) final; bool fromMap(const QVariantMap &map) final;
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &rci) final; void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &rci) final;
bool canRunForNode(const ProjectExplorer::Node *node) const final;
void updateTargetInformation(); void updateTargetInformation();

View File

@@ -130,11 +130,6 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
} }
} }
bool DesktopQmakeRunConfiguration::canRunForNode(const Node *node) const
{
return node->filePath() == proFilePath();
}
FileName DesktopQmakeRunConfiguration::proFilePath() const FileName DesktopQmakeRunConfiguration::proFilePath() const
{ {
return FileName::fromString(buildKey()); return FileName::fromString(buildKey());

View File

@@ -47,8 +47,6 @@ private:
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final; void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
QString defaultDisplayName(); QString defaultDisplayName();
bool canRunForNode(const ProjectExplorer::Node *node) const final;
Utils::FileName proFilePath() const; Utils::FileName proFilePath() const;
}; };