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

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

Issue 835903002: debugger: Update inspector view data consistently while paused (Closed) Base URL: https://skia.googlesource.com/skia.git@debugger-small-things-02-debuggergui-redundant-variables
Patch Set: rename a function Created 5 years, 11 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
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 "SkForceLinking.h" 9 #include "SkForceLinking.h"
10 #include <QListWidgetItem> 10 #include <QListWidgetItem>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 , fCanvasWidget(this, &fDebugger) 59 , fCanvasWidget(this, &fDebugger)
60 , fDrawCommandGeometryWidget(&fDebugger) 60 , fDrawCommandGeometryWidget(&fDebugger)
61 , fMenuBar(this) 61 , fMenuBar(this)
62 , fMenuFile(this) 62 , fMenuFile(this)
63 , fMenuNavigate(this) 63 , fMenuNavigate(this)
64 , fMenuView(this) 64 , fMenuView(this)
65 , fLoading(false) 65 , fLoading(false)
66 { 66 {
67 setupUi(this); 67 setupUi(this);
68 fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection); 68 fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection);
69 connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidge tItem*)), this, SLOT(registerListClick(QListWidgetItem *))); 69 connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidge tItem*)), this,
70 SLOT(updateDrawCommandInfo()));
70 connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile())); 71 connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile()));
71 connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory() )); 72 connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory() ));
72 connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QList WidgetItem*)), this, SLOT(loadFile(QListWidgetItem *))); 73 connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QList WidgetItem*)), this, SLOT(loadFile(QListWidgetItem *)));
73 connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete())); 74 connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete()));
74 connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLO T(toggleBreakpoint())); 75 connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLO T(toggleBreakpoint()));
75 connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind())); 76 connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind()));
76 connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay())); 77 connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay()));
77 connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())) ; 78 connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack())) ;
78 connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForwa rd())); 79 connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForwa rd()));
79 connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoint s())); 80 connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoint s()));
(...skipping 11 matching lines...) Expand all
91 #endif 92 #endif
92 connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(action RasterSettingsChanged())); 93 connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(action RasterSettingsChanged()));
93 connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(action VisualizationsChanged())); 94 connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(action VisualizationsChanged()));
94 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act ionTextureFilter())); 95 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act ionTextureFilter()));
95 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)) ); 96 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)) );
96 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea kpoint())); 97 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea kpoint()));
97 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())) ; 98 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())) ;
98 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in t))); 99 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in t)));
99 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))) ; 100 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))) ;
100 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action Scale(float))); 101 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action Scale(float)));
101 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), this, SLOT(updateComman d(int)));
102 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fDrawCommandGeometryWi dget, SLOT(updateImage()));
103 102
104 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); 103 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs()));
105 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); 104 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave()));
106 105
107 fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); 106 fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand);
108 fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); 107 fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand);
109 108
110 connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); 109 connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map()));
111 connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); 110 connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map()));
112 connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); 111 connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int)));
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 fDirectoryWidgetActive = true; 396 fDirectoryWidgetActive = true;
398 } 397 }
399 398
400 void SkDebuggerGUI::pauseDrawing(bool isPaused) { 399 void SkDebuggerGUI::pauseDrawing(bool isPaused) {
401 fPausedRow = fListWidget.currentRow(); 400 fPausedRow = fListWidget.currentRow();
402 if (!fLoading) { 401 if (!fLoading) {
403 fCanvasWidget.drawTo(fPausedRow); 402 fCanvasWidget.drawTo(fPausedRow);
404 } 403 }
405 } 404 }
406 405
407 void SkDebuggerGUI::registerListClick(QListWidgetItem *item) { 406 void SkDebuggerGUI::updateDrawCommandInfo() {
408 if(!fLoading) { 407 int currentRow = -1;
409 int currentRow = fListWidget.currentRow(); 408 if (!fLoading) {
409 currentRow = fListWidget.currentRow();
410 }
411 if (currentRow == -1) {
412 fInspectorWidget.setText("", SkInspectorWidget::kDetail_TabType);
413 fInspectorWidget.setText("", SkInspectorWidget::kClipStack_TabType);
414 fCurrentCommandBox.setText("");
415 fDrawCommandGeometryWidget.setDrawCommandIndex(-1);
416 } else {
417 fInspectorWidget.setDisabled(false);
418 fViewStateFrame.setDisabled(false);
410 419
robertphillips 2015/01/05 19:14:09 Don't we no longer need this "currentRow != -1" te
Kimmo Kinnunen 2015/01/07 07:33:48 Done. (Sorry, that was a rebase error, too many pa
411 if (currentRow != -1) { 420 if (currentRow != -1) {
412 if (!this->isPaused()) { 421 if (!this->isPaused()) {
413 fCanvasWidget.drawTo(currentRow); 422 fCanvasWidget.drawTo(currentRow);
414 } 423 }
415 const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(curr entRow); 424 const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(curr entRow);
416 425
417 /* TODO(chudy): Add command type before parameters. Rename v 426 /* TODO(chudy): Add command type before parameters. Rename v
418 * to something more informative. */ 427 * to something more informative. */
419 if (currInfo) { 428 if (currInfo) {
420 QString info; 429 QString info;
421 info.append("<b>Parameters: </b><br/>"); 430 info.append("<b>Parameters: </b><br/>");
422 for (int i = 0; i < currInfo->count(); i++) { 431 for (int i = 0; i < currInfo->count(); i++) {
423 432
424 info.append(QString((*currInfo)[i]->c_str())); 433 info.append(QString((*currInfo)[i]->c_str()));
425 info.append("<br/>"); 434 info.append("<br/>");
426 } 435 }
427 fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabTyp e); 436 fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabTyp e);
428 fInspectorWidget.setDisabled(false); 437 fInspectorWidget.setDisabled(false);
429 fViewStateFrame.setDisabled(false); 438 fViewStateFrame.setDisabled(false);
430 } 439 }
431 setupClipStackText(); 440 } else {
441 fInspectorWidget.setText("", SkInspectorWidget::kDetail_TabType);
432 } 442 }
433 443
444 SkString clipStack;
445 fDebugger.getClipStackText(&clipStack);
446 fInspectorWidget.setText(clipStack.c_str(), SkInspectorWidget::kClipStac k_TabType);
447
448 fCurrentCommandBox.setText(QString::number(currentRow));
449
450 fDrawCommandGeometryWidget.setDrawCommandIndex(currentRow);
434 } 451 }
435 } 452 }
436 453
437 void SkDebuggerGUI::selectCommand(int command) { 454 void SkDebuggerGUI::selectCommand(int command) {
438 if (this->isPaused()) { 455 if (this->isPaused()) {
439 fListWidget.setCurrentRow(command); 456 fListWidget.setCurrentRow(command);
440 } 457 }
441 } 458 }
442 459
443 void SkDebuggerGUI::toggleBreakpoint() { 460 void SkDebuggerGUI::toggleBreakpoint() {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 this->setupOverviewText(NULL, 0.0, 1); 793 this->setupOverviewText(NULL, 0.0, 1);
777 fInspectorWidget.setDisabled(false); 794 fInspectorWidget.setDisabled(false);
778 fViewStateFrame.setDisabled(false); 795 fViewStateFrame.setDisabled(false);
779 fSettingsWidget.setDisabled(false); 796 fSettingsWidget.setDisabled(false);
780 fMenuEdit.setDisabled(false); 797 fMenuEdit.setDisabled(false);
781 fMenuNavigate.setDisabled(false); 798 fMenuNavigate.setDisabled(false);
782 fMenuView.setDisabled(false); 799 fMenuView.setDisabled(false);
783 fActionSave.setDisabled(false); 800 fActionSave.setDisabled(false);
784 fActionSaveAs.setDisabled(false); 801 fActionSaveAs.setDisabled(false);
785 fActionPause.setChecked(false); 802 fActionPause.setChecked(false);
803 fDrawCommandGeometryWidget.setDrawCommandIndex(-1);
804
786 fLoading = false; 805 fLoading = false;
787 actionPlay(); 806 actionPlay();
788 } 807 }
789 808
790 void SkDebuggerGUI::setupListWidget() { 809 void SkDebuggerGUI::setupListWidget() {
791 fListWidget.clear(); 810 fListWidget.clear();
792 int counter = 0; 811 int counter = 0;
793 int indent = 0; 812 int indent = 0;
794 for (int i = 0; i < fDebugger.getSize(); i++) { 813 for (int i = 0; i < fDebugger.getSize(); i++) {
795 QListWidgetItem *item = new QListWidgetItem(); 814 QListWidgetItem *item = new QListWidgetItem();
(...skipping 23 matching lines...) Expand all
819 } 838 }
820 839
821 void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes, 840 void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes,
822 double totTime, 841 double totTime,
823 int numRuns) { 842 int numRuns) {
824 SkString overview; 843 SkString overview;
825 fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns); 844 fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns);
826 fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabT ype); 845 fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabT ype);
827 } 846 }
828 847
829 void SkDebuggerGUI::setupClipStackText() {
830 SkString clipStack;
831 fDebugger.getClipStackText(&clipStack);
832 fInspectorWidget.setText(clipStack.c_str(), SkInspectorWidget::kClipStack_Ta bType);
833 }
834 848
835 void SkDebuggerGUI::setupComboBox() { 849 void SkDebuggerGUI::setupComboBox() {
836 fFilter.clear(); 850 fFilter.clear();
837 fFilter.addItem("--Filter By Available Commands--"); 851 fFilter.addItem("--Filter By Available Commands--");
838 852
839 std::map<std::string, int> map; 853 std::map<std::string, int> map;
840 for (int i = 0; i < fDebugger.getSize(); i++) { 854 for (int i = 0; i < fDebugger.getSize(); i++) {
841 map[fDebugger.getDrawCommandAt(i)->toString().c_str()]++; 855 map[fDebugger.getDrawCommandAt(i)->toString().c_str()]++;
842 } 856 }
843 857
844 for (std::map<std::string, int>::iterator it = map.begin(); it != map.end(); 858 for (std::map<std::string, int>::iterator it = map.begin(); it != map.end();
845 ++it) { 859 ++it) {
846 fFilter.addItem((it->first).c_str()); 860 fFilter.addItem((it->first).c_str());
847 } 861 }
848 862
849 // NOTE(chudy): Makes first item unselectable. 863 // NOTE(chudy): Makes first item unselectable.
850 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( 864 QStandardItemModel* model = qobject_cast<QStandardItemModel*>(
851 fFilter.model()); 865 fFilter.model());
852 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), 866 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(),
853 fFilter.rootModelIndex()); 867 fFilter.rootModelIndex());
854 QStandardItem* firstItem = model->itemFromIndex(firstIndex); 868 QStandardItem* firstItem = model->itemFromIndex(firstIndex);
855 firstItem->setSelectable(false); 869 firstItem->setSelectable(false);
856 } 870 }
857 871
858 void SkDebuggerGUI::updateCommand(int newCommand) {
859 fCurrentCommandBox.setText(QString::number(newCommand));
860 }
861
862 void SkDebuggerGUI::updateHit(int newHit) { 872 void SkDebuggerGUI::updateHit(int newHit) {
863 fCommandHitBox.setText(QString::number(newHit)); 873 fCommandHitBox.setText(QString::number(newHit));
864 } 874 }
865 875
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698