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
QAction *resetAction; // FIXME: Should not be needed in a stable release
QAction *stepAction;
QAction *stepOutAction;
QAction *runToLineAction;
QAction *runToLineAction1; // in the Debug menu
QAction *runToLineAction2; // in the text editor context menu
QAction *runToFunctionAction;
QAction *jumpToLineAction;
QAction *jumpToLineAction1; // in the Debug menu
QAction *jumpToLineAction2; // in the text editor context menu
QAction *nextAction;
QAction *snapshotAction;
QAction *watchAction1; // in the Debug menu
......
......@@ -473,11 +473,13 @@ void DebuggerManager::init()
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.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.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);
......@@ -503,11 +505,15 @@ void DebuggerManager::init()
this, SLOT(stepExec()));
connect(d->m_actions.stepOutAction, SIGNAL(triggered()),
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()));
connect(d->m_actions.runToFunctionAction, SIGNAL(triggered()),
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()));
connect(d->m_actions.watchAction1, SIGNAL(triggered()),
this, SLOT(addToWatchWindow()));
......@@ -1728,7 +1734,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
d->m_actions.breakAction->setEnabled(true);
d->m_actions.snapshotAction->setEnabled(stopped && (engineCapabilities & SnapshotCapability));
bool interruptIsExit = !running;
const bool interruptIsExit = !running;
if (interruptIsExit) {
static QIcon icon(":/debugger/images/debugger_stop_small.png");
d->m_actions.stopAction->setIcon(icon);
......@@ -1744,15 +1750,20 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
d->m_actions.stepAction->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.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);
theDebuggerAction(RecheckDebuggingHelpers)->setEnabled(actionsEnabled);
theDebuggerAction(AutoDerefPointers)->setEnabled(actionsEnabled &&
(engineCapabilities & AutoDerefPointersCapability));
const bool canDeref = actionsEnabled
&& (engineCapabilities & AutoDerefPointersCapability);
theDebuggerAction(AutoDerefPointers)->setEnabled(canDeref);
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady);
......
......@@ -113,9 +113,11 @@ const char * const ATTACHCORE = "Debugger.AttachCore";
const char * const ATTACHREMOTE = "Debugger.AttachRemote";
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 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 TOGGLE_BREAK = "Debugger.ToggleBreak";
const char * const BREAK_BY_FUNCTION = "Debugger.BreakByFunction";
......@@ -786,8 +788,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY));
mdebug->addAction(cmd);
cmd = am->registerAction(actions.runToLineAction,
Constants::RUN_TO_LINE, debuggercontext);
cmd = am->registerAction(actions.runToLineAction1,
Constants::RUN_TO_LINE1, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY));
mdebug->addAction(cmd);
......@@ -796,8 +798,8 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY));
mdebug->addAction(cmd);
cmd = am->registerAction(actions.jumpToLineAction,
Constants::JUMP_TO_LINE, debuggercontext);
cmd = am->registerAction(actions.jumpToLineAction1,
Constants::JUMP_TO_LINE1, debuggercontext);
mdebug->addAction(cmd);
#ifdef USE_REVERSE_DEBUGGING
......@@ -838,16 +840,29 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
//cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W")));
mdebug->addAction(cmd);
// Editor context menu
ActionContainer *editorContextMenu =
am->actionContainer(CppEditor::Constants::M_CONTEXT);
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Views"),
debuggercontext);
editorContextMenu->addAction(cmd);
cmd->setAttribute(Command::CA_Hide);
cmd = am->registerAction(actions.watchAction2,
Constants::ADD_TO_WATCH2, debuggercontext);
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);
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