aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/runconfiguration.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/projectexplorer/runconfiguration.h')
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h62
1 files changed, 42 insertions, 20 deletions
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index d26a54cc199..08797804c06 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -59,6 +59,7 @@ class RunConfiguration;
class RunConfigurationCreationInfo;
class RunConfigWidget;
class RunControl;
+class RunWorkerFactory;
class Target;
namespace Internal {
@@ -165,7 +166,6 @@ public:
QString commandLineArguments;
QString workingDirectory;
Utils::Environment environment;
- ApplicationLauncher::Mode runMode = ApplicationLauncher::Gui;
IDevice::ConstPtr device; // Override the kit's device. Keep unset by default.
// FIXME: Not necessarily a display name
@@ -301,13 +301,25 @@ protected:
return new RunConfig(t, runConfigBaseId);
};
m_runConfigBaseId = runConfigBaseId;
+ m_ownTypeChecker = [](RunConfiguration *runConfig) {
+ return qobject_cast<RunConfig *>(runConfig) != nullptr;
+ };
}
void addSupportedProjectType(Core::Id id);
void addSupportedTargetDeviceType(Core::Id id);
void setDecorateDisplayNames(bool on);
+ template<class Worker>
+ RunWorkerFactory *addRunWorkerFactory(Core::Id runMode)
+ {
+ return addRunWorkerFactoryHelper(runMode, [](RunControl *rc) { return new Worker(rc); });
+ }
+
private:
+ RunWorkerFactory *addRunWorkerFactoryHelper
+ (Core::Id runMode, const std::function<RunWorker *(RunControl *)> &creator);
+
RunConfigurationFactory(const RunConfigurationFactory &) = delete;
RunConfigurationFactory operator=(const RunConfigurationFactory &) = delete;
@@ -319,6 +331,8 @@ private:
QList<Core::Id> m_supportedProjectTypes;
QList<Core::Id> m_supportedTargetDeviceTypes;
bool m_decorateDisplayNames = false;
+ QList<RunWorkerFactory *> m_ownedRunWorkerFactories;
+ std::function<bool(RunConfiguration *)> m_ownTypeChecker;
};
class PROJECTEXPLORER_EXPORT FixedRunConfigurationFactory : public RunConfigurationFactory
@@ -403,7 +417,7 @@ protected:
private:
friend class Internal::RunControlPrivate;
friend class Internal::RunWorkerPrivate;
- Internal::RunWorkerPrivate *d;
+ const std::unique_ptr<Internal::RunWorkerPrivate> d;
};
class PROJECTEXPLORER_EXPORT RunWorkerFactory
@@ -412,17 +426,27 @@ public:
using WorkerCreator = std::function<RunWorker *(RunControl *)>;
using Constraint = std::function<bool(RunConfiguration *)>;
- RunWorkerFactory(Core::Id mode, Constraint constr, const WorkerCreator &prod,
- int prio = 0);
+ RunWorkerFactory();
+ virtual ~RunWorkerFactory();
- bool canRun(RunConfiguration *runConfiguration, Core::Id m_runMode) const;
+ bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const;
+
+ void setPriority(int priority);
+ void setProducer(const WorkerCreator &producer);
+ void addConstraint(const Constraint &constraint);
+ void addSupportedRunMode(Core::Id runMode);
int priority() const { return m_priority; }
WorkerCreator producer() const { return m_producer; }
private:
- Core::Id m_runMode;
- Constraint m_constraint;
+ // FIXME: That's temporary until ownership has been transferred to
+ // the individual plugins.
+ friend class ProjectExplorerPlugin;
+ static void destroyRemainingRunWorkerFactories();
+
+ QList<Core::Id> m_supportedRunModes;
+ QList<Constraint> m_constraints;
WorkerCreator m_producer;
int m_priority = 0;
};
@@ -473,7 +497,6 @@ public:
RunConfiguration *runConfiguration() const;
Project *project() const;
- bool canReUseOutputPane(const RunControl *other) const;
Utils::OutputFormatter *outputFormatter() const;
Core::Id runMode() const;
@@ -498,20 +521,19 @@ public:
static void registerWorker(Core::Id runMode, const WorkerCreator &producer,
const Constraint &constraint = {})
{
- addWorkerFactory({runMode, constraint, producer});
+ auto factory = new RunWorkerFactory;
+ factory->setProducer(producer);
+ factory->addSupportedRunMode(runMode);
+ factory->addConstraint(constraint);
}
template <class Worker>
static void registerWorker(Core::Id runMode, const Constraint &constraint, int priority = 0)
{
- auto producer = [](RunControl *rc) { return new Worker(rc); };
- addWorkerFactory({runMode, constraint, producer, priority});
- }
- template <class Config, class Worker>
- static void registerWorker(Core::Id runMode, int priority = 0)
- {
- auto constraint = [](RunConfiguration *runConfig) { return qobject_cast<Config *>(runConfig) != nullptr; };
- auto producer = [](RunControl *rc) { return new Worker(rc); };
- addWorkerFactory({runMode, constraint, producer, priority});
+ auto factory = new RunWorkerFactory;
+ factory->setProducer([](RunControl *rc) { return new Worker(rc); });
+ factory->addSupportedRunMode(runMode);
+ factory->addConstraint(constraint);
+ factory->setPriority(priority);
}
static WorkerCreator producer(RunConfiguration *runConfiguration, Core::Id runMode);
@@ -529,8 +551,7 @@ private:
friend class RunWorker;
friend class Internal::RunWorkerPrivate;
- static void addWorkerFactory(const RunWorkerFactory &workerFactory);
- Internal::RunControlPrivate *d;
+ const std::unique_ptr<Internal::RunControlPrivate> d;
};
@@ -564,6 +585,7 @@ private:
Runnable m_runnable;
IDevice::ConstPtr m_device;
bool m_stopReported = false;
+ bool m_useTerminal = false;
};
} // namespace ProjectExplorer