diff options
author | hjk <[email protected]> | 2018-03-07 15:31:08 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2018-03-08 16:59:10 +0000 |
commit | 37ef24114cde593ba16e02f3d4c422a969a63317 (patch) | |
tree | 8b0ee0b029a8edf603ed4ec6e238fff8a68ed74c /src/plugins/debugger/debuggerplugin.cpp | |
parent | 144bba95e9b29d5edd909049452da47565305e9f (diff) |
Debugger: Move DebugInfoTask handling to plugin
This does not involve the engine (currently).
Task-number: QTCREATORBUG-19994
Change-Id: I07a628580bf99c988eb0df165d649d5cc0869c0d
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/debugger/debuggerplugin.cpp')
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 8e46a9735e3..b58a226b095 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -92,6 +92,7 @@ #include <projectexplorer/buildmanager.h> #include <projectexplorer/devicesupport/deviceprocessesdialog.h> #include <projectexplorer/devicesupport/deviceprocesslist.h> +#include <projectexplorer/itaskhandler.h> #include <projectexplorer/project.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorericons.h> @@ -580,6 +581,42 @@ static Kit *findUniversalCdbKit() /////////////////////////////////////////////////////////////////////// // +// Debuginfo Taskhandler +// +/////////////////////////////////////////////////////////////////////// + +class DebugInfoTaskHandler : public ITaskHandler +{ +public: + bool canHandle(const Task &task) const final + { + return m_debugInfoTasks.contains(task.taskId); + } + + void handle(const Task &task) final + { + QString cmd = m_debugInfoTasks.value(task.taskId); + QProcess::startDetached(cmd); + } + + void addTask(unsigned id, const QString &cmd) + { + m_debugInfoTasks[id] = cmd; + } + + QAction *createAction(QObject *parent) const final + { + QAction *action = new QAction(DebuggerPlugin::tr("Install &Debug Information"), parent); + action->setToolTip(DebuggerPlugin::tr("Tries to install missing debug information.")); + return action; + } + +private: + QHash<unsigned, QString> m_debugInfoTasks; +}; + +/////////////////////////////////////////////////////////////////////// +// // DebuggerPluginPrivate // /////////////////////////////////////////////////////////////////////// @@ -1028,6 +1065,8 @@ public: CommonOptionsPage *m_commonOptionsPage = 0; DummyEngine *m_dummyEngine = 0; const QSharedPointer<GlobalDebuggerOptions> m_globalDebuggerOptions; + + DebugInfoTaskHandler m_debugInfoTaskHandler; }; DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) @@ -2955,6 +2994,11 @@ QMessageBox *showMessageBox(int icon, const QString &title, return mb; } +void addDebugInfoTask(unsigned id, const QString &cmd) +{ + dd->m_debugInfoTaskHandler.addTask(id, cmd); +} + bool isReverseDebuggingEnabled() { static bool enabled = qEnvironmentVariableIsSet("QTC_DEBUGGER_ENABLE_REVERSE"); |