Commit f0314d0f authored by hjk's avatar hjk

debugger: add runToLine and jumpToLine actions to editor context menu in debug mode

parent d4ac9c9f
...@@ -147,9 +147,11 @@ struct DebuggerManagerActions ...@@ -147,9 +147,11 @@ struct DebuggerManagerActions
QAction *resetAction; // FIXME: Should not be needed in a stable release QAction *resetAction; // FIXME: Should not be needed in a stable release
QAction *stepAction; QAction *stepAction;
QAction *stepOutAction; QAction *stepOutAction;
QAction *runToLineAction; QAction *runToLineAction1; // in the Debug menu
QAction *runToLineAction2; // in the text editor context menu
QAction *runToFunctionAction; QAction *runToFunctionAction;
QAction *jumpToLineAction; QAction *jumpToLineAction1; // in the Debug menu
QAction *jumpToLineAction2; // in the text editor context menu
QAction *nextAction; QAction *nextAction;
QAction *snapshotAction; QAction *snapshotAction;
QAction *watchAction1; // in the Debug menu QAction *watchAction1; // in the Debug menu
......
...@@ -473,11 +473,13 @@ void DebuggerManager::init() ...@@ -473,11 +473,13 @@ void DebuggerManager::init()
d->m_actions.stepOutAction = new QAction(tr("Step Out"), this); d->m_actions.stepOutAction = new QAction(tr("Step Out"), this);
d->m_actions.stepOutAction->setIcon(QIcon(":/debugger/images/debugger_stepout_small.png")); d->m_actions.stepOutAction->setIcon(QIcon(":/debugger/images/debugger_stepout_small.png"));
d->m_actions.runToLineAction = new QAction(tr("Run to Line"), this); d->m_actions.runToLineAction1 = new QAction(tr("Run to Line"), this);
d->m_actions.runToLineAction2 = new QAction(tr("Run to Line"), this);
d->m_actions.runToFunctionAction = new QAction(tr("Run to Outermost Function"), this); d->m_actions.runToFunctionAction = new QAction(tr("Run to Outermost Function"), this);
d->m_actions.jumpToLineAction = new QAction(tr("Jump to Line"), this); d->m_actions.jumpToLineAction1 = new QAction(tr("Jump to Line"), this);
d->m_actions.jumpToLineAction2 = new QAction(tr("Jump to Line"), this);
d->m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this); d->m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this);
...@@ -503,11 +505,15 @@ void DebuggerManager::init() ...@@ -503,11 +505,15 @@ void DebuggerManager::init()
this, SLOT(stepExec())); this, SLOT(stepExec()));
connect(d->m_actions.stepOutAction, SIGNAL(triggered()), connect(d->m_actions.stepOutAction, SIGNAL(triggered()),
this, SLOT(stepOutExec())); this, SLOT(stepOutExec()));
connect(d->m_actions.runToLineAction, SIGNAL(triggered()), connect(d->m_actions.runToLineAction1, SIGNAL(triggered()),
this, SLOT(runToLineExec()));
connect(d->m_actions.runToLineAction2, SIGNAL(triggered()),
this, SLOT(runToLineExec())); this, SLOT(runToLineExec()));
connect(d->m_actions.runToFunctionAction, SIGNAL(triggered()), connect(d->m_actions.runToFunctionAction, SIGNAL(triggered()),
this, SLOT(runToFunctionExec())); this, SLOT(runToFunctionExec()));
connect(d->m_actions.jumpToLineAction, SIGNAL(triggered()), connect(d->m_actions.jumpToLineAction1, SIGNAL(triggered()),
this, SLOT(jumpToLineExec()));
connect(d->m_actions.jumpToLineAction2, SIGNAL(triggered()),
this, SLOT(jumpToLineExec())); this, SLOT(jumpToLineExec()));
connect(d->m_actions.watchAction1, SIGNAL(triggered()), connect(d->m_actions.watchAction1, SIGNAL(triggered()),
this, SLOT(addToWatchWindow())); this, SLOT(addToWatchWindow()));
...@@ -1728,7 +1734,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced) ...@@ -1728,7 +1734,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
d->m_actions.breakAction->setEnabled(true); d->m_actions.breakAction->setEnabled(true);
d->m_actions.snapshotAction->setEnabled(stopped && (engineCapabilities & SnapshotCapability)); d->m_actions.snapshotAction->setEnabled(stopped && (engineCapabilities & SnapshotCapability));
bool interruptIsExit = !running; const bool interruptIsExit = !running;
if (interruptIsExit) { if (interruptIsExit) {
static QIcon icon(":/debugger/images/debugger_stop_small.png"); static QIcon icon(":/debugger/images/debugger_stop_small.png");
d->m_actions.stopAction->setIcon(icon); d->m_actions.stopAction->setIcon(icon);
...@@ -1744,15 +1750,20 @@ void DebuggerManager::setState(DebuggerState state, bool forced) ...@@ -1744,15 +1750,20 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
d->m_actions.stepAction->setEnabled(stopped); d->m_actions.stepAction->setEnabled(stopped);
d->m_actions.stepOutAction->setEnabled(stopped); d->m_actions.stepOutAction->setEnabled(stopped);
d->m_actions.runToLineAction->setEnabled(stopped); d->m_actions.runToLineAction1->setEnabled(stopped);
d->m_actions.runToLineAction2->setEnabled(stopped);
d->m_actions.runToFunctionAction->setEnabled(stopped); d->m_actions.runToFunctionAction->setEnabled(stopped);
d->m_actions.jumpToLineAction->setEnabled(stopped &&
(engineCapabilities & JumpToLineCapability)); const bool canJump = stopped && (engineCapabilities & JumpToLineCapability);
d->m_actions.jumpToLineAction1->setEnabled(canJump);
d->m_actions.jumpToLineAction2->setEnabled(canJump);
d->m_actions.nextAction->setEnabled(stopped); d->m_actions.nextAction->setEnabled(stopped);
theDebuggerAction(RecheckDebuggingHelpers)->setEnabled(actionsEnabled); theDebuggerAction(RecheckDebuggingHelpers)->setEnabled(actionsEnabled);
theDebuggerAction(AutoDerefPointers)->setEnabled(actionsEnabled && const bool canDeref = actionsEnabled
(engineCapabilities & AutoDerefPointersCapability)); && (engineCapabilities & AutoDerefPointersCapability);
theDebuggerAction(AutoDerefPointers)->setEnabled(canDeref);
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled); theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady); theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady);
......
...@@ -113,9 +113,11 @@ const char * const ATTACHCORE = "Debugger.AttachCore"; ...@@ -113,9 +113,11 @@ const char * const ATTACHCORE = "Debugger.AttachCore";
const char * const ATTACHREMOTE = "Debugger.AttachRemote"; const char * const ATTACHREMOTE = "Debugger.AttachRemote";
const char * const DETACH = "Debugger.Detach"; const char * const DETACH = "Debugger.Detach";
const char * const RUN_TO_LINE = "Debugger.RunToLine"; const char * const RUN_TO_LINE1 = "Debugger.RunToLine1";
const char * const RUN_TO_LINE2 = "Debugger.RunToLine2";
const char * const RUN_TO_FUNCTION = "Debugger.RunToFunction"; const char * const RUN_TO_FUNCTION = "Debugger.RunToFunction";
const char * const JUMP_TO_LINE = "Debugger.JumpToLine"; const char * const JUMP_TO_LINE1 = "Debugger.JumpToLine1";
const char * const JUMP_TO_LINE2 = "Debugger.JumpToLine2";
const char * const SNAPSHOT = "Debugger.Snapshot"; const char * const SNAPSHOT = "Debugger.Snapshot";
const char * const TOGGLE_BREAK = "Debugger.ToggleBreak"; const char * const TOGGLE_BREAK = "Debugger.ToggleBreak";
const char * const BREAK_BY_FUNCTION = "Debugger.BreakByFunction"; const char * const BREAK_BY_FUNCTION = "Debugger.BreakByFunction";
...@@ -786,8 +788,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess ...@@ -786,8 +788,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(actions.runToLineAction, cmd = am->registerAction(actions.runToLineAction1,
Constants::RUN_TO_LINE, debuggercontext); Constants::RUN_TO_LINE1, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
...@@ -796,8 +798,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess ...@@ -796,8 +798,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY)); cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY));
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(actions.jumpToLineAction, cmd = am->registerAction(actions.jumpToLineAction1,
Constants::JUMP_TO_LINE, debuggercontext); Constants::JUMP_TO_LINE1, debuggercontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
#ifdef USE_REVERSE_DEBUGGING #ifdef USE_REVERSE_DEBUGGING
...@@ -838,16 +840,29 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess ...@@ -838,16 +840,29 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
//cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W"))); //cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W")));
mdebug->addAction(cmd); mdebug->addAction(cmd);
// Editor context menu
ActionContainer *editorContextMenu = ActionContainer *editorContextMenu =
am->actionContainer(CppEditor::Constants::M_CONTEXT); am->actionContainer(CppEditor::Constants::M_CONTEXT);
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Views"), cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Views"),
debuggercontext); debuggercontext);
editorContextMenu->addAction(cmd); editorContextMenu->addAction(cmd);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
cmd = am->registerAction(actions.watchAction2, cmd = am->registerAction(actions.watchAction2,
Constants::ADD_TO_WATCH2, debuggercontext); Constants::ADD_TO_WATCH2, debuggercontext);
cmd->action()->setEnabled(true); cmd->action()->setEnabled(true);
//cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W"))); editorContextMenu->addAction(cmd);
cmd->setAttribute(Command::CA_Hide);
cmd = am->registerAction(actions.runToLineAction2,
Constants::RUN_TO_LINE2, debuggercontext);
cmd->action()->setEnabled(true);
editorContextMenu->addAction(cmd);
cmd->setAttribute(Command::CA_Hide);
cmd = am->registerAction(actions.jumpToLineAction2,
Constants::JUMP_TO_LINE2, debuggercontext);
cmd->action()->setEnabled(true);
editorContextMenu->addAction(cmd); editorContextMenu->addAction(cmd);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment