2012-06-29 14:21:22 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "SkDebuggerGUI.h"
|
2012-11-15 14:57:57 +00:00
|
|
|
#include "PictureRenderer.h"
|
2015-02-11 21:18:14 +00:00
|
|
|
#include "SkPictureData.h"
|
|
|
|
#include "SkPicturePlayback.h"
|
|
|
|
#include "SkPictureRecord.h"
|
2015-01-14 06:49:02 +00:00
|
|
|
#include <QListWidgetItem>
|
|
|
|
#include <QtGui>
|
2012-11-27 16:04:42 +00:00
|
|
|
|
|
|
|
#if defined(SK_BUILD_FOR_WIN32)
|
2014-06-20 18:29:20 +00:00
|
|
|
#include "SysTimer_windows.h"
|
2012-11-27 16:04:42 +00:00
|
|
|
#elif defined(SK_BUILD_FOR_MAC)
|
2014-06-20 18:29:20 +00:00
|
|
|
#include "SysTimer_mach.h"
|
2012-11-27 16:04:42 +00:00
|
|
|
#elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
|
2014-06-20 18:29:20 +00:00
|
|
|
#include "SysTimer_posix.h"
|
2012-11-27 16:04:42 +00:00
|
|
|
#else
|
2014-06-20 18:29:20 +00:00
|
|
|
#include "SysTimer_c.h"
|
2012-11-27 16:04:42 +00:00
|
|
|
#endif
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
|
2012-07-10 13:19:25 +00:00
|
|
|
QMainWindow(parent)
|
2013-11-21 13:41:37 +00:00
|
|
|
, fCentralSplitter(this)
|
2012-07-31 12:49:52 +00:00
|
|
|
, fStatusBar(this)
|
|
|
|
, fToolBar(this)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fActionOpen(this)
|
|
|
|
, fActionBreakpoint(this)
|
2014-03-25 23:31:33 +00:00
|
|
|
, fActionToggleIndexStyle(this)
|
2012-11-12 20:42:12 +00:00
|
|
|
, fActionProfile(this)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fActionCancel(this)
|
2012-07-17 15:40:51 +00:00
|
|
|
, fActionClearBreakpoints(this)
|
2012-07-16 18:35:23 +00:00
|
|
|
, fActionClearDeletes(this)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fActionClose(this)
|
2012-07-16 18:35:23 +00:00
|
|
|
, fActionCreateBreakpoint(this)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fActionDelete(this)
|
|
|
|
, fActionDirectory(this)
|
|
|
|
, fActionGoToLine(this)
|
|
|
|
, fActionInspector(this)
|
2013-07-01 14:24:12 +00:00
|
|
|
, fActionSettings(this)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fActionPlay(this)
|
2012-07-16 18:35:23 +00:00
|
|
|
, fActionPause(this)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fActionRewind(this)
|
2012-07-28 20:16:11 +00:00
|
|
|
, fActionSave(this)
|
|
|
|
, fActionSaveAs(this)
|
2012-07-17 15:40:51 +00:00
|
|
|
, fActionShowDeletes(this)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fActionStepBack(this)
|
|
|
|
, fActionStepForward(this)
|
2012-07-26 20:26:44 +00:00
|
|
|
, fActionZoomIn(this)
|
|
|
|
, fActionZoomOut(this)
|
|
|
|
, fMapper(this)
|
2013-11-21 13:41:37 +00:00
|
|
|
, fListWidget(&fCentralSplitter)
|
|
|
|
, fDirectoryWidget(&fCentralSplitter)
|
2012-08-07 16:12:23 +00:00
|
|
|
, fCanvasWidget(this, &fDebugger)
|
2014-12-31 07:03:56 +00:00
|
|
|
, fDrawCommandGeometryWidget(&fDebugger)
|
2012-07-10 13:19:25 +00:00
|
|
|
, fMenuBar(this)
|
|
|
|
, fMenuFile(this)
|
|
|
|
, fMenuNavigate(this)
|
|
|
|
, fMenuView(this)
|
2012-07-19 13:41:27 +00:00
|
|
|
, fLoading(false)
|
2012-07-10 13:19:25 +00:00
|
|
|
{
|
2012-06-29 14:21:22 +00:00
|
|
|
setupUi(this);
|
2013-01-22 19:38:46 +00:00
|
|
|
fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection);
|
2015-01-07 15:33:46 +00:00
|
|
|
connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this,
|
|
|
|
SLOT(updateDrawCommandInfo()));
|
2012-07-10 13:19:25 +00:00
|
|
|
connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile()));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory()));
|
|
|
|
connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *)));
|
2012-07-10 13:19:25 +00:00
|
|
|
connect(&fActionDelete, SIGNAL(triggered()), this, SLOT(actionDelete()));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleBreakpoint()));
|
2012-07-10 13:19:25 +00:00
|
|
|
connect(&fActionRewind, SIGNAL(triggered()), this, SLOT(actionRewind()));
|
|
|
|
connect(&fActionPlay, SIGNAL(triggered()), this, SLOT(actionPlay()));
|
|
|
|
connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack()));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForward()));
|
|
|
|
connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoints()));
|
2014-03-25 23:31:33 +00:00
|
|
|
connect(&fActionToggleIndexStyle, SIGNAL(triggered()), this, SLOT(actionToggleIndexStyle()));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector()));
|
2013-07-01 14:24:12 +00:00
|
|
|
connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings()));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString)));
|
2012-11-12 20:42:12 +00:00
|
|
|
connect(&fActionProfile, SIGNAL(triggered()), this, SLOT(actionProfile()));
|
2012-07-10 13:19:25 +00:00
|
|
|
connect(&fActionCancel, SIGNAL(triggered()), this, SLOT(actionCancel()));
|
2012-07-17 15:40:51 +00:00
|
|
|
connect(&fActionClearBreakpoints, SIGNAL(triggered()), this, SLOT(actionClearBreakpoints()));
|
|
|
|
connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes()));
|
2012-07-10 13:19:25 +00:00
|
|
|
connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose()));
|
2013-02-13 13:26:13 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLSettingsChanged()));
|
2013-02-13 13:26:13 +00:00
|
|
|
#endif
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(actionRasterSettingsChanged()));
|
|
|
|
connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(actionVisualizationsChanged()));
|
2013-10-17 17:56:10 +00:00
|
|
|
connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(actionTextureFilter()));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)));
|
2012-07-16 18:35:23 +00:00
|
|
|
connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint()));
|
2012-07-17 15:40:51 +00:00
|
|
|
connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes()));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(int)));
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int)));
|
2012-07-26 19:38:22 +00:00
|
|
|
connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(actionScale(float)));
|
2014-12-31 07:03:56 +00:00
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs()));
|
|
|
|
connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave()));
|
2012-07-17 15:40:51 +00:00
|
|
|
|
2013-01-17 16:30:56 +00:00
|
|
|
fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand);
|
|
|
|
fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand);
|
2012-07-26 20:26:44 +00:00
|
|
|
|
|
|
|
connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map()));
|
|
|
|
connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map()));
|
2013-01-17 16:30:56 +00:00
|
|
|
connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int)));
|
2012-07-26 20:26:44 +00:00
|
|
|
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
fViewStateFrame.setDisabled(true);
|
2012-07-17 15:40:51 +00:00
|
|
|
fInspectorWidget.setDisabled(true);
|
2012-07-19 13:41:27 +00:00
|
|
|
fMenuEdit.setDisabled(true);
|
|
|
|
fMenuNavigate.setDisabled(true);
|
|
|
|
fMenuView.setDisabled(true);
|
2012-08-13 14:26:36 +00:00
|
|
|
}
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
void SkDebuggerGUI::actionBreakpoints() {
|
2015-01-05 09:14:11 +00:00
|
|
|
bool breakpointsActivated = fActionBreakpoint.isChecked();
|
2012-07-17 15:40:51 +00:00
|
|
|
for (int row = 0; row < fListWidget.count(); row++) {
|
|
|
|
QListWidgetItem *item = fListWidget.item(row);
|
2015-01-05 09:14:11 +00:00
|
|
|
item->setHidden(item->checkState() == Qt::Unchecked && breakpointsActivated);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
2012-07-17 15:40:51 +00:00
|
|
|
}
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2014-03-25 23:31:33 +00:00
|
|
|
void SkDebuggerGUI::actionToggleIndexStyle() {
|
2015-01-05 09:14:11 +00:00
|
|
|
bool indexStyleToggle = fActionToggleIndexStyle.isChecked();
|
2014-03-25 23:31:33 +00:00
|
|
|
SkListWidget* list = (SkListWidget*) fListWidget.itemDelegate();
|
2015-01-05 09:14:11 +00:00
|
|
|
list->setIndexStyle(indexStyleToggle ? SkListWidget::kOffset_IndexStyle
|
|
|
|
: SkListWidget::kIndex_IndexStyle);
|
2014-03-25 23:31:33 +00:00
|
|
|
fListWidget.update();
|
|
|
|
}
|
|
|
|
|
2012-07-17 15:40:51 +00:00
|
|
|
void SkDebuggerGUI::showDeletes() {
|
2015-01-05 09:14:11 +00:00
|
|
|
bool deletesActivated = fActionShowDeletes.isChecked();
|
2012-07-10 13:19:25 +00:00
|
|
|
for (int row = 0; row < fListWidget.count(); row++) {
|
|
|
|
QListWidgetItem *item = fListWidget.item(row);
|
2015-01-05 09:14:11 +00:00
|
|
|
item->setHidden(fDebugger.isCommandVisible(row) && deletesActivated);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
2012-11-19 20:44:29 +00:00
|
|
|
// This is a simplification of PictureBenchmark's run with the addition of
|
|
|
|
// clearing of the times after the first pass (in resetTimes)
|
2014-07-07 20:46:35 +00:00
|
|
|
void SkDebuggerGUI::run(const SkPicture* pict,
|
2012-11-20 02:01:23 +00:00
|
|
|
sk_tools::PictureRenderer* renderer,
|
2012-11-19 20:44:29 +00:00
|
|
|
int repeats) {
|
|
|
|
SkASSERT(pict);
|
|
|
|
if (NULL == pict) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkASSERT(renderer != NULL);
|
|
|
|
if (NULL == renderer) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-09 11:59:19 +00:00
|
|
|
renderer->init(pict, NULL, NULL, NULL, false, false);
|
2012-11-19 20:44:29 +00:00
|
|
|
|
|
|
|
renderer->setup();
|
2014-03-19 17:26:07 +00:00
|
|
|
renderer->render();
|
2014-03-11 22:58:00 +00:00
|
|
|
renderer->resetState(true); // flush, swapBuffers and Finish
|
2012-11-19 20:44:29 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < repeats; ++i) {
|
|
|
|
renderer->setup();
|
2014-03-19 17:26:07 +00:00
|
|
|
renderer->render();
|
2014-03-11 22:58:00 +00:00
|
|
|
renderer->resetState(false); // flush & swapBuffers, but don't Finish
|
2012-11-19 20:44:29 +00:00
|
|
|
}
|
2014-03-11 22:58:00 +00:00
|
|
|
renderer->resetState(true); // flush, swapBuffers and Finish
|
2012-11-19 20:44:29 +00:00
|
|
|
|
|
|
|
renderer->end();
|
|
|
|
}
|
|
|
|
|
2012-11-12 20:42:12 +00:00
|
|
|
void SkDebuggerGUI::actionProfile() {
|
2012-11-15 14:57:57 +00:00
|
|
|
// In order to profile we pass the command offsets (that were read-in
|
|
|
|
// in loadPicture by the SkOffsetPicture) to an SkTimedPlaybackPicture.
|
2012-11-16 02:01:17 +00:00
|
|
|
// The SkTimedPlaybackPicture in turn passes the offsets to an
|
2012-11-15 14:57:57 +00:00
|
|
|
// SkTimedPicturePlayback object which uses them to track the performance
|
|
|
|
// of individual commands.
|
|
|
|
if (fFileName.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkFILEStream inputStream;
|
|
|
|
|
|
|
|
inputStream.setPath(fFileName.c_str());
|
|
|
|
if (!inputStream.isValid()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-07-07 20:46:35 +00:00
|
|
|
SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream,
|
|
|
|
&SkImageDecoder::DecodeMemory)); // , fSkipCommands));
|
2013-06-28 21:32:00 +00:00
|
|
|
if (NULL == picture.get()) {
|
2012-11-15 14:57:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-12 20:42:12 +00:00
|
|
|
}
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
void SkDebuggerGUI::actionCancel() {
|
2012-07-10 13:19:25 +00:00
|
|
|
for (int row = 0; row < fListWidget.count(); row++) {
|
|
|
|
fListWidget.item(row)->setHidden(false);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-17 15:40:51 +00:00
|
|
|
void SkDebuggerGUI::actionClearBreakpoints() {
|
|
|
|
for (int row = 0; row < fListWidget.count(); row++) {
|
|
|
|
QListWidgetItem* item = fListWidget.item(row);
|
|
|
|
item->setCheckState(Qt::Unchecked);
|
|
|
|
item->setData(Qt::DecorationRole,
|
2012-11-19 17:39:18 +00:00
|
|
|
QPixmap(":/blank.png"));
|
2012-07-17 15:40:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::actionClearDeletes() {
|
|
|
|
for (int row = 0; row < fListWidget.count(); row++) {
|
|
|
|
QListWidgetItem* item = fListWidget.item(row);
|
2012-11-19 17:39:18 +00:00
|
|
|
item->setData(Qt::UserRole + 2, QPixmap(":/blank.png"));
|
2012-08-07 16:12:23 +00:00
|
|
|
fDebugger.setCommandVisible(row, true);
|
2012-12-07 20:48:56 +00:00
|
|
|
fSkipCommands[row] = false;
|
2012-07-17 15:40:51 +00:00
|
|
|
}
|
2015-01-14 06:49:02 +00:00
|
|
|
this->updateImage();
|
2012-07-17 15:40:51 +00:00
|
|
|
}
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
void SkDebuggerGUI::actionClose() {
|
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::actionDelete() {
|
2012-07-17 15:40:51 +00:00
|
|
|
|
2013-01-22 19:38:46 +00:00
|
|
|
for (int row = 0; row < fListWidget.count(); ++row) {
|
|
|
|
QListWidgetItem* item = fListWidget.item(row);
|
|
|
|
|
|
|
|
if (!item->isSelected()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fDebugger.isCommandVisible(row)) {
|
|
|
|
item->setData(Qt::UserRole + 2, QPixmap(":/delete.png"));
|
|
|
|
fDebugger.setCommandVisible(row, false);
|
|
|
|
fSkipCommands[row] = true;
|
|
|
|
} else {
|
|
|
|
item->setData(Qt::UserRole + 2, QPixmap(":/blank.png"));
|
|
|
|
fDebugger.setCommandVisible(row, true);
|
|
|
|
fSkipCommands[row] = false;
|
|
|
|
}
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
2012-07-17 15:40:51 +00:00
|
|
|
|
2015-01-14 06:49:02 +00:00
|
|
|
this->updateImage();
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
|
2013-02-13 13:26:13 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
void SkDebuggerGUI::actionGLSettingsChanged() {
|
2013-08-02 13:59:50 +00:00
|
|
|
bool isToggled = fSettingsWidget.isGLActive();
|
|
|
|
if (isToggled) {
|
|
|
|
fCanvasWidget.setGLSampleCount(fSettingsWidget.getGLSampleCount());
|
|
|
|
}
|
2012-07-26 19:38:22 +00:00
|
|
|
fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kGPU_WidgetType, !isToggled);
|
|
|
|
}
|
2013-02-13 13:26:13 +00:00
|
|
|
#endif
|
2012-07-26 19:38:22 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
void SkDebuggerGUI::actionInspector() {
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
bool newState = !fInspectorWidget.isHidden();
|
|
|
|
|
|
|
|
fInspectorWidget.setHidden(newState);
|
|
|
|
fViewStateFrame.setHidden(newState);
|
2014-12-31 07:03:56 +00:00
|
|
|
fDrawCommandGeometryWidget.setHidden(newState);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::actionPlay() {
|
2012-07-10 13:19:25 +00:00
|
|
|
for (int row = fListWidget.currentRow() + 1; row < fListWidget.count();
|
2012-07-09 20:26:53 +00:00
|
|
|
row++) {
|
2012-07-10 13:19:25 +00:00
|
|
|
QListWidgetItem *item = fListWidget.item(row);
|
2012-06-29 14:21:22 +00:00
|
|
|
if (item->checkState() == Qt::Checked) {
|
2012-07-10 13:19:25 +00:00
|
|
|
fListWidget.setCurrentItem(item);
|
2012-06-29 14:21:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-07-10 13:19:25 +00:00
|
|
|
fListWidget.setCurrentRow(fListWidget.count() - 1);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
void SkDebuggerGUI::actionRasterSettingsChanged() {
|
|
|
|
fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kRaster_8888_WidgetType,
|
|
|
|
!fSettingsWidget.isRasterEnabled());
|
|
|
|
fDebugger.setOverdrawViz(fSettingsWidget.isOverdrawVizEnabled());
|
2015-01-14 06:49:02 +00:00
|
|
|
this->updateImage();
|
2014-03-03 16:32:17 +00:00
|
|
|
}
|
|
|
|
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
void SkDebuggerGUI::actionVisualizationsChanged() {
|
|
|
|
fDebugger.setMegaViz(fSettingsWidget.isMegaVizEnabled());
|
|
|
|
fDebugger.setPathOps(fSettingsWidget.isPathOpsEnabled());
|
|
|
|
fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled());
|
2015-01-14 06:49:02 +00:00
|
|
|
this->updateImage();
|
2014-05-19 13:53:10 +00:00
|
|
|
}
|
|
|
|
|
2013-10-17 17:56:10 +00:00
|
|
|
void SkDebuggerGUI::actionTextureFilter() {
|
|
|
|
SkPaint::FilterLevel level;
|
|
|
|
bool enabled = fSettingsWidget.getFilterOverride(&level);
|
|
|
|
fDebugger.setTexFilterOverride(enabled, level);
|
|
|
|
fCanvasWidget.update();
|
|
|
|
}
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
void SkDebuggerGUI::actionRewind() {
|
2012-07-16 18:35:23 +00:00
|
|
|
fListWidget.setCurrentRow(0);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
void SkDebuggerGUI::actionSave() {
|
2013-01-28 19:25:43 +00:00
|
|
|
fFileName = fPath.toAscii().data();
|
2012-11-12 20:42:12 +00:00
|
|
|
fFileName.append("/");
|
2013-01-28 19:25:43 +00:00
|
|
|
fFileName.append(fDirectoryWidget.currentItem()->text().toAscii().data());
|
2012-11-12 20:42:12 +00:00
|
|
|
saveToFile(fFileName);
|
2012-07-28 20:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::actionSaveAs() {
|
|
|
|
QString filename = QFileDialog::getSaveFileName(this, "Save File", "",
|
|
|
|
"Skia Picture (*skp)");
|
2012-07-28 23:26:10 +00:00
|
|
|
if (!filename.endsWith(".skp", Qt::CaseInsensitive)) {
|
2012-07-28 20:16:11 +00:00
|
|
|
filename.append(".skp");
|
|
|
|
}
|
2012-11-13 18:35:10 +00:00
|
|
|
saveToFile(SkString(filename.toAscii().data()));
|
2012-07-28 20:16:11 +00:00
|
|
|
}
|
|
|
|
|
2012-07-09 20:26:53 +00:00
|
|
|
void SkDebuggerGUI::actionScale(float scaleFactor) {
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
fZoomBox.setText(QString::number(scaleFactor * 100, 'f', 0).append("%"));
|
2012-07-09 20:26:53 +00:00
|
|
|
}
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
void SkDebuggerGUI::actionSettings() {
|
2012-07-10 13:19:25 +00:00
|
|
|
if (fSettingsWidget.isHidden()) {
|
|
|
|
fSettingsWidget.setHidden(false);
|
2012-06-29 14:21:22 +00:00
|
|
|
} else {
|
2012-07-10 13:19:25 +00:00
|
|
|
fSettingsWidget.setHidden(true);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::actionStepBack() {
|
2012-07-10 13:19:25 +00:00
|
|
|
int currentRow = fListWidget.currentRow();
|
2012-06-29 14:21:22 +00:00
|
|
|
if (currentRow != 0) {
|
2012-07-10 13:19:25 +00:00
|
|
|
fListWidget.setCurrentRow(currentRow - 1);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::actionStepForward() {
|
2012-07-10 13:19:25 +00:00
|
|
|
int currentRow = fListWidget.currentRow();
|
2012-06-29 14:21:22 +00:00
|
|
|
QString curRow = QString::number(currentRow);
|
2012-07-10 13:19:25 +00:00
|
|
|
QString curCount = QString::number(fListWidget.count());
|
|
|
|
if (currentRow < fListWidget.count() - 1) {
|
|
|
|
fListWidget.setCurrentRow(currentRow + 1);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-03 17:32:05 +00:00
|
|
|
void SkDebuggerGUI::drawComplete() {
|
2015-01-14 06:49:02 +00:00
|
|
|
SkString clipStack;
|
|
|
|
fDebugger.getClipStackText(&clipStack);
|
|
|
|
fInspectorWidget.setText(clipStack.c_str(), SkInspectorWidget::kClipStack_TabType);
|
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
fInspectorWidget.setMatrix(fDebugger.getCurrentMatrix());
|
|
|
|
fInspectorWidget.setClip(fDebugger.getCurrentClip());
|
2012-08-03 17:32:05 +00:00
|
|
|
}
|
|
|
|
|
2012-11-12 20:42:12 +00:00
|
|
|
void SkDebuggerGUI::saveToFile(const SkString& filename) {
|
|
|
|
SkFILEWStream file(filename.c_str());
|
2013-01-22 18:03:56 +00:00
|
|
|
SkAutoTUnref<SkPicture> copy(fDebugger.copyPicture());
|
|
|
|
|
|
|
|
copy->serialize(&file);
|
2012-07-28 20:16:11 +00:00
|
|
|
}
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
void SkDebuggerGUI::loadFile(QListWidgetItem *item) {
|
|
|
|
if (fDirectoryWidgetActive) {
|
2013-01-28 19:25:43 +00:00
|
|
|
fFileName = fPath.toAscii().data();
|
2013-02-05 19:44:07 +00:00
|
|
|
// don't add a '/' to files in the local directory
|
|
|
|
if (fFileName.size() > 0) {
|
|
|
|
fFileName.append("/");
|
|
|
|
}
|
2013-01-28 19:25:43 +00:00
|
|
|
fFileName.append(item->text().toAscii().data());
|
2012-11-12 20:42:12 +00:00
|
|
|
loadPicture(fFileName);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::openFile() {
|
2012-11-12 20:42:12 +00:00
|
|
|
QString temp = QFileDialog::getOpenFileName(this, tr("Open File"), "",
|
2012-07-09 20:26:53 +00:00
|
|
|
tr("Files (*.*)"));
|
2013-01-28 17:43:26 +00:00
|
|
|
openFile(temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::openFile(const QString &filename) {
|
2012-06-29 14:21:22 +00:00
|
|
|
fDirectoryWidgetActive = false;
|
2013-01-28 17:43:26 +00:00
|
|
|
if (!filename.isEmpty()) {
|
|
|
|
QFileInfo pathInfo(filename);
|
|
|
|
loadPicture(SkString(filename.toAscii().data()));
|
|
|
|
setupDirectoryWidget(pathInfo.path());
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
fDirectoryWidgetActive = true;
|
|
|
|
}
|
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
void SkDebuggerGUI::pauseDrawing(bool isPaused) {
|
2012-08-07 16:12:23 +00:00
|
|
|
fPausedRow = fListWidget.currentRow();
|
2015-01-14 06:49:02 +00:00
|
|
|
this->updateDrawCommandInfo();
|
2012-07-09 20:26:53 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 15:33:46 +00:00
|
|
|
void SkDebuggerGUI::updateDrawCommandInfo() {
|
|
|
|
int currentRow = -1;
|
|
|
|
if (!fLoading) {
|
|
|
|
currentRow = fListWidget.currentRow();
|
|
|
|
}
|
|
|
|
if (currentRow == -1) {
|
|
|
|
fInspectorWidget.setText("", SkInspectorWidget::kDetail_TabType);
|
|
|
|
fInspectorWidget.setText("", SkInspectorWidget::kClipStack_TabType);
|
|
|
|
fCurrentCommandBox.setText("");
|
|
|
|
fDrawCommandGeometryWidget.setDrawCommandIndex(-1);
|
|
|
|
} else {
|
2015-01-14 06:49:02 +00:00
|
|
|
this->updateImage();
|
|
|
|
|
2015-01-07 15:33:46 +00:00
|
|
|
const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(currentRow);
|
|
|
|
|
|
|
|
/* TODO(chudy): Add command type before parameters. Rename v
|
|
|
|
* to something more informative. */
|
|
|
|
if (currInfo) {
|
|
|
|
QString info;
|
|
|
|
info.append("<b>Parameters: </b><br/>");
|
|
|
|
for (int i = 0; i < currInfo->count(); i++) {
|
|
|
|
info.append(QString((*currInfo)[i]->c_str()));
|
|
|
|
info.append("<br/>");
|
2012-07-19 13:41:27 +00:00
|
|
|
}
|
2015-01-07 15:33:46 +00:00
|
|
|
fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabType);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
2012-07-26 19:38:22 +00:00
|
|
|
|
2015-01-07 15:33:46 +00:00
|
|
|
fCurrentCommandBox.setText(QString::number(currentRow));
|
|
|
|
|
|
|
|
fDrawCommandGeometryWidget.setDrawCommandIndex(currentRow);
|
|
|
|
|
|
|
|
fInspectorWidget.setDisabled(false);
|
|
|
|
fViewStateFrame.setDisabled(false);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-12 21:58:14 +00:00
|
|
|
void SkDebuggerGUI::selectCommand(int command) {
|
2015-01-05 09:14:11 +00:00
|
|
|
if (this->isPaused()) {
|
2012-07-12 21:58:14 +00:00
|
|
|
fListWidget.setCurrentRow(command);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
void SkDebuggerGUI::toggleBreakpoint() {
|
2012-07-10 13:19:25 +00:00
|
|
|
QListWidgetItem* item = fListWidget.currentItem();
|
2012-06-29 14:21:22 +00:00
|
|
|
if (item->checkState() == Qt::Unchecked) {
|
|
|
|
item->setCheckState(Qt::Checked);
|
2012-07-12 14:15:54 +00:00
|
|
|
item->setData(Qt::DecorationRole,
|
2012-11-19 17:39:18 +00:00
|
|
|
QPixmap(":/breakpoint_16x16.png"));
|
2012-06-29 14:21:22 +00:00
|
|
|
} else {
|
|
|
|
item->setCheckState(Qt::Unchecked);
|
2012-07-12 14:15:54 +00:00
|
|
|
item->setData(Qt::DecorationRole,
|
2012-11-19 17:39:18 +00:00
|
|
|
QPixmap(":/blank.png"));
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::toggleDirectory() {
|
2012-08-07 16:12:23 +00:00
|
|
|
fDirectoryWidget.setHidden(!fDirectoryWidget.isHidden());
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::toggleFilter(QString string) {
|
2012-07-10 13:19:25 +00:00
|
|
|
for (int row = 0; row < fListWidget.count(); row++) {
|
|
|
|
QListWidgetItem *item = fListWidget.item(row);
|
2012-08-07 16:12:23 +00:00
|
|
|
item->setHidden(item->text() != string);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkDebuggerGUI::setupUi(QMainWindow *SkDebuggerGUI) {
|
|
|
|
QIcon windowIcon;
|
2012-11-19 17:39:18 +00:00
|
|
|
windowIcon.addFile(QString::fromUtf8(":/skia.png"), QSize(),
|
2012-07-09 20:26:53 +00:00
|
|
|
QIcon::Normal, QIcon::Off);
|
2012-06-29 14:21:22 +00:00
|
|
|
SkDebuggerGUI->setObjectName(QString::fromUtf8("SkDebuggerGUI"));
|
|
|
|
SkDebuggerGUI->resize(1200, 1000);
|
|
|
|
SkDebuggerGUI->setWindowIcon(windowIcon);
|
2012-07-10 13:19:25 +00:00
|
|
|
SkDebuggerGUI->setWindowTitle("Skia Debugger");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionOpen.setShortcuts(QKeySequence::Open);
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionOpen.setText("Open");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QIcon breakpoint;
|
2012-11-19 17:39:18 +00:00
|
|
|
breakpoint.addFile(QString::fromUtf8(":/breakpoint.png"),
|
2012-07-09 20:26:53 +00:00
|
|
|
QSize(), QIcon::Normal, QIcon::Off);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionBreakpoint.setShortcut(QKeySequence(tr("Ctrl+B")));
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionBreakpoint.setIcon(breakpoint);
|
2012-07-17 15:40:51 +00:00
|
|
|
fActionBreakpoint.setText("Breakpoints");
|
2015-01-05 09:14:11 +00:00
|
|
|
fActionBreakpoint.setCheckable(true);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2014-03-25 23:31:33 +00:00
|
|
|
fActionToggleIndexStyle.setShortcut(QKeySequence(tr("Ctrl+T")));
|
|
|
|
fActionToggleIndexStyle.setText("Toggle Index Style");
|
2015-01-05 09:14:11 +00:00
|
|
|
fActionToggleIndexStyle.setCheckable(true);
|
2014-03-25 23:31:33 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QIcon cancel;
|
2012-11-19 17:39:18 +00:00
|
|
|
cancel.addFile(QString::fromUtf8(":/reload.png"), QSize(),
|
2012-07-09 20:26:53 +00:00
|
|
|
QIcon::Normal, QIcon::Off);
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionCancel.setIcon(cancel);
|
|
|
|
fActionCancel.setText("Clear Filter");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-17 15:40:51 +00:00
|
|
|
fActionClearBreakpoints.setShortcut(QKeySequence(tr("Alt+B")));
|
|
|
|
fActionClearBreakpoints.setText("Clear Breakpoints");
|
|
|
|
|
|
|
|
fActionClearDeletes.setShortcut(QKeySequence(tr("Alt+X")));
|
|
|
|
fActionClearDeletes.setText("Clear Deletes");
|
|
|
|
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionClose.setShortcuts(QKeySequence::Quit);
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionClose.setText("Exit");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionCreateBreakpoint.setShortcut(QKeySequence(tr("B")));
|
|
|
|
fActionCreateBreakpoint.setText("Set Breakpoint");
|
|
|
|
|
|
|
|
fActionDelete.setShortcut(QKeySequence(tr("X")));
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionDelete.setText("Delete Command");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionDirectory.setShortcut(QKeySequence(tr("Ctrl+D")));
|
|
|
|
fActionDirectory.setText("Directory");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-11-12 20:42:12 +00:00
|
|
|
QIcon profile;
|
2012-11-19 18:25:09 +00:00
|
|
|
profile.addFile(QString::fromUtf8(":/profile.png"), QSize(),
|
2012-11-12 20:42:12 +00:00
|
|
|
QIcon::Normal, QIcon::Off);
|
|
|
|
fActionProfile.setIcon(profile);
|
|
|
|
fActionProfile.setText("Profile");
|
2012-11-19 16:26:40 +00:00
|
|
|
fActionProfile.setDisabled(true);
|
2012-11-12 20:42:12 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
QIcon inspector;
|
2012-11-19 18:25:09 +00:00
|
|
|
inspector.addFile(QString::fromUtf8(":/inspector.png"),
|
2012-07-09 20:26:53 +00:00
|
|
|
QSize(), QIcon::Normal, QIcon::Off);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionInspector.setShortcut(QKeySequence(tr("Ctrl+I")));
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionInspector.setIcon(inspector);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionInspector.setText("Inspector");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2013-07-01 14:24:12 +00:00
|
|
|
QIcon settings;
|
|
|
|
settings.addFile(QString::fromUtf8(":/inspector.png"),
|
|
|
|
QSize(), QIcon::Normal, QIcon::Off);
|
|
|
|
fActionSettings.setShortcut(QKeySequence(tr("Ctrl+G")));
|
|
|
|
fActionSettings.setIcon(settings);
|
|
|
|
fActionSettings.setText("Settings");
|
2013-07-02 07:00:59 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QIcon play;
|
2012-11-19 18:25:09 +00:00
|
|
|
play.addFile(QString::fromUtf8(":/play.png"), QSize(),
|
2012-07-09 20:26:53 +00:00
|
|
|
QIcon::Normal, QIcon::Off);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionPlay.setShortcut(QKeySequence(tr("Ctrl+P")));
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionPlay.setIcon(play);
|
|
|
|
fActionPlay.setText("Play");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-16 18:35:23 +00:00
|
|
|
QIcon pause;
|
2012-11-19 18:25:09 +00:00
|
|
|
pause.addFile(QString::fromUtf8(":/pause.png"), QSize(),
|
2012-07-09 20:26:53 +00:00
|
|
|
QIcon::Normal, QIcon::Off);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionPause.setShortcut(QKeySequence(tr("Space")));
|
|
|
|
fActionPause.setCheckable(true);
|
|
|
|
fActionPause.setIcon(pause);
|
|
|
|
fActionPause.setText("Pause");
|
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QIcon rewind;
|
2012-11-19 17:39:18 +00:00
|
|
|
rewind.addFile(QString::fromUtf8(":/rewind.png"), QSize(),
|
2012-07-10 13:19:25 +00:00
|
|
|
QIcon::Normal, QIcon::Off);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionRewind.setShortcut(QKeySequence(tr("Ctrl+R")));
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionRewind.setIcon(rewind);
|
|
|
|
fActionRewind.setText("Rewind");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
fActionSave.setShortcut(QKeySequence::Save);
|
|
|
|
fActionSave.setText("Save");
|
|
|
|
fActionSave.setDisabled(true);
|
|
|
|
fActionSaveAs.setShortcut(QKeySequence::SaveAs);
|
|
|
|
fActionSaveAs.setText("Save As");
|
|
|
|
fActionSaveAs.setDisabled(true);
|
|
|
|
|
2012-07-17 15:40:51 +00:00
|
|
|
fActionShowDeletes.setShortcut(QKeySequence(tr("Ctrl+X")));
|
|
|
|
fActionShowDeletes.setText("Deleted Commands");
|
2015-01-05 09:14:11 +00:00
|
|
|
fActionShowDeletes.setCheckable(true);
|
2012-07-17 15:40:51 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QIcon stepBack;
|
2012-11-19 17:39:18 +00:00
|
|
|
stepBack.addFile(QString::fromUtf8(":/previous.png"), QSize(),
|
2012-07-09 20:26:53 +00:00
|
|
|
QIcon::Normal, QIcon::Off);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionStepBack.setShortcut(QKeySequence(tr("[")));
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionStepBack.setIcon(stepBack);
|
|
|
|
fActionStepBack.setText("Step Back");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
QIcon stepForward;
|
2012-11-19 17:39:18 +00:00
|
|
|
stepForward.addFile(QString::fromUtf8(":/next.png"),
|
2012-07-10 13:19:25 +00:00
|
|
|
QSize(), QIcon::Normal, QIcon::Off);
|
2012-07-16 18:35:23 +00:00
|
|
|
fActionStepForward.setShortcut(QKeySequence(tr("]")));
|
2012-07-10 13:19:25 +00:00
|
|
|
fActionStepForward.setIcon(stepForward);
|
|
|
|
fActionStepForward.setText("Step Forward");
|
|
|
|
|
2012-07-26 20:26:44 +00:00
|
|
|
fActionZoomIn.setShortcut(QKeySequence(tr("Ctrl+=")));
|
|
|
|
fActionZoomIn.setText("Zoom In");
|
|
|
|
fActionZoomOut.setShortcut(QKeySequence(tr("Ctrl+-")));
|
|
|
|
fActionZoomOut.setText("Zoom Out");
|
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fListWidget.setItemDelegate(new SkListWidget(&fListWidget));
|
|
|
|
fListWidget.setObjectName(QString::fromUtf8("listWidget"));
|
2013-11-21 13:41:37 +00:00
|
|
|
fListWidget.setMinimumWidth(250);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fFilter.addItem("--Filter By Available Commands--");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2013-11-21 13:41:37 +00:00
|
|
|
fDirectoryWidget.setMinimumWidth(250);
|
2012-07-10 13:19:25 +00:00
|
|
|
fDirectoryWidget.setStyleSheet("QListWidget::Item {padding: 5px;}");
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fCanvasWidget.setSizePolicy(QSizePolicy::Expanding,
|
2012-07-09 20:26:53 +00:00
|
|
|
QSizePolicy::Expanding);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2014-12-31 07:03:56 +00:00
|
|
|
fDrawCommandGeometryWidget.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
2012-11-21 17:11:02 +00:00
|
|
|
|
|
|
|
fSettingsAndImageLayout.addWidget(&fSettingsWidget);
|
|
|
|
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
// View state group, part of inspector.
|
|
|
|
fViewStateFrame.setFrameStyle(QFrame::Panel);
|
|
|
|
fViewStateFrame.setLayout(&fViewStateFrameLayout);
|
|
|
|
fViewStateFrameLayout.addWidget(&fViewStateGroup);
|
2014-12-31 07:03:56 +00:00
|
|
|
fViewStateGroup.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
fViewStateGroup.setTitle("View");
|
|
|
|
fViewStateLayout.addRow("Zoom Level", &fZoomBox);
|
|
|
|
fZoomBox.setText("100%");
|
|
|
|
fZoomBox.setMinimumSize(QSize(50,25));
|
|
|
|
fZoomBox.setMaximumSize(QSize(50,25));
|
|
|
|
fZoomBox.setAlignment(Qt::AlignRight);
|
|
|
|
fZoomBox.setReadOnly(true);
|
|
|
|
fViewStateLayout.addRow("Command HitBox", &fCommandHitBox);
|
|
|
|
fCommandHitBox.setText("0");
|
|
|
|
fCommandHitBox.setMinimumSize(QSize(50,25));
|
|
|
|
fCommandHitBox.setMaximumSize(QSize(50,25));
|
|
|
|
fCommandHitBox.setAlignment(Qt::AlignRight);
|
|
|
|
fCommandHitBox.setReadOnly(true);
|
|
|
|
fViewStateLayout.addRow("Current Command", &fCurrentCommandBox);
|
|
|
|
fCurrentCommandBox.setText("0");
|
|
|
|
fCurrentCommandBox.setMinimumSize(QSize(50,25));
|
|
|
|
fCurrentCommandBox.setMaximumSize(QSize(50,25));
|
|
|
|
fCurrentCommandBox.setAlignment(Qt::AlignRight);
|
|
|
|
fCurrentCommandBox.setReadOnly(true);
|
|
|
|
fViewStateGroup.setLayout(&fViewStateLayout);
|
|
|
|
fSettingsAndImageLayout.addWidget(&fViewStateFrame);
|
|
|
|
|
2014-12-31 07:03:56 +00:00
|
|
|
fDrawCommandGeometryWidget.setToolTip("Current Command Geometry");
|
|
|
|
fSettingsAndImageLayout.addWidget(&fDrawCommandGeometryWidget);
|
2012-07-10 13:19:25 +00:00
|
|
|
|
2013-11-21 13:41:37 +00:00
|
|
|
fLeftColumnSplitter.addWidget(&fListWidget);
|
|
|
|
fLeftColumnSplitter.addWidget(&fDirectoryWidget);
|
|
|
|
fLeftColumnSplitter.setOrientation(Qt::Vertical);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-11-21 17:11:02 +00:00
|
|
|
fCanvasSettingsAndImageLayout.setSpacing(6);
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
fCanvasSettingsAndImageLayout.addWidget(&fCanvasWidget, 1);
|
|
|
|
fCanvasSettingsAndImageLayout.addLayout(&fSettingsAndImageLayout, 0);
|
2012-11-21 17:11:02 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fMainAndRightColumnLayout.setSpacing(6);
|
2015-01-02 14:35:43 +00:00
|
|
|
fMainAndRightColumnLayout.addLayout(&fCanvasSettingsAndImageLayout, 1);
|
|
|
|
fMainAndRightColumnLayout.addWidget(&fInspectorWidget, 0);
|
2013-11-21 13:41:37 +00:00
|
|
|
fMainAndRightColumnWidget.setLayout(&fMainAndRightColumnLayout);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2013-11-21 13:41:37 +00:00
|
|
|
fCentralSplitter.addWidget(&fLeftColumnSplitter);
|
|
|
|
fCentralSplitter.addWidget(&fMainAndRightColumnWidget);
|
|
|
|
fCentralSplitter.setStretchFactor(0, 0);
|
|
|
|
fCentralSplitter.setStretchFactor(1, 1);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2013-11-21 13:41:37 +00:00
|
|
|
SkDebuggerGUI->setCentralWidget(&fCentralSplitter);
|
2012-07-10 13:19:25 +00:00
|
|
|
SkDebuggerGUI->setStatusBar(&fStatusBar);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-16 18:35:23 +00:00
|
|
|
fToolBar.setIconSize(QSize(32, 32));
|
2012-07-10 13:19:25 +00:00
|
|
|
fToolBar.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
|
|
|
SkDebuggerGUI->addToolBar(Qt::TopToolBarArea, &fToolBar);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-28 20:16:11 +00:00
|
|
|
fSpacer.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fToolBar.addAction(&fActionRewind);
|
|
|
|
fToolBar.addAction(&fActionStepBack);
|
2012-07-16 18:35:23 +00:00
|
|
|
fToolBar.addAction(&fActionPause);
|
2012-07-10 13:19:25 +00:00
|
|
|
fToolBar.addAction(&fActionStepForward);
|
|
|
|
fToolBar.addAction(&fActionPlay);
|
|
|
|
fToolBar.addSeparator();
|
2012-07-16 18:35:23 +00:00
|
|
|
fToolBar.addAction(&fActionInspector);
|
2013-07-01 14:24:12 +00:00
|
|
|
fToolBar.addAction(&fActionSettings);
|
2012-11-12 20:42:12 +00:00
|
|
|
fToolBar.addSeparator();
|
|
|
|
fToolBar.addAction(&fActionProfile);
|
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fToolBar.addSeparator();
|
2012-07-28 20:16:11 +00:00
|
|
|
fToolBar.addWidget(&fSpacer);
|
2012-07-10 13:19:25 +00:00
|
|
|
fToolBar.addWidget(&fFilter);
|
|
|
|
fToolBar.addAction(&fActionCancel);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
// TODO(chudy): Remove static call.
|
|
|
|
fDirectoryWidgetActive = false;
|
2012-11-12 20:42:12 +00:00
|
|
|
fFileName = "";
|
2013-01-28 17:43:26 +00:00
|
|
|
setupDirectoryWidget("");
|
2012-06-29 14:21:22 +00:00
|
|
|
fDirectoryWidgetActive = true;
|
|
|
|
|
|
|
|
// Menu Bar
|
2012-07-10 13:19:25 +00:00
|
|
|
fMenuFile.setTitle("File");
|
|
|
|
fMenuFile.addAction(&fActionOpen);
|
2012-07-28 20:16:11 +00:00
|
|
|
fMenuFile.addAction(&fActionSave);
|
|
|
|
fMenuFile.addAction(&fActionSaveAs);
|
2012-07-10 13:19:25 +00:00
|
|
|
fMenuFile.addAction(&fActionClose);
|
2012-07-16 18:35:23 +00:00
|
|
|
|
|
|
|
fMenuEdit.setTitle("Edit");
|
|
|
|
fMenuEdit.addAction(&fActionDelete);
|
2012-07-17 15:40:51 +00:00
|
|
|
fMenuEdit.addAction(&fActionClearDeletes);
|
|
|
|
fMenuEdit.addSeparator();
|
2012-07-16 18:35:23 +00:00
|
|
|
fMenuEdit.addAction(&fActionCreateBreakpoint);
|
2012-07-17 15:40:51 +00:00
|
|
|
fMenuEdit.addAction(&fActionClearBreakpoints);
|
2012-07-16 18:35:23 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fMenuNavigate.setTitle("Navigate");
|
2012-07-16 18:35:23 +00:00
|
|
|
fMenuNavigate.addAction(&fActionRewind);
|
|
|
|
fMenuNavigate.addAction(&fActionStepBack);
|
|
|
|
fMenuNavigate.addAction(&fActionStepForward);
|
|
|
|
fMenuNavigate.addAction(&fActionPlay);
|
|
|
|
fMenuNavigate.addAction(&fActionPause);
|
2012-07-10 13:19:25 +00:00
|
|
|
fMenuNavigate.addAction(&fActionGoToLine);
|
2012-07-16 18:35:23 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fMenuView.setTitle("View");
|
2012-07-16 18:35:23 +00:00
|
|
|
fMenuView.addAction(&fActionBreakpoint);
|
2012-07-17 15:40:51 +00:00
|
|
|
fMenuView.addAction(&fActionShowDeletes);
|
2014-03-25 23:31:33 +00:00
|
|
|
fMenuView.addAction(&fActionToggleIndexStyle);
|
2012-07-26 20:26:44 +00:00
|
|
|
fMenuView.addAction(&fActionZoomIn);
|
|
|
|
fMenuView.addAction(&fActionZoomOut);
|
2012-07-16 18:35:23 +00:00
|
|
|
|
|
|
|
fMenuWindows.setTitle("Window");
|
|
|
|
fMenuWindows.addAction(&fActionInspector);
|
2013-07-01 14:24:12 +00:00
|
|
|
fMenuWindows.addAction(&fActionSettings);
|
2012-07-16 18:35:23 +00:00
|
|
|
fMenuWindows.addAction(&fActionDirectory);
|
2012-07-10 13:19:25 +00:00
|
|
|
|
|
|
|
fActionGoToLine.setText("Go to Line...");
|
|
|
|
fActionGoToLine.setDisabled(true);
|
|
|
|
fMenuBar.addAction(fMenuFile.menuAction());
|
2012-07-16 18:35:23 +00:00
|
|
|
fMenuBar.addAction(fMenuEdit.menuAction());
|
2012-07-10 13:19:25 +00:00
|
|
|
fMenuBar.addAction(fMenuView.menuAction());
|
|
|
|
fMenuBar.addAction(fMenuNavigate.menuAction());
|
2012-07-16 18:35:23 +00:00
|
|
|
fMenuBar.addAction(fMenuWindows.menuAction());
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
SkDebuggerGUI->setMenuBar(&fMenuBar);
|
2012-06-29 14:21:22 +00:00
|
|
|
QMetaObject::connectSlotsByName(SkDebuggerGUI);
|
|
|
|
}
|
|
|
|
|
2013-01-28 17:43:26 +00:00
|
|
|
void SkDebuggerGUI::setupDirectoryWidget(const QString& path) {
|
|
|
|
fPath = path;
|
|
|
|
QDir dir(path);
|
2012-06-29 14:21:22 +00:00
|
|
|
QRegExp r(".skp");
|
2012-07-10 13:19:25 +00:00
|
|
|
fDirectoryWidget.clear();
|
|
|
|
const QStringList files = dir.entryList();
|
2012-06-29 14:21:22 +00:00
|
|
|
foreach (QString f, files) {
|
2012-07-09 20:26:53 +00:00
|
|
|
if (f.contains(r))
|
2012-07-10 13:19:25 +00:00
|
|
|
fDirectoryWidget.addItem(f);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-12 20:42:12 +00:00
|
|
|
void SkDebuggerGUI::loadPicture(const SkString& fileName) {
|
|
|
|
fFileName = fileName;
|
2012-07-19 13:41:27 +00:00
|
|
|
fLoading = true;
|
2015-01-21 20:09:53 +00:00
|
|
|
SkAutoTDelete<SkStream> stream(SkNEW_ARGS(SkFILEStream, (fileName.c_str())));
|
2013-02-07 20:39:40 +00:00
|
|
|
|
2013-06-28 21:32:00 +00:00
|
|
|
SkPicture* picture = SkPicture::CreateFromStream(stream);
|
2013-02-07 20:39:40 +00:00
|
|
|
|
2013-06-28 21:32:00 +00:00
|
|
|
if (NULL == picture) {
|
2013-02-07 20:39:40 +00:00
|
|
|
QMessageBox::critical(this, "Error loading file", "Couldn't read file, sorry.");
|
|
|
|
return;
|
|
|
|
}
|
2012-11-15 14:57:57 +00:00
|
|
|
|
2012-08-14 16:00:32 +00:00
|
|
|
fCanvasWidget.resetWidgetTransform();
|
2012-08-07 16:12:23 +00:00
|
|
|
fDebugger.loadPicture(picture);
|
2012-08-14 19:38:31 +00:00
|
|
|
|
2013-05-23 13:21:18 +00:00
|
|
|
fSkipCommands.setCount(fDebugger.getSize());
|
|
|
|
for (int i = 0; i < fSkipCommands.count(); ++i) {
|
2012-12-07 20:48:56 +00:00
|
|
|
fSkipCommands[i] = false;
|
|
|
|
}
|
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
SkSafeUnref(picture);
|
|
|
|
|
2013-05-23 13:21:18 +00:00
|
|
|
fActionProfile.setDisabled(false);
|
2012-11-15 14:57:57 +00:00
|
|
|
|
2012-07-09 20:26:53 +00:00
|
|
|
/* fDebugCanvas is reinitialized every load picture. Need it to retain value
|
2012-08-07 16:12:23 +00:00
|
|
|
* of the visibility filter.
|
|
|
|
* TODO(chudy): This should be deprecated since fDebugger is not
|
|
|
|
* recreated.
|
|
|
|
* */
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled());
|
2012-08-07 16:12:23 +00:00
|
|
|
|
2014-12-30 15:22:58 +00:00
|
|
|
this->setupListWidget();
|
|
|
|
this->setupComboBox();
|
2014-03-25 23:31:33 +00:00
|
|
|
this->setupOverviewText(NULL, 0.0, 1);
|
2012-07-17 15:40:51 +00:00
|
|
|
fInspectorWidget.setDisabled(false);
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
fViewStateFrame.setDisabled(false);
|
2012-07-12 14:31:25 +00:00
|
|
|
fSettingsWidget.setDisabled(false);
|
2012-07-19 13:41:27 +00:00
|
|
|
fMenuEdit.setDisabled(false);
|
|
|
|
fMenuNavigate.setDisabled(false);
|
|
|
|
fMenuView.setDisabled(false);
|
2012-07-28 20:16:11 +00:00
|
|
|
fActionSave.setDisabled(false);
|
|
|
|
fActionSaveAs.setDisabled(false);
|
2015-01-05 09:14:11 +00:00
|
|
|
fActionPause.setChecked(false);
|
2015-01-07 15:33:46 +00:00
|
|
|
fDrawCommandGeometryWidget.setDrawCommandIndex(-1);
|
|
|
|
|
2012-07-19 13:41:27 +00:00
|
|
|
fLoading = false;
|
|
|
|
actionPlay();
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
|
2014-12-30 15:22:58 +00:00
|
|
|
void SkDebuggerGUI::setupListWidget() {
|
2012-07-10 13:19:25 +00:00
|
|
|
fListWidget.clear();
|
2012-06-29 14:21:22 +00:00
|
|
|
int counter = 0;
|
2012-11-06 16:45:36 +00:00
|
|
|
int indent = 0;
|
2014-12-30 15:22:58 +00:00
|
|
|
for (int i = 0; i < fDebugger.getSize(); i++) {
|
2012-06-29 14:21:22 +00:00
|
|
|
QListWidgetItem *item = new QListWidgetItem();
|
2014-12-30 15:22:58 +00:00
|
|
|
SkDrawCommand* command = fDebugger.getDrawCommandAt(i);
|
|
|
|
SkString commandString = command->toString();
|
|
|
|
item->setData(Qt::DisplayRole, commandString.c_str());
|
2012-06-29 14:21:22 +00:00
|
|
|
item->setData(Qt::UserRole + 1, counter++);
|
2012-11-06 16:45:36 +00:00
|
|
|
|
2014-12-30 15:22:58 +00:00
|
|
|
if (0 == strcmp("Restore", commandString.c_str()) ||
|
|
|
|
0 == strcmp("EndCommentGroup", commandString.c_str())) {
|
2012-11-06 16:45:36 +00:00
|
|
|
indent -= 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
item->setData(Qt::UserRole + 3, indent);
|
|
|
|
|
2014-12-30 15:22:58 +00:00
|
|
|
if (0 == strcmp("Save", commandString.c_str()) ||
|
|
|
|
0 == strcmp("Save Layer", commandString.c_str()) ||
|
|
|
|
0 == strcmp("BeginCommentGroup", commandString.c_str())) {
|
2012-11-06 16:45:36 +00:00
|
|
|
indent += 10;
|
|
|
|
}
|
|
|
|
|
2014-03-25 23:31:33 +00:00
|
|
|
item->setData(Qt::UserRole + 4, -1);
|
2014-12-30 15:22:58 +00:00
|
|
|
item->setData(Qt::UserRole + 5, (int) command->offset());
|
2012-11-12 20:42:12 +00:00
|
|
|
|
2012-07-10 13:19:25 +00:00
|
|
|
fListWidget.addItem(item);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 07:01:04 +00:00
|
|
|
void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes,
|
2013-03-12 15:33:40 +00:00
|
|
|
double totTime,
|
|
|
|
int numRuns) {
|
2013-03-12 13:07:40 +00:00
|
|
|
SkString overview;
|
2013-03-12 15:33:40 +00:00
|
|
|
fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns);
|
2013-03-12 13:07:40 +00:00
|
|
|
fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabType);
|
2012-11-19 20:44:29 +00:00
|
|
|
}
|
|
|
|
|
2014-05-19 13:53:10 +00:00
|
|
|
|
2014-12-30 15:22:58 +00:00
|
|
|
void SkDebuggerGUI::setupComboBox() {
|
2012-11-19 20:44:29 +00:00
|
|
|
fFilter.clear();
|
|
|
|
fFilter.addItem("--Filter By Available Commands--");
|
|
|
|
|
|
|
|
std::map<std::string, int> map;
|
2014-12-30 15:22:58 +00:00
|
|
|
for (int i = 0; i < fDebugger.getSize(); i++) {
|
|
|
|
map[fDebugger.getDrawCommandAt(i)->toString().c_str()]++;
|
2012-11-19 20:44:29 +00:00
|
|
|
}
|
|
|
|
|
2012-11-20 02:01:23 +00:00
|
|
|
for (std::map<std::string, int>::iterator it = map.begin(); it != map.end();
|
2012-11-19 20:44:29 +00:00
|
|
|
++it) {
|
|
|
|
fFilter.addItem((it->first).c_str());
|
|
|
|
}
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
// NOTE(chudy): Makes first item unselectable.
|
2012-07-09 20:26:53 +00:00
|
|
|
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(
|
2012-07-10 13:19:25 +00:00
|
|
|
fFilter.model());
|
|
|
|
QModelIndex firstIndex = model->index(0, fFilter.modelColumn(),
|
|
|
|
fFilter.rootModelIndex());
|
2012-06-29 14:21:22 +00:00
|
|
|
QStandardItem* firstItem = model->itemFromIndex(firstIndex);
|
|
|
|
firstItem->setSelectable(false);
|
|
|
|
}
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
|
2015-01-14 06:49:02 +00:00
|
|
|
void SkDebuggerGUI::updateImage() {
|
|
|
|
if (this->isPaused()) {
|
|
|
|
fCanvasWidget.drawTo(fPausedRow);
|
|
|
|
} else {
|
|
|
|
fCanvasWidget.drawTo(fListWidget.currentRow());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
debugger: Make settings widget resizeable
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
2014-12-31 06:49:58 +00:00
|
|
|
void SkDebuggerGUI::updateHit(int newHit) {
|
|
|
|
fCommandHitBox.setText(QString::number(newHit));
|
|
|
|
}
|
|
|
|
|