From 30d35f23ae390043462e2aa5fc6863a4621aa74d Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Tue, 6 Nov 2012 16:45:36 +0000 Subject: Enhanced debugger with command indenting and Path Bound print out https://codereview.appspot.com/6820099/ git-svn-id: http://skia.googlecode.com/svn/trunk@6309 2bbb7eff-a529-9590-31e7-b0007b416f81 --- debugger/QT/SkDebuggerGUI.cpp | 13 +++++++++++++ debugger/QT/SkListWidget.cpp | 10 ++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'debugger/QT') diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index a03c87876d..df3489177c 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -607,10 +607,23 @@ void SkDebuggerGUI::loadPicture(QString fileName) { void SkDebuggerGUI::setupListWidget(SkTDArray* command) { fListWidget.clear(); int counter = 0; + int indent = 0; for (int i = 0; i < command->count(); i++) { QListWidgetItem *item = new QListWidgetItem(); item->setData(Qt::DisplayRole, (*command)[i]->c_str()); item->setData(Qt::UserRole + 1, counter++); + + if (0 == strcmp("Restore", (*command)[i]->c_str())) { + indent -= 10; + } + + item->setData(Qt::UserRole + 3, indent); + + if (0 == strcmp("Save", (*command)[i]->c_str()) || + 0 == strcmp("Save Layer", (*command)[i]->c_str())) { + indent += 10; + } + fListWidget.addItem(item); } } diff --git a/debugger/QT/SkListWidget.cpp b/debugger/QT/SkListWidget.cpp index 669f2258f5..2d8d2da9a4 100644 --- a/debugger/QT/SkListWidget.cpp +++ b/debugger/QT/SkListWidget.cpp @@ -61,6 +61,7 @@ void SkListWidget::paint (QPainter *painter, QIcon(qvariant_cast(index.data(Qt::DecorationRole))); QIcon deleteIcon = QIcon(qvariant_cast(index.data(Qt::UserRole + 2))); + int indent = index.data(Qt::UserRole + 3).toInt(); QString drawCommandText = index.data(Qt::DisplayRole).toString(); QString drawCommandNumber = index.data(Qt::UserRole + 1).toString(); @@ -74,7 +75,8 @@ void SkListWidget::paint (QPainter *painter, * spot act as a margin for the bottom and right sides. Positive values in * x1,y1 act as a margin for the top and left. The target area will not * affect size of text but will scale icons. */ - int imageSpace = 35; + static const int kImageSpace = 35; + static const int kCommandNumberSpace = 30; // Breakpoint Icon r = option.rect.adjusted(5, 10, -10, -10); @@ -85,12 +87,12 @@ void SkListWidget::paint (QPainter *painter, deleteIcon.paint(painter, r, Qt::AlignVCenter|Qt::AlignLeft); // Draw Command - r = option.rect.adjusted(imageSpace, 0, -10, -7); + r = option.rect.adjusted(kImageSpace+kCommandNumberSpace+indent, 0, -10, -7); painter->drawText(r.left(), r.top(), r.width(), r.height(), - Qt::AlignBottom|Qt::AlignRight, drawCommandText, &r); + Qt::AlignBottom|Qt::AlignLeft, drawCommandText, &r); // Draw Command Number - r = option.rect.adjusted(imageSpace, 0, -10, -7); + r = option.rect.adjusted(kImageSpace, 0, -10, -7); painter->drawText(r.left(), r.top(), r.width(), r.height(), Qt::AlignBottom|Qt::AlignLeft, drawCommandNumber, &r); } -- cgit v1.2.3