diff options
author | hjk <qtc-committer@nokia.com> | 2009-06-12 11:54:01 +0200 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2009-06-12 11:55:42 +0200 |
commit | 94b1b1fd7b58ed365698917b8fecf5071669daa1 (patch) | |
tree | db6d78a0cb16f40d20c328040b6eba1075e617d8 | |
parent | ea74cfd8f3348beac1638d945180a833be10d096 (diff) |
debugger: move 'break by function' menu items
Move menu to from the main debug window to the context menu of the
breakpoints view to avoid clutter in the main menus.
-rw-r--r-- | src/plugins/debugger/breakwindow.cpp | 50 | ||||
-rw-r--r-- | src/plugins/debugger/breakwindow.h | 1 | ||||
-rw-r--r-- | src/plugins/debugger/debuggermanager.cpp | 53 | ||||
-rw-r--r-- | src/plugins/debugger/debuggermanager.h | 4 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 8 |
5 files changed, 51 insertions, 65 deletions
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 863a0eea36e..0320bb5de07 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -31,6 +31,7 @@ #include "debuggeractions.h" #include "ui_breakcondition.h" +#include "ui_breakbyfunction.h" #include <QtCore/QDebug> #include <QtCore/QDir> @@ -48,6 +49,32 @@ using Debugger::Internal::BreakWindow; +/////////////////////////////////////////////////////////////////////// +// +// BreakByFunctionDialog +// +/////////////////////////////////////////////////////////////////////// + +class BreakByFunctionDialog : public QDialog, Ui::BreakByFunctionDialog +{ +public: + explicit BreakByFunctionDialog(QWidget *parent) + : QDialog(parent) + { + setupUi(this); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + } + QString functionName() const { return functionLineEdit->text(); } +}; + + +/////////////////////////////////////////////////////////////////////// +// +// BreakWindow +// +/////////////////////////////////////////////////////////////////////// + BreakWindow::BreakWindow(QWidget *parent) : QTreeView(parent), m_alwaysResizeColumnsToContents(false) { @@ -96,8 +123,14 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) QString str = enabled ? tr("Disable breakpoint") : tr("Enable breakpoint"); QAction *act5 = new QAction(str, &menu); bool fullpath = indexIsValid && model()->data(index2, Qt::UserRole).toBool(); - QString str1 = fullpath ? tr("Use short path") : tr("Use full path"); - QAction *act6 = new QAction(str1, &menu); + QString str6 = fullpath ? tr("Use short path") : tr("Use full path"); + QAction *act6 = new QAction(str6, &menu); + + QAction *act7 = new QAction(this); + act7->setText(tr("Set Breakpoint at Function...")); + QAction *act8 = new QAction(this); + act8->setText(tr("Set Breakpoint at Function \"main\"")); + menu.addAction(act0); menu.addAction(act3); @@ -108,6 +141,9 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(act2); menu.addAction(act4); menu.addSeparator(); + menu.addAction(act7); + menu.addAction(act8); + menu.addSeparator(); menu.addAction(theDebuggerAction(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); @@ -128,6 +164,16 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) } else if (act == act6) { model()->setData(index2, !fullpath); emit breakpointSynchronizationRequested(); + } else if (act == act7) { + BreakByFunctionDialog dlg(this); + if (dlg.exec()) + emit breakByFunctionRequested(dlg.functionName()); + } else if (act == act8) { +#ifdef Q_OS_WIN + emit breakByFunctionRequested("qMain"); +#else + emit breakByFunctionRequested("main"); +#endif } } diff --git a/src/plugins/debugger/breakwindow.h b/src/plugins/debugger/breakwindow.h index ec82dc52a74..5bb4e06a0cc 100644 --- a/src/plugins/debugger/breakwindow.h +++ b/src/plugins/debugger/breakwindow.h @@ -50,6 +50,7 @@ signals: void breakpointDeleted(int index); void breakpointActivated(int index); void breakpointSynchronizationRequested(); + void breakByFunctionRequested(const QString &functionName); private slots: void rowActivated(const QModelIndex &index); diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 42df3f27d57..ac99281ddbe 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -44,8 +44,6 @@ #include "threadswindow.h" #include "watchwindow.h" -#include "ui_breakbyfunction.h" - #include "disassemblerhandler.h" #include "breakhandler.h" #include "moduleshandler.h" @@ -128,27 +126,6 @@ static const char *stateName(int s) return "<unknown>"; } -/////////////////////////////////////////////////////////////////////// -// -// BreakByFunctionDialog -// -/////////////////////////////////////////////////////////////////////// - -class BreakByFunctionDialog : public QDialog, Ui::BreakByFunctionDialog -{ - Q_OBJECT - -public: - explicit BreakByFunctionDialog(QWidget *parent) - : QDialog(parent) - { - setupUi(this); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - } - QString functionName() const { return functionLineEdit->text(); } -}; - /////////////////////////////////////////////////////////////////////// // @@ -300,6 +277,8 @@ void DebuggerManager::init() this, SIGNAL(sessionValueRequested(QString,QVariant*))); connect(m_breakHandler, SIGNAL(setSessionValueRequested(QString,QVariant)), this, SIGNAL(setSessionValueRequested(QString,QVariant))); + connect(breakView, SIGNAL(breakByFunctionRequested(QString)), + this, SLOT(breakByFunction(QString)), Qt::QueuedConnection); // Modules QAbstractItemView *modulesView = @@ -403,12 +382,6 @@ void DebuggerManager::init() m_breakAction = new QAction(this); m_breakAction->setText(tr("Toggle Breakpoint")); - m_breakByFunctionAction = new QAction(this); - m_breakByFunctionAction->setText(tr("Set Breakpoint at Function...")); - - m_breakAtMainAction = new QAction(this); - m_breakAtMainAction->setText(tr("Set Breakpoint at Function \"main\"")); - m_watchAction = new QAction(this); m_watchAction->setText(tr("Add to Watch Window")); @@ -446,10 +419,6 @@ void DebuggerManager::init() this, SLOT(addToWatchWindow())); connect(m_breakAction, SIGNAL(triggered()), this, SLOT(toggleBreakpoint())); - connect(m_breakByFunctionAction, SIGNAL(triggered()), - this, SLOT(breakByFunction())); - connect(m_breakAtMainAction, SIGNAL(triggered()), - this, SLOT(breakAtMain())); connect(m_statusTimer, SIGNAL(timeout()), this, SLOT(clearStatusMessage())); @@ -1144,22 +1113,6 @@ void DebuggerManager::breakByFunction(const QString &functionName) attemptBreakpointSynchronization(); } -void DebuggerManager::breakByFunction() -{ - BreakByFunctionDialog dlg(m_mainWindow); - if (dlg.exec()) - breakByFunction(dlg.functionName()); -} - -void DebuggerManager::breakAtMain() -{ -#ifdef Q_OS_WIN - breakByFunction("qMain"); -#else - breakByFunction("main"); -#endif -} - static bool isAllowedTransition(int from, int to) { return (from == -1) @@ -1531,5 +1484,3 @@ void DebuggerManager::runTest(const QString &fileName) m_startParameters->workingDir.clear(); //startNewDebugger(StartInternal); } - -#include "debuggermanager.moc" diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index bc022d9a40b..c9ff008a762 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -277,10 +277,8 @@ public slots: void runToLineExec(); void runToFunctionExec(); void toggleBreakpoint(); - void breakByFunction(); void breakByFunction(const QString &functionName); void setBreakpoint(const QString &fileName, int lineNumber); - void breakAtMain(); void activateFrame(int index); void selectThread(int index); @@ -460,8 +458,6 @@ private: QAction *m_nextAction; QAction *m_watchAction; QAction *m_breakAction; - QAction *m_breakByFunctionAction; - QAction *m_breakAtMainAction; QAction *m_sepAction; QAction *m_stepIAction; QAction *m_nextIAction; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index fc58e95f52b..18a348f7289 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -709,14 +709,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess mdebug->addAction(cmd); //mcppcontext->addAction(cmd); - cmd = am->registerAction(m_manager->m_breakByFunctionAction, - Constants::BREAK_BY_FUNCTION, globalcontext); - mdebug->addAction(cmd); - - cmd = am->registerAction(m_manager->m_breakAtMainAction, - Constants::BREAK_AT_MAIN, globalcontext); - mdebug->addAction(cmd); - sep = new QAction(this); sep->setSeparator(true); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep2"), globalcontext); |