aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/debuggerplugin.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-08-07 18:05:15 +0200
committerhjk <hjk@qt.io>2019-08-09 12:34:42 +0000
commitf9c221eb54ca3174c57f736b7afd5914147ab2a2 (patch)
tree1d58370c31fd3c342ddd133f659ee01adb017b22 /src/plugins/debugger/debuggerplugin.cpp
parenta88970db34357adaaedd7514490d94702744a7ec (diff)
ProjectExplorer: Re-work setup runworker factories
This combines two of the previous three paths to create run workers, and refers to RunConfigurations by id, not by type where possible to decrease coupling between the classes. Only allow "type of run configuration" and "type of device" as the only possible kind of restriction and require a uniform RunWorker constructor signature. Adapt user code to fit that pattern. Change-Id: I5a6d49c9a144785fd0235d7586f244b56f67b366 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/debugger/debuggerplugin.cpp')
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index c7ccd5d961..ec7f47f6b7 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -610,6 +610,7 @@ private:
QHash<unsigned, QString> m_debugInfoTasks;
};
+
///////////////////////////////////////////////////////////////////////
//
// DebuggerPluginPrivate
@@ -776,6 +777,18 @@ public:
Perspective m_perspective{Constants::PRESET_PERSPECTIVE_ID, tr("Debugger")};
DebuggerKitAspect debuggerKitAspect;
+
+ RunWorkerFactory debuggerWorkerFactory{
+ RunWorkerFactory::make<DebuggerRunTool>(),
+ {ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ {}, // All local run configs?
+ {PE::DESKTOP_DEVICE_TYPE}
+ };
+
+ // FIXME: Needed?
+// QString mainScript = runConfig->property("mainScript").toString();
+// const bool isDebuggableScript = mainScript.endsWith(".py"); // Only Python for now.
+// return isDebuggableScript;
};
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
@@ -2086,23 +2099,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
}
}
- auto constraint = [](RunConfiguration *runConfig) {
- Runnable runnable = runConfig->runnable();
- if (runnable.device && runnable.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
- return true;
-
- if (DeviceTypeKitAspect::deviceTypeId(runConfig->target()->kit())
- == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
- return true;
-
- QString mainScript = runConfig->property("mainScript").toString();
- const bool isDebuggableScript = mainScript.endsWith(".py"); // Only Python for now.
- return isDebuggableScript;
- };
-
- RunControl::registerWorker<DebuggerRunTool>
- (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
-
DebuggerMainWindow::ensureMainWindowExists();
}