diff options
author | hjk <hjk@qt.io> | 2018-03-14 14:40:47 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2018-03-16 09:55:03 +0000 |
commit | e20d6200436da24bfed43f0738c94e4bc3ce751b (patch) | |
tree | d9c451c7c803025983a79b9fcfd10c0b9af5115c /src/plugins/ios | |
parent | e3918b563f87db838ca279ad63a460d992fc03b4 (diff) | |
download | qt-creator-e20d6200436da24bfed43f0738c94e4bc3ce751b.tar.gz |
ProjectExplorer: Let RunConfiguration declare what nodes it belongs to
This feature in question is the availability of the "Run" button in the
context menu of certain project nodes in the project tree to run
something presumably related to/build from that (sub)project.
Previously, the decision was made for certain qmake based projects
(those targeting Desktop, iOS and VxWorks) by some indirection
through the corresponding RunConfigurationFactories.
The patch lets the RunConfigurations decide themselves directly
and removes the indirection, potentially opening the feature for
other qmake based RCs, as well as other combinations (e.g.
PythonRunConfiguration could be associated with its .py file,
without the need to have a dummy project)
Change-Id: Ic489bd1dfa25fcd9102ffa4fa30125565dd2e40e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/ios')
-rw-r--r-- | src/plugins/ios/iosrunconfiguration.cpp | 5 | ||||
-rw-r--r-- | src/plugins/ios/iosrunconfiguration.h | 1 | ||||
-rw-r--r-- | src/plugins/ios/iosrunfactories.cpp | 6 | ||||
-rw-r--r-- | src/plugins/ios/iosrunfactories.h | 10 |
4 files changed, 7 insertions, 15 deletions
diff --git a/src/plugins/ios/iosrunconfiguration.cpp b/src/plugins/ios/iosrunconfiguration.cpp index 703461266b..09a3feebde 100644 --- a/src/plugins/ios/iosrunconfiguration.cpp +++ b/src/plugins/ios/iosrunconfiguration.cpp @@ -157,6 +157,11 @@ void IosRunConfiguration::updateEnabledState() return RunConfiguration::updateEnabledState(); } +bool IosRunConfiguration::canRunForNode(const Node *node) const +{ + return node->filePath() == m_profilePath; +} + IosDeployStep *IosRunConfiguration::deployStep() const { DeployConfiguration *config = target()->activeDeployConfiguration(); diff --git a/src/plugins/ios/iosrunconfiguration.h b/src/plugins/ios/iosrunconfiguration.h index 6e40b66573..4bdf92f046 100644 --- a/src/plugins/ios/iosrunconfiguration.h +++ b/src/plugins/ios/iosrunconfiguration.h @@ -74,6 +74,7 @@ private: friend class IosRunConfigurationWidget; void updateDisplayNames(); void updateEnabledState() final; + bool canRunForNode(const ProjectExplorer::Node *node) const final; Utils::FileName m_profilePath; IosDeviceType m_deviceType; diff --git a/src/plugins/ios/iosrunfactories.cpp b/src/plugins/ios/iosrunfactories.cpp index e626e8ac96..2faa99afba 100644 --- a/src/plugins/ios/iosrunfactories.cpp +++ b/src/plugins/ios/iosrunfactories.cpp @@ -59,11 +59,5 @@ IosRunConfigurationFactory::availableCreators(Target *parent) const ProjectType::SharedLibraryTemplate}); } -bool IosRunConfigurationFactory::hasRunConfigForProFile(RunConfiguration *rc, const Utils::FileName &n) const -{ - auto iosRc = qobject_cast<IosRunConfiguration *>(rc); - return iosRc && iosRc->profilePath() == n; -} - } // namespace Internal } // namespace Ios diff --git a/src/plugins/ios/iosrunfactories.h b/src/plugins/ios/iosrunfactories.h index 08159b2456..0f2b53b02b 100644 --- a/src/plugins/ios/iosrunfactories.h +++ b/src/plugins/ios/iosrunfactories.h @@ -26,17 +26,11 @@ #pragma once #include <projectexplorer/runconfiguration.h> -#include <qmakeprojectmanager/qmakerunconfigurationfactory.h> - -namespace ProjectExplorer { -class Target; -class Node; -} // namespace ProjectExplorer namespace Ios { namespace Internal { -class IosRunConfigurationFactory : public QmakeProjectManager::QmakeRunConfigurationFactory +class IosRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory { Q_OBJECT @@ -45,8 +39,6 @@ public: QList<ProjectExplorer::RunConfigurationCreationInfo> availableCreators(ProjectExplorer::Target *parent) const override; - - bool hasRunConfigForProFile(ProjectExplorer::RunConfiguration *rc, const Utils::FileName &n) const override; }; } // namespace Internal |