blob: 660da77cfd0033bdd6c53371d4e3d0970cacded9 [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
chudy@google.com7dcae672012-07-09 20:26:53 +000077private slots:
78 void updateCommand(int newCommand);
chudy@google.come606d6e2012-07-12 14:31:25 +000079 void updateHit(int newHit);
chudy@google.com7dcae672012-07-09 20:26:53 +000080
81signals:
82 void scrollingPreferences(bool isStickyActivate);
83 void showStyle(bool isSingleCommand);
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000084 void visibilityFilterChanged();
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000085 void texFilterSettingsChanged();
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000086#if SK_SUPPORT_GPU
87 void glSettingsChanged();
88#endif
chudy@google.com7dcae672012-07-09 20:26:53 +000089
chudy@google.com902ebe52012-06-29 14:21:22 +000090private:
chudy@google.com7dcae672012-07-09 20:26:53 +000091 QVBoxLayout mainFrameLayout;
92 QFrame mainFrame;
93 QVBoxLayout fVerticalLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +000094
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000095 QLabel fVisibleText;
chudy@google.com7dcae672012-07-09 20:26:53 +000096 QFrame fVisibleFrame;
97 QVBoxLayout fVisibleFrameLayout;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000098 QComboBox fVisibilityCombo;
chudy@google.com902ebe52012-06-29 14:21:22 +000099
chudy@google.com7dcae672012-07-09 20:26:53 +0000100 QLabel fCommandToggle;
101 QFrame fCommandFrame;
102 QVBoxLayout fCommandLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +0000103
chudy@google.com2d537a12012-07-31 12:49:52 +0000104 QHBoxLayout fCurrentCommandLayout;
chudy@google.com7dcae672012-07-09 20:26:53 +0000105 QLabel fCurrentCommandLabel;
chudy@google.come606d6e2012-07-12 14:31:25 +0000106 QLineEdit fCurrentCommandBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000107
chudy@google.com2d537a12012-07-31 12:49:52 +0000108 QHBoxLayout fCommandHitLayout;
chudy@google.come606d6e2012-07-12 14:31:25 +0000109 QLabel fCommandHitLabel;
110 QLineEdit fCommandHitBox;
chudy@google.come606d6e2012-07-12 14:31:25 +0000111
chudy@google.comea5488b2012-07-26 19:38:22 +0000112 QFrame fCanvasFrame;
113 QVBoxLayout fCanvasLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000114 QLabel fCanvasToggle;
chudy@google.comea5488b2012-07-26 19:38:22 +0000115
116 QHBoxLayout fRasterLayout;
117 QLabel fRasterLabel;
118 QCheckBox fRasterCheckBox;
119
commit-bot@chromium.org768ac852014-03-03 16:32:17 +0000120 QHBoxLayout fVizLayout;
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000121 QLabel fOverdrawVizLabel;
122 QCheckBox fOverdrawVizCheckBox;
commit-bot@chromium.org768ac852014-03-03 16:32:17 +0000123 QLabel fMegaVizLabel;
124 QCheckBox fMegaVizCheckBox;
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000125
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000126#if SK_SUPPORT_GPU
chudy@google.comea5488b2012-07-26 19:38:22 +0000127 QHBoxLayout fGLLayout;
128 QLabel fGLLabel;
129 QCheckBox fGLCheckBox;
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +0000130 QGroupBox fGLMSAAButtonGroup;
131 QVBoxLayout fGLMSAALayout;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000132 QComboBox fGLMSAACombo;
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000133#endif
chudy@google.comea5488b2012-07-26 19:38:22 +0000134
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000135 // for filtering group
136 QGroupBox fFilterButtonGroup;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000137 QComboBox fFilterCombo;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000138 QVBoxLayout fFilterLayout;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +0000139
chudy@google.com7dcae672012-07-09 20:26:53 +0000140 QFrame fZoomFrame;
chudy@google.com7dcae672012-07-09 20:26:53 +0000141 QHBoxLayout fZoomLayout;
chudy@google.com2d537a12012-07-31 12:49:52 +0000142 QLabel fZoomSetting;
143 QLineEdit fZoomBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000144};
145
146#endif /* SKSETTINGSWIDGET_H_ */