forked from qt-creator/qt-creator
ProjectExplorer: Make it easier to use RunConfiguration ids
... in RunWorkerFactory. The semantics is the same as in the other {RunConfiguration,BuildConfiguration,...}Factory::addSupportedFoo cases: As long as none is specified, there's no constraint, if there are any, it's a whitelist. Change-Id: Ia05afd9afe6886e4bacc58ac786f2548f03e5ca8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -87,6 +87,11 @@ bool RunWorkerFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMo
|
||||
if (!m_supportedRunModes.contains(runMode))
|
||||
return false;
|
||||
|
||||
if (!m_supportedRunConfigurations.isEmpty()) {
|
||||
if (!m_supportedRunConfigurations.contains(runConfiguration->id()))
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const Constraint &constraint : m_constraints) {
|
||||
if (!constraint(runConfiguration))
|
||||
return false;
|
||||
@@ -115,6 +120,16 @@ void RunWorkerFactory::addSupportedRunMode(Core::Id runMode)
|
||||
m_supportedRunModes.append(runMode);
|
||||
}
|
||||
|
||||
void RunWorkerFactory::setSupportedRunConfigurations(const QList<Core::Id> &ids)
|
||||
{
|
||||
m_supportedRunConfigurations = ids;
|
||||
}
|
||||
|
||||
void RunWorkerFactory::addSupportedRunConfiguration(Core::Id id)
|
||||
{
|
||||
m_supportedRunConfigurations.append(id);
|
||||
}
|
||||
|
||||
void RunWorkerFactory::destroyRemainingRunWorkerFactories()
|
||||
{
|
||||
qDeleteAll(g_runWorkerFactories);
|
||||
|
@@ -157,6 +157,9 @@ public:
|
||||
void addConstraint(const Constraint &constraint);
|
||||
void addSupportedRunMode(Core::Id runMode);
|
||||
|
||||
void setSupportedRunConfigurations(const QList<Core::Id> &ids);
|
||||
void addSupportedRunConfiguration(Core::Id id);
|
||||
|
||||
WorkerCreator producer() const { return m_producer; }
|
||||
|
||||
private:
|
||||
@@ -166,6 +169,7 @@ private:
|
||||
static void destroyRemainingRunWorkerFactories();
|
||||
|
||||
QList<Core::Id> m_supportedRunModes;
|
||||
QList<Core::Id> m_supportedRunConfigurations;
|
||||
QList<Constraint> m_constraints;
|
||||
WorkerCreator m_producer;
|
||||
};
|
||||
|
Reference in New Issue
Block a user