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> |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 22 | |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 23 | #include "SkPaint.h" |
| 24 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 25 | /** \class SkSettingsWidget |
| 26 | |
| 27 | The SettingsWidget contains multiple checkboxes and toggles for altering |
| 28 | the visibility. |
| 29 | */ |
| 30 | class SkSettingsWidget : public QWidget { |
| 31 | Q_OBJECT |
| 32 | |
| 33 | public: |
| 34 | /** |
| 35 | Constructs a widget with the specified parent for layout purposes. |
| 36 | @param parent The parent container of this widget |
| 37 | */ |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 38 | SkSettingsWidget(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 39 | |
bungeman@google.com | e8cc6e8 | 2013-01-17 16:30:56 +0000 | [diff] [blame] | 40 | /** Sets the displayed user zoom level. A scale of 1.0 represents no zoom. */ |
| 41 | void setZoomText(float scale); |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 42 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 43 | bool getVisibilityFilter() const { |
| 44 | return fVisibilityCombo.itemData(fVisibilityCombo.currentIndex()).toBool(); |
| 45 | } |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 46 | |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 47 | #if SK_SUPPORT_GPU |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 48 | bool isGLActive() const { |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 49 | return fGLCheckBox.isChecked(); |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 50 | } |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 51 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 52 | int getGLSampleCount() const { |
| 53 | return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt(); |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 54 | } |
| 55 | |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 56 | #endif |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 57 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 58 | bool getFilterOverride(SkPaint::FilterLevel* filterLevel) const { |
| 59 | int index = fFilterCombo.currentIndex(); |
| 60 | *filterLevel = (SkPaint::FilterLevel)fFilterCombo.itemData(index).toUInt(); |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 61 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 62 | return index > 0; |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 63 | } |
| 64 | |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 65 | QCheckBox* getRasterCheckBox() { |
| 66 | return &fRasterCheckBox; |
| 67 | } |
| 68 | |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 69 | QCheckBox* getOverdrawVizCheckBox() { |
| 70 | return &fOverdrawVizCheckBox; |
| 71 | } |
| 72 | |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 73 | QCheckBox* getMegaVizCheckBox() { |
| 74 | return &fMegaVizCheckBox; |
| 75 | } |
| 76 | |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 77 | QCheckBox* getPathOpsCheckBox() { |
| 78 | return &fPathOpsCheckBox; |
| 79 | } |
| 80 | |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 81 | private slots: |
| 82 | void updateCommand(int newCommand); |
chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 83 | void updateHit(int newHit); |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 84 | |
| 85 | signals: |
| 86 | void scrollingPreferences(bool isStickyActivate); |
| 87 | void showStyle(bool isSingleCommand); |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 88 | void visibilityFilterChanged(); |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 89 | void texFilterSettingsChanged(); |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 90 | #if SK_SUPPORT_GPU |
| 91 | void glSettingsChanged(); |
| 92 | #endif |
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: |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 95 | QVBoxLayout mainFrameLayout; |
| 96 | QFrame mainFrame; |
| 97 | QVBoxLayout fVerticalLayout; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 98 | |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 99 | QLabel fVisibleText; |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 100 | QFrame fVisibleFrame; |
| 101 | QVBoxLayout fVisibleFrameLayout; |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 102 | QComboBox fVisibilityCombo; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 103 | |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 104 | QLabel fCommandToggle; |
| 105 | QFrame fCommandFrame; |
| 106 | QVBoxLayout fCommandLayout; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 107 | |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 108 | QHBoxLayout fCurrentCommandLayout; |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 109 | QLabel fCurrentCommandLabel; |
chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 110 | QLineEdit fCurrentCommandBox; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 111 | |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 112 | QHBoxLayout fCommandHitLayout; |
chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 113 | QLabel fCommandHitLabel; |
| 114 | QLineEdit fCommandHitBox; |
chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 115 | |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 116 | QFrame fCanvasFrame; |
| 117 | QVBoxLayout fCanvasLayout; |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 118 | QLabel fCanvasToggle; |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 119 | |
| 120 | QHBoxLayout fRasterLayout; |
| 121 | QLabel fRasterLabel; |
| 122 | QCheckBox fRasterCheckBox; |
| 123 | |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 124 | QHBoxLayout fVizLayout; |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 125 | QLabel fOverdrawVizLabel; |
| 126 | QCheckBox fOverdrawVizCheckBox; |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 127 | QLabel fMegaVizLabel; |
| 128 | QCheckBox fMegaVizCheckBox; |
commit-bot@chromium.org | 2a67e12 | 2014-05-19 13:53:10 +0000 | [diff] [blame] | 129 | QLabel fPathOpsLabel; |
| 130 | QCheckBox fPathOpsCheckBox; |
robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 131 | |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 132 | #if SK_SUPPORT_GPU |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 133 | QHBoxLayout fGLLayout; |
| 134 | QLabel fGLLabel; |
| 135 | QCheckBox fGLCheckBox; |
commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 136 | QGroupBox fGLMSAAButtonGroup; |
| 137 | QVBoxLayout fGLMSAALayout; |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 138 | QComboBox fGLMSAACombo; |
robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 139 | #endif |
chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 140 | |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 141 | // for filtering group |
| 142 | QGroupBox fFilterButtonGroup; |
commit-bot@chromium.org | 22d3933 | 2013-11-21 15:37:29 +0000 | [diff] [blame] | 143 | QComboBox fFilterCombo; |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 144 | QVBoxLayout fFilterLayout; |
robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 145 | |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 146 | QFrame fZoomFrame; |
chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 147 | QHBoxLayout fZoomLayout; |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 148 | QLabel fZoomSetting; |
| 149 | QLineEdit fZoomBox; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | #endif /* SKSETTINGSWIDGET_H_ */ |