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>
This commit is contained in:
David Schulz
2014-12-02 08:56:33 +01:00
parent f5933839ee
commit 8f9e74b93c
2 changed files with 22 additions and 3 deletions

View File

@@ -41,10 +41,13 @@
#include "imageviewer.h" #include "imageviewer.h"
#include "watchutils.h" #include "watchutils.h"
#include <coreplugin/icore.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/basetreeview.h> #include <utils/basetreeview.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
#include <utils/checkablemessagebox.h>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
@@ -1883,6 +1886,14 @@ void WatchHandler::clearWatches()
{ {
if (theWatcherNames.isEmpty()) if (theWatcherNames.isEmpty())
return; 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); m_model->destroyChildren(m_model->m_watchRoot);
theWatcherNames.clear(); theWatcherNames.clear();
m_watcherCounter = 0; m_watcherCounter = 0;

View File

@@ -810,11 +810,16 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
break; break;
p = pp; p = pp;
} }
bool showExpressionActions = (canHandleWatches || state == DebuggerNotReady) && m_type == WatchersType;
QString removeExp = p.data(LocalsExpressionRole).toString(); QString removeExp = p.data(LocalsExpressionRole).toString();
QAction actRemoveWatchExpression(removeWatchActionText(removeExp), 0); QAction actRemoveWatchExpression(removeWatchActionText(removeExp), 0);
actRemoveWatchExpression.setEnabled( actRemoveWatchExpression.setEnabled(showExpressionActions && !exp.isEmpty());
(canHandleWatches || state == DebuggerNotReady)
&& !exp.isEmpty() && m_type == WatchersType); QAction actRemoveAllWatchExpression(tr("Remove All Expression Evaluators"), 0);
actRemoveAllWatchExpression.setEnabled(showExpressionActions
&& !handler->watchedExpressions().isEmpty());
QMenu formatMenu(tr("Change Local Display Format...")); QMenu formatMenu(tr("Change Local Display Format..."));
if (mi0.isValid()) if (mi0.isValid())
@@ -891,6 +896,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(&actInsertNewWatchItem); menu.addAction(&actInsertNewWatchItem);
menu.addAction(&actWatchExpression); menu.addAction(&actWatchExpression);
menu.addAction(&actRemoveWatchExpression); menu.addAction(&actRemoveWatchExpression);
menu.addAction(&actRemoveAllWatchExpression);
menu.addAction(&actSelectWidgetToWatch); menu.addAction(&actSelectWidgetToWatch);
menu.addSeparator(); menu.addSeparator();
@@ -950,6 +956,8 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
watchExpression(exp, name); watchExpression(exp, name);
} else if (act == &actRemoveWatchExpression) { } else if (act == &actRemoveWatchExpression) {
handler->removeData(p.data(LocalsINameRole).toByteArray()); handler->removeData(p.data(LocalsINameRole).toByteArray());
} else if (act == &actRemoveAllWatchExpression) {
handler->clearWatches();
} else if (act == &actCopy) { } else if (act == &actCopy) {
copyToClipboard(DebuggerToolTipManager::treeModelClipboardContents(model())); copyToClipboard(DebuggerToolTipManager::treeModelClipboardContents(model()));
} else if (act == &actCopyValue) { } else if (act == &actCopyValue) {