| 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> |
| 19 | #include <QRadioButton> |
| 20 | #include <QCheckBox> |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 21 | #include <QLineEdit> |
| 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 | |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 43 | QRadioButton* getVisibilityButton(); |
| 44 | |
| robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 45 | #if SK_SUPPORT_GPU |
| commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 46 | bool isGLActive() { |
| 47 | return fGLCheckBox.isChecked(); |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 48 | } |
| commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 49 | |
| 50 | int getGLSampleCount() { |
| 51 | if (fGLMSAA4On.isChecked()) { |
| 52 | return 4; |
| 53 | } else if (fGLMSAA16On.isChecked()) { |
| 54 | return 16; |
| 55 | } |
| 56 | return 0; |
| 57 | } |
| 58 | |
| robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 59 | #endif |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 60 | |
| robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 61 | bool getFilterOverride(SkPaint::FilterLevel* filterLevel) { |
| 62 | if (fFilterDefault.isChecked()) { |
| 63 | *filterLevel = SkPaint::kNone_FilterLevel; |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | if (fFilterNone.isChecked()) { |
| 68 | *filterLevel = SkPaint::kNone_FilterLevel; |
| 69 | } else if (fFilterLow.isChecked()) { |
| 70 | *filterLevel = SkPaint::kLow_FilterLevel; |
| 71 | } else if (fFilterMed.isChecked()) { |
| 72 | *filterLevel = SkPaint::kMedium_FilterLevel; |
| 73 | } else { |
| 74 | *filterLevel = SkPaint::kHigh_FilterLevel; |
| 75 | } |
| 76 | |
| 77 | return true; |
| 78 | } |
| 79 | |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 80 | QCheckBox* getRasterCheckBox() { |
| 81 | return &fRasterCheckBox; |
| 82 | } |
| 83 | |
| robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 84 | QCheckBox* getOverdrawVizCheckBox() { |
| 85 | return &fOverdrawVizCheckBox; |
| 86 | } |
| 87 | |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 88 | private slots: |
| 89 | void updateCommand(int newCommand); |
| chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 90 | void updateHit(int newHit); |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 91 | |
| 92 | signals: |
| 93 | void scrollingPreferences(bool isStickyActivate); |
| 94 | void showStyle(bool isSingleCommand); |
| 95 | void visibilityFilter(bool isEnabled); |
| robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 96 | void texFilterSettingsChanged(); |
| commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 97 | #if SK_SUPPORT_GPU |
| 98 | void glSettingsChanged(); |
| 99 | #endif |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 100 | |
| chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 101 | private: |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 102 | QVBoxLayout mainFrameLayout; |
| 103 | QFrame mainFrame; |
| 104 | QVBoxLayout fVerticalLayout; |
| chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 105 | |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 106 | QLabel fVisibileText; |
| 107 | QFrame fVisibleFrame; |
| 108 | QVBoxLayout fVisibleFrameLayout; |
| 109 | QRadioButton fVisibleOn; |
| 110 | QRadioButton fVisibleOff; |
| chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 111 | |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 112 | QLabel fCommandToggle; |
| 113 | QFrame fCommandFrame; |
| 114 | QVBoxLayout fCommandLayout; |
| chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 115 | |
| chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 116 | QHBoxLayout fCurrentCommandLayout; |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 117 | QLabel fCurrentCommandLabel; |
| chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 118 | QLineEdit fCurrentCommandBox; |
| chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 119 | |
| chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 120 | QHBoxLayout fCommandHitLayout; |
| chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 121 | QLabel fCommandHitLabel; |
| 122 | QLineEdit fCommandHitBox; |
| chudy@google.com | e606d6e | 2012-07-12 14:31:25 +0000 | [diff] [blame] | 123 | |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 124 | QFrame fCanvasFrame; |
| 125 | QVBoxLayout fCanvasLayout; |
| chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 126 | QLabel fCanvasToggle; |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 127 | |
| 128 | QHBoxLayout fRasterLayout; |
| 129 | QLabel fRasterLabel; |
| 130 | QCheckBox fRasterCheckBox; |
| 131 | |
| robertphillips@google.com | f4741c1 | 2013-02-06 20:13:54 +0000 | [diff] [blame] | 132 | QHBoxLayout fOverdrawVizLayout; |
| 133 | QLabel fOverdrawVizLabel; |
| 134 | QCheckBox fOverdrawVizCheckBox; |
| 135 | |
| robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 136 | #if SK_SUPPORT_GPU |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 137 | QHBoxLayout fGLLayout; |
| 138 | QLabel fGLLabel; |
| 139 | QCheckBox fGLCheckBox; |
| commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 140 | QGroupBox fGLMSAAButtonGroup; |
| 141 | QVBoxLayout fGLMSAALayout; |
| 142 | QRadioButton fGLMSAAOff; |
| 143 | QRadioButton fGLMSAA4On; |
| 144 | QRadioButton fGLMSAA16On; |
| robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 145 | #endif |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 146 | |
| robertphillips@google.com | 32bbcf8 | 2013-10-17 17:56:10 +0000 | [diff] [blame] | 147 | // for filtering group |
| 148 | QGroupBox fFilterButtonGroup; |
| 149 | QVBoxLayout fFilterLayout; |
| 150 | QRadioButton fFilterDefault; |
| 151 | QRadioButton fFilterNone; |
| 152 | QRadioButton fFilterLow; |
| 153 | QRadioButton fFilterMed; |
| 154 | QRadioButton fFilterHigh; |
| 155 | |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 156 | QFrame fZoomFrame; |
| chudy@google.com | 7dcae67 | 2012-07-09 20:26:53 +0000 | [diff] [blame] | 157 | QHBoxLayout fZoomLayout; |
| chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 158 | QLabel fZoomSetting; |
| 159 | QLineEdit fZoomBox; |
| chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | #endif /* SKSETTINGSWIDGET_H_ */ |