chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 1 | |
| 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.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 17 | #include <QGroupBox> |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 18 | #include <QLabel> |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 19 | #include <QCheckBox> |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 20 | #include <QLineEdit> |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 21 | #include <QComboBox> |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 22 | #include <QFormLayout> |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 23 | |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 24 | #include "SkPaint.h" |
| 25 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 26 | /** \class SkSettingsWidget |
| 27 | |
| 28 | The SettingsWidget contains multiple checkboxes and toggles for altering |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 29 | the visualizations. |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 30 | */ |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 31 | class SkSettingsWidget : public QFrame { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 32 | Q_OBJECT |
| 33 | |
| 34 | public: |
| 35 | /** |
| 36 | Constructs a widget with the specified parent for layout purposes. |
| 37 | @param parent The parent container of this widget |
| 38 | */ |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 39 | SkSettingsWidget(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 40 | |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 41 | |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 42 | #if SK_SUPPORT_GPU |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 43 | // GL settings. |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 44 | bool isGLActive() const { |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 45 | return fGLGroup.isChecked(); |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 46 | } |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 47 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 48 | int getGLSampleCount() const { |
| 49 | return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt(); |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 50 | } |
| 51 | |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 52 | #endif |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 53 | |
reed | e7903c7 | 2015-03-16 10:26:13 -0700 | [diff] [blame] | 54 | bool getFilterOverride(SkFilterQuality* filterQuality) const { |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 55 | int index = fFilterCombo.currentIndex(); |
reed | e7903c7 | 2015-03-16 10:26:13 -0700 | [diff] [blame] | 56 | *filterQuality = (SkFilterQuality)fFilterCombo.itemData(index).toUInt(); |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 57 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 58 | return index > 0; |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 59 | } |
| 60 | |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 61 | |
| 62 | // Raster settings. |
| 63 | bool isRasterEnabled() { |
| 64 | return fRasterGroup.isChecked(); |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 65 | } |
| 66 | |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 67 | bool isOverdrawVizEnabled() { |
| 68 | return fOverdrawVizCheckBox.isChecked(); |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 69 | } |
| 70 | |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 71 | // Visualizations. |
| 72 | bool isVisibilityFilterEnabled() const { |
| 73 | return fVisibilityFilterCheckBox.isChecked(); |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 74 | } |
| 75 | |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 76 | bool isMegaVizEnabled() { |
| 77 | return fMegaVizCheckBox.isChecked(); |
| 78 | } |
| 79 | |
| 80 | bool isPathOpsEnabled() { |
| 81 | return fPathOpsCheckBox.isChecked(); |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 82 | } |
| 83 | |
robertphillips | 9ea8acd | 2016-03-01 09:34:38 -0800 | [diff] [blame] | 84 | private Q_SLOTS: |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 85 | |
robertphillips | 9ea8acd | 2016-03-01 09:34:38 -0800 | [diff] [blame] | 86 | Q_SIGNALS: |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 87 | void visualizationsChanged(); |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 88 | void texFilterSettingsChanged(); |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 89 | #if SK_SUPPORT_GPU |
| 90 | void glSettingsChanged(); |
| 91 | #endif |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 92 | void rasterSettingsChanged(); |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 93 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 94 | private: |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 95 | QFormLayout fVerticalLayout; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 96 | |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 97 | QGroupBox fVisualizationsGroup; |
| 98 | QVBoxLayout fVisualizationsLayout; |
| 99 | QCheckBox fVisibilityFilterCheckBox; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 100 | |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 101 | QGroupBox fRasterGroup; |
| 102 | QVBoxLayout fRasterLayout; |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 103 | QCheckBox fOverdrawVizCheckBox; |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 104 | QCheckBox fMegaVizCheckBox; |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 105 | QCheckBox fPathOpsCheckBox; |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 106 | |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 107 | #if SK_SUPPORT_GPU |
kkinnunen | 41c79cc | 2014-12-30 22:49:58 -0800 | [diff] [blame] | 108 | QGroupBox fGLGroup; |
| 109 | QFormLayout fGLLayout; |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 110 | QComboBox fGLMSAACombo; |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 111 | #endif |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 112 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 113 | QComboBox fFilterCombo; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 114 | }; |
| 115 | |
| 116 | #endif /* SKSETTINGSWIDGET_H_ */ |