Commit 307470b2 authored by hjk's avatar hjk
Browse files

debugger: make striped background of debug views optional

parent eb63bebc
......@@ -32,16 +32,18 @@
#include "debuggeractions.h"
#include "ui_breakcondition.h"
#include <QAction>
#include <QDir>
#include <QFileInfo>
#include <QFileInfoList>
#include <QHeaderView>
#include <QKeyEvent>
#include <QMenu>
#include <QResizeEvent>
#include <QToolButton>
#include <QTreeView>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QFileInfoList>
#include <QtGui/QAction>
#include <QtGui/QHeaderView>
#include <QtGui/QKeyEvent>
#include <QtGui/QMenu>
#include <QtGui/QResizeEvent>
#include <QtGui/QToolButton>
#include <QtGui/QTreeView>
using Debugger::Internal::BreakWindow;
......@@ -49,14 +51,17 @@ using Debugger::Internal::BreakWindow;
BreakWindow::BreakWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
{
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Breakpoints"));
setWindowIcon(QIcon(":/gdbdebugger/images/debugger_breakpoints.png"));
setAlternatingRowColors(true);
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
setIconSize(QSize(10, 10));
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void BreakWindow::keyPressEvent(QKeyEvent *ev)
......@@ -68,16 +73,6 @@ void BreakWindow::keyPressEvent(QKeyEvent *ev)
void BreakWindow::resizeEvent(QResizeEvent *ev)
{
/*
QHeaderView *hv = header();
int totalSize = ev->size().width() - 180;
hv->resizeSection(0, 60);
hv->resizeSection(1, (totalSize * 30) / 100);
hv->resizeSection(2, (totalSize * 30) / 100);
hv->resizeSection(3, (totalSize * 30) / 100);
hv->resizeSection(4, 70);
hv->resizeSection(5, 50);
*/
QTreeView::resizeEvent(ev);
}
......@@ -85,8 +80,8 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
const QModelIndex index = indexAt(ev->pos());
const QModelIndex index0 = index.sibling(index.row(), 0);
const bool indexIsValid = index.isValid();
const QModelIndex index0 = index.sibling(index.row(), 0);
QAction *act0 = new QAction(tr("Delete breakpoint"), &menu);
act0->setEnabled(indexIsValid);
QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu);
......@@ -96,7 +91,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *act3 = new QAction(tr("Edit condition..."), &menu);
act3->setEnabled(indexIsValid);
QAction *act4 = new QAction(tr("Synchronize breakpoints"), &menu);
bool enabled = model()->data(index0, Qt::UserRole).toBool();
bool enabled = indexIsValid && model()->data(index0, Qt::UserRole).toBool();
QString str = enabled ? tr("Disable breakpoint") : tr("Enable breakpoint");
QAction *act5 = new QAction(str, &menu);
......
......@@ -53,6 +53,7 @@ signals:
private slots:
void rowActivated(const QModelIndex &index);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
protected:
void resizeEvent(QResizeEvent *ev);
......
......@@ -30,6 +30,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseAlternatingRowColors">
<property name="text">
<string>Use alternating row colors in debug views.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
......
......@@ -102,6 +102,7 @@ DebuggerSettings *DebuggerSettings::instance()
if (instance)
return instance;
const QString debugModeGroup = QLatin1String("DebugMode");
instance = new DebuggerSettings;
SavedAction *item = 0;
......@@ -122,20 +123,27 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Always adjust column widths to contents"));
item->setCheckable(true);
item = new SavedAction(instance);
item->setText(tr("Use alternating row colors"));
item->setSettingsKey(debugModeGroup, QLatin1String("UseAlternatingRowColours"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseAlternatingRowColors, item);
//
// Locals & Watchers
//
item = new SavedAction(instance);
instance->insertItem(WatchExpression, item);
item->setTextPattern(tr("Watch expression \"%1\""));
instance->insertItem(WatchExpression, item);
item = new SavedAction(instance);
instance->insertItem(RemoveWatchExpression, item);
item->setTextPattern(tr("Remove watch expression \"%1\""));
instance->insertItem(RemoveWatchExpression, item);
item = new SavedAction(instance);
instance->insertItem(WatchExpressionInWindow, item);
item->setTextPattern(tr("Watch expression \"%1\" in separate window"));
instance->insertItem(WatchExpressionInWindow, item);
item = new SavedAction(instance);
instance->insertItem(AssignValue, item);
......@@ -144,23 +152,23 @@ DebuggerSettings *DebuggerSettings::instance()
instance->insertItem(AssignType, item);
item = new SavedAction(instance);
instance->insertItem(ExpandItem, item);
item->setText(tr("Expand item"));
instance->insertItem(ExpandItem, item);
item = new SavedAction(instance);
instance->insertItem(CollapseItem, item);
item->setText(tr("Collapse item"));
instance->insertItem(CollapseItem, item);
//
// DebuggingHelper
const QString debugModeGroup = QLatin1String("DebugMode");
//
item = new SavedAction(instance);
instance->insertItem(UseDebuggingHelpers, item);
item->setDefaultValue(true);
item->setSettingsKey(debugModeGroup, QLatin1String("UseDebuggingHelper"));
item->setText(tr("Use debugging helper"));
item->setCheckable(true);
item->setDefaultValue(true);
instance->insertItem(UseDebuggingHelpers, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("CustomDebuggingHelperLocation"));
......@@ -234,8 +242,8 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Raw"));
item->setCheckable(true);
item->setSettingsKey(debugModeGroup, QLatin1String("FormatRaw"));
instance->insertItem(FormatRaw, item);
item->setData(FormatRaw);
instance->insertItem(FormatRaw, item);
instance->m_registerFormatGroup->addAction(item);
item = new SavedAction(instance);
......
......@@ -76,6 +76,7 @@ enum DebuggerActionCode
SettingsDialog,
AdjustColumnWidths,
AlwaysAdjustColumnWidths,
UseAlternatingRowColors,
AutoQuit,
LockView,
......
......@@ -1570,7 +1570,6 @@ void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
}
}
//////////////////////////////////////////////////////////////////////
//
// Testing
......
......@@ -279,6 +279,8 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
m_group.insert(theDebuggerAction(ListSourceFiles),
m_ui.checkBoxListSourceFiles);
m_group.insert(theDebuggerAction(UseAlternatingRowColors),
m_ui.checkBoxUseAlternatingRowColors);
m_group.insert(theDebuggerAction(SkipKnownFrames),
m_ui.checkBoxSkipKnownFrames);
m_group.insert(theDebuggerAction(UseToolTips),
......
......@@ -42,17 +42,14 @@ using namespace Debugger::Internal;
DisassemblerWindow::DisassemblerWindow()
: m_alwaysResizeColumnsToContents(true), m_alwaysReloadContents(false)
{
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Disassembler"));
setSortingEnabled(false);
setAlternatingRowColors(true);
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
header()->hide();
//setIconSize(QSize(10, 10));
//setWindowIcon(QIcon(":/gdbdebugger/images/debugger_breakpoints.png"));
//QHeaderView *hv = header();
//hv->setDefaultAlignment(Qt::AlignLeft);
//hv->setClickable(true);
//hv->setSortIndicatorShown(true);
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void DisassemblerWindow::resizeEvent(QResizeEvent *ev)
......
......@@ -51,12 +51,12 @@ public slots:
void setAlwaysResizeColumnsToContents(bool on);
void reloadContents();
void setAlwaysReloadContents(bool on);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
protected:
private:
void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
private:
bool m_alwaysResizeColumnsToContents;
bool m_alwaysReloadContents;
};
......
......@@ -28,7 +28,9 @@
**************************************************************************/
#include "moduleswindow.h"
#include "moduleshandler.h" // for model roles
#include "debuggeractions.h"
#include "debuggermanager.h"
#include <QtCore/QDebug>
......@@ -58,14 +60,17 @@ ModulesWindow::ModulesWindow(DebuggerManager *debuggerManager,
m_alwaysResizeColumnsToContents(false),
m_debuggerManager(debuggerManager)
{
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Modules"));
setSortingEnabled(true);
setAlternatingRowColors(true);
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
setIconSize(QSize(10, 10));
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(moduleActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void ModulesWindow::moduleActivated(const QModelIndex &index)
......
......@@ -57,6 +57,7 @@ public slots:
void setAlwaysResizeColumnsToContents(bool on);
void moduleActivated(const QModelIndex &);
void showSymbols(const QString &name);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
private:
void resizeEvent(QResizeEvent *ev);
......
......@@ -48,27 +48,20 @@ using namespace Debugger::Internal;
using namespace Debugger::Constants;
RegisterWindow::RegisterWindow()
: m_alwaysResizeColumnsToContents(true), m_alwaysReloadContents(false)
: m_alwaysResizeColumnsToContents(true), m_alwaysReloadContents(false)
{
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Registers"));
setSortingEnabled(true);
setAlternatingRowColors(true);
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
//header()->hide();
//setIconSize(QSize(10, 10));
//setWindowIcon(QIcon(":/gdbdebugger/images/debugger_breakpoints.png"));
//QHeaderView *hv = header();
//hv->setDefaultAlignment(Qt::AlignLeft);
//hv->setClickable(true);
//hv->setSortIndicatorShown(true);
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void RegisterWindow::resizeEvent(QResizeEvent *ev)
{
//QHeaderView *hv = header();
//int totalSize = ev->size().width() - 110;
//hv->resizeSection(0, totalSize / 4);
//hv->resizeSection(1, totalSize / 4);
QTreeView::resizeEvent(ev);
}
......
......@@ -51,12 +51,12 @@ public slots:
void setAlwaysResizeColumnsToContents(bool on);
void reloadContents();
void setAlwaysReloadContents(bool on);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
protected:
private:
void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
private:
bool m_alwaysResizeColumnsToContents;
bool m_alwaysReloadContents;
};
......
......@@ -165,6 +165,7 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)
: QTreeView(parent)
{
m_model = new SourceFilesModel(this);
QAction *act = theDebuggerAction(UseAlternatingRowColors);
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(m_model);
......@@ -172,13 +173,15 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)
setWindowTitle(tr("Source Files"));
setSortingEnabled(true);
setAlternatingRowColors(true);
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
setIconSize(QSize(10, 10));
//header()->setDefaultAlignment(Qt::AlignLeft);
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(sourceFileActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
......
......@@ -60,6 +60,7 @@ signals:
private slots:
void sourceFileActivated(const QModelIndex &index);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
private:
void contextMenuEvent(QContextMenuEvent *ev);
......
......@@ -51,9 +51,10 @@ using Debugger::Internal::StackWindow;
StackWindow::StackWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
{
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Stack"));
setAlternatingRowColors(true);
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
setIconSize(QSize(10, 10));
......@@ -61,6 +62,8 @@ StackWindow::StackWindow(QWidget *parent)
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void StackWindow::resizeEvent(QResizeEvent *event)
......
......@@ -57,6 +57,7 @@ public slots:
private slots:
void rowActivated(const QModelIndex &index);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
private:
void resizeEvent(QResizeEvent *ev);
......
......@@ -29,6 +29,7 @@
#include "threadswindow.h"
#include "debuggeractions.h"
#include "stackhandler.h"
#include <utils/qtcassert.h>
......@@ -47,16 +48,19 @@ using Debugger::Internal::ThreadsWindow;
ThreadsWindow::ThreadsWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(false)
{
setWindowTitle(tr("Thread"));
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setAlternatingRowColors(true);
setWindowTitle(tr("Thread"));
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
setIconSize(QSize(10, 10));
header()->setDefaultAlignment(Qt::AlignLeft);
connect(this, SIGNAL(activated(const QModelIndex &)),
this, SLOT(rowActivated(const QModelIndex &)));
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void ThreadsWindow::resizeEvent(QResizeEvent *event)
......
......@@ -51,6 +51,7 @@ public slots:
private slots:
void rowActivated(const QModelIndex &index);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
private:
void resizeEvent(QResizeEvent *ev);
......
......@@ -117,8 +117,9 @@ public:
WatchWindow::WatchWindow(Type type, QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(true), m_type(type)
{
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Locals and Watchers"));
setAlternatingRowColors(true);
setAlternatingRowColors(act->isChecked());
setIndentation(indentation() * 9/10);
setUniformRowHeights(true);
setItemDelegate(new WatchDelegate(this));
......@@ -130,6 +131,8 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
this, SLOT(expandNode(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)),
this, SLOT(collapseNode(QModelIndex)));
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void WatchWindow::expandNode(const QModelIndex &idx)
......
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