Commit 8d04a3aa authored by hjk's avatar hjk

Debugger/Utils: Merge Debugger::TreeView into layer above and below

Change-Id: Ibb186cabba8fecedfdbd04da000459cf358e56e4
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 8694ad98
......@@ -53,11 +53,10 @@ public:
void mousePressEvent(QMouseEvent *ev);
public slots:
void resizeColumns();
void resizeColumnsFinish();
void reset();
protected slots:
void resizeColumns();
void resizeColumnsFinish();
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void setAlwaysAdjustColumns(bool on);
......
......@@ -36,36 +36,28 @@
#include <coreplugin/findplaceholder.h>
#include <coreplugin/find/treeviewfind.h>
#include <utils/savedaction.h>
#include <utils/basetreeview.h>
#include <QMenu>
#include <QVBoxLayout>
namespace Debugger {
namespace Internal {
BaseTreeView::BaseTreeView(QWidget *parent)
: Utils::BaseTreeView(parent)
BaseWindow::BaseWindow(QTreeView *treeView, QWidget *parent)
: QWidget(parent), m_treeView(treeView)
{
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setAlternatingRowColors(act->isChecked());
m_treeView->setAlternatingRowColors(act->isChecked());
connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool)));
act = debuggerCore()->action(AlwaysAdjustColumnWidths);
setAlwaysAdjustColumns(act->isChecked());
connect(act, SIGNAL(toggled(bool)),
SLOT(setAlwaysAdjustColumns(bool)));
}
void BaseTreeView::addBaseContextActions(QMenu *menu)
{
menu->addSeparator();
menu->addAction(debuggerCore()->action(SettingsDialog));
}
if (Utils::BaseTreeView *tv = qobject_cast<Utils::BaseTreeView *>(m_treeView)) {
act = debuggerCore()->action(AlwaysAdjustColumnWidths);
tv->setAlwaysAdjustColumns(act->isChecked());
connect(act, SIGNAL(toggled(bool)),
SLOT(setAlwaysAdjustColumns(bool)));
}
BaseWindow::BaseWindow(QTreeView *treeView, QWidget *parent)
: QWidget(parent), m_treeView(treeView)
{
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setMargin(0);
vbox->setSpacing(0);
......
......@@ -30,20 +30,11 @@
#ifndef DEBUGGER_BASEWINDOW_H
#define DEBUGGER_BASEWINDOW_H
#include <utils/basetreeview.h>
#include <QTreeView>
namespace Debugger {
namespace Internal {
class BaseTreeView : public Utils::BaseTreeView
{
Q_OBJECT
public:
explicit BaseTreeView(QWidget *parent = 0);
void addBaseContextActions(QMenu *menu);
};
class BaseWindow : public QWidget
{
Q_OBJECT
......
......@@ -832,7 +832,8 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
if (debuggerCore()->currentEngine()->hasCapability(MemoryAddressCapability))
menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
addBaseContextActions(&menu);
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
......
......@@ -32,11 +32,12 @@
#include "breakpoint.h"
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
class BreakTreeView : public BaseTreeView
class BreakTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......
......@@ -150,7 +150,8 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(actEditFile);
menu.addAction(actShowModuleSymbols);
menu.addAction(actShowModuleSections);
addBaseContextActions(&menu);
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
......
......@@ -31,11 +31,12 @@
#define DEBUGGER_MODULESWINDOW_H
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
class ModulesTreeView : public BaseTreeView
class ModulesTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......
......@@ -29,6 +29,7 @@
#include "registerwindow.h"
#include "memoryview.h"
#include "debuggeractions.h"
#include "debuggerdialogs.h"
#include "debuggercore.h"
#include "debuggerengine.h"
......@@ -36,6 +37,7 @@
#include "watchdelegatewidgets.h"
#include "memoryagent.h"
#include <utils/savedaction.h>
#include <utils/qtcassert.h>
#include <QDebug>
......@@ -43,7 +45,6 @@
#include <QItemDelegate>
#include <QMenu>
#include <QPainter>
#include <QResizeEvent>
namespace Debugger {
......@@ -225,7 +226,8 @@ void RegisterTreeView::contextMenuEvent(QContextMenuEvent *ev)
act2->setCheckable(true);
act2->setChecked(base == 2);
addBaseContextActions(&menu);
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
const QPoint position = ev->globalPos();
QAction *act = menu.exec(position);
......
......@@ -31,11 +31,12 @@
#define DEBUGGER_REGISTERWINDOW_H
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
class RegisterTreeView : public BaseTreeView
class RegisterTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......
......@@ -92,7 +92,8 @@ void SnapshotTreeView::contextMenuEvent(QContextMenuEvent *ev)
QAction *actRemove = menu.addAction(tr("Remove Snapshot"));
actRemove->setEnabled(idx.isValid());
addBaseContextActions(&menu);
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
......
......@@ -31,13 +31,14 @@
#define DEBUGGER_SNAPSHOTWINDOW_H
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
class SnapshotHandler;
class SnapshotTreeView : public BaseTreeView
class SnapshotTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......
......@@ -29,10 +29,12 @@
#include "sourcefileswindow.h"
#include "debuggeractions.h"
#include "debuggercore.h"
#include "debuggerengine.h"
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QDebug>
......@@ -87,7 +89,8 @@ void SourceFilesTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(act1);
menu.addAction(act2);
addBaseContextActions(&menu);
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
......
......@@ -31,11 +31,12 @@
#define SOURCEFILESWINDOW_H
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
class SourceFilesTreeView : public BaseTreeView
class SourceFilesTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......
......@@ -204,17 +204,13 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev)
if (engine->hasCapability(ShowModuleSymbolsCapability))
actLoadSymbols = menu.addAction(tr("Try to Load Unknown Symbols"));
#if 0 // @TODO: not implemented
menu.addAction(debuggerCore()->action(UseToolTipsInStackView));
#endif
if (engine->hasCapability(MemoryAddressCapability))
menu.addAction(debuggerCore()->action(UseAddressInStackView));
menu.addSeparator();
menu.addAction(debuggerCore()->action(UseToolTipsInStackView));
menu.addSeparator();
addBaseContextActions(&menu);
menu.addAction(debuggerCore()->action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
if (!act)
......
......@@ -31,11 +31,12 @@
#define DEBUGGER_STACKWINDOW_H
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
class StackTreeView : public BaseTreeView
class StackTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......
......@@ -53,21 +53,10 @@ void ThreadsTreeView::rowActivated(const QModelIndex &index)
debuggerCore()->currentEngine()->selectThread(id);
}
void ThreadsTreeView::setModel(QAbstractItemModel *model)
{
BaseTreeView::setModel(model);
// resizeColumnToContents(ThreadData::IdColumn);
// resizeColumnToContents(ThreadData::LineColumn);
// resizeColumnToContents(ThreadData::NameColumn);
// resizeColumnToContents(ThreadData::StateColumn);
// resizeColumnToContents(ThreadData::TargetIdColumn);
// resizeColumnToContents(ThreadData::DetailsColumn);
}
void ThreadsTreeView::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
addBaseContextActions(&menu);
menu.addAction(debuggerCore()->action(SettingsDialog));
menu.exec(ev->globalPos());
}
......
......@@ -31,11 +31,12 @@
#define THREADSWINDOW_H
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
class ThreadsTreeView : public BaseTreeView
class ThreadsTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......@@ -44,7 +45,6 @@ public:
private:
void rowActivated(const QModelIndex &index);
void setModel(QAbstractItemModel *model);
void contextMenuEvent(QContextMenuEvent *ev);
};
......
......@@ -912,7 +912,8 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(debuggerCore()->action(UseDynamicType));
menu.addAction(debuggerCore()->action(SettingsDialog));
addBaseContextActions(&menu);
menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
......
......@@ -31,6 +31,7 @@
#define DEBUGGER_WATCHWINDOW_H
#include "basewindow.h"
#include <utils/basetreeview.h>
namespace Debugger {
namespace Internal {
......@@ -43,7 +44,7 @@ namespace Internal {
enum WatchType { LocalsType, InspectType, WatchersType, ReturnType, TooltipType };
class WatchTreeView : public BaseTreeView
class WatchTreeView : public Utils::BaseTreeView
{
Q_OBJECT
......
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