| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SKSETTINGSWIDGET_H_ | 10 #ifndef SKSETTINGSWIDGET_H_ |
| 11 #define SKSETTINGSWIDGET_H_ | 11 #define SKSETTINGSWIDGET_H_ |
| 12 | 12 |
| 13 #include <QWidget> | 13 #include <QWidget> |
| 14 #include <QHBoxLayout> | 14 #include <QHBoxLayout> |
| 15 #include <QTextEdit> | 15 #include <QTextEdit> |
| 16 #include <QFrame> | 16 #include <QFrame> |
| 17 #include <QGroupBox> | 17 #include <QGroupBox> |
| 18 #include <QLabel> | 18 #include <QLabel> |
| 19 #include <QRadioButton> | |
| 20 #include <QCheckBox> | 19 #include <QCheckBox> |
| 21 #include <QLineEdit> | 20 #include <QLineEdit> |
| 21 #include <QComboBox> |
| 22 | 22 |
| 23 #include "SkPaint.h" | 23 #include "SkPaint.h" |
| 24 | 24 |
| 25 /** \class SkSettingsWidget | 25 /** \class SkSettingsWidget |
| 26 | 26 |
| 27 The SettingsWidget contains multiple checkboxes and toggles for altering | 27 The SettingsWidget contains multiple checkboxes and toggles for altering |
| 28 the visibility. | 28 the visibility. |
| 29 */ | 29 */ |
| 30 class SkSettingsWidget : public QWidget { | 30 class SkSettingsWidget : public QWidget { |
| 31 Q_OBJECT | 31 Q_OBJECT |
| 32 | 32 |
| 33 public: | 33 public: |
| 34 /** | 34 /** |
| 35 Constructs a widget with the specified parent for layout purposes. | 35 Constructs a widget with the specified parent for layout purposes. |
| 36 @param parent The parent container of this widget | 36 @param parent The parent container of this widget |
| 37 */ | 37 */ |
| 38 SkSettingsWidget(); | 38 SkSettingsWidget(); |
| 39 | 39 |
| 40 /** Sets the displayed user zoom level. A scale of 1.0 represents no zoom. *
/ | 40 /** Sets the displayed user zoom level. A scale of 1.0 represents no zoom. *
/ |
| 41 void setZoomText(float scale); | 41 void setZoomText(float scale); |
| 42 | 42 |
| 43 QRadioButton* getVisibilityButton(); | 43 bool getVisibilityFilter() const { |
| 44 return fVisibilityCombo.itemData(fVisibilityCombo.currentIndex()).toBool
(); |
| 45 } |
| 44 | 46 |
| 45 #if SK_SUPPORT_GPU | 47 #if SK_SUPPORT_GPU |
| 46 bool isGLActive() { | 48 bool isGLActive() const { |
| 47 return fGLCheckBox.isChecked(); | 49 return fGLCheckBox.isChecked(); |
| 48 } | 50 } |
| 49 | 51 |
| 50 int getGLSampleCount() { | 52 int getGLSampleCount() const { |
| 51 if (fGLMSAA4On.isChecked()) { | 53 return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt(); |
| 52 return 4; | |
| 53 } else if (fGLMSAA16On.isChecked()) { | |
| 54 return 16; | |
| 55 } | |
| 56 return 0; | |
| 57 } | 54 } |
| 58 | 55 |
| 59 #endif | 56 #endif |
| 60 | 57 |
| 61 bool getFilterOverride(SkPaint::FilterLevel* filterLevel) { | 58 bool getFilterOverride(SkPaint::FilterLevel* filterLevel) const { |
| 62 if (fFilterDefault.isChecked()) { | 59 int index = fFilterCombo.currentIndex(); |
| 63 *filterLevel = SkPaint::kNone_FilterLevel; | 60 *filterLevel = (SkPaint::FilterLevel)fFilterCombo.itemData(index).toUInt
(); |
| 64 return false; | |
| 65 } | |
| 66 | 61 |
| 67 if (fFilterNone.isChecked()) { | 62 return index > 0; |
| 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 } | 63 } |
| 79 | 64 |
| 80 QCheckBox* getRasterCheckBox() { | 65 QCheckBox* getRasterCheckBox() { |
| 81 return &fRasterCheckBox; | 66 return &fRasterCheckBox; |
| 82 } | 67 } |
| 83 | 68 |
| 84 QCheckBox* getOverdrawVizCheckBox() { | 69 QCheckBox* getOverdrawVizCheckBox() { |
| 85 return &fOverdrawVizCheckBox; | 70 return &fOverdrawVizCheckBox; |
| 86 } | 71 } |
| 87 | 72 |
| 88 private slots: | 73 private slots: |
| 89 void updateCommand(int newCommand); | 74 void updateCommand(int newCommand); |
| 90 void updateHit(int newHit); | 75 void updateHit(int newHit); |
| 91 | 76 |
| 92 signals: | 77 signals: |
| 93 void scrollingPreferences(bool isStickyActivate); | 78 void scrollingPreferences(bool isStickyActivate); |
| 94 void showStyle(bool isSingleCommand); | 79 void showStyle(bool isSingleCommand); |
| 95 void visibilityFilter(bool isEnabled); | 80 void visibilityFilterChanged(); |
| 96 void texFilterSettingsChanged(); | 81 void texFilterSettingsChanged(); |
| 97 #if SK_SUPPORT_GPU | 82 #if SK_SUPPORT_GPU |
| 98 void glSettingsChanged(); | 83 void glSettingsChanged(); |
| 99 #endif | 84 #endif |
| 100 | 85 |
| 101 private: | 86 private: |
| 102 QVBoxLayout mainFrameLayout; | 87 QVBoxLayout mainFrameLayout; |
| 103 QFrame mainFrame; | 88 QFrame mainFrame; |
| 104 QVBoxLayout fVerticalLayout; | 89 QVBoxLayout fVerticalLayout; |
| 105 | 90 |
| 106 QLabel fVisibileText; | 91 QLabel fVisibleText; |
| 107 QFrame fVisibleFrame; | 92 QFrame fVisibleFrame; |
| 108 QVBoxLayout fVisibleFrameLayout; | 93 QVBoxLayout fVisibleFrameLayout; |
| 109 QRadioButton fVisibleOn; | 94 QComboBox fVisibilityCombo; |
| 110 QRadioButton fVisibleOff; | |
| 111 | 95 |
| 112 QLabel fCommandToggle; | 96 QLabel fCommandToggle; |
| 113 QFrame fCommandFrame; | 97 QFrame fCommandFrame; |
| 114 QVBoxLayout fCommandLayout; | 98 QVBoxLayout fCommandLayout; |
| 115 | 99 |
| 116 QHBoxLayout fCurrentCommandLayout; | 100 QHBoxLayout fCurrentCommandLayout; |
| 117 QLabel fCurrentCommandLabel; | 101 QLabel fCurrentCommandLabel; |
| 118 QLineEdit fCurrentCommandBox; | 102 QLineEdit fCurrentCommandBox; |
| 119 | 103 |
| 120 QHBoxLayout fCommandHitLayout; | 104 QHBoxLayout fCommandHitLayout; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 132 QHBoxLayout fOverdrawVizLayout; | 116 QHBoxLayout fOverdrawVizLayout; |
| 133 QLabel fOverdrawVizLabel; | 117 QLabel fOverdrawVizLabel; |
| 134 QCheckBox fOverdrawVizCheckBox; | 118 QCheckBox fOverdrawVizCheckBox; |
| 135 | 119 |
| 136 #if SK_SUPPORT_GPU | 120 #if SK_SUPPORT_GPU |
| 137 QHBoxLayout fGLLayout; | 121 QHBoxLayout fGLLayout; |
| 138 QLabel fGLLabel; | 122 QLabel fGLLabel; |
| 139 QCheckBox fGLCheckBox; | 123 QCheckBox fGLCheckBox; |
| 140 QGroupBox fGLMSAAButtonGroup; | 124 QGroupBox fGLMSAAButtonGroup; |
| 141 QVBoxLayout fGLMSAALayout; | 125 QVBoxLayout fGLMSAALayout; |
| 142 QRadioButton fGLMSAAOff; | 126 QComboBox fGLMSAACombo; |
| 143 QRadioButton fGLMSAA4On; | |
| 144 QRadioButton fGLMSAA16On; | |
| 145 #endif | 127 #endif |
| 146 | 128 |
| 147 // for filtering group | 129 // for filtering group |
| 148 QGroupBox fFilterButtonGroup; | 130 QGroupBox fFilterButtonGroup; |
| 131 QComboBox fFilterCombo; |
| 149 QVBoxLayout fFilterLayout; | 132 QVBoxLayout fFilterLayout; |
| 150 QRadioButton fFilterDefault; | |
| 151 QRadioButton fFilterNone; | |
| 152 QRadioButton fFilterLow; | |
| 153 QRadioButton fFilterMed; | |
| 154 QRadioButton fFilterHigh; | |
| 155 | 133 |
| 156 QFrame fZoomFrame; | 134 QFrame fZoomFrame; |
| 157 QHBoxLayout fZoomLayout; | 135 QHBoxLayout fZoomLayout; |
| 158 QLabel fZoomSetting; | 136 QLabel fZoomSetting; |
| 159 QLineEdit fZoomBox; | 137 QLineEdit fZoomBox; |
| 160 }; | 138 }; |
| 161 | 139 |
| 162 #endif /* SKSETTINGSWIDGET_H_ */ | 140 #endif /* SKSETTINGSWIDGET_H_ */ |
| OLD | NEW |