OLD | NEW |
---|---|
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 "SkGraphics.h" | 10 #include "SkGraphics.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 , fActionSaveAs(this) | 54 , fActionSaveAs(this) |
55 , fActionShowDeletes(this) | 55 , fActionShowDeletes(this) |
56 , fActionStepBack(this) | 56 , fActionStepBack(this) |
57 , fActionStepForward(this) | 57 , fActionStepForward(this) |
58 , fActionZoomIn(this) | 58 , fActionZoomIn(this) |
59 , fActionZoomOut(this) | 59 , fActionZoomOut(this) |
60 , fMapper(this) | 60 , fMapper(this) |
61 , fListWidget(&fCentralSplitter) | 61 , fListWidget(&fCentralSplitter) |
62 , fDirectoryWidget(&fCentralSplitter) | 62 , fDirectoryWidget(&fCentralSplitter) |
63 , fCanvasWidget(this, &fDebugger) | 63 , fCanvasWidget(this, &fDebugger) |
64 , fImageWidget(&fDebugger) | 64 , fDrawGeometryWidget(&fDebugger) |
65 , fMenuBar(this) | 65 , fMenuBar(this) |
66 , fMenuFile(this) | 66 , fMenuFile(this) |
67 , fMenuNavigate(this) | 67 , fMenuNavigate(this) |
68 , fMenuView(this) | 68 , fMenuView(this) |
69 , fBreakpointsActivated(false) | 69 , fBreakpointsActivated(false) |
70 , fIndexStyleToggle(false) | 70 , fIndexStyleToggle(false) |
71 , fDeletesActivated(false) | 71 , fDeletesActivated(false) |
72 , fPause(false) | 72 , fPause(false) |
73 , fLoading(false) | 73 , fLoading(false) |
74 { | 74 { |
(...skipping 25 matching lines...) Expand all Loading... | |
100 connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(action RasterSettingsChanged())); | 100 connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(action RasterSettingsChanged())); |
101 connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(action VisualizationsChanged())); | 101 connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(action VisualizationsChanged())); |
102 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act ionTextureFilter())); | 102 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act ionTextureFilter())); |
103 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)) ); | 103 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)) ); |
104 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea kpoint())); | 104 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea kpoint())); |
105 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())) ; | 105 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())) ; |
106 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in t))); | 106 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in t))); |
107 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))) ; | 107 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))) ; |
108 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action Scale(float))); | 108 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action Scale(float))); |
109 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), this, SLOT(updateComman d(int))); | 109 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), this, SLOT(updateComman d(int))); |
110 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fDrawGeometryWidget, S LOT(updateImage())); | |
111 | |
110 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); | 112 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); |
111 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); | 113 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); |
112 | 114 |
113 fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); | 115 fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); |
114 fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); | 116 fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); |
115 | 117 |
116 connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); | 118 connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); |
117 connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); | 119 connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); |
118 connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); | 120 connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); |
119 | 121 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 | 227 |
226 void SkDebuggerGUI::actionClearDeletes() { | 228 void SkDebuggerGUI::actionClearDeletes() { |
227 for (int row = 0; row < fListWidget.count(); row++) { | 229 for (int row = 0; row < fListWidget.count(); row++) { |
228 QListWidgetItem* item = fListWidget.item(row); | 230 QListWidgetItem* item = fListWidget.item(row); |
229 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png")); | 231 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png")); |
230 fDebugger.setCommandVisible(row, true); | 232 fDebugger.setCommandVisible(row, true); |
231 fSkipCommands[row] = false; | 233 fSkipCommands[row] = false; |
232 } | 234 } |
233 if (fPause) { | 235 if (fPause) { |
234 fCanvasWidget.drawTo(fPausedRow); | 236 fCanvasWidget.drawTo(fPausedRow); |
235 fImageWidget.draw(); | |
236 } else { | 237 } else { |
237 fCanvasWidget.drawTo(fListWidget.currentRow()); | 238 fCanvasWidget.drawTo(fListWidget.currentRow()); |
238 fImageWidget.draw(); | |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 void SkDebuggerGUI::actionClose() { | 242 void SkDebuggerGUI::actionClose() { |
243 this->close(); | 243 this->close(); |
244 } | 244 } |
245 | 245 |
246 void SkDebuggerGUI::actionDelete() { | 246 void SkDebuggerGUI::actionDelete() { |
247 | 247 |
248 for (int row = 0; row < fListWidget.count(); ++row) { | 248 for (int row = 0; row < fListWidget.count(); ++row) { |
(...skipping 11 matching lines...) Expand all Loading... | |
260 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png")); | 260 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png")); |
261 fDebugger.setCommandVisible(row, true); | 261 fDebugger.setCommandVisible(row, true); |
262 fSkipCommands[row] = false; | 262 fSkipCommands[row] = false; |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 int currentRow = fListWidget.currentRow(); | 266 int currentRow = fListWidget.currentRow(); |
267 | 267 |
268 if (fPause) { | 268 if (fPause) { |
269 fCanvasWidget.drawTo(fPausedRow); | 269 fCanvasWidget.drawTo(fPausedRow); |
270 fImageWidget.draw(); | |
271 } else { | 270 } else { |
272 fCanvasWidget.drawTo(currentRow); | 271 fCanvasWidget.drawTo(currentRow); |
273 fImageWidget.draw(); | |
274 } | 272 } |
275 } | 273 } |
276 | 274 |
277 #if SK_SUPPORT_GPU | 275 #if SK_SUPPORT_GPU |
278 void SkDebuggerGUI::actionGLSettingsChanged() { | 276 void SkDebuggerGUI::actionGLSettingsChanged() { |
279 bool isToggled = fSettingsWidget.isGLActive(); | 277 bool isToggled = fSettingsWidget.isGLActive(); |
280 if (isToggled) { | 278 if (isToggled) { |
281 fCanvasWidget.setGLSampleCount(fSettingsWidget.getGLSampleCount()); | 279 fCanvasWidget.setGLSampleCount(fSettingsWidget.getGLSampleCount()); |
282 } | 280 } |
283 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kGPU_WidgetType, !isToggle d); | 281 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kGPU_WidgetType, !isToggle d); |
284 } | 282 } |
285 #endif | 283 #endif |
286 | 284 |
287 void SkDebuggerGUI::actionInspector() { | 285 void SkDebuggerGUI::actionInspector() { |
288 bool newState = !fInspectorWidget.isHidden(); | 286 bool newState = !fInspectorWidget.isHidden(); |
289 | 287 |
290 fInspectorWidget.setHidden(newState); | 288 fInspectorWidget.setHidden(newState); |
291 fViewStateFrame.setHidden(newState); | 289 fViewStateFrame.setHidden(newState); |
292 fImageWidget.setHidden(newState); | 290 fDrawGeometryWidget.setHidden(newState); |
293 } | 291 } |
294 | 292 |
295 void SkDebuggerGUI::actionPlay() { | 293 void SkDebuggerGUI::actionPlay() { |
296 for (int row = fListWidget.currentRow() + 1; row < fListWidget.count(); | 294 for (int row = fListWidget.currentRow() + 1; row < fListWidget.count(); |
297 row++) { | 295 row++) { |
298 QListWidgetItem *item = fListWidget.item(row); | 296 QListWidgetItem *item = fListWidget.item(row); |
299 if (item->checkState() == Qt::Checked) { | 297 if (item->checkState() == Qt::Checked) { |
300 fListWidget.setCurrentItem(item); | 298 fListWidget.setCurrentItem(item); |
301 return; | 299 return; |
302 } | 300 } |
303 } | 301 } |
304 fListWidget.setCurrentRow(fListWidget.count() - 1); | 302 fListWidget.setCurrentRow(fListWidget.count() - 1); |
305 } | 303 } |
306 | 304 |
307 void SkDebuggerGUI::actionRasterSettingsChanged() { | 305 void SkDebuggerGUI::actionRasterSettingsChanged() { |
308 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kRaster_8888_WidgetType, ! fSettingsWidget.isRasterEnabled()); | 306 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kRaster_8888_WidgetType, ! fSettingsWidget.isRasterEnabled()); |
309 fDebugger.setOverdrawViz(fSettingsWidget.isOverdrawVizEnabled()); | 307 fDebugger.setOverdrawViz(fSettingsWidget.isOverdrawVizEnabled()); |
310 fCanvasWidget.update(); | 308 fCanvasWidget.update(); |
311 } | 309 } |
312 | 310 |
313 void SkDebuggerGUI::actionVisualizationsChanged() { | 311 void SkDebuggerGUI::actionVisualizationsChanged() { |
314 fDebugger.setMegaViz(fSettingsWidget.isMegaVizEnabled()); | 312 fDebugger.setMegaViz(fSettingsWidget.isMegaVizEnabled()); |
315 fDebugger.setPathOps(fSettingsWidget.isPathOpsEnabled()); | 313 fDebugger.setPathOps(fSettingsWidget.isPathOpsEnabled()); |
316 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled( )); | 314 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled( )); |
317 fCanvasWidget.drawTo(fListWidget.currentRow()); | 315 fCanvasWidget.drawTo(fListWidget.currentRow()); |
318 fImageWidget.draw(); | |
319 } | 316 } |
320 | 317 |
321 void SkDebuggerGUI::actionTextureFilter() { | 318 void SkDebuggerGUI::actionTextureFilter() { |
322 SkPaint::FilterLevel level; | 319 SkPaint::FilterLevel level; |
323 bool enabled = fSettingsWidget.getFilterOverride(&level); | 320 bool enabled = fSettingsWidget.getFilterOverride(&level); |
324 fDebugger.setTexFilterOverride(enabled, level); | 321 fDebugger.setTexFilterOverride(enabled, level); |
325 fCanvasWidget.update(); | 322 fCanvasWidget.update(); |
326 } | 323 } |
327 | 324 |
328 void SkDebuggerGUI::actionRewind() { | 325 void SkDebuggerGUI::actionRewind() { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 loadPicture(SkString(filename.toAscii().data())); | 407 loadPicture(SkString(filename.toAscii().data())); |
411 setupDirectoryWidget(pathInfo.path()); | 408 setupDirectoryWidget(pathInfo.path()); |
412 } | 409 } |
413 fDirectoryWidgetActive = true; | 410 fDirectoryWidgetActive = true; |
414 } | 411 } |
415 | 412 |
416 void SkDebuggerGUI::pauseDrawing(bool isPaused) { | 413 void SkDebuggerGUI::pauseDrawing(bool isPaused) { |
417 fPause = isPaused; | 414 fPause = isPaused; |
418 fPausedRow = fListWidget.currentRow(); | 415 fPausedRow = fListWidget.currentRow(); |
419 fCanvasWidget.drawTo(fPausedRow); | 416 fCanvasWidget.drawTo(fPausedRow); |
420 fImageWidget.draw(); | |
421 } | 417 } |
422 | 418 |
423 void SkDebuggerGUI::registerListClick(QListWidgetItem *item) { | 419 void SkDebuggerGUI::registerListClick(QListWidgetItem *item) { |
424 if(!fLoading) { | 420 if(!fLoading) { |
425 int currentRow = fListWidget.currentRow(); | 421 int currentRow = fListWidget.currentRow(); |
426 | 422 |
427 if (currentRow != -1) { | 423 if (currentRow != -1) { |
428 if (!fPause) { | 424 if (!fPause) { |
429 fCanvasWidget.drawTo(currentRow); | 425 fCanvasWidget.drawTo(currentRow); |
430 fImageWidget.draw(); | |
431 } | 426 } |
432 const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(curr entRow); | 427 const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(curr entRow); |
433 | 428 |
434 /* TODO(chudy): Add command type before parameters. Rename v | 429 /* TODO(chudy): Add command type before parameters. Rename v |
435 * to something more informative. */ | 430 * to something more informative. */ |
436 if (currInfo) { | 431 if (currInfo) { |
437 QString info; | 432 QString info; |
438 info.append("<b>Parameters: </b><br/>"); | 433 info.append("<b>Parameters: </b><br/>"); |
439 for (int i = 0; i < currInfo->count(); i++) { | 434 for (int i = 0; i < currInfo->count(); i++) { |
440 | 435 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
603 fListWidget.setObjectName(QString::fromUtf8("listWidget")); | 598 fListWidget.setObjectName(QString::fromUtf8("listWidget")); |
604 fListWidget.setMinimumWidth(250); | 599 fListWidget.setMinimumWidth(250); |
605 | 600 |
606 fFilter.addItem("--Filter By Available Commands--"); | 601 fFilter.addItem("--Filter By Available Commands--"); |
607 | 602 |
608 fDirectoryWidget.setMinimumWidth(250); | 603 fDirectoryWidget.setMinimumWidth(250); |
609 fDirectoryWidget.setStyleSheet("QListWidget::Item {padding: 5px;}"); | 604 fDirectoryWidget.setStyleSheet("QListWidget::Item {padding: 5px;}"); |
610 | 605 |
611 fCanvasWidget.setSizePolicy(QSizePolicy::Expanding, | 606 fCanvasWidget.setSizePolicy(QSizePolicy::Expanding, |
612 QSizePolicy::Expanding); | 607 QSizePolicy::Expanding); |
613 | 608 |
robertphillips
2014/12/30 17:35:33
one line ?
Kimmo Kinnunen
2014/12/31 06:43:29
Done.
| |
614 fImageWidget.setFixedSize(SkImageWidget::kImageWidgetWidth, | 609 fDrawGeometryWidget.setSizePolicy(QSizePolicy::Expanding, |
615 SkImageWidget::kImageWidgetHeight); | 610 QSizePolicy::Expanding); |
616 | 611 |
617 fInspectorWidget.setSizePolicy(QSizePolicy::Expanding, | 612 fInspectorWidget.setSizePolicy(QSizePolicy::Expanding, |
618 QSizePolicy::Expanding); | 613 QSizePolicy::Expanding); |
619 fInspectorWidget.setMaximumHeight(300); | 614 fInspectorWidget.setMaximumHeight(300); |
620 | 615 |
621 fSettingsAndImageLayout.addWidget(&fSettingsWidget); | 616 fSettingsAndImageLayout.addWidget(&fSettingsWidget); |
622 | 617 |
623 // View state group, part of inspector. | 618 // View state group, part of inspector. |
624 fViewStateFrame.setFrameStyle(QFrame::Panel); | 619 fViewStateFrame.setFrameStyle(QFrame::Panel); |
625 fViewStateFrame.setLayout(&fViewStateFrameLayout); | 620 fViewStateFrame.setLayout(&fViewStateFrameLayout); |
(...skipping 13 matching lines...) Expand all Loading... | |
639 fCommandHitBox.setReadOnly(true); | 634 fCommandHitBox.setReadOnly(true); |
640 fViewStateLayout.addRow("Zoom Level", &fZoomBox); | 635 fViewStateLayout.addRow("Zoom Level", &fZoomBox); |
641 fZoomBox.setText("100%"); | 636 fZoomBox.setText("100%"); |
642 fZoomBox.setMinimumSize(QSize(50,25)); | 637 fZoomBox.setMinimumSize(QSize(50,25)); |
643 fZoomBox.setMaximumSize(QSize(50,25)); | 638 fZoomBox.setMaximumSize(QSize(50,25)); |
644 fZoomBox.setAlignment(Qt::AlignRight); | 639 fZoomBox.setAlignment(Qt::AlignRight); |
645 fZoomBox.setReadOnly(true); | 640 fZoomBox.setReadOnly(true); |
646 fViewStateGroup.setLayout(&fViewStateLayout); | 641 fViewStateGroup.setLayout(&fViewStateLayout); |
647 fSettingsAndImageLayout.addWidget(&fViewStateFrame); | 642 fSettingsAndImageLayout.addWidget(&fViewStateFrame); |
648 | 643 |
649 fSettingsAndImageLayout.addWidget(&fImageWidget); | 644 fDrawGeometryGroup.setTitle("Draw Geometry"); |
645 fDrawGeometryGroupLayout.addWidget(&fDrawGeometryWidget); | |
646 fDrawGeometryGroup.setLayout(&fDrawGeometryGroupLayout); | |
647 fSettingsAndImageLayout.addWidget(&fDrawGeometryGroup); | |
650 | 648 |
651 fLeftColumnSplitter.addWidget(&fListWidget); | 649 fLeftColumnSplitter.addWidget(&fListWidget); |
652 fLeftColumnSplitter.addWidget(&fDirectoryWidget); | 650 fLeftColumnSplitter.addWidget(&fDirectoryWidget); |
653 fLeftColumnSplitter.setOrientation(Qt::Vertical); | 651 fLeftColumnSplitter.setOrientation(Qt::Vertical); |
654 | 652 |
655 fCanvasSettingsAndImageLayout.setSpacing(6); | 653 fCanvasSettingsAndImageLayout.setSpacing(6); |
656 fCanvasSettingsAndImageLayout.addWidget(&fCanvasWidget, 1); | 654 fCanvasSettingsAndImageLayout.addWidget(&fCanvasWidget, 1); |
657 fCanvasSettingsAndImageLayout.addLayout(&fSettingsAndImageLayout, 0); | 655 fCanvasSettingsAndImageLayout.addLayout(&fSettingsAndImageLayout, 0); |
658 | 656 |
659 fMainAndRightColumnLayout.setSpacing(6); | 657 fMainAndRightColumnLayout.setSpacing(6); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 } | 876 } |
879 | 877 |
880 void SkDebuggerGUI::updateCommand(int newCommand) { | 878 void SkDebuggerGUI::updateCommand(int newCommand) { |
881 fCurrentCommandBox.setText(QString::number(newCommand)); | 879 fCurrentCommandBox.setText(QString::number(newCommand)); |
882 } | 880 } |
883 | 881 |
884 void SkDebuggerGUI::updateHit(int newHit) { | 882 void SkDebuggerGUI::updateHit(int newHit) { |
885 fCommandHitBox.setText(QString::number(newHit)); | 883 fCommandHitBox.setText(QString::number(newHit)); |
886 } | 884 } |
887 | 885 |
OLD | NEW |