blob: fc8fda7c6efe4828131ece3a664208e80f7705d8 [file] [log] [blame]
chudy@google.com902ebe52012-06-29 14:21:22 +00001
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#ifndef SKSETTINGSWIDGET_H_
11#define SKSETTINGSWIDGET_H_
12
13#include <QWidget>
14#include <QHBoxLayout>
15#include <QTextEdit>
16#include <QFrame>
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000017#include <QGroupBox>
chudy@google.com902ebe52012-06-29 14:21:22 +000018#include <QLabel>
19#include <QRadioButton>
20#include <QCheckBox>
chudy@google.com7dcae672012-07-09 20:26:53 +000021#include <QLineEdit>
chudy@google.com902ebe52012-06-29 14:21:22 +000022
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000023#include "SkPaint.h"
24
chudy@google.com902ebe52012-06-29 14:21:22 +000025/** \class SkSettingsWidget
26
27 The SettingsWidget contains multiple checkboxes and toggles for altering
28 the visibility.
29 */
30class SkSettingsWidget : public QWidget {
31 Q_OBJECT
32
33public:
34 /**
35 Constructs a widget with the specified parent for layout purposes.
36 @param parent The parent container of this widget
37 */
chudy@google.com2d537a12012-07-31 12:49:52 +000038 SkSettingsWidget();
chudy@google.com902ebe52012-06-29 14:21:22 +000039
bungeman@google.come8cc6e82013-01-17 16:30:56 +000040 /** Sets the displayed user zoom level. A scale of 1.0 represents no zoom. */
41 void setZoomText(float scale);
chudy@google.com7dcae672012-07-09 20:26:53 +000042
chudy@google.com7dcae672012-07-09 20:26:53 +000043 QRadioButton* getVisibilityButton();
44
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000045#if SK_SUPPORT_GPU
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000046 bool isGLActive() {
47 return fGLCheckBox.isChecked();
chudy@google.comea5488b2012-07-26 19:38:22 +000048 }
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000049
50 int getGLSampleCount() {
51 if (fGLMSAA4On.isChecked()) {
52 return 4;
53 } else if (fGLMSAA16On.isChecked()) {
54 return 16;
55 }
56 return 0;
57 }
58
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000059#endif
chudy@google.comea5488b2012-07-26 19:38:22 +000060
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000061 bool getFilterOverride(SkPaint::FilterLevel* filterLevel) {
62 if (fFilterDefault.isChecked()) {
63 *filterLevel = SkPaint::kNone_FilterLevel;
64 return false;
65 }
66
67 if (fFilterNone.isChecked()) {
68 *filterLevel = SkPaint::kNone_FilterLevel;
69 } else if (fFilterLow.isChecked()) {
70 *filterLevel = SkPaint::kLow_FilterLevel;
71 } else if (fFilterMed.isChecked()) {
72 *filterLevel = SkPaint::kMedium_FilterLevel;
73 } else {
74 *filterLevel = SkPaint::kHigh_FilterLevel;
75 }
76
77 return true;
78 }
79
chudy@google.comea5488b2012-07-26 19:38:22 +000080 QCheckBox* getRasterCheckBox() {
81 return &fRasterCheckBox;
82 }
83
robertphillips@google.comf4741c12013-02-06 20:13:54 +000084 QCheckBox* getOverdrawVizCheckBox() {
85 return &fOverdrawVizCheckBox;
86 }
87
chudy@google.com7dcae672012-07-09 20:26:53 +000088private slots:
89 void updateCommand(int newCommand);
chudy@google.come606d6e2012-07-12 14:31:25 +000090 void updateHit(int newHit);
chudy@google.com7dcae672012-07-09 20:26:53 +000091
92signals:
93 void scrollingPreferences(bool isStickyActivate);
94 void showStyle(bool isSingleCommand);
95 void visibilityFilter(bool isEnabled);
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000096 void texFilterSettingsChanged();
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000097#if SK_SUPPORT_GPU
98 void glSettingsChanged();
99#endif
chudy@google.com7dcae672012-07-09 20:26:53 +0000100
chudy@google.com902ebe52012-06-29 14:21:22 +0000101private:
chudy@google.com7dcae672012-07-09 20:26:53 +0000102 QVBoxLayout mainFrameLayout;
103 QFrame mainFrame;
104 QVBoxLayout fVerticalLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +0000105
chudy@google.com7dcae672012-07-09 20:26:53 +0000106 QLabel fVisibileText;
107 QFrame fVisibleFrame;
108 QVBoxLayout fVisibleFrameLayout;
109 QRadioButton fVisibleOn;
110 QRadioButton fVisibleOff;
chudy@google.com902ebe52012-06-29 14:21:22 +0000111
chudy@google.com7dcae672012-07-09 20:26:53 +0000112 QLabel fCommandToggle;
113 QFrame fCommandFrame;
114 QVBoxLayout fCommandLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +0000115
chudy@google.com2d537a12012-07-31 12:49:52 +0000116 QHBoxLayout fCurrentCommandLayout;
chudy@google.com7dcae672012-07-09 20:26:53 +0000117 QLabel fCurrentCommandLabel;
chudy@google.come606d6e2012-07-12 14:31:25 +0000118 QLineEdit fCurrentCommandBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000119
chudy@google.com2d537a12012-07-31 12:49:52 +0000120 QHBoxLayout fCommandHitLayout;
chudy@google.come606d6e2012-07-12 14:31:25 +0000121 QLabel fCommandHitLabel;
122 QLineEdit fCommandHitBox;
chudy@google.come606d6e2012-07-12 14:31:25 +0000123
chudy@google.comea5488b2012-07-26 19:38:22 +0000124 QFrame fCanvasFrame;
125 QVBoxLayout fCanvasLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000126 QLabel fCanvasToggle;
chudy@google.comea5488b2012-07-26 19:38:22 +0000127
128 QHBoxLayout fRasterLayout;
129 QLabel fRasterLabel;
130 QCheckBox fRasterCheckBox;
131
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000132 QHBoxLayout fOverdrawVizLayout;
133 QLabel fOverdrawVizLabel;
134 QCheckBox fOverdrawVizCheckBox;
135
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000136#if SK_SUPPORT_GPU
chudy@google.comea5488b2012-07-26 19:38:22 +0000137 QHBoxLayout fGLLayout;
138 QLabel fGLLabel;
139 QCheckBox fGLCheckBox;
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +0000140 QGroupBox fGLMSAAButtonGroup;
141 QVBoxLayout fGLMSAALayout;
142 QRadioButton fGLMSAAOff;
143 QRadioButton fGLMSAA4On;
144 QRadioButton fGLMSAA16On;
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000145#endif
chudy@google.comea5488b2012-07-26 19:38:22 +0000146
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000147 // for filtering group
148 QGroupBox fFilterButtonGroup;
149 QVBoxLayout fFilterLayout;
150 QRadioButton fFilterDefault;
151 QRadioButton fFilterNone;
152 QRadioButton fFilterLow;
153 QRadioButton fFilterMed;
154 QRadioButton fFilterHigh;
155
chudy@google.com7dcae672012-07-09 20:26:53 +0000156 QFrame fZoomFrame;
chudy@google.com7dcae672012-07-09 20:26:53 +0000157 QHBoxLayout fZoomLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000158 QLabel fZoomSetting;
159 QLineEdit fZoomBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000160};
161
162#endif /* SKSETTINGSWIDGET_H_ */