Commit ccd37a66 authored by hjk's avatar hjk
Browse files

debugger: make 'address column' in stack and breakpoint view optional

parent d9d39ab2
......@@ -257,9 +257,8 @@ bool BreakpointData::conditionsMatch() const
//////////////////////////////////////////////////////////////////
BreakHandler::BreakHandler(DebuggerManager *manager, QObject *parent)
: QAbstractItemModel(parent), m_manager(manager)
{
}
: QAbstractTableModel(parent), m_manager(manager)
{}
BreakHandler::~BreakHandler()
{
......@@ -268,7 +267,7 @@ BreakHandler::~BreakHandler()
int BreakHandler::columnCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : 6;
return parent.isValid() ? 0 : 7;
}
int BreakHandler::rowCount(const QModelIndex &parent) const
......@@ -436,7 +435,7 @@ QVariant BreakHandler::headerData(int section,
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
static QString headers[] = {
tr("Number"), tr("Function"), tr("File"), tr("Line"),
tr("Condition"), tr("Ignore")
tr("Condition"), tr("Ignore"), tr("Address")
};
return headers[section];
}
......@@ -505,10 +504,13 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
return data->pending ? data->ignoreCount : data->bpIgnoreCount;
if (role == Qt::ToolTipRole)
return tr("Breakpoint will only be hit after being ignored so many times.");
case 6:
if (role == Qt::DisplayRole)
return data->bpAddress;
break;
}
if (role == Qt::ToolTipRole)
return theDebuggerBoolSetting(UseToolTipsInLocalsView)
return theDebuggerBoolSetting(UseToolTipsInBreakpointsView)
? data->toToolTip() : QVariant();
return QVariant();
}
......@@ -519,7 +521,7 @@ Qt::ItemFlags BreakHandler::flags(const QModelIndex &mi) const
//case 0:
// return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
default:
return QAbstractItemModel::flags(mi);
return QAbstractTableModel::flags(mi);
}
}
......
......@@ -33,7 +33,7 @@
#include <utils/qtcassert.h>
#include <QtCore/QObject>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QAbstractTableModel>
namespace Debugger {
class DebuggerManager;
......@@ -109,7 +109,7 @@ public:
//
//////////////////////////////////////////////////////////////////
class BreakHandler : public QAbstractItemModel
class BreakHandler : public QAbstractTableModel
{
Q_OBJECT
......@@ -158,9 +158,6 @@ private:
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &, int role);
QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
QModelIndex index(int row, int column, const QModelIndex &) const
{ return createIndex(row, column); }
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
......
......@@ -93,6 +93,13 @@ BreakWindow::BreakWindow(QWidget *parent)
this, SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
connect(theDebuggerAction(UseAddressInBreakpointsView), SIGNAL(toggled(bool)),
this, SLOT(showAddressColumn(bool)));
}
void BreakWindow::showAddressColumn(bool on)
{
setColumnHidden(6, !on);
}
static QModelIndexList normalizeIndexes(const QModelIndexList &list)
......@@ -201,6 +208,8 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(breakAtFunctionAction);
menu.addAction(breakAtMainAction);
menu.addSeparator();
menu.addAction(theDebuggerAction(UseToolTipsInBreakpointsView));
menu.addAction(theDebuggerAction(UseAddressInBreakpointsView));
menu.addAction(adjustColumnAction);
menu.addAction(alwaysAdjustAction);
menu.addSeparator();
......@@ -300,10 +309,8 @@ void BreakWindow::editConditions(const QModelIndexList &list)
void BreakWindow::resizeColumnsToContents()
{
resizeColumnToContents(0);
resizeColumnToContents(1);
resizeColumnToContents(2);
resizeColumnToContents(3);
for (int i = model()->columnCount(); --i >= 0; )
resizeColumnToContents(i);
}
void BreakWindow::setAlwaysResizeColumnsToContents(bool on)
......@@ -311,10 +318,8 @@ void BreakWindow::setAlwaysResizeColumnsToContents(bool on)
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode);
header()->setResizeMode(1, mode);
header()->setResizeMode(2, mode);
header()->setResizeMode(3, mode);
for (int i = model()->columnCount(); --i >= 0; )
header()->setResizeMode(i, mode);
}
void BreakWindow::rowActivated(const QModelIndex &idx)
......
......@@ -56,6 +56,7 @@ signals:
private slots:
void rowActivated(const QModelIndex &index);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void showAddressColumn(bool on);
protected:
void resizeEvent(QResizeEvent *ev);
......
......@@ -52,26 +52,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolTipsInMainEditor">
<property name="toolTip">
<string>Checking this will enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
</property>
<property name="text">
<string>Use tooltips in locals view while debugging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolTipsInLocalsView">
<property name="toolTip">
<string>Checking this will enable tooltips for in the locals view during debugging.</string>
</property>
<property name="text">
<string>Use tooltips in main editor while debugging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxEnableReverseDebugging">
<property name="text">
......
......@@ -259,6 +259,10 @@ DebuggerSettings *DebuggerSettings::instance()
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTips"));
item->setText(tr("Use tooltips in main editor when debugging"));
item->setToolTip(tr("Checking this will enable tooltips for variable "
"values during debugging. Since this can slow down debugging and "
"does not provide reliable information as it does not use scope "
"information, it is switched off by default."));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseToolTipsInMainEditor, item);
......@@ -266,11 +270,41 @@ DebuggerSettings *DebuggerSettings::instance()
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTipsInLocalsView"));
item->setText(tr("Use tooltips in locals view when debugging"));
item->setToolTip(tr("Checking this will enable tooltips in the locals "
"view during debugging."));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseToolTipsInLocalsView, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTipsInBreakpointsView"));
item->setText(tr("Use tooltips in breakpoints view when debugging"));
item->setToolTip(tr("Checking this will enable tooltips in the breakpoints "
"view during debugging."));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseToolTipsInBreakpointsView, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseAddressInBreakpointsView"));
item->setText(tr("Show address data in breakpoints view when debugging"));
item->setToolTip(tr("Checking this will show a column with address "
"information in the breakpoint view during debugging."));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseAddressInBreakpointsView, item);
item = new SavedAction(instance);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseAddressInStackView"));
item->setText(tr("Show address data in stack view when debugging"));
item->setToolTip(tr("Checking this will show a column with address "
"information in the stack view during debugging."));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseAddressInStackView, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("ListSourceFiles"));
item->setText(tr("List source files"));
item->setCheckable(true);
......
......@@ -85,6 +85,13 @@ enum DebuggerActionCode
CustomDebuggingHelperLocation,
DebugDebuggingHelpers,
UseToolTipsInMainEditor,
UseToolTipsInLocalsView,
UseToolTipsInBreakpointsView,
UseToolTipsInStackView,
UseAddressInBreakpointsView,
UseAddressInStackView,
// Gdb
GdbLocation,
GdbEnvironment,
......@@ -100,8 +107,6 @@ enum DebuggerActionCode
WatchExpressionInWindow,
RemoveWatchExpression,
WatchPoint,
UseToolTipsInMainEditor,
UseToolTipsInLocalsView,
AssignValue,
AssignType,
......
......@@ -292,10 +292,11 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
m_ui.checkBoxUseMessageBoxForSignals);
m_group.insert(theDebuggerAction(SkipKnownFrames),
m_ui.checkBoxSkipKnownFrames);
m_group.insert(theDebuggerAction(UseToolTipsInMainEditor),
m_ui.checkBoxUseToolTipsInMainEditor);
m_group.insert(theDebuggerAction(UseToolTipsInLocalsView),
m_ui.checkBoxUseToolTipsInLocalsView);
m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), 0);
m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), 0);
m_group.insert(theDebuggerAction(UseToolTipsInBreakpointsView), 0);
m_group.insert(theDebuggerAction(UseAddressInBreakpointsView), 0);
m_group.insert(theDebuggerAction(UseAddressInStackView), 0);
m_group.insert(theDebuggerAction(EnableReverseDebugging),
m_ui.checkBoxEnableReverseDebugging);
m_group.insert(theDebuggerAction(MaximalStackDepth),
......
......@@ -32,7 +32,7 @@
#include "stackframe.h"
#include <QtCore/QAbstractTableModel>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QObject>
#include <QtGui/QIcon>
......@@ -72,7 +72,7 @@ private:
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QList<StackFrame> m_stackFrames;
......
......@@ -69,22 +69,13 @@ StackWindow::StackWindow(DebuggerManager *manager, QWidget *parent)
this, SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
connect(theDebuggerAction(UseAddressInStackView), SIGNAL(toggled(bool)),
this, SLOT(showAddressColumn(bool)));
}
void StackWindow::resizeEvent(QResizeEvent *event)
void StackWindow::showAddressColumn(bool on)
{
/*
QHeaderView *hv = header();
int totalSize = event->size().width() - 120;
if (totalSize > 10) {
hv->resizeSection(0, 45);
hv->resizeSection(1, totalSize / 2);
hv->resizeSection(2, totalSize / 2);
hv->resizeSection(3, 55);
}
*/
QTreeView::resizeEvent(event);
setColumnHidden(4, !on);
}
void StackWindow::rowActivated(const QModelIndex &index)
......@@ -124,6 +115,9 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator();
//menu.addAction(theDebuggerAction(UseTooltipsInStackView));
menu.addAction(theDebuggerAction(UseAddressInStackView));
QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents"));
QAction *actAlwaysAdjust =
......@@ -171,10 +165,8 @@ void StackWindow::copyContentsToClipboard()
void StackWindow::resizeColumnsToContents()
{
resizeColumnToContents(0);
resizeColumnToContents(1);
resizeColumnToContents(2);
resizeColumnToContents(3);
for (int i = model()->columnCount(); --i >= 0; )
resizeColumnToContents(i);
}
void StackWindow::setAlwaysResizeColumnsToContents(bool on)
......@@ -182,10 +174,8 @@ void StackWindow::setAlwaysResizeColumnsToContents(bool on)
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode =
on ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode);
header()->setResizeMode(1, mode);
header()->setResizeMode(2, mode);
header()->setResizeMode(3, mode);
for (int i = model()->columnCount(); --i >= 0; )
header()->setResizeMode(i, mode);
}
} // namespace Internal
......
......@@ -61,9 +61,9 @@ public slots:
private slots:
void rowActivated(const QModelIndex &index);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void showAddressColumn(bool on);
private:
void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
void copyContentsToClipboard();
......
......@@ -273,6 +273,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(theDebuggerAction(UseDebuggingHelpers));
menu.addSeparator();
menu.addAction(theDebuggerAction(UseToolTipsInLocalsView));
QAction *actAdjustColumnWidths =
menu.addAction(tr("Adjust column widths to contents"));
QAction *actAlwaysAdjustColumnWidth =
......
......@@ -41,7 +41,7 @@
#include "qmljsastvisitor_p.h"
QT_BEGIN_NAMESPACE
QT_QML_BEGIN_NAMESPACE
namespace QmlJS { namespace AST {
......@@ -55,4 +55,4 @@ Visitor::~Visitor()
} } // namespace QmlJS::AST
QT_END_NAMESPACE
QT_QML_END_NAMESPACE
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