2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "watchwindow.h"
|
|
|
|
|
|
2010-11-05 19:38:40 +01:00
|
|
|
#include "breakhandler.h"
|
2009-03-17 17:00:06 +01:00
|
|
|
#include "debuggeractions.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "debuggerconstants.h"
|
2010-11-10 11:39:01 +01:00
|
|
|
#include "debuggercore.h"
|
2009-08-19 14:41:51 +02:00
|
|
|
#include "debuggerdialogs.h"
|
2010-11-05 19:38:40 +01:00
|
|
|
#include "debuggerengine.h"
|
2010-09-22 17:30:22 +02:00
|
|
|
#include "watchdelegatewidgets.h"
|
2010-11-05 19:38:40 +01:00
|
|
|
#include "watchhandler.h"
|
2011-02-14 09:40:43 +01:00
|
|
|
#include "debuggertooltipmanager.h"
|
2009-03-17 17:00:06 +01:00
|
|
|
|
2009-03-19 15:24:18 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2010-03-18 10:59:06 +01:00
|
|
|
#include <utils/savedaction.h>
|
2009-03-19 15:24:18 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtCore/QDebug>
|
2010-09-24 10:35:22 +02:00
|
|
|
#include <QtCore/QMetaObject>
|
2010-11-05 19:38:40 +01:00
|
|
|
#include <QtCore/QMetaProperty>
|
|
|
|
|
#include <QtCore/QVariant>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-17 16:31:43 +01:00
|
|
|
#include <QtGui/QApplication>
|
|
|
|
|
#include <QtGui/QClipboard>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtGui/QContextMenuEvent>
|
|
|
|
|
#include <QtGui/QHeaderView>
|
2009-03-19 15:24:18 +01:00
|
|
|
#include <QtGui/QItemDelegate>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtGui/QMenu>
|
2011-02-17 16:31:43 +01:00
|
|
|
#include <QtGui/QPainter>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtGui/QResizeEvent>
|
2011-02-28 10:58:21 +01:00
|
|
|
#include <QtGui/QInputDialog>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-03-19 15:24:18 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// WatchDelegate
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-11-05 19:38:40 +01:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
static DebuggerEngine *currentEngine()
|
|
|
|
|
{
|
2010-11-10 11:39:01 +01:00
|
|
|
return debuggerCore()->currentEngine();
|
2010-11-05 19:38:40 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-19 15:24:18 +01:00
|
|
|
class WatchDelegate : public QItemDelegate
|
|
|
|
|
{
|
|
|
|
|
public:
|
2010-11-05 19:38:40 +01:00
|
|
|
explicit WatchDelegate(WatchWindow *parent)
|
|
|
|
|
: QItemDelegate(parent), m_watchWindow(parent)
|
|
|
|
|
{}
|
2009-03-19 15:24:18 +01:00
|
|
|
|
|
|
|
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
|
2010-09-22 17:30:22 +02:00
|
|
|
const QModelIndex &index) const
|
2009-03-19 15:24:18 +01:00
|
|
|
{
|
2010-09-22 17:30:22 +02:00
|
|
|
// Value column: Custom editor. Apply integer-specific settings.
|
|
|
|
|
if (index.column() == 1) {
|
2010-11-04 11:27:23 +01:00
|
|
|
const QVariant::Type type =
|
|
|
|
|
static_cast<QVariant::Type>(index.data(LocalsEditTypeRole).toInt());
|
2010-09-22 17:30:22 +02:00
|
|
|
switch (type) {
|
|
|
|
|
case QVariant::Bool:
|
|
|
|
|
return new BooleanComboBox(parent);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
WatchLineEdit *edit = WatchLineEdit::create(type, parent);
|
2011-02-17 16:31:43 +01:00
|
|
|
edit->setFrame(false);
|
|
|
|
|
IntegerWatchLineEdit *intEdit
|
|
|
|
|
= qobject_cast<IntegerWatchLineEdit *>(edit);
|
|
|
|
|
if (intEdit)
|
2010-09-22 17:30:22 +02:00
|
|
|
intEdit->setBase(index.data(LocalsIntegerBaseRole).toInt());
|
|
|
|
|
return edit;
|
|
|
|
|
}
|
2011-02-17 16:31:43 +01:00
|
|
|
|
|
|
|
|
// Standard line edits for the rest.
|
|
|
|
|
QLineEdit *lineEdit = new QLineEdit(parent);
|
|
|
|
|
lineEdit->setFrame(false);
|
|
|
|
|
return lineEdit;
|
2009-03-19 15:24:18 +01:00
|
|
|
}
|
|
|
|
|
|
2009-04-07 13:38:19 +02:00
|
|
|
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
2010-09-24 10:35:22 +02:00
|
|
|
const QModelIndex &index) const
|
2009-03-19 15:24:18 +01:00
|
|
|
{
|
2010-09-24 10:35:22 +02:00
|
|
|
// Standard handling for anything but the watcher name column (change
|
|
|
|
|
// expression), which removes/recreates a row, which cannot be done
|
|
|
|
|
// in model->setData().
|
|
|
|
|
if (index.column() != 0) {
|
|
|
|
|
QItemDelegate::setModelData(editor, model, index);
|
2010-09-22 17:30:22 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2010-09-24 10:35:22 +02:00
|
|
|
const QMetaProperty userProperty = editor->metaObject()->userProperty();
|
|
|
|
|
QTC_ASSERT(userProperty.isValid(), return);
|
2010-11-05 19:38:40 +01:00
|
|
|
const QString value = editor->property(userProperty.name()).toString();
|
2010-09-24 10:35:22 +02:00
|
|
|
const QString exp = index.data(LocalsExpressionRole).toString();
|
2010-11-05 19:38:40 +01:00
|
|
|
if (exp == value)
|
|
|
|
|
return;
|
|
|
|
|
m_watchWindow->removeWatchExpression(exp);
|
|
|
|
|
m_watchWindow->watchExpression(value);
|
2009-03-19 15:24:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
|
|
|
|
const QModelIndex &) const
|
|
|
|
|
{
|
|
|
|
|
editor->setGeometry(option.rect);
|
|
|
|
|
}
|
2010-11-05 19:38:40 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
WatchWindow *m_watchWindow;
|
2009-03-19 15:24:18 +01:00
|
|
|
};
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// WatchWindow
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
WatchWindow::WatchWindow(Type type, QWidget *parent)
|
|
|
|
|
: QTreeView(parent),
|
|
|
|
|
m_type(type)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-07-01 12:49:41 +02:00
|
|
|
m_grabbing = false;
|
|
|
|
|
|
2010-03-16 16:55:56 +01:00
|
|
|
setFrameStyle(QFrame::NoFrame);
|
2010-04-16 11:39:36 +02:00
|
|
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
2008-12-02 12:01:29 +01:00
|
|
|
setWindowTitle(tr("Locals and Watchers"));
|
|
|
|
|
setIndentation(indentation() * 9/10);
|
|
|
|
|
setUniformRowHeights(true);
|
2009-03-19 15:24:18 +01:00
|
|
|
setItemDelegate(new WatchDelegate(this));
|
2009-04-29 12:20:10 +02:00
|
|
|
setDragEnabled(true);
|
|
|
|
|
setAcceptDrops(true);
|
|
|
|
|
setDropIndicatorShown(true);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-03-16 18:48:14 +01:00
|
|
|
QAction *useColors = debuggerCore()->action(UseAlternatingRowColors);
|
|
|
|
|
setAlternatingRowColors(useColors->isChecked());
|
|
|
|
|
|
|
|
|
|
QAction *adjustColumns = debuggerCore()->action(AlwaysAdjustLocalsColumnWidths);
|
|
|
|
|
|
|
|
|
|
connect(useColors, SIGNAL(toggled(bool)),
|
|
|
|
|
SLOT(setAlternatingRowColorsHelper(bool)));
|
|
|
|
|
connect(adjustColumns, SIGNAL(triggered(bool)),
|
|
|
|
|
SLOT(setAlwaysResizeColumnsToContents(bool)));
|
2009-10-20 16:02:35 +02:00
|
|
|
connect(this, SIGNAL(expanded(QModelIndex)),
|
2011-03-16 18:48:14 +01:00
|
|
|
SLOT(expandNode(QModelIndex)));
|
2009-10-20 16:02:35 +02:00
|
|
|
connect(this, SIGNAL(collapsed(QModelIndex)),
|
2011-03-16 18:48:14 +01:00
|
|
|
SLOT(collapseNode(QModelIndex)));
|
2010-01-29 21:33:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::expandNode(const QModelIndex &idx)
|
|
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
setModelData(LocalsExpandedRole, true, idx);
|
2010-01-29 21:33:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::collapseNode(const QModelIndex &idx)
|
|
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
setModelData(LocalsExpandedRole, false, idx);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-17 18:02:08 +01:00
|
|
|
void WatchWindow::keyPressEvent(QKeyEvent *ev)
|
|
|
|
|
{
|
2009-04-03 13:39:14 +02:00
|
|
|
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
|
2008-12-17 18:02:08 +01:00
|
|
|
QModelIndex idx = currentIndex();
|
|
|
|
|
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
2011-03-17 19:37:07 +01:00
|
|
|
QString exp = idx1.data(LocalsRawExpressionRole).toString();
|
2010-06-23 15:13:51 +02:00
|
|
|
removeWatchExpression(exp);
|
2009-04-07 13:38:19 +02:00
|
|
|
} else if (ev->key() == Qt::Key_Return
|
|
|
|
|
&& ev->modifiers() == Qt::ControlModifier
|
|
|
|
|
&& m_type == LocalsType) {
|
2009-04-03 13:39:14 +02:00
|
|
|
QModelIndex idx = currentIndex();
|
|
|
|
|
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
|
|
|
|
QString exp = model()->data(idx1).toString();
|
2010-06-23 15:13:51 +02:00
|
|
|
watchExpression(exp);
|
2008-12-17 18:02:08 +01:00
|
|
|
}
|
|
|
|
|
QTreeView::keyPressEvent(ev);
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-29 12:20:10 +02:00
|
|
|
void WatchWindow::dragEnterEvent(QDragEnterEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
//QTreeView::dragEnterEvent(ev);
|
|
|
|
|
if (ev->mimeData()->hasFormat("text/plain")) {
|
|
|
|
|
ev->setDropAction(Qt::CopyAction);
|
|
|
|
|
ev->accept();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::dragMoveEvent(QDragMoveEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
//QTreeView::dragMoveEvent(ev);
|
|
|
|
|
if (ev->mimeData()->hasFormat("text/plain")) {
|
|
|
|
|
ev->setDropAction(Qt::CopyAction);
|
|
|
|
|
ev->accept();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::dropEvent(QDropEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
if (ev->mimeData()->hasFormat("text/plain")) {
|
2010-06-23 15:13:51 +02:00
|
|
|
watchExpression(ev->mimeData()->text());
|
2009-04-29 12:20:10 +02:00
|
|
|
//ev->acceptProposedAction();
|
|
|
|
|
ev->setDropAction(Qt::CopyAction);
|
|
|
|
|
ev->accept();
|
|
|
|
|
}
|
|
|
|
|
//QTreeView::dropEvent(ev);
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-14 15:38:20 +02:00
|
|
|
void WatchWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
const QModelIndex idx = indexAt(ev->pos());
|
|
|
|
|
if (!idx.isValid()) {
|
2010-07-23 18:20:13 +02:00
|
|
|
// The "<Edit>" case.
|
|
|
|
|
watchExpression(QString());
|
2010-07-14 15:38:20 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QTreeView::mouseDoubleClickEvent(ev);
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-25 13:51:54 +01:00
|
|
|
// Text for add watch action with truncated expression
|
|
|
|
|
static inline QString addWatchActionText(QString exp)
|
|
|
|
|
{
|
|
|
|
|
if (exp.isEmpty())
|
|
|
|
|
return WatchWindow::tr("Watch Expression");
|
|
|
|
|
if (exp.size() > 30) {
|
|
|
|
|
exp.truncate(30);
|
|
|
|
|
exp.append(QLatin1String("..."));
|
|
|
|
|
}
|
|
|
|
|
return WatchWindow::tr("Watch Expression \"%1\"").arg(exp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Text for add watch action with truncated expression
|
|
|
|
|
static inline QString removeWatchActionText(QString exp)
|
|
|
|
|
{
|
|
|
|
|
if (exp.isEmpty())
|
|
|
|
|
return WatchWindow::tr("Remove Watch Expression");
|
|
|
|
|
if (exp.size() > 30) {
|
|
|
|
|
exp.truncate(30);
|
|
|
|
|
exp.append(QLatin1String("..."));
|
|
|
|
|
}
|
|
|
|
|
return WatchWindow::tr("Remove Watch Expression \"%1\"").arg(exp);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|
|
|
|
{
|
2010-11-05 19:38:40 +01:00
|
|
|
DebuggerEngine *engine = currentEngine();
|
|
|
|
|
WatchHandler *handler = engine->watchHandler();
|
|
|
|
|
|
2010-03-17 12:38:37 +01:00
|
|
|
const QModelIndex idx = indexAt(ev->pos());
|
|
|
|
|
const QModelIndex mi0 = idx.sibling(idx.row(), 0);
|
|
|
|
|
const QModelIndex mi1 = idx.sibling(idx.row(), 1);
|
|
|
|
|
const QModelIndex mi2 = idx.sibling(idx.row(), 2);
|
2010-06-16 11:08:54 +02:00
|
|
|
const quint64 address = mi0.data(LocalsAddressRole).toULongLong();
|
|
|
|
|
const quint64 pointerValue = mi0.data(LocalsPointerValueRole).toULongLong();
|
|
|
|
|
const QString exp = mi0.data(LocalsExpressionRole).toString();
|
|
|
|
|
const QString type = mi2.data().toString();
|
2009-07-03 11:20:47 +02:00
|
|
|
|
2010-03-17 12:38:37 +01:00
|
|
|
const QStringList alternativeFormats =
|
2010-06-16 11:08:54 +02:00
|
|
|
mi0.data(LocalsTypeFormatListRole).toStringList();
|
2009-12-08 16:00:06 +01:00
|
|
|
const int typeFormat =
|
2010-06-16 11:08:54 +02:00
|
|
|
mi0.data(LocalsTypeFormatRole).toInt();
|
2009-12-08 16:00:06 +01:00
|
|
|
const int individualFormat =
|
2010-06-16 11:08:54 +02:00
|
|
|
mi0.data(LocalsIndividualFormatRole).toInt();
|
2009-12-08 16:00:06 +01:00
|
|
|
const int effectiveIndividualFormat =
|
|
|
|
|
individualFormat == -1 ? typeFormat : individualFormat;
|
2011-02-17 19:00:33 +01:00
|
|
|
const int unprintableBase = handler->unprintableBase();
|
2009-07-03 11:20:47 +02:00
|
|
|
|
2010-12-16 10:18:51 +01:00
|
|
|
QMenu formatMenu;
|
2009-07-03 11:20:47 +02:00
|
|
|
QList<QAction *> typeFormatActions;
|
2010-12-16 10:18:51 +01:00
|
|
|
QList<QAction *> individualFormatActions;
|
2010-05-19 15:15:56 +02:00
|
|
|
QAction *clearTypeFormatAction = 0;
|
2010-12-16 10:18:51 +01:00
|
|
|
QAction *clearIndividualFormatAction = 0;
|
2011-02-17 19:00:33 +01:00
|
|
|
QAction *showUnprintableUnicode = 0;
|
|
|
|
|
QAction *showUnprintableOctal = 0;
|
|
|
|
|
QAction *showUnprintableHexadecimal = 0;
|
2010-12-16 10:18:51 +01:00
|
|
|
formatMenu.setTitle(tr("Change Display Format..."));
|
2011-03-23 12:16:37 +01:00
|
|
|
showUnprintableUnicode =
|
|
|
|
|
formatMenu.addAction(tr("Treat All Characters as Printable"));
|
|
|
|
|
showUnprintableUnicode->setCheckable(true);
|
|
|
|
|
showUnprintableUnicode->setChecked(unprintableBase == 0);
|
|
|
|
|
showUnprintableOctal =
|
|
|
|
|
formatMenu.addAction(tr("Show Unprintable Characters as Octal"));
|
|
|
|
|
showUnprintableOctal->setCheckable(true);
|
|
|
|
|
showUnprintableOctal->setChecked(unprintableBase == 8);
|
|
|
|
|
showUnprintableHexadecimal =
|
|
|
|
|
formatMenu.addAction(tr("Show Unprintable Characters as Hexadecimal"));
|
|
|
|
|
showUnprintableHexadecimal->setCheckable(true);
|
|
|
|
|
showUnprintableHexadecimal->setChecked(unprintableBase == 16);
|
|
|
|
|
if (idx.isValid() /*&& !alternativeFormats.isEmpty() */) {
|
|
|
|
|
const QString spacer = QLatin1String(" ");
|
2011-02-17 19:00:33 +01:00
|
|
|
formatMenu.addSeparator();
|
2010-12-16 10:18:51 +01:00
|
|
|
QAction *dummy = formatMenu.addAction(
|
2011-03-23 12:16:37 +01:00
|
|
|
tr("Change Display for Type \"%1\":").arg(type));
|
2010-12-16 10:18:51 +01:00
|
|
|
dummy->setEnabled(false);
|
2011-03-23 12:16:37 +01:00
|
|
|
clearTypeFormatAction = formatMenu.addAction(spacer + tr("Automatic"));
|
2010-12-16 10:18:51 +01:00
|
|
|
//clearTypeFormatAction->setEnabled(typeFormat != -1);
|
|
|
|
|
//clearTypeFormatAction->setEnabled(individualFormat != -1);
|
|
|
|
|
clearTypeFormatAction->setCheckable(true);
|
|
|
|
|
clearTypeFormatAction->setChecked(typeFormat == -1);
|
|
|
|
|
for (int i = 0; i != alternativeFormats.size(); ++i) {
|
2011-03-23 12:16:37 +01:00
|
|
|
const QString format = spacer + alternativeFormats.at(i);
|
2010-12-16 10:18:51 +01:00
|
|
|
QAction *act = new QAction(format, &formatMenu);
|
|
|
|
|
act->setCheckable(true);
|
|
|
|
|
//act->setEnabled(individualFormat != -1);
|
|
|
|
|
if (i == typeFormat)
|
|
|
|
|
act->setChecked(true);
|
|
|
|
|
formatMenu.addAction(act);
|
|
|
|
|
typeFormatActions.append(act);
|
2010-03-17 13:03:34 +01:00
|
|
|
}
|
2010-12-16 10:18:51 +01:00
|
|
|
formatMenu.addSeparator();
|
|
|
|
|
dummy = formatMenu.addAction(
|
2011-03-23 12:16:37 +01:00
|
|
|
tr("Change Display for Object Named \"%1\":").arg(mi0.data().toString()));
|
2010-12-16 10:18:51 +01:00
|
|
|
dummy->setEnabled(false);
|
|
|
|
|
clearIndividualFormatAction
|
2011-03-23 12:16:37 +01:00
|
|
|
= formatMenu.addAction(spacer + tr("Use Display Format Based on Type"));
|
2010-12-16 10:18:51 +01:00
|
|
|
//clearIndividualFormatAction->setEnabled(individualFormat != -1);
|
|
|
|
|
clearIndividualFormatAction->setCheckable(true);
|
|
|
|
|
clearIndividualFormatAction->setChecked(effectiveIndividualFormat == -1);
|
|
|
|
|
for (int i = 0; i != alternativeFormats.size(); ++i) {
|
2011-03-23 12:16:37 +01:00
|
|
|
const QString format = spacer + alternativeFormats.at(i);
|
2010-12-16 10:18:51 +01:00
|
|
|
QAction *act = new QAction(format, &formatMenu);
|
|
|
|
|
act->setCheckable(true);
|
|
|
|
|
if (i == effectiveIndividualFormat)
|
|
|
|
|
act->setChecked(true);
|
|
|
|
|
formatMenu.addAction(act);
|
|
|
|
|
individualFormatActions.append(act);
|
2009-10-07 14:29:55 +02:00
|
|
|
}
|
2009-07-08 09:02:36 +02:00
|
|
|
} else {
|
2011-03-23 12:16:37 +01:00
|
|
|
QAction *dummy = formatMenu.addAction(
|
|
|
|
|
tr("Change Display for Type or Item..."));
|
|
|
|
|
dummy->setEnabled(false);
|
2009-07-03 11:20:47 +02:00
|
|
|
}
|
|
|
|
|
|
2010-11-25 18:49:26 +01:00
|
|
|
const bool actionsEnabled = engine->debuggerActionsEnabled();
|
|
|
|
|
const unsigned engineCapabilities = engine->debuggerCapabilities();
|
2011-02-28 10:58:21 +01:00
|
|
|
const bool canHandleWatches = engineCapabilities & AddWatcherCapability;
|
2010-11-25 18:49:26 +01:00
|
|
|
const DebuggerState state = engine->state();
|
2011-02-28 10:58:21 +01:00
|
|
|
const bool canInsertWatches = (state==InferiorStopOk) || ((state==InferiorRunOk) && engine->acceptsWatchesWhileRunning());
|
2010-04-16 16:36:00 +02:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
QMenu menu;
|
2010-02-12 10:52:09 +01:00
|
|
|
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item"));
|
2011-02-28 10:58:21 +01:00
|
|
|
actInsertNewWatchItem->setEnabled(canHandleWatches && canInsertWatches);
|
2010-02-12 10:52:09 +01:00
|
|
|
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select Widget to Watch"));
|
2011-02-28 10:58:21 +01:00
|
|
|
actSelectWidgetToWatch->setEnabled(canHandleWatches && (engine->canWatchWidgets()));
|
2009-08-12 10:51:25 +02:00
|
|
|
|
2010-05-19 17:34:47 +02:00
|
|
|
// Offer to open address pointed to or variable address.
|
2010-06-16 11:08:54 +02:00
|
|
|
const bool createPointerActions = pointerValue && pointerValue != address;
|
2010-05-19 17:34:47 +02:00
|
|
|
|
2009-07-03 11:20:47 +02:00
|
|
|
menu.addSeparator();
|
2009-08-18 16:46:33 +02:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
QAction *actSetWatchpointAtVariableAddress = 0;
|
|
|
|
|
QAction *actSetWatchpointAtPointerValue = 0;
|
2010-05-07 15:16:31 +02:00
|
|
|
const bool canSetWatchpoint = engineCapabilities & WatchpointCapability;
|
2010-05-19 17:34:47 +02:00
|
|
|
if (canSetWatchpoint && address) {
|
2010-11-10 16:33:11 +01:00
|
|
|
actSetWatchpointAtVariableAddress =
|
2010-11-04 11:27:23 +01:00
|
|
|
new QAction(tr("Add Watchpoint at Object's Address (0x%1)")
|
2010-06-23 15:13:51 +02:00
|
|
|
.arg(address, 0, 16), &menu);
|
2010-11-10 16:33:11 +01:00
|
|
|
actSetWatchpointAtVariableAddress->
|
2010-06-16 11:08:54 +02:00
|
|
|
setChecked(mi0.data(LocalsIsWatchpointAtAddressRole).toBool());
|
2010-05-20 19:35:34 +02:00
|
|
|
if (createPointerActions) {
|
2010-11-10 16:33:11 +01:00
|
|
|
actSetWatchpointAtPointerValue =
|
2010-11-04 11:27:23 +01:00
|
|
|
new QAction(tr("Add Watchpoint at Referenced Address (0x%1)")
|
2010-06-23 15:13:51 +02:00
|
|
|
.arg(pointerValue, 0, 16), &menu);
|
2010-11-10 16:33:11 +01:00
|
|
|
actSetWatchpointAtPointerValue->setCheckable(true);
|
|
|
|
|
actSetWatchpointAtPointerValue->
|
2010-06-16 11:08:54 +02:00
|
|
|
setChecked(mi0.data(LocalsIsWatchpointAtPointerValueRole).toBool());
|
2010-05-20 19:35:34 +02:00
|
|
|
}
|
2010-05-07 15:16:31 +02:00
|
|
|
} else {
|
2010-11-10 16:33:11 +01:00
|
|
|
actSetWatchpointAtVariableAddress =
|
2010-11-26 09:58:34 +01:00
|
|
|
new QAction(tr("Add Watchpoint"), &menu);
|
2010-11-10 16:33:11 +01:00
|
|
|
actSetWatchpointAtVariableAddress->setEnabled(false);
|
2010-05-07 15:16:31 +02:00
|
|
|
}
|
2010-11-10 16:33:11 +01:00
|
|
|
actSetWatchpointAtVariableAddress->setToolTip(
|
2010-11-04 11:27:23 +01:00
|
|
|
tr("Setting a watchpoint on an address will cause the program "
|
2010-11-04 14:03:44 +01:00
|
|
|
"to stop when the data at the address it modified."));
|
2010-05-07 15:16:31 +02:00
|
|
|
|
2010-11-25 13:51:54 +01:00
|
|
|
QAction *actWatchExpression = new QAction(addWatchActionText(exp), &menu);
|
2010-07-14 14:52:14 +02:00
|
|
|
actWatchExpression->setEnabled(canHandleWatches && !exp.isEmpty());
|
2010-06-23 15:13:51 +02:00
|
|
|
|
2010-10-11 12:59:49 +02:00
|
|
|
// Can remove watch if engine can handle it or session engine.
|
2010-11-25 13:51:54 +01:00
|
|
|
QAction *actRemoveWatchExpression = new QAction(removeWatchActionText(exp), &menu);
|
2010-11-04 11:27:23 +01:00
|
|
|
actRemoveWatchExpression->setEnabled(
|
|
|
|
|
(canHandleWatches || state == DebuggerNotReady) && !exp.isEmpty());
|
2011-01-17 09:12:37 +01:00
|
|
|
QAction *actRemoveWatches = new QAction(tr("Remove All Watch Items"), &menu);
|
2011-01-14 17:28:37 +01:00
|
|
|
actRemoveWatches->setEnabled(!WatchHandler::watcherNames().isEmpty());
|
2010-06-23 15:13:51 +02:00
|
|
|
|
|
|
|
|
if (m_type == LocalsType)
|
|
|
|
|
menu.addAction(actWatchExpression);
|
2011-01-14 17:28:37 +01:00
|
|
|
else {
|
2010-06-23 15:13:51 +02:00
|
|
|
menu.addAction(actRemoveWatchExpression);
|
2011-01-14 17:28:37 +01:00
|
|
|
menu.addAction(actRemoveWatches);
|
|
|
|
|
}
|
2009-07-03 11:20:47 +02:00
|
|
|
|
2010-12-16 12:07:12 +01:00
|
|
|
QMenu memoryMenu;
|
|
|
|
|
memoryMenu.setTitle(tr("Open Memory Editor..."));
|
|
|
|
|
QAction *actOpenMemoryEditAtVariableAddress = new QAction(&memoryMenu);
|
|
|
|
|
QAction *actOpenMemoryEditAtPointerValue = new QAction(&memoryMenu);
|
|
|
|
|
QAction *actOpenMemoryEditor = new QAction(&memoryMenu);
|
|
|
|
|
if (engineCapabilities & ShowMemoryCapability) {
|
|
|
|
|
actOpenMemoryEditor->setText(tr("Open Memory Editor..."));
|
|
|
|
|
if (address) {
|
|
|
|
|
actOpenMemoryEditAtVariableAddress->setText(
|
|
|
|
|
tr("Open Memory Editor at Object's Address (0x%1)")
|
|
|
|
|
.arg(address, 0, 16));
|
|
|
|
|
} else {
|
|
|
|
|
actOpenMemoryEditAtVariableAddress->setText(
|
|
|
|
|
tr("Open Memory Editor at Object's Address"));
|
|
|
|
|
actOpenMemoryEditAtVariableAddress->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
if (createPointerActions) {
|
|
|
|
|
actOpenMemoryEditAtPointerValue->setText(
|
|
|
|
|
tr("Open Memory Editor at Referenced Address (0x%1)")
|
|
|
|
|
.arg(pointerValue, 0, 16));
|
|
|
|
|
} else {
|
|
|
|
|
actOpenMemoryEditAtPointerValue->setText(
|
|
|
|
|
tr("Open Memory Editor at Referenced Address"));
|
|
|
|
|
actOpenMemoryEditAtPointerValue->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
memoryMenu.addAction(actOpenMemoryEditAtVariableAddress);
|
|
|
|
|
memoryMenu.addAction(actOpenMemoryEditAtPointerValue);
|
|
|
|
|
memoryMenu.addAction(actOpenMemoryEditor);
|
|
|
|
|
} else {
|
|
|
|
|
memoryMenu.setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-14 09:40:43 +01:00
|
|
|
QAction *actCopy = new QAction(tr("Copy Contents to Clipboard"), &menu);
|
|
|
|
|
|
2009-08-12 10:51:25 +02:00
|
|
|
menu.addAction(actInsertNewWatchItem);
|
|
|
|
|
menu.addAction(actSelectWidgetToWatch);
|
2010-12-16 10:18:51 +01:00
|
|
|
menu.addMenu(&formatMenu);
|
2010-12-16 12:07:12 +01:00
|
|
|
menu.addMenu(&memoryMenu);
|
2010-11-10 16:33:11 +01:00
|
|
|
menu.addAction(actSetWatchpointAtVariableAddress);
|
|
|
|
|
if (actSetWatchpointAtPointerValue)
|
|
|
|
|
menu.addAction(actSetWatchpointAtPointerValue);
|
2011-02-14 09:40:43 +01:00
|
|
|
menu.addAction(actCopy );
|
2009-02-27 11:41:19 +01:00
|
|
|
menu.addSeparator();
|
2009-10-07 13:36:48 +02:00
|
|
|
|
2010-11-10 16:33:11 +01:00
|
|
|
menu.addAction(debuggerCore()->action(UseDebuggingHelpers));
|
|
|
|
|
menu.addAction(debuggerCore()->action(UseToolTipsInLocalsView));
|
|
|
|
|
menu.addAction(debuggerCore()->action(AutoDerefPointers));
|
|
|
|
|
menu.addAction(debuggerCore()->action(ShowStdNamespace));
|
|
|
|
|
menu.addAction(debuggerCore()->action(ShowQtNamespace));
|
|
|
|
|
menu.addAction(debuggerCore()->action(SortStructMembers));
|
2009-10-07 13:36:48 +02:00
|
|
|
|
2009-08-18 16:46:33 +02:00
|
|
|
QAction *actAdjustColumnWidths =
|
2010-02-12 10:52:09 +01:00
|
|
|
menu.addAction(tr("Adjust Column Widths to Contents"));
|
2011-03-16 18:48:14 +01:00
|
|
|
menu.addAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
|
2009-03-18 09:03:47 +01:00
|
|
|
menu.addSeparator();
|
2011-03-16 18:48:14 +01:00
|
|
|
|
2010-09-28 13:09:19 +02:00
|
|
|
QAction *actClearCodeModelSnapshot
|
|
|
|
|
= new QAction(tr("Refresh Code Model Snapshot"), &menu);
|
|
|
|
|
actClearCodeModelSnapshot->setEnabled(actionsEnabled
|
2010-11-10 16:33:11 +01:00
|
|
|
&& debuggerCore()->action(UseCodeModel)->isChecked());
|
2010-09-28 13:09:19 +02:00
|
|
|
menu.addAction(actClearCodeModelSnapshot);
|
|
|
|
|
QAction *actShowInEditor
|
|
|
|
|
= new QAction(tr("Show View Contents in Editor"), &menu);
|
|
|
|
|
actShowInEditor->setEnabled(actionsEnabled);
|
|
|
|
|
menu.addAction(actShowInEditor);
|
2010-11-10 16:33:11 +01:00
|
|
|
menu.addAction(debuggerCore()->action(SettingsDialog));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-02-21 16:45:07 +01:00
|
|
|
QAction *actCloseEditorToolTips = new QAction(tr("Close Editor Tooltips"), &menu);
|
|
|
|
|
actCloseEditorToolTips->setEnabled(DebuggerToolTipManager::instance()->hasToolTips());
|
|
|
|
|
menu.addAction(actCloseEditorToolTips);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QAction *act = menu.exec(ev->globalPos());
|
2010-05-19 17:34:47 +02:00
|
|
|
if (act == 0)
|
|
|
|
|
return;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-08-12 10:51:25 +02:00
|
|
|
if (act == actAdjustColumnWidths) {
|
2008-12-02 12:01:29 +01:00
|
|
|
resizeColumnsToContents();
|
2009-08-12 10:51:25 +02:00
|
|
|
} else if (act == actInsertNewWatchItem) {
|
2011-02-28 10:58:21 +01:00
|
|
|
bool ok;
|
|
|
|
|
QString newExp = QInputDialog::getText(this, tr("Enter watch expression"),
|
|
|
|
|
tr("Expression:"), QLineEdit::Normal,
|
|
|
|
|
QString(), &ok);
|
|
|
|
|
if (ok && !newExp.isEmpty()) {
|
|
|
|
|
watchExpression(newExp);
|
|
|
|
|
}
|
2010-05-19 17:34:47 +02:00
|
|
|
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
2010-12-08 12:43:11 +01:00
|
|
|
currentEngine()->openMemoryView(address);
|
2010-05-19 17:34:47 +02:00
|
|
|
} else if (act == actOpenMemoryEditAtPointerValue) {
|
2010-12-08 12:43:11 +01:00
|
|
|
currentEngine()->openMemoryView(pointerValue);
|
2010-05-19 17:34:47 +02:00
|
|
|
} else if (act == actOpenMemoryEditor) {
|
2009-08-19 14:41:51 +02:00
|
|
|
AddressDialog dialog;
|
2010-06-16 11:08:54 +02:00
|
|
|
if (dialog.exec() == QDialog::Accepted)
|
2010-12-08 12:43:11 +01:00
|
|
|
currentEngine()->openMemoryView(dialog.address());
|
2010-11-10 16:33:11 +01:00
|
|
|
} else if (act == actSetWatchpointAtVariableAddress) {
|
2010-11-05 19:38:40 +01:00
|
|
|
setWatchpoint(address);
|
2010-11-10 16:33:11 +01:00
|
|
|
} else if (act == actSetWatchpointAtPointerValue) {
|
2010-11-05 19:38:40 +01:00
|
|
|
setWatchpoint(pointerValue);
|
2009-08-12 10:51:25 +02:00
|
|
|
} else if (act == actSelectWidgetToWatch) {
|
2009-07-01 12:49:41 +02:00
|
|
|
grabMouse(Qt::CrossCursor);
|
|
|
|
|
m_grabbing = true;
|
2010-06-23 15:13:51 +02:00
|
|
|
} else if (act == actWatchExpression) {
|
|
|
|
|
watchExpression(exp);
|
|
|
|
|
} else if (act == actRemoveWatchExpression) {
|
|
|
|
|
removeWatchExpression(exp);
|
2011-02-14 09:40:43 +01:00
|
|
|
} else if (act == actCopy ) {
|
|
|
|
|
const QString clipboardText = DebuggerTreeViewToolTipWidget::treeModelClipboardContents(model());
|
|
|
|
|
QClipboard *clipboard = QApplication::clipboard();
|
|
|
|
|
#ifdef Q_WS_X11
|
|
|
|
|
clipboard->setText(clipboardText, QClipboard::Selection);
|
|
|
|
|
#endif
|
|
|
|
|
clipboard->setText(clipboardText, QClipboard::Clipboard);
|
2011-01-14 17:28:37 +01:00
|
|
|
} else if (act == actRemoveWatches) {
|
|
|
|
|
currentEngine()->watchHandler()->clearWatches();
|
2009-10-16 16:26:28 +02:00
|
|
|
} else if (act == actClearCodeModelSnapshot) {
|
2010-11-10 11:39:01 +01:00
|
|
|
debuggerCore()->clearCppCodeModelSnapshot();
|
2010-05-19 17:34:47 +02:00
|
|
|
} else if (act == clearTypeFormatAction) {
|
2010-06-16 11:08:54 +02:00
|
|
|
setModelData(LocalsTypeFormatRole, -1, mi1);
|
2010-05-19 17:34:47 +02:00
|
|
|
} else if (act == clearIndividualFormatAction) {
|
2010-06-16 11:08:54 +02:00
|
|
|
setModelData(LocalsIndividualFormatRole, -1, mi1);
|
2010-09-08 09:09:09 +02:00
|
|
|
} else if (act == actShowInEditor) {
|
2010-11-05 19:38:40 +01:00
|
|
|
QString contents = handler->editorContents();
|
2010-11-10 11:39:01 +01:00
|
|
|
debuggerCore()->openTextEditor(tr("Locals & Watchers"), contents);
|
2011-02-17 19:00:33 +01:00
|
|
|
} else if (act == showUnprintableUnicode) {
|
|
|
|
|
handler->setUnprintableBase(0);
|
|
|
|
|
} else if (act == showUnprintableOctal) {
|
|
|
|
|
handler->setUnprintableBase(8);
|
|
|
|
|
} else if (act == showUnprintableHexadecimal) {
|
|
|
|
|
handler->setUnprintableBase(16);
|
2011-02-21 16:45:07 +01:00
|
|
|
} else if (act == actCloseEditorToolTips) {
|
|
|
|
|
DebuggerToolTipManager::instance()->closeAllToolTips();
|
2010-01-29 21:33:57 +01:00
|
|
|
} else {
|
2010-03-17 13:03:34 +01:00
|
|
|
for (int i = 0; i != typeFormatActions.size(); ++i) {
|
2009-07-03 11:20:47 +02:00
|
|
|
if (act == typeFormatActions.at(i))
|
2010-06-23 16:30:42 +02:00
|
|
|
setModelData(LocalsTypeFormatRole, i, mi1);
|
2010-03-17 13:03:34 +01:00
|
|
|
}
|
|
|
|
|
for (int i = 0; i != individualFormatActions.size(); ++i) {
|
|
|
|
|
if (act == individualFormatActions.at(i))
|
2010-06-23 16:30:42 +02:00
|
|
|
setModelData(LocalsIndividualFormatRole, i, mi1);
|
2009-07-03 11:20:47 +02:00
|
|
|
}
|
2009-07-01 12:49:41 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::resizeColumnsToContents()
|
|
|
|
|
{
|
|
|
|
|
resizeColumnToContents(0);
|
|
|
|
|
resizeColumnToContents(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::setAlwaysResizeColumnsToContents(bool on)
|
|
|
|
|
{
|
|
|
|
|
if (!header())
|
|
|
|
|
return;
|
2010-01-29 21:33:57 +01:00
|
|
|
QHeaderView::ResizeMode mode = on
|
2008-12-02 12:01:29 +01:00
|
|
|
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
|
|
|
|
|
header()->setResizeMode(0, mode);
|
|
|
|
|
header()->setResizeMode(1, mode);
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-01 12:49:41 +02:00
|
|
|
bool WatchWindow::event(QEvent *ev)
|
|
|
|
|
{
|
|
|
|
|
if (m_grabbing && ev->type() == QEvent::MouseButtonPress) {
|
|
|
|
|
QMouseEvent *mev = static_cast<QMouseEvent *>(ev);
|
|
|
|
|
m_grabbing = false;
|
|
|
|
|
releaseMouse();
|
2010-11-05 19:38:40 +01:00
|
|
|
currentEngine()->watchPoint(mapToGlobal(mev->pos()));
|
2009-07-01 12:49:41 +02:00
|
|
|
}
|
|
|
|
|
return QTreeView::event(ev);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void WatchWindow::editItem(const QModelIndex &idx)
|
|
|
|
|
{
|
2009-07-13 17:35:17 +02:00
|
|
|
Q_UNUSED(idx) // FIXME
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-07-13 09:11:07 +02:00
|
|
|
void WatchWindow::setModel(QAbstractItemModel *model)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-07-13 09:11:07 +02:00
|
|
|
QTreeView::setModel(model);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
setRootIsDecorated(true);
|
2011-03-16 18:48:14 +01:00
|
|
|
if (header()) {
|
|
|
|
|
setAlwaysResizeColumnsToContents(
|
|
|
|
|
debuggerCore()->boolSetting(AlwaysAdjustLocalsColumnWidths));
|
|
|
|
|
header()->setDefaultAlignment(Qt::AlignLeft);
|
|
|
|
|
if (m_type != LocalsType)
|
|
|
|
|
header()->hide();
|
|
|
|
|
}
|
2009-03-25 13:05:12 +01:00
|
|
|
|
2010-11-05 19:38:40 +01:00
|
|
|
connect(model, SIGNAL(layoutChanged()), SLOT(resetHelper()));
|
|
|
|
|
connect(model, SIGNAL(enableUpdates(bool)), SLOT(setUpdatesEnabled(bool)));
|
2011-03-03 10:39:05 +01:00
|
|
|
// Potentially left in disabled state in case engine crashes when expanding.
|
|
|
|
|
setUpdatesEnabled(true);
|
2009-08-31 09:14:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::setUpdatesEnabled(bool enable)
|
|
|
|
|
{
|
|
|
|
|
//qDebug() << "ENABLING UPDATES: " << enable;
|
|
|
|
|
QTreeView::setUpdatesEnabled(enable);
|
2009-03-25 13:05:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::resetHelper()
|
|
|
|
|
{
|
2010-11-25 18:44:07 +01:00
|
|
|
bool old = updatesEnabled();
|
|
|
|
|
setUpdatesEnabled(false);
|
2009-03-25 13:05:12 +01:00
|
|
|
resetHelper(model()->index(0, 0));
|
2010-11-25 18:44:07 +01:00
|
|
|
setUpdatesEnabled(old);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-08 11:00:46 +01:00
|
|
|
void WatchWindow::resetHelper(const QModelIndex &idx)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
if (idx.data(LocalsExpandedRole).toBool()) {
|
2009-03-25 13:05:12 +01:00
|
|
|
//qDebug() << "EXPANDING " << model()->data(idx, INameRole);
|
2010-11-25 18:44:07 +01:00
|
|
|
if (!isExpanded(idx)) {
|
|
|
|
|
expand(idx);
|
|
|
|
|
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
|
|
|
|
QModelIndex idx1 = model()->index(i, 0, idx);
|
|
|
|
|
resetHelper(idx1);
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-03-25 13:05:12 +01:00
|
|
|
} else {
|
|
|
|
|
//qDebug() << "COLLAPSING " << model()->data(idx, INameRole);
|
2010-11-25 18:44:07 +01:00
|
|
|
if (isExpanded(idx))
|
|
|
|
|
collapse(idx);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-06-23 15:13:51 +02:00
|
|
|
void WatchWindow::watchExpression(const QString &exp)
|
|
|
|
|
{
|
2010-11-05 19:38:40 +01:00
|
|
|
currentEngine()->watchHandler()->watchExpression(exp);
|
2010-06-23 15:13:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WatchWindow::removeWatchExpression(const QString &exp)
|
|
|
|
|
{
|
2010-11-05 19:38:40 +01:00
|
|
|
currentEngine()->watchHandler()->removeWatchExpression(exp);
|
2010-06-23 15:13:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void WatchWindow::setModelData
|
|
|
|
|
(int role, const QVariant &value, const QModelIndex &index)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(model(), return);
|
|
|
|
|
model()->setData(index, value, role);
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-05 19:38:40 +01:00
|
|
|
void WatchWindow::setWatchpoint(quint64 address)
|
|
|
|
|
{
|
2011-03-01 19:16:24 +01:00
|
|
|
BreakpointParameters data(Watchpoint);
|
|
|
|
|
data.address = address;
|
|
|
|
|
BreakpointId id = breakHandler()->findWatchpoint(data);
|
|
|
|
|
if (id) {
|
|
|
|
|
qDebug() << "WATCHPOINT EXISTS";
|
|
|
|
|
// removeBreakpoint(index);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
breakHandler()->appendBreakpoint(data);
|
2010-11-05 19:38:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|