Debugger: Register "Reload Debugging Helper" action

This allows assigning shortcuts via Tools->Options, Environment,
Keyboard Shortcuts

Fixes: QTCREATORBUG-25900
Change-Id: I6dfa6b0f3ff12ad971444b2d3adb427c8acf783c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-06-23 11:24:42 +02:00
parent 10af72100d
commit 1955c82d5c
4 changed files with 19 additions and 12 deletions

View File

@@ -540,7 +540,6 @@ public:
"Move to Called Frame")};
QAction m_openMemoryEditorAction{QCoreApplication::translate("Debugger::Internal::DebuggerPluginPrivate",
"Memory...")};
// In the Debug menu.
QAction m_returnFromFunctionAction{tr("Immediately Return From Inner Function")};
QAction m_stepOverAction{tr("Step Over")};

View File

@@ -52,6 +52,7 @@ const char FRAME_UP[] = "Debugger.FrameUp";
const char FRAME_DOWN[] = "Debugger.FrameDown";
const char QML_SHOW_APP_ON_TOP[] = "Debugger.QmlShowAppOnTop";
const char QML_SELECTTOOL[] = "Debugger.QmlSelectTool";
const char RELOAD_DEBUGGING_HELPERS[] = "Debugger.ReloadDebuggingHelpers";
const char DEBUGGER_COMMON_SETTINGS_ID[] = "A.Debugger.General";
const char DEBUGGER_SETTINGS_CATEGORY[] = "O.Debugger";

View File

@@ -642,6 +642,7 @@ public:
void attachToQmlPort();
void runScheduled();
void attachCore();
void reloadDebuggingHelpers();
void remoteCommand(const QStringList &options);
@@ -683,6 +684,7 @@ public:
QAction m_watchAction{tr("Add Expression Evaluator")};
Command *m_watchCommand = nullptr;
QAction m_breakAction{tr("Toggle Breakpoint")};
QAction m_reloadDebuggingHelpersAction{tr("Reload Debugging Helpers")};
BreakpointManager m_breakpointManager;
QString m_lastPermanentStatusMessage;
@@ -1115,6 +1117,10 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
debugMenu->addSeparator();
ActionManager::registerAction(&m_reloadDebuggingHelpersAction, Constants::RELOAD_DEBUGGING_HELPERS);
connect(&m_reloadDebuggingHelpersAction, &QAction::triggered,
this, &DebuggerPluginPrivate::reloadDebuggingHelpers);
cmd = m_watchCommand = ActionManager::registerAction(&m_watchAction, Constants::WATCH);
debugMenu->addAction(cmd);
@@ -1548,6 +1554,15 @@ void DebuggerPluginPrivate::attachCore()
debugger->startRunControl();
}
void DebuggerPluginPrivate::reloadDebuggingHelpers()
{
if (DebuggerEngine *engine = EngineManager::currentEngine())
engine->reloadDebuggingHelpers();
else
DebuggerMainWindow::showStatusMessage(
tr("Reload debugging helpers skipped as no engine is running."), 5000);
}
void DebuggerPluginPrivate::startRemoteCdbSession()
{
const QString connectionKey = "CdbRemoteConnection";

View File

@@ -29,6 +29,7 @@
#include "debuggercore.h"
#include "debuggerengine.h"
#include "debuggericons.h"
#include "debuggerinternalconstants.h"
#include <QDebug>
#include <QTime>
@@ -46,6 +47,7 @@
#include <app/app_version.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/minisplitter.h>
#include <coreplugin/find/basetextfind.h>
@@ -208,10 +210,6 @@ public:
m_saveContentsAction->setEnabled(true);
connect(m_saveContentsAction, &QAction::triggered,
this, &DebuggerPane::saveContents);
m_reloadDebuggingHelpersAction = new QAction(this);
m_reloadDebuggingHelpersAction->setText(tr("Reload Debugging Helpers"));
m_reloadDebuggingHelpersAction->setEnabled(true);
}
void contextMenuEvent(QContextMenuEvent *ev) override
@@ -220,7 +218,7 @@ public:
menu->addAction(m_clearContentsAction);
menu->addAction(m_saveContentsAction); // X11 clipboard is unreliable for long texts
menu->addAction(debuggerSettings()->logTimeStamps.action());
menu->addAction(m_reloadDebuggingHelpersAction);
menu->addAction(Core::ActionManager::command(Constants::RELOAD_DEBUGGING_HELPERS)->action());
menu->addSeparator();
menu->addAction(debuggerSettings()->settingsDialog.action());
menu->exec(ev->globalPos());
@@ -255,14 +253,12 @@ public:
}
QAction *clearContentsAction() const { return m_clearContentsAction; }
QAction *reloadDebuggingHelpersAction() const { return m_reloadDebuggingHelpersAction; }
private:
void saveContents() { writeLogContents(this, this); }
QAction *m_clearContentsAction;
QAction *m_saveContentsAction;
QAction *m_reloadDebuggingHelpersAction;
};
@@ -281,8 +277,6 @@ public:
{
connect(clearContentsAction(), &QAction::triggered,
logWindow, &LogWindow::clearContents);
connect(reloadDebuggingHelpersAction(), &QAction::triggered,
logWindow->engine(), &DebuggerEngine::reloadDebuggingHelpers);
(void) new InputHighlighter(this);
}
@@ -351,8 +345,6 @@ public:
(void) new OutputHighlighter(this);
connect(clearContentsAction(), &QAction::triggered,
logWindow, &LogWindow::clearContents);
connect(reloadDebuggingHelpersAction(), &QAction::triggered,
logWindow->engine(), &DebuggerEngine::reloadDebuggingHelpers);
}
void gotoResult(int i)