aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/runcontrol.h
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-09-02 18:22:35 +0200
committerhjk <hjk@qt.io>2019-09-04 11:08:34 +0000
commit4028a41d2eb00649fb97c1f78be90a2cf42c7adf (patch)
tree2544a317c15722b849e5f4513f65160eced8b8fc /src/plugins/projectexplorer/runcontrol.h
parent8d85a7c2bc011a06dff3a85e47b6ecfa5cdaed24 (diff)
ProjectExplorer: Use std::function for SimpleTargetRunner::start()
This spares us the typical r = runnable(); modify(r); setRunnable(r) roundtrip and the m_runnable storage that might or might not be the same as runControl->runnable. Similar for m_device. Change-Id: I8300260dd8dd7cd395e40bcd3d2ae45089085008 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/runcontrol.h')
-rw-r--r--src/plugins/projectexplorer/runcontrol.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h
index 794d305fc1..3f3e78968c 100644
--- a/src/plugins/projectexplorer/runcontrol.h
+++ b/src/plugins/projectexplorer/runcontrol.h
@@ -279,23 +279,19 @@ class PROJECTEXPLORER_EXPORT SimpleTargetRunner : public RunWorker
public:
explicit SimpleTargetRunner(RunControl *runControl);
- void setRunnable(const Runnable &runnable);
-
- void setDevice(const IDevice::ConstPtr &device);
- IDevice::ConstPtr device() const;
-
protected:
- void start() override;
- void stop() override;
+ void setStarter(const std::function<void()> &starter);
+ void doStart(const Runnable &runnable, const IDevice::ConstPtr &device);
private:
- void onProcessStarted();
- void onProcessFinished(int exitCode, QProcess::ExitStatus status);
- void onProcessError(QProcess::ProcessError error);
+ void start() final;
+ void stop() final;
+
+ const Runnable &runnable() const = delete;
ApplicationLauncher m_launcher;
- Runnable m_runnable;
- IDevice::ConstPtr m_device;
+ std::function<void()> m_starter;
+
bool m_stopReported = false;
bool m_useTerminal = false;
};