Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: debugger/QT/SkDebuggerGUI.cpp

Issue 1034733004: Debugger: remove dead feature (SkPicture offset display) & fix bug (unbalanced indents) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « debugger/QT/SkDebuggerGUI.h ('k') | debugger/QT/SkListWidget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDebuggerGUI.h" 8 #include "SkDebuggerGUI.h"
9 #include "PictureRenderer.h" 9 #include "PictureRenderer.h"
10 #include "SkPictureData.h" 10 #include "SkPictureData.h"
(...skipping 14 matching lines...) Expand all
25 #endif 25 #endif
26 26
27 27
28 SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : 28 SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
29 QMainWindow(parent) 29 QMainWindow(parent)
30 , fCentralSplitter(this) 30 , fCentralSplitter(this)
31 , fStatusBar(this) 31 , fStatusBar(this)
32 , fToolBar(this) 32 , fToolBar(this)
33 , fActionOpen(this) 33 , fActionOpen(this)
34 , fActionBreakpoint(this) 34 , fActionBreakpoint(this)
35 , fActionToggleIndexStyle(this)
36 , fActionProfile(this) 35 , fActionProfile(this)
37 , fActionCancel(this) 36 , fActionCancel(this)
38 , fActionClearBreakpoints(this) 37 , fActionClearBreakpoints(this)
39 , fActionClearDeletes(this) 38 , fActionClearDeletes(this)
40 , fActionClose(this) 39 , fActionClose(this)
41 , fActionCreateBreakpoint(this) 40 , fActionCreateBreakpoint(this)
42 , fActionDelete(this) 41 , fActionDelete(this)
43 , fActionDirectory(this) 42 , fActionDirectory(this)
44 , fActionGoToLine(this) 43 , fActionGoToLine(this)
45 , fActionInspector(this) 44 , fActionInspector(this)
(...skipping 26 matching lines...) Expand all
72 connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile())); 71 connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile()));
73 connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory() )); 72 connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory() ));
74 connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QList WidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); 73 connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QList WidgetItem*)), this, SLOT(loadFile(QListWidgetItem *)));
75 connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); 74 connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete()));
76 connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLO T(toggleBreakpoint())); 75 connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLO T(toggleBreakpoint()));
77 connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); 76 connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind()));
78 connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay())); 77 connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay()));
79 connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())) ; 78 connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())) ;
80 connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForwa rd())); 79 connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForwa rd()));
81 connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoint s())); 80 connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoint s()));
82 connect(&fActionToggleIndexStyle, SIGNAL(triggered()), this, SLOT(actionTogg leIndexStyle()));
83 connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector() )); 81 connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector() ));
84 connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings())) ; 82 connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings())) ;
85 connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QStrin g))); 83 connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QStrin g)));
86 connect(&fActionProfile, SIGNAL(triggered()), this, SLOT(actionProfile())); 84 connect(&fActionProfile, SIGNAL(triggered()), this, SLOT(actionProfile()));
87 connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel())); 85 connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel()));
88 connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClea rBreakpoints())); 86 connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClea rBreakpoints()));
89 connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDel etes())); 87 connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDel etes()));
90 connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); 88 connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose()));
91 #if SK_SUPPORT_GPU 89 #if SK_SUPPORT_GPU
92 connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLSe ttingsChanged())); 90 connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLSe ttingsChanged()));
(...skipping 26 matching lines...) Expand all
119 } 117 }
120 118
121 void SkDebuggerGUI::actionBreakpoints() { 119 void SkDebuggerGUI::actionBreakpoints() {
122 bool breakpointsActivated = fActionBreakpoint.isChecked(); 120 bool breakpointsActivated = fActionBreakpoint.isChecked();
123 for (int row = 0; row < fListWidget.count(); row++) { 121 for (int row = 0; row < fListWidget.count(); row++) {
124 QListWidgetItem *item = fListWidget.item(row); 122 QListWidgetItem *item = fListWidget.item(row);
125 item->setHidden(item->checkState() == Qt::Unchecked && breakpointsActiva ted); 123 item->setHidden(item->checkState() == Qt::Unchecked && breakpointsActiva ted);
126 } 124 }
127 } 125 }
128 126
129 void SkDebuggerGUI::actionToggleIndexStyle() {
130 bool indexStyleToggle = fActionToggleIndexStyle.isChecked();
131 SkListWidget* list = (SkListWidget*) fListWidget.itemDelegate();
132 list->setIndexStyle(indexStyleToggle ? SkListWidget::kOffset_IndexStyle
133 : SkListWidget::kIndex_IndexStyle);
134 fListWidget.update();
135 }
136
137 void SkDebuggerGUI::showDeletes() { 127 void SkDebuggerGUI::showDeletes() {
138 bool deletesActivated = fActionShowDeletes.isChecked(); 128 bool deletesActivated = fActionShowDeletes.isChecked();
139 for (int row = 0; row < fListWidget.count(); row++) { 129 for (int row = 0; row < fListWidget.count(); row++) {
140 QListWidgetItem *item = fListWidget.item(row); 130 QListWidgetItem *item = fListWidget.item(row);
141 item->setHidden(fDebugger.isCommandVisible(row) && deletesActivated); 131 item->setHidden(fDebugger.isCommandVisible(row) && deletesActivated);
142 } 132 }
143 } 133 }
144 // This is a simplification of PictureBenchmark's run with the addition of 134 // This is a simplification of PictureBenchmark's run with the addition of
145 // clearing of the times after the first pass (in resetTimes) 135 // clearing of the times after the first pass (in resetTimes)
146 void SkDebuggerGUI::run(const SkPicture* pict, 136 void SkDebuggerGUI::run(const SkPicture* pict,
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 fActionOpen.setText("Open"); 466 fActionOpen.setText("Open");
477 467
478 QIcon breakpoint; 468 QIcon breakpoint;
479 breakpoint.addFile(QString::fromUtf8(":/breakpoint.png"), 469 breakpoint.addFile(QString::fromUtf8(":/breakpoint.png"),
480 QSize(), QIcon::Normal, QIcon::Off); 470 QSize(), QIcon::Normal, QIcon::Off);
481 fActionBreakpoint.setShortcut(QKeySequence(tr("Ctrl+B"))); 471 fActionBreakpoint.setShortcut(QKeySequence(tr("Ctrl+B")));
482 fActionBreakpoint.setIcon(breakpoint); 472 fActionBreakpoint.setIcon(breakpoint);
483 fActionBreakpoint.setText("Breakpoints"); 473 fActionBreakpoint.setText("Breakpoints");
484 fActionBreakpoint.setCheckable(true); 474 fActionBreakpoint.setCheckable(true);
485 475
486 fActionToggleIndexStyle.setShortcut(QKeySequence(tr("Ctrl+T")));
487 fActionToggleIndexStyle.setText("Toggle Index Style");
488 fActionToggleIndexStyle.setCheckable(true);
489
490 QIcon cancel; 476 QIcon cancel;
491 cancel.addFile(QString::fromUtf8(":/reload.png"), QSize(), 477 cancel.addFile(QString::fromUtf8(":/reload.png"), QSize(),
492 QIcon::Normal, QIcon::Off); 478 QIcon::Normal, QIcon::Off);
493 fActionCancel.setIcon(cancel); 479 fActionCancel.setIcon(cancel);
494 fActionCancel.setText("Clear Filter"); 480 fActionCancel.setText("Clear Filter");
495 481
496 fActionClearBreakpoints.setShortcut(QKeySequence(tr("Alt+B"))); 482 fActionClearBreakpoints.setShortcut(QKeySequence(tr("Alt+B")));
497 fActionClearBreakpoints.setText("Clear Breakpoints"); 483 fActionClearBreakpoints.setText("Clear Breakpoints");
498 484
499 fActionClearDeletes.setShortcut(QKeySequence(tr("Alt+X"))); 485 fActionClearDeletes.setShortcut(QKeySequence(tr("Alt+X")));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 fMenuNavigate.addAction(&fActionRewind); 683 fMenuNavigate.addAction(&fActionRewind);
698 fMenuNavigate.addAction(&fActionStepBack); 684 fMenuNavigate.addAction(&fActionStepBack);
699 fMenuNavigate.addAction(&fActionStepForward); 685 fMenuNavigate.addAction(&fActionStepForward);
700 fMenuNavigate.addAction(&fActionPlay); 686 fMenuNavigate.addAction(&fActionPlay);
701 fMenuNavigate.addAction(&fActionPause); 687 fMenuNavigate.addAction(&fActionPause);
702 fMenuNavigate.addAction(&fActionGoToLine); 688 fMenuNavigate.addAction(&fActionGoToLine);
703 689
704 fMenuView.setTitle("View"); 690 fMenuView.setTitle("View");
705 fMenuView.addAction(&fActionBreakpoint); 691 fMenuView.addAction(&fActionBreakpoint);
706 fMenuView.addAction(&fActionShowDeletes); 692 fMenuView.addAction(&fActionShowDeletes);
707 fMenuView.addAction(&fActionToggleIndexStyle);
708 fMenuView.addAction(&fActionZoomIn); 693 fMenuView.addAction(&fActionZoomIn);
709 fMenuView.addAction(&fActionZoomOut); 694 fMenuView.addAction(&fActionZoomOut);
710 695
711 fMenuWindows.setTitle("Window"); 696 fMenuWindows.setTitle("Window");
712 fMenuWindows.addAction(&fActionInspector); 697 fMenuWindows.addAction(&fActionInspector);
713 fMenuWindows.addAction(&fActionSettings); 698 fMenuWindows.addAction(&fActionSettings);
714 fMenuWindows.addAction(&fActionDirectory); 699 fMenuWindows.addAction(&fActionDirectory);
715 700
716 fActionGoToLine.setText("Go to Line..."); 701 fActionGoToLine.setText("Go to Line...");
717 fActionGoToLine.setDisabled(true); 702 fActionGoToLine.setDisabled(true);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 fActionSave.setDisabled(false); 765 fActionSave.setDisabled(false);
781 fActionSaveAs.setDisabled(false); 766 fActionSaveAs.setDisabled(false);
782 fActionPause.setChecked(false); 767 fActionPause.setChecked(false);
783 fDrawCommandGeometryWidget.setDrawCommandIndex(-1); 768 fDrawCommandGeometryWidget.setDrawCommandIndex(-1);
784 769
785 fLoading = false; 770 fLoading = false;
786 actionPlay(); 771 actionPlay();
787 } 772 }
788 773
789 void SkDebuggerGUI::setupListWidget() { 774 void SkDebuggerGUI::setupListWidget() {
775
776 SkASSERT(!strcmp("Save",
777 SkDrawCommand::GetCommandString(SkDrawCommand::kSave_OpType )));
778 SkASSERT(!strcmp("SaveLayer",
779 SkDrawCommand::GetCommandString(SkDrawCommand::kSaveLayer_O pType)));
780 SkASSERT(!strcmp("Restore",
781 SkDrawCommand::GetCommandString(SkDrawCommand::kRestore_OpT ype)));
782 SkASSERT(!strcmp("BeginCommentGroup",
783 SkDrawCommand::GetCommandString(SkDrawCommand::kBeginCommen tGroup_OpType)));
784 SkASSERT(!strcmp("EndCommentGroup",
785 SkDrawCommand::GetCommandString(SkDrawCommand::kEndCommentG roup_OpType)));
786
787
790 fListWidget.clear(); 788 fListWidget.clear();
791 int counter = 0; 789 int counter = 0;
792 int indent = 0; 790 int indent = 0;
793 for (int i = 0; i < fDebugger.getSize(); i++) { 791 for (int i = 0; i < fDebugger.getSize(); i++) {
794 QListWidgetItem *item = new QListWidgetItem(); 792 QListWidgetItem *item = new QListWidgetItem();
795 SkDrawCommand* command = fDebugger.getDrawCommandAt(i); 793 SkDrawCommand* command = fDebugger.getDrawCommandAt(i);
796 SkString commandString = command->toString(); 794 SkString commandString = command->toString();
797 item->setData(Qt::DisplayRole, commandString.c_str()); 795 item->setData(Qt::DisplayRole, commandString.c_str());
798 item->setData(Qt::UserRole + 1, counter++); 796 item->setData(Qt::UserRole + 1, counter++);
799 797
800 if (0 == strcmp("Restore", commandString.c_str()) || 798 if (0 == strcmp("Restore", commandString.c_str()) ||
801 0 == strcmp("EndCommentGroup", commandString.c_str())) { 799 0 == strcmp("EndCommentGroup", commandString.c_str())) {
802 indent -= 10; 800 indent -= 10;
803 } 801 }
804 802
805 item->setData(Qt::UserRole + 3, indent); 803 item->setData(Qt::UserRole + 3, indent);
806 804
807 if (0 == strcmp("Save", commandString.c_str()) || 805 if (0 == strcmp("Save", commandString.c_str()) ||
808 0 == strcmp("Save Layer", commandString.c_str()) || 806 0 == strcmp("SaveLayer", commandString.c_str()) ||
809 0 == strcmp("BeginCommentGroup", commandString.c_str())) { 807 0 == strcmp("BeginCommentGroup", commandString.c_str())) {
810 indent += 10; 808 indent += 10;
811 } 809 }
812 810
813 item->setData(Qt::UserRole + 4, -1); 811 item->setData(Qt::UserRole + 4, -1);
814 item->setData(Qt::UserRole + 5, (int) command->offset());
815 812
816 fListWidget.addItem(item); 813 fListWidget.addItem(item);
817 } 814 }
818 } 815 }
819 816
820 void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes, 817 void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes,
821 double totTime, 818 double totTime,
822 int numRuns) { 819 int numRuns) {
823 SkString overview; 820 SkString overview;
824 fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns); 821 fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns);
(...skipping 29 matching lines...) Expand all
854 fCanvasWidget.drawTo(fPausedRow); 851 fCanvasWidget.drawTo(fPausedRow);
855 } else { 852 } else {
856 fCanvasWidget.drawTo(fListWidget.currentRow()); 853 fCanvasWidget.drawTo(fListWidget.currentRow());
857 } 854 }
858 } 855 }
859 856
860 void SkDebuggerGUI::updateHit(int newHit) { 857 void SkDebuggerGUI::updateHit(int newHit) {
861 fCommandHitBox.setText(QString::number(newHit)); 858 fCommandHitBox.setText(QString::number(newHit));
862 } 859 }
863 860
OLDNEW
« no previous file with comments | « debugger/QT/SkDebuggerGUI.h ('k') | debugger/QT/SkListWidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698