Commit 0821f6fa authored by hjk's avatar hjk

debugger: make 'Add to watch' available in the editor context menu in debug mode

parent 1324a1c6
...@@ -150,7 +150,8 @@ struct DebuggerManagerActions ...@@ -150,7 +150,8 @@ struct DebuggerManagerActions
QAction *runToFunctionAction; QAction *runToFunctionAction;
QAction *jumpToLineAction; QAction *jumpToLineAction;
QAction *nextAction; QAction *nextAction;
QAction *watchAction; QAction *watchAction1; // in the Debug menu
QAction *watchAction2; // in the text editor context menu
QAction *breakAction; QAction *breakAction;
QAction *sepAction; QAction *sepAction;
QAction *reverseDirectionAction; QAction *reverseDirectionAction;
......
...@@ -468,7 +468,8 @@ void DebuggerManager::init() ...@@ -468,7 +468,8 @@ void DebuggerManager::init()
d->m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this); d->m_actions.breakAction = new QAction(tr("Toggle Breakpoint"), this);
d->m_actions.watchAction = new QAction(tr("Add to Watch Window"), this); d->m_actions.watchAction1 = new QAction(tr("Add to Watch Window"), this);
d->m_actions.watchAction2 = new QAction(tr("Add to Watch Window"), this);
d->m_actions.reverseDirectionAction = new QAction(tr("Reverse Direction"), this); d->m_actions.reverseDirectionAction = new QAction(tr("Reverse Direction"), this);
d->m_actions.reverseDirectionAction->setCheckable(true); d->m_actions.reverseDirectionAction->setCheckable(true);
...@@ -492,7 +493,9 @@ void DebuggerManager::init() ...@@ -492,7 +493,9 @@ void DebuggerManager::init()
this, SLOT(runToFunctionExec())); this, SLOT(runToFunctionExec()));
connect(d->m_actions.jumpToLineAction, SIGNAL(triggered()), connect(d->m_actions.jumpToLineAction, SIGNAL(triggered()),
this, SLOT(jumpToLineExec())); this, SLOT(jumpToLineExec()));
connect(d->m_actions.watchAction, SIGNAL(triggered()), connect(d->m_actions.watchAction1, SIGNAL(triggered()),
this, SLOT(addToWatchWindow()));
connect(d->m_actions.watchAction2, SIGNAL(triggered()),
this, SLOT(addToWatchWindow())); this, SLOT(addToWatchWindow()));
connect(d->m_actions.breakAction, SIGNAL(triggered()), connect(d->m_actions.breakAction, SIGNAL(triggered()),
this, SLOT(toggleBreakpoint())); this, SLOT(toggleBreakpoint()));
...@@ -1669,7 +1672,8 @@ void DebuggerManager::setState(DebuggerState state, bool forced) ...@@ -1669,7 +1672,8 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
if (stopped) if (stopped)
QApplication::alert(mainWindow(), 3000); QApplication::alert(mainWindow(), 3000);
d->m_actions.watchAction->setEnabled(true); d->m_actions.watchAction1->setEnabled(true);
d->m_actions.watchAction2->setEnabled(true);
d->m_actions.breakAction->setEnabled(true); d->m_actions.breakAction->setEnabled(true);
bool interruptIsExit = !running; bool interruptIsExit = !running;
......
...@@ -119,7 +119,8 @@ const char * const JUMP_TO_LINE = "Debugger.JumpToLine"; ...@@ -119,7 +119,8 @@ const char * const JUMP_TO_LINE = "Debugger.JumpToLine";
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";
const char * const BREAK_AT_MAIN = "Debugger.BreakAtMain"; const char * const BREAK_AT_MAIN = "Debugger.BreakAtMain";
const char * const ADD_TO_WATCH = "Debugger.AddToWatch"; const char * const ADD_TO_WATCH1 = "Debugger.AddToWatch1";
const char * const ADD_TO_WATCH2 = "Debugger.AddToWatch2";
const char * const OPERATE_BY_INSTRUCTION = "Debugger.OperateByInstruction"; const char * const OPERATE_BY_INSTRUCTION = "Debugger.OperateByInstruction";
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
...@@ -801,16 +802,24 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess ...@@ -801,16 +802,24 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Watch"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Watch"), globalcontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = am->registerAction(actions.watchAction, cmd = am->registerAction(actions.watchAction1,
Constants::ADD_TO_WATCH, cppeditorcontext); Constants::ADD_TO_WATCH1, cppeditorcontext);
cmd->action()->setEnabled(true); cmd->action()->setEnabled(true);
cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W"))); //cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W")));
mdebug->addAction(cmd); mdebug->addAction(cmd);
// QTCREATORBUG-342 asks for that unconditionally
//ActionContainer *editorContextMenu = ActionContainer *editorContextMenu =
// am->actionContainer(CppEditor::Constants::M_CONTEXT); am->actionContainer(CppEditor::Constants::M_CONTEXT);
//editorContextMenu->addAction(cmd); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Views"),
//cmd->setAttribute(Command::CA_Hide); 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);
// Views menu // Views menu
cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Views"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep.Views"), globalcontext);
......
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