1
2 /*
3 * Copyright 2012 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10 #include "SkSettingsWidget.h"
11 #include <iostream>
12 #include <math.h>
13
14 // TODO(chudy): See if the layout can't be attached to the frame post construction.
SkSettingsWidget()15 SkSettingsWidget::SkSettingsWidget() : QFrame()
16 {
17 this->setLayout(&fVerticalLayout);
18 this->setFrameStyle(QFrame::Panel);
19 // Vertical Layout is the alignment inside of the main frame.
20 fVerticalLayout.setAlignment(Qt::AlignTop);
21
22 // Visualizations toggles.
23 fVisualizationsGroup.setTitle("Visualizations");
24 fVisibilityFilterCheckBox.setText("Visibility Filter");
25 fVisualizationsLayout.addWidget(&fVisibilityFilterCheckBox);
26 fMegaVizCheckBox.setText("Mega Viz");
27 fVisualizationsLayout.addWidget(&fMegaVizCheckBox);
28 fPathOpsCheckBox.setText("PathOps ");
29 fVisualizationsLayout.addWidget(&fPathOpsCheckBox);
30 fVisualizationsGroup.setLayout(&fVisualizationsLayout);
31 connect(&fVisibilityFilterCheckBox, SIGNAL(toggled(bool)), this,
32 SIGNAL(visualizationsChanged()));
33 connect(&fMegaVizCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(visualizationsChanged()));
34 connect(&fPathOpsCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(visualizationsChanged()));
35
36 fVerticalLayout.addRow(&fVisualizationsGroup);
37
38 // Raster toggles.
39 fRasterGroup.setTitle("Raster");
40 fRasterGroup.setCheckable(true);
41 fOverdrawVizCheckBox.setText("Overdraw Viz");
42 fRasterLayout.addWidget(&fOverdrawVizCheckBox);
43 fRasterGroup.setLayout(&fRasterLayout);
44 fVerticalLayout.addRow(&fRasterGroup);
45
46 connect(&fRasterGroup, SIGNAL(toggled(bool)), this, SIGNAL(rasterSettingsChanged()));
47 connect(&fOverdrawVizCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(rasterSettingsChanged()));
48
49 #if SK_SUPPORT_GPU
50 fGLGroup.setTitle("OpenGL");
51 fGLGroup.setCheckable(true);
52 fGLGroup.setChecked(false);
53 fGLMSAACombo.addItem("Off", QVariant(0));
54 fGLMSAACombo.addItem("4", QVariant(4));
55 fGLMSAACombo.addItem("16", QVariant(16));
56 fGLLayout.addRow("MSAA", &fGLMSAACombo);
57 fGLGroup.setLayout(&fGLLayout);
58
59 connect(&fGLGroup, SIGNAL(toggled(bool)), this,
60 SIGNAL(glSettingsChanged()));
61 connect(&fGLMSAACombo, SIGNAL(activated(int)), this,
62 SIGNAL(glSettingsChanged()));
63
64 fVerticalLayout.addRow(&fGLGroup);
65 #endif
66
67 fFilterCombo.addItem("As encoded", QVariant(kNone_SkFilterQuality));
68 fFilterCombo.addItem("None", QVariant(kNone_SkFilterQuality));
69 fFilterCombo.addItem("Low", QVariant(kLow_SkFilterQuality));
70 fFilterCombo.addItem("Medium", QVariant(kMedium_SkFilterQuality));
71 fFilterCombo.addItem("High", QVariant(kHigh_SkFilterQuality));
72 connect(&fFilterCombo, SIGNAL(activated(int)), this, SIGNAL(texFilterSettingsChanged()));
73
74 fVerticalLayout.addRow("Filtering", &fFilterCombo);
75 this->setDisabled(true);
76 }
77
78