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))
|
if (!m_supportedRunModes.contains(runMode))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!m_supportedRunConfigurations.isEmpty()) {
|
||||||
|
if (!m_supportedRunConfigurations.contains(runConfiguration->id()))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (const Constraint &constraint : m_constraints) {
|
for (const Constraint &constraint : m_constraints) {
|
||||||
if (!constraint(runConfiguration))
|
if (!constraint(runConfiguration))
|
||||||
return false;
|
return false;
|
||||||
@@ -115,6 +120,16 @@ void RunWorkerFactory::addSupportedRunMode(Core::Id runMode)
|
|||||||
m_supportedRunModes.append(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()
|
void RunWorkerFactory::destroyRemainingRunWorkerFactories()
|
||||||
{
|
{
|
||||||
qDeleteAll(g_runWorkerFactories);
|
qDeleteAll(g_runWorkerFactories);
|
||||||
|
@@ -157,6 +157,9 @@ public:
|
|||||||
void addConstraint(const Constraint &constraint);
|
void addConstraint(const Constraint &constraint);
|
||||||
void addSupportedRunMode(Core::Id runMode);
|
void addSupportedRunMode(Core::Id runMode);
|
||||||
|
|
||||||
|
void setSupportedRunConfigurations(const QList<Core::Id> &ids);
|
||||||
|
void addSupportedRunConfiguration(Core::Id id);
|
||||||
|
|
||||||
WorkerCreator producer() const { return m_producer; }
|
WorkerCreator producer() const { return m_producer; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -166,6 +169,7 @@ private:
|
|||||||
static void destroyRemainingRunWorkerFactories();
|
static void destroyRemainingRunWorkerFactories();
|
||||||
|
|
||||||
QList<Core::Id> m_supportedRunModes;
|
QList<Core::Id> m_supportedRunModes;
|
||||||
|
QList<Core::Id> m_supportedRunConfigurations;
|
||||||
QList<Constraint> m_constraints;
|
QList<Constraint> m_constraints;
|
||||||
WorkerCreator m_producer;
|
WorkerCreator m_producer;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user