blob: f35df9401007235e390c809b700855700ced8e0f [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>
chudy@google.com902ebe52012-06-29 14:21:22 +000019#include <QCheckBox>
chudy@google.com7dcae672012-07-09 20:26:53 +000020#include <QLineEdit>
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000021#include <QComboBox>
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
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000043 bool getVisibilityFilter() const {
44 return fVisibilityCombo.itemData(fVisibilityCombo.currentIndex()).toBool();
45 }
chudy@google.com7dcae672012-07-09 20:26:53 +000046
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000047#if SK_SUPPORT_GPU
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000048 bool isGLActive() const {
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000049 return fGLCheckBox.isChecked();
chudy@google.comea5488b2012-07-26 19:38:22 +000050 }
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000051
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000052 int getGLSampleCount() const {
53 return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt();
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000054 }
55
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000056#endif
chudy@google.comea5488b2012-07-26 19:38:22 +000057
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000058 bool getFilterOverride(SkPaint::FilterLevel* filterLevel) const {
59 int index = fFilterCombo.currentIndex();
60 *filterLevel = (SkPaint::FilterLevel)fFilterCombo.itemData(index).toUInt();
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000061
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000062 return index > 0;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000063 }
64
chudy@google.comea5488b2012-07-26 19:38:22 +000065 QCheckBox* getRasterCheckBox() {
66 return &fRasterCheckBox;
67 }
68
robertphillips@google.comf4741c12013-02-06 20:13:54 +000069 QCheckBox* getOverdrawVizCheckBox() {
70 return &fOverdrawVizCheckBox;
71 }
72
commit-bot@chromium.org768ac852014-03-03 16:32:17 +000073 QCheckBox* getMegaVizCheckBox() {
74 return &fMegaVizCheckBox;
75 }
76
commit-bot@chromium.org2a67e122014-05-19 13:53:10 +000077 QCheckBox* getPathOpsCheckBox() {
78 return &fPathOpsCheckBox;
79 }
80
chudy@google.com7dcae672012-07-09 20:26:53 +000081private slots:
82 void updateCommand(int newCommand);
chudy@google.come606d6e2012-07-12 14:31:25 +000083 void updateHit(int newHit);
chudy@google.com7dcae672012-07-09 20:26:53 +000084
85signals:
86 void scrollingPreferences(bool isStickyActivate);
87 void showStyle(bool isSingleCommand);
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000088 void visibilityFilterChanged();
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000089 void texFilterSettingsChanged();
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000090#if SK_SUPPORT_GPU
91 void glSettingsChanged();
92#endif
chudy@google.com7dcae672012-07-09 20:26:53 +000093
chudy@google.com902ebe52012-06-29 14:21:22 +000094private:
chudy@google.com7dcae672012-07-09 20:26:53 +000095 QVBoxLayout mainFrameLayout;
96 QFrame mainFrame;
97 QVBoxLayout fVerticalLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +000098
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000099 QLabel fVisibleText;
chudy@google.com7dcae672012-07-09 20:26:53 +0000100 QFrame fVisibleFrame;
101 QVBoxLayout fVisibleFrameLayout;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000102 QComboBox fVisibilityCombo;
chudy@google.com902ebe52012-06-29 14:21:22 +0000103
chudy@google.com7dcae672012-07-09 20:26:53 +0000104 QLabel fCommandToggle;
105 QFrame fCommandFrame;
106 QVBoxLayout fCommandLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +0000107
chudy@google.com2d537a12012-07-31 12:49:52 +0000108 QHBoxLayout fCurrentCommandLayout;
chudy@google.com7dcae672012-07-09 20:26:53 +0000109 QLabel fCurrentCommandLabel;
chudy@google.come606d6e2012-07-12 14:31:25 +0000110 QLineEdit fCurrentCommandBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000111
chudy@google.com2d537a12012-07-31 12:49:52 +0000112 QHBoxLayout fCommandHitLayout;
chudy@google.come606d6e2012-07-12 14:31:25 +0000113 QLabel fCommandHitLabel;
114 QLineEdit fCommandHitBox;
chudy@google.come606d6e2012-07-12 14:31:25 +0000115
chudy@google.comea5488b2012-07-26 19:38:22 +0000116 QFrame fCanvasFrame;
117 QVBoxLayout fCanvasLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000118 QLabel fCanvasToggle;
chudy@google.comea5488b2012-07-26 19:38:22 +0000119
120 QHBoxLayout fRasterLayout;
121 QLabel fRasterLabel;
122 QCheckBox fRasterCheckBox;
123
commit-bot@chromium.org768ac852014-03-03 16:32:17 +0000124 QHBoxLayout fVizLayout;
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000125 QLabel fOverdrawVizLabel;
126 QCheckBox fOverdrawVizCheckBox;
commit-bot@chromium.org768ac852014-03-03 16:32:17 +0000127 QLabel fMegaVizLabel;
128 QCheckBox fMegaVizCheckBox;
commit-bot@chromium.org2a67e122014-05-19 13:53:10 +0000129 QLabel fPathOpsLabel;
130 QCheckBox fPathOpsCheckBox;
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000131
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000132#if SK_SUPPORT_GPU
chudy@google.comea5488b2012-07-26 19:38:22 +0000133 QHBoxLayout fGLLayout;
134 QLabel fGLLabel;
135 QCheckBox fGLCheckBox;
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +0000136 QGroupBox fGLMSAAButtonGroup;
137 QVBoxLayout fGLMSAALayout;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000138 QComboBox fGLMSAACombo;
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000139#endif
chudy@google.comea5488b2012-07-26 19:38:22 +0000140
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000141 // for filtering group
142 QGroupBox fFilterButtonGroup;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000143 QComboBox fFilterCombo;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000144 QVBoxLayout fFilterLayout;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000145
chudy@google.com7dcae672012-07-09 20:26:53 +0000146 QFrame fZoomFrame;
chudy@google.com7dcae672012-07-09 20:26:53 +0000147 QHBoxLayout fZoomLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000148 QLabel fZoomSetting;
149 QLineEdit fZoomBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000150};
151
152#endif /* SKSETTINGSWIDGET_H_ */