diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 65941b1b39ba78ffbc0da70270480e11c14de670..a22eea601e02a691555a2c3c53eafd1009a03fa0 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -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 diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 4e88a793225a5d3f7e21d5c5f365a291f26679c6..a89ce8820a80d08a20d21b60c5a2be3d561e48a7 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -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); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index b4146dfa19731ff4f1066664d42bd9790c15785b..5b964996aed40ff872e01161ed6e29e4aa0b47e4 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -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);