blob: 23100118b1ddad185a851b61172e4068df54f12c [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
chudy@google.com7dcae672012-07-09 20:26:53 +000073private slots:
74 void updateCommand(int newCommand);
chudy@google.come606d6e2012-07-12 14:31:25 +000075 void updateHit(int newHit);
chudy@google.com7dcae672012-07-09 20:26:53 +000076
77signals:
78 void scrollingPreferences(bool isStickyActivate);
79 void showStyle(bool isSingleCommand);
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000080 void visibilityFilterChanged();
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000081 void texFilterSettingsChanged();
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000082#if SK_SUPPORT_GPU
83 void glSettingsChanged();
84#endif
chudy@google.com7dcae672012-07-09 20:26:53 +000085
chudy@google.com902ebe52012-06-29 14:21:22 +000086private:
chudy@google.com7dcae672012-07-09 20:26:53 +000087 QVBoxLayout mainFrameLayout;
88 QFrame mainFrame;
89 QVBoxLayout fVerticalLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +000090
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000091 QLabel fVisibleText;
chudy@google.com7dcae672012-07-09 20:26:53 +000092 QFrame fVisibleFrame;
93 QVBoxLayout fVisibleFrameLayout;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000094 QComboBox fVisibilityCombo;
chudy@google.com902ebe52012-06-29 14:21:22 +000095
chudy@google.com7dcae672012-07-09 20:26:53 +000096 QLabel fCommandToggle;
97 QFrame fCommandFrame;
98 QVBoxLayout fCommandLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +000099
chudy@google.com2d537a12012-07-31 12:49:52 +0000100 QHBoxLayout fCurrentCommandLayout;
chudy@google.com7dcae672012-07-09 20:26:53 +0000101 QLabel fCurrentCommandLabel;
chudy@google.come606d6e2012-07-12 14:31:25 +0000102 QLineEdit fCurrentCommandBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000103
chudy@google.com2d537a12012-07-31 12:49:52 +0000104 QHBoxLayout fCommandHitLayout;
chudy@google.come606d6e2012-07-12 14:31:25 +0000105 QLabel fCommandHitLabel;
106 QLineEdit fCommandHitBox;
chudy@google.come606d6e2012-07-12 14:31:25 +0000107
chudy@google.comea5488b2012-07-26 19:38:22 +0000108 QFrame fCanvasFrame;
109 QVBoxLayout fCanvasLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000110 QLabel fCanvasToggle;
chudy@google.comea5488b2012-07-26 19:38:22 +0000111
112 QHBoxLayout fRasterLayout;
113 QLabel fRasterLabel;
114 QCheckBox fRasterCheckBox;
115
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000116 QHBoxLayout fOverdrawVizLayout;
117 QLabel fOverdrawVizLabel;
118 QCheckBox fOverdrawVizCheckBox;
119
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000120#if SK_SUPPORT_GPU
chudy@google.comea5488b2012-07-26 19:38:22 +0000121 QHBoxLayout fGLLayout;
122 QLabel fGLLabel;
123 QCheckBox fGLCheckBox;
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +0000124 QGroupBox fGLMSAAButtonGroup;
125 QVBoxLayout fGLMSAALayout;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000126 QComboBox fGLMSAACombo;
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000127#endif
chudy@google.comea5488b2012-07-26 19:38:22 +0000128
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000129 // for filtering group
130 QGroupBox fFilterButtonGroup;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000131 QComboBox fFilterCombo;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000132 QVBoxLayout fFilterLayout;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000133
chudy@google.com7dcae672012-07-09 20:26:53 +0000134 QFrame fZoomFrame;
chudy@google.com7dcae672012-07-09 20:26:53 +0000135 QHBoxLayout fZoomLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000136 QLabel fZoomSetting;
137 QLineEdit fZoomBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000138};
139
140#endif /* SKSETTINGSWIDGET_H_ */