blob: dec938e650227665d730f95d5513588165b612c9 [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>
kkinnunen41c79cc2014-12-30 22:49:58 -080022#include <QFormLayout>
chudy@google.com902ebe52012-06-29 14:21:22 +000023
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000024#include "SkPaint.h"
25
chudy@google.com902ebe52012-06-29 14:21:22 +000026/** \class SkSettingsWidget
27
28 The SettingsWidget contains multiple checkboxes and toggles for altering
kkinnunen41c79cc2014-12-30 22:49:58 -080029 the visualizations.
chudy@google.com902ebe52012-06-29 14:21:22 +000030 */
kkinnunen41c79cc2014-12-30 22:49:58 -080031class SkSettingsWidget : public QFrame {
chudy@google.com902ebe52012-06-29 14:21:22 +000032 Q_OBJECT
33
34public:
35 /**
36 Constructs a widget with the specified parent for layout purposes.
37 @param parent The parent container of this widget
38 */
chudy@google.com2d537a12012-07-31 12:49:52 +000039 SkSettingsWidget();
chudy@google.com902ebe52012-06-29 14:21:22 +000040
chudy@google.com7dcae672012-07-09 20:26:53 +000041
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000042#if SK_SUPPORT_GPU
kkinnunen41c79cc2014-12-30 22:49:58 -080043 // GL settings.
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000044 bool isGLActive() const {
kkinnunen41c79cc2014-12-30 22:49:58 -080045 return fGLGroup.isChecked();
chudy@google.comea5488b2012-07-26 19:38:22 +000046 }
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000047
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000048 int getGLSampleCount() const {
49 return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt();
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000050 }
51
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000052#endif
chudy@google.comea5488b2012-07-26 19:38:22 +000053
reede7903c72015-03-16 10:26:13 -070054 bool getFilterOverride(SkFilterQuality* filterQuality) const {
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000055 int index = fFilterCombo.currentIndex();
reede7903c72015-03-16 10:26:13 -070056 *filterQuality = (SkFilterQuality)fFilterCombo.itemData(index).toUInt();
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000057
commit-bot@chromium.org22d39332013-11-21 15:37:29 +000058 return index > 0;
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000059 }
60
kkinnunen41c79cc2014-12-30 22:49:58 -080061
62 // Raster settings.
63 bool isRasterEnabled() {
64 return fRasterGroup.isChecked();
chudy@google.comea5488b2012-07-26 19:38:22 +000065 }
66
kkinnunen41c79cc2014-12-30 22:49:58 -080067 bool isOverdrawVizEnabled() {
68 return fOverdrawVizCheckBox.isChecked();
robertphillips@google.comf4741c12013-02-06 20:13:54 +000069 }
70
kkinnunen41c79cc2014-12-30 22:49:58 -080071 // Visualizations.
72 bool isVisibilityFilterEnabled() const {
73 return fVisibilityFilterCheckBox.isChecked();
commit-bot@chromium.org768ac852014-03-03 16:32:17 +000074 }
75
kkinnunen41c79cc2014-12-30 22:49:58 -080076 bool isMegaVizEnabled() {
77 return fMegaVizCheckBox.isChecked();
78 }
79
80 bool isPathOpsEnabled() {
81 return fPathOpsCheckBox.isChecked();
commit-bot@chromium.org2a67e122014-05-19 13:53:10 +000082 }
83
robertphillips9ea8acd2016-03-01 09:34:38 -080084private Q_SLOTS:
chudy@google.com7dcae672012-07-09 20:26:53 +000085
robertphillips9ea8acd2016-03-01 09:34:38 -080086Q_SIGNALS:
kkinnunen41c79cc2014-12-30 22:49:58 -080087 void visualizationsChanged();
robertphillips@google.com32bbcf82013-10-17 17:56:10 +000088 void texFilterSettingsChanged();
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000089#if SK_SUPPORT_GPU
90 void glSettingsChanged();
91#endif
kkinnunen41c79cc2014-12-30 22:49:58 -080092 void rasterSettingsChanged();
chudy@google.com7dcae672012-07-09 20:26:53 +000093
chudy@google.com902ebe52012-06-29 14:21:22 +000094private:
kkinnunen41c79cc2014-12-30 22:49:58 -080095 QFormLayout fVerticalLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +000096
kkinnunen41c79cc2014-12-30 22:49:58 -080097 QGroupBox fVisualizationsGroup;
98 QVBoxLayout fVisualizationsLayout;
99 QCheckBox fVisibilityFilterCheckBox;
chudy@google.com902ebe52012-06-29 14:21:22 +0000100
kkinnunen41c79cc2014-12-30 22:49:58 -0800101 QGroupBox fRasterGroup;
102 QVBoxLayout fRasterLayout;
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000103 QCheckBox fOverdrawVizCheckBox;
commit-bot@chromium.org768ac852014-03-03 16:32:17 +0000104 QCheckBox fMegaVizCheckBox;
commit-bot@chromium.org2a67e122014-05-19 13:53:10 +0000105 QCheckBox fPathOpsCheckBox;
robertphillips@google.comf4741c12013-02-06 20:13:54 +0000106
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000107#if SK_SUPPORT_GPU
kkinnunen41c79cc2014-12-30 22:49:58 -0800108 QGroupBox fGLGroup;
109 QFormLayout fGLLayout;
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000110 QComboBox fGLMSAACombo;
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +0000111#endif
chudy@google.comea5488b2012-07-26 19:38:22 +0000112
commit-bot@chromium.org22d39332013-11-21 15:37:29 +0000113 QComboBox fFilterCombo;
chudy@google.com902ebe52012-06-29 14:21:22 +0000114};
115
116#endif /* SKSETTINGSWIDGET_H_ */