OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SKSETTINGSWIDGET_H_ | 10 #ifndef SKSETTINGSWIDGET_H_ |
11 #define SKSETTINGSWIDGET_H_ | 11 #define SKSETTINGSWIDGET_H_ |
12 | 12 |
13 #include <QWidget> | 13 #include <QWidget> |
14 #include <QHBoxLayout> | 14 #include <QHBoxLayout> |
15 #include <QTextEdit> | 15 #include <QTextEdit> |
16 #include <QFrame> | 16 #include <QFrame> |
17 #include <QGroupBox> | 17 #include <QGroupBox> |
18 #include <QLabel> | 18 #include <QLabel> |
19 #include <QCheckBox> | 19 #include <QCheckBox> |
20 #include <QLineEdit> | 20 #include <QLineEdit> |
21 #include <QComboBox> | 21 #include <QComboBox> |
| 22 #include <QFormLayout> |
22 | 23 |
23 #include "SkPaint.h" | 24 #include "SkPaint.h" |
24 | 25 |
25 /** \class SkSettingsWidget | 26 /** \class SkSettingsWidget |
26 | 27 |
27 The SettingsWidget contains multiple checkboxes and toggles for altering | 28 The SettingsWidget contains multiple checkboxes and toggles for altering |
28 the visibility. | 29 the visualizations. |
29 */ | 30 */ |
30 class SkSettingsWidget : public QWidget { | 31 class SkSettingsWidget : public QFrame { |
31 Q_OBJECT | 32 Q_OBJECT |
32 | 33 |
33 public: | 34 public: |
34 /** | 35 /** |
35 Constructs a widget with the specified parent for layout purposes. | 36 Constructs a widget with the specified parent for layout purposes. |
36 @param parent The parent container of this widget | 37 @param parent The parent container of this widget |
37 */ | 38 */ |
38 SkSettingsWidget(); | 39 SkSettingsWidget(); |
39 | 40 |
40 /** Sets the displayed user zoom level. A scale of 1.0 represents no zoom. *
/ | |
41 void setZoomText(float scale); | |
42 | |
43 bool getVisibilityFilter() const { | |
44 return fVisibilityCombo.itemData(fVisibilityCombo.currentIndex()).toBool
(); | |
45 } | |
46 | 41 |
47 #if SK_SUPPORT_GPU | 42 #if SK_SUPPORT_GPU |
| 43 // GL settings. |
48 bool isGLActive() const { | 44 bool isGLActive() const { |
49 return fGLCheckBox.isChecked(); | 45 return fGLGroup.isChecked(); |
50 } | 46 } |
51 | 47 |
52 int getGLSampleCount() const { | 48 int getGLSampleCount() const { |
53 return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt(); | 49 return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt(); |
54 } | 50 } |
55 | 51 |
56 #endif | 52 #endif |
57 | 53 |
58 bool getFilterOverride(SkPaint::FilterLevel* filterLevel) const { | 54 bool getFilterOverride(SkPaint::FilterLevel* filterLevel) const { |
59 int index = fFilterCombo.currentIndex(); | 55 int index = fFilterCombo.currentIndex(); |
60 *filterLevel = (SkPaint::FilterLevel)fFilterCombo.itemData(index).toUInt
(); | 56 *filterLevel = (SkPaint::FilterLevel)fFilterCombo.itemData(index).toUInt
(); |
61 | 57 |
62 return index > 0; | 58 return index > 0; |
63 } | 59 } |
64 | 60 |
65 QCheckBox* getRasterCheckBox() { | 61 |
66 return &fRasterCheckBox; | 62 // Raster settings. |
| 63 bool isRasterEnabled() { |
| 64 return fRasterGroup.isChecked(); |
67 } | 65 } |
68 | 66 |
69 QCheckBox* getOverdrawVizCheckBox() { | 67 bool isOverdrawVizEnabled() { |
70 return &fOverdrawVizCheckBox; | 68 return fOverdrawVizCheckBox.isChecked(); |
71 } | 69 } |
72 | 70 |
73 QCheckBox* getMegaVizCheckBox() { | 71 // Visualizations. |
74 return &fMegaVizCheckBox; | 72 bool isVisibilityFilterEnabled() const { |
| 73 return fVisibilityFilterCheckBox.isChecked(); |
75 } | 74 } |
76 | 75 |
77 QCheckBox* getPathOpsCheckBox() { | 76 bool isMegaVizEnabled() { |
78 return &fPathOpsCheckBox; | 77 return fMegaVizCheckBox.isChecked(); |
| 78 } |
| 79 |
| 80 bool isPathOpsEnabled() { |
| 81 return fPathOpsCheckBox.isChecked(); |
79 } | 82 } |
80 | 83 |
81 private slots: | 84 private slots: |
82 void updateCommand(int newCommand); | |
83 void updateHit(int newHit); | |
84 | 85 |
85 signals: | 86 signals: |
86 void scrollingPreferences(bool isStickyActivate); | 87 void visualizationsChanged(); |
87 void showStyle(bool isSingleCommand); | |
88 void visibilityFilterChanged(); | |
89 void texFilterSettingsChanged(); | 88 void texFilterSettingsChanged(); |
90 #if SK_SUPPORT_GPU | 89 #if SK_SUPPORT_GPU |
91 void glSettingsChanged(); | 90 void glSettingsChanged(); |
92 #endif | 91 #endif |
| 92 void rasterSettingsChanged(); |
93 | 93 |
94 private: | 94 private: |
95 QVBoxLayout mainFrameLayout; | 95 QFormLayout fVerticalLayout; |
96 QFrame mainFrame; | |
97 QVBoxLayout fVerticalLayout; | |
98 | 96 |
99 QLabel fVisibleText; | 97 QGroupBox fVisualizationsGroup; |
100 QFrame fVisibleFrame; | 98 QVBoxLayout fVisualizationsLayout; |
101 QVBoxLayout fVisibleFrameLayout; | 99 QCheckBox fVisibilityFilterCheckBox; |
102 QComboBox fVisibilityCombo; | |
103 | 100 |
104 QLabel fCommandToggle; | 101 QGroupBox fRasterGroup; |
105 QFrame fCommandFrame; | 102 QVBoxLayout fRasterLayout; |
106 QVBoxLayout fCommandLayout; | |
107 | |
108 QHBoxLayout fCurrentCommandLayout; | |
109 QLabel fCurrentCommandLabel; | |
110 QLineEdit fCurrentCommandBox; | |
111 | |
112 QHBoxLayout fCommandHitLayout; | |
113 QLabel fCommandHitLabel; | |
114 QLineEdit fCommandHitBox; | |
115 | |
116 QFrame fCanvasFrame; | |
117 QVBoxLayout fCanvasLayout; | |
118 QLabel fCanvasToggle; | |
119 | |
120 QHBoxLayout fRasterLayout; | |
121 QLabel fRasterLabel; | |
122 QCheckBox fRasterCheckBox; | |
123 | |
124 QHBoxLayout fVizLayout; | |
125 QLabel fOverdrawVizLabel; | |
126 QCheckBox fOverdrawVizCheckBox; | 103 QCheckBox fOverdrawVizCheckBox; |
127 QLabel fMegaVizLabel; | |
128 QCheckBox fMegaVizCheckBox; | 104 QCheckBox fMegaVizCheckBox; |
129 QLabel fPathOpsLabel; | |
130 QCheckBox fPathOpsCheckBox; | 105 QCheckBox fPathOpsCheckBox; |
131 | 106 |
132 #if SK_SUPPORT_GPU | 107 #if SK_SUPPORT_GPU |
133 QHBoxLayout fGLLayout; | 108 QGroupBox fGLGroup; |
134 QLabel fGLLabel; | 109 QFormLayout fGLLayout; |
135 QCheckBox fGLCheckBox; | |
136 QGroupBox fGLMSAAButtonGroup; | |
137 QVBoxLayout fGLMSAALayout; | |
138 QComboBox fGLMSAACombo; | 110 QComboBox fGLMSAACombo; |
139 #endif | 111 #endif |
140 | 112 |
141 // for filtering group | |
142 QGroupBox fFilterButtonGroup; | |
143 QComboBox fFilterCombo; | 113 QComboBox fFilterCombo; |
144 QVBoxLayout fFilterLayout; | |
145 | |
146 QFrame fZoomFrame; | |
147 QHBoxLayout fZoomLayout; | |
148 QLabel fZoomSetting; | |
149 QLineEdit fZoomBox; | |
150 }; | 114 }; |
151 | 115 |
152 #endif /* SKSETTINGSWIDGET_H_ */ | 116 #endif /* SKSETTINGSWIDGET_H_ */ |
OLD | NEW |