aboutsummaryrefslogtreecommitdiffhomepage
path: root/debugger/QT/SkSettingsWidget.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2014-12-30 22:49:58 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-30 22:49:58 -0800
commit41c79cc0ff3003ef77cb48590f7887221856f941 (patch)
tree42e06d9966d3ede14803e0143d35b58400602459 /debugger/QT/SkSettingsWidget.cpp
parentc187a3c8849ba5e409f79ead21cd5bc82173d9f8 (diff)
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
Diffstat (limited to 'debugger/QT/SkSettingsWidget.cpp')
-rw-r--r--debugger/QT/SkSettingsWidget.cpp226
1 files changed, 43 insertions, 183 deletions
diff --git a/debugger/QT/SkSettingsWidget.cpp b/debugger/QT/SkSettingsWidget.cpp
index dc9dc6e45c..90e358b7c3 100644
--- a/debugger/QT/SkSettingsWidget.cpp
+++ b/debugger/QT/SkSettingsWidget.cpp
@@ -12,206 +12,66 @@
#include <math.h>
// TODO(chudy): See if the layout can't be attached to the frame post construction.
-SkSettingsWidget::SkSettingsWidget() : QWidget()
- , mainFrameLayout(this)
- , fVerticalLayout(&mainFrame)
- , fVisibleFrameLayout(&fVisibleFrame)
- , fCommandLayout(&fCommandFrame)
- , fCurrentCommandBox(&fCommandFrame)
- , fCommandHitBox(&fCommandFrame)
- , fCanvasLayout(&fCanvasFrame)
- , fZoomLayout(&fZoomFrame)
- , fZoomBox(&fZoomFrame)
+SkSettingsWidget::SkSettingsWidget() : QFrame()
{
- // Sets up the container and it's alignment around the settings widget.
- mainFrame.setFrameShape(QFrame::StyledPanel);
- mainFrame.setFrameShadow(QFrame::Raised);
- mainFrameLayout.setSpacing(6);
- mainFrameLayout.setContentsMargins(0,0,0,0);
- mainFrameLayout.addWidget(&mainFrame);
-
+ this->setLayout(&fVerticalLayout);
+ this->setFrameStyle(QFrame::Panel);
// Vertical Layout is the alignment inside of the main frame.
- fVerticalLayout.setContentsMargins(11,11,11,11);
fVerticalLayout.setAlignment(Qt::AlignTop);
- // Visible Toggle
- fVisibleText.setText("Visibility Filter");
- fVisibleFrame.setFrameShape(QFrame::StyledPanel);
- fVisibleFrame.setFrameShadow(QFrame::Raised);
-
- fVisibilityCombo.addItem("Off", QVariant(false));
- fVisibilityCombo.addItem("On", QVariant(true));
-
- fVisibleFrameLayout.setContentsMargins(11, 5, 11, 5);
- fVisibleFrameLayout.addWidget(&fVisibilityCombo);
- connect(&fVisibilityCombo, SIGNAL(activated(int)), this,
- SIGNAL(visibilityFilterChanged()));
-
- // Canvas
- fCanvasToggle.setText("Render Targets");
- fCanvasFrame.setFrameShape(QFrame::StyledPanel);
- fCanvasFrame.setFrameShadow(QFrame::Raised);
-
- fRasterLabel.setText("Raster: ");
- fRasterLabel.setMinimumWidth(178);
- fRasterLabel.setMaximumWidth(178);
-
- fPathOpsLabel.setText("PathOps: ");
- fPathOpsLabel.setMinimumWidth(178);
- fPathOpsLabel.setMaximumWidth(178);
-
- fRasterCheckBox.setChecked(true);
-
- fOverdrawVizLabel.setText(" Overdraw Viz: ");
- fOverdrawVizLabel.setMinimumWidth(178);
- fOverdrawVizLabel.setMaximumWidth(178);
-
- fMegaVizLabel.setText(" Mega Viz: ");
- fMegaVizLabel.setMinimumWidth(178);
- fMegaVizLabel.setMaximumWidth(178);
+ // Visualizations toggles.
+ fVisualizationsGroup.setTitle("Visualizations");
+ fVisibilityFilterCheckBox.setText("Visibility Filter");
+ fVisualizationsLayout.addWidget(&fVisibilityFilterCheckBox);
+ fMegaVizCheckBox.setText("Mega Viz");
+ fVisualizationsLayout.addWidget(&fMegaVizCheckBox);
+ fPathOpsCheckBox.setText("PathOps ");
+ fVisualizationsLayout.addWidget(&fPathOpsCheckBox);
+ fVisualizationsGroup.setLayout(&fVisualizationsLayout);
+ connect(&fVisibilityFilterCheckBox, SIGNAL(toggled(bool)), this,
+ SIGNAL(visualizationsChanged()));
+ connect(&fMegaVizCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(visualizationsChanged()));
+ connect(&fPathOpsCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(visualizationsChanged()));
+
+ fVerticalLayout.addRow(&fVisualizationsGroup);
+
+ // Raster toggles.
+ fRasterGroup.setTitle("Raster");
+ fRasterGroup.setCheckable(true);
+ fOverdrawVizCheckBox.setText("Overdraw Viz");
+ fRasterLayout.addWidget(&fOverdrawVizCheckBox);
+ fRasterGroup.setLayout(&fRasterLayout);
+ fVerticalLayout.addRow(&fRasterGroup);
+
+ connect(&fRasterGroup, SIGNAL(toggled(bool)), this, SIGNAL(rasterSettingsChanged()));
+ connect(&fOverdrawVizCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(rasterSettingsChanged()));
#if SK_SUPPORT_GPU
- fGLLabel.setText("OpenGL: ");
- fGLLabel.setMinimumWidth(178);
- fGLLabel.setMaximumWidth(178);
-
- fGLMSAAButtonGroup.setTitle("MSAA");
- fGLMSAAButtonGroup.setMinimumWidth(178);
- fGLMSAAButtonGroup.setMaximumWidth(178);
- fGLMSAAButtonGroup.setEnabled(fGLCheckBox.isChecked());
-
+ fGLGroup.setTitle("OpenGL");
+ fGLGroup.setCheckable(true);
+ fGLGroup.setChecked(false);
fGLMSAACombo.addItem("Off", QVariant(0));
fGLMSAACombo.addItem("4", QVariant(4));
fGLMSAACombo.addItem("16", QVariant(16));
+ fGLLayout.addRow("MSAA", &fGLMSAACombo);
+ fGLGroup.setLayout(&fGLLayout);
- fGLMSAALayout.addWidget(&fGLMSAACombo);
- fGLMSAAButtonGroup.setLayout(&fGLMSAALayout);
-
- connect(&fGLCheckBox, SIGNAL(toggled(bool)), &fGLMSAAButtonGroup,
- SLOT(setEnabled(bool)));
- connect(&fGLCheckBox, SIGNAL(toggled(bool)), this,
+ connect(&fGLGroup, SIGNAL(toggled(bool)), this,
SIGNAL(glSettingsChanged()));
connect(&fGLMSAACombo, SIGNAL(activated(int)), this,
SIGNAL(glSettingsChanged()));
-#endif
-
- {
- // set up filter buttons
- fFilterButtonGroup.setTitle("Filtering");
- fFilterButtonGroup.setMinimumWidth(178);
- fFilterButtonGroup.setMaximumWidth(178);
-
- fFilterCombo.addItem("As encoded", QVariant(SkPaint::kNone_FilterLevel));
- fFilterCombo.addItem("None", QVariant(SkPaint::kNone_FilterLevel));
- fFilterCombo.addItem("Low", QVariant(SkPaint::kLow_FilterLevel));
- fFilterCombo.addItem("Medium", QVariant(SkPaint::kMedium_FilterLevel));
- fFilterCombo.addItem("High", QVariant(SkPaint::kHigh_FilterLevel));
-
- fFilterLayout.addWidget(&fFilterCombo);
- fFilterButtonGroup.setLayout(&fFilterLayout);
-
- connect(&fFilterCombo, SIGNAL(activated(int)), this,
- SIGNAL(texFilterSettingsChanged()));
- }
-
- fRasterLayout.addWidget(&fRasterLabel);
- fRasterLayout.addWidget(&fRasterCheckBox);
- fRasterLayout.addWidget(&fPathOpsLabel);
- fRasterLayout.addWidget(&fPathOpsCheckBox);
- fVizLayout.addWidget(&fOverdrawVizLabel);
- fVizLayout.addWidget(&fOverdrawVizCheckBox);
- fVizLayout.addWidget(&fMegaVizLabel);
- fVizLayout.addWidget(&fMegaVizCheckBox);
-
-#if SK_SUPPORT_GPU
- fGLLayout.addWidget(&fGLLabel);
- fGLLayout.addWidget(&fGLCheckBox);
-#endif
-
- fCanvasLayout.setSpacing(6);
- fCanvasLayout.setContentsMargins(11,11,11,11);
- fCanvasLayout.addLayout(&fRasterLayout);
- fCanvasLayout.addLayout(&fVizLayout);
-#if SK_SUPPORT_GPU
- fCanvasLayout.addLayout(&fGLLayout);
- fCanvasLayout.addWidget(&fGLMSAAButtonGroup);
+ fVerticalLayout.addRow(&fGLGroup);
#endif
- fCanvasLayout.addWidget(&fFilterButtonGroup);
-
- // Command Toggle
- fCommandToggle.setText("Command Scrolling Preferences");
- fCommandFrame.setFrameShape(QFrame::StyledPanel);
- fCommandFrame.setFrameShadow(QFrame::Raised);
-
- fCurrentCommandLabel.setText("Current Command: ");
- fCurrentCommandLabel.setMinimumWidth(178);
- fCurrentCommandLabel.setMaximumWidth(178);
- fCurrentCommandBox.setText("0");
- fCurrentCommandBox.setMinimumSize(QSize(50,25));
- fCurrentCommandBox.setMaximumSize(QSize(50,25));
- fCurrentCommandBox.setAlignment(Qt::AlignRight);
-
- fCurrentCommandLayout.setSpacing(0);
- fCurrentCommandLayout.setContentsMargins(0,0,0,0);
- fCurrentCommandLayout.setAlignment(Qt::AlignLeft);
- fCurrentCommandLayout.addWidget(&fCurrentCommandLabel);
- fCurrentCommandLayout.addWidget(&fCurrentCommandBox);
-
- fCommandHitLabel.setText("Command HitBox: ");
- fCommandHitLabel.setMinimumWidth(178);
- fCommandHitLabel.setMaximumWidth(178);
- fCommandHitBox.setText("0");
- fCommandHitBox.setMinimumSize(QSize(50,25));
- fCommandHitBox.setMaximumSize(QSize(50,25));
- fCommandHitBox.setAlignment(Qt::AlignRight);
- fCommandHitLayout.setSpacing(0);
- fCommandHitLayout.setContentsMargins(0,0,0,0);
- fCommandHitLayout.setAlignment(Qt::AlignLeft);
- fCommandHitLayout.addWidget(&fCommandHitLabel);
- fCommandHitLayout.addWidget(&fCommandHitBox);
- fCommandLayout.setSpacing(6);
- fCommandLayout.setContentsMargins(11,11,11,11);
- fCommandLayout.addLayout(&fCurrentCommandLayout);
- fCommandLayout.addLayout(&fCommandHitLayout);
-
- // Zoom Info
- fZoomSetting.setText("Zoom Level: ");
- fZoomSetting.setMinimumWidth(178);
- fZoomSetting.setMaximumWidth(178);
- fZoomFrame.setFrameShape(QFrame::StyledPanel);
- fZoomFrame.setFrameShadow(QFrame::Raised);
- fZoomBox.setText("100%");
- fZoomBox.setMinimumSize(QSize(50,25));
- fZoomBox.setMaximumSize(QSize(50,25));
- fZoomBox.setAlignment(Qt::AlignRight);
- fZoomLayout.setSpacing(6);
- fZoomLayout.setContentsMargins(11,11,11,11);
- fZoomLayout.addWidget(&fZoomSetting);
- fZoomLayout.addWidget(&fZoomBox);
-
- // Adds all widgets to settings container
- fVerticalLayout.addWidget(&fVisibleText);
- fVerticalLayout.addWidget(&fVisibleFrame);
- fVerticalLayout.addWidget(&fCommandToggle);
- fVerticalLayout.addWidget(&fCommandFrame);
- fVerticalLayout.addWidget(&fCanvasToggle);
- fVerticalLayout.addWidget(&fCanvasFrame);
- fVerticalLayout.addWidget(&fZoomFrame);
+ fFilterCombo.addItem("As encoded", QVariant(SkPaint::kNone_FilterLevel));
+ fFilterCombo.addItem("None", QVariant(SkPaint::kNone_FilterLevel));
+ fFilterCombo.addItem("Low", QVariant(SkPaint::kLow_FilterLevel));
+ fFilterCombo.addItem("Medium", QVariant(SkPaint::kMedium_FilterLevel));
+ fFilterCombo.addItem("High", QVariant(SkPaint::kHigh_FilterLevel));
+ connect(&fFilterCombo, SIGNAL(activated(int)), this, SIGNAL(texFilterSettingsChanged()));
+ fVerticalLayout.addRow("Filtering", &fFilterCombo);
this->setDisabled(true);
}
-
-void SkSettingsWidget::updateCommand(int newCommand) {
- fCurrentCommandBox.setText(QString::number(newCommand));
-}
-
-void SkSettingsWidget::updateHit(int newHit) {
- fCommandHitBox.setText(QString::number(newHit));
-}
-
-void SkSettingsWidget::setZoomText(float scale) {
- fZoomBox.setText(QString::number(scale*100, 'f', 0).append("%"));
-}