diff options
author | David Schulz <david.schulz@theqtcompany.com> | 2014-12-02 08:56:33 +0100 |
---|---|---|
committer | David Schulz <david.schulz@theqtcompany.com> | 2014-12-04 11:11:33 +0100 |
commit | 8f9e74b93c28d06e112d5acbbe9361ab65693d43 (patch) | |
tree | 22247507b68698ddfae96e023687c48502d42eba /src/plugins/debugger | |
parent | f5933839eedc0c0888a1ad2071695a2f7fe25bfd (diff) | |
download | qt-creator-8f9e74b93c28d06e112d5acbbe9361ab65693d43.tar.gz |
Debugger: Re-enable the Remove All Expression Evaluators Action.
Also adding a confirmation dialog that prevents accidental
triggering of that action.
Change-Id: Ib1c496e34edfa0f869737559aff5b0b24da9ae64
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 11 | ||||
-rw-r--r-- | src/plugins/debugger/watchwindow.cpp | 14 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 05afb7c061..ceb28fd5eb 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -41,10 +41,13 @@ #include "imageviewer.h" #include "watchutils.h" +#include <coreplugin/icore.h> + #include <utils/algorithm.h> #include <utils/basetreeview.h> #include <utils/qtcassert.h> #include <utils/savedaction.h> +#include <utils/checkablemessagebox.h> #include <QDebug> #include <QFile> @@ -1883,6 +1886,14 @@ void WatchHandler::clearWatches() { if (theWatcherNames.isEmpty()) return; + + const QDialogButtonBox::StandardButton ret = Utils::CheckableMessageBox::doNotAskAgainQuestion( + Core::ICore::mainWindow(), tr("Remove All Expression Evaluators"), + tr("Are you sure you want to remove all expression evaluators?"), + Core::ICore::settings(), QLatin1String("RemoveAllWatchers")); + if (ret != QDialogButtonBox::Yes) + return; + m_model->destroyChildren(m_model->m_watchRoot); theWatcherNames.clear(); m_watcherCounter = 0; diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 67da4b3246..02737482e8 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -810,11 +810,16 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) break; p = pp; } + + bool showExpressionActions = (canHandleWatches || state == DebuggerNotReady) && m_type == WatchersType; + QString removeExp = p.data(LocalsExpressionRole).toString(); QAction actRemoveWatchExpression(removeWatchActionText(removeExp), 0); - actRemoveWatchExpression.setEnabled( - (canHandleWatches || state == DebuggerNotReady) - && !exp.isEmpty() && m_type == WatchersType); + actRemoveWatchExpression.setEnabled(showExpressionActions && !exp.isEmpty()); + + QAction actRemoveAllWatchExpression(tr("Remove All Expression Evaluators"), 0); + actRemoveAllWatchExpression.setEnabled(showExpressionActions + && !handler->watchedExpressions().isEmpty()); QMenu formatMenu(tr("Change Local Display Format...")); if (mi0.isValid()) @@ -891,6 +896,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(&actInsertNewWatchItem); menu.addAction(&actWatchExpression); menu.addAction(&actRemoveWatchExpression); + menu.addAction(&actRemoveAllWatchExpression); menu.addAction(&actSelectWidgetToWatch); menu.addSeparator(); @@ -950,6 +956,8 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) watchExpression(exp, name); } else if (act == &actRemoveWatchExpression) { handler->removeData(p.data(LocalsINameRole).toByteArray()); + } else if (act == &actRemoveAllWatchExpression) { + handler->clearWatches(); } else if (act == &actCopy) { copyToClipboard(DebuggerToolTipManager::treeModelClipboardContents(model())); } else if (act == &actCopyValue) { |