SkSettingsWidget.h revision fde1e7ccb4524aa2e0c42872e529ee25d09e7f34
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>
17#include <QGroupBox>
18#include <QLabel>
19#include <QRadioButton>
20#include <QCheckBox>
21#include <QLineEdit>
22
23/** \class SkSettingsWidget
24
25    The SettingsWidget contains multiple checkboxes and toggles for altering
26    the visibility.
27 */
28class SkSettingsWidget : public QWidget {
29    Q_OBJECT
30
31public:
32    /**
33        Constructs a widget with the specified parent for layout purposes.
34        @param parent  The parent container of this widget
35     */
36    SkSettingsWidget();
37
38    /** Sets the displayed user zoom level. A scale of 1.0 represents no zoom. */
39    void setZoomText(float scale);
40
41    QRadioButton* getVisibilityButton();
42
43#if SK_SUPPORT_GPU
44    bool isGLActive() {
45        return fGLCheckBox.isChecked();
46    }
47
48    int getGLSampleCount() {
49        if (fGLMSAA4On.isChecked()) {
50            return 4;
51        } else if (fGLMSAA16On.isChecked()) {
52            return 16;
53        }
54        return 0;
55    }
56
57#endif
58
59    QCheckBox* getRasterCheckBox() {
60        return &fRasterCheckBox;
61    }
62
63    QCheckBox* getOverdrawVizCheckBox() {
64        return &fOverdrawVizCheckBox;
65    }
66
67private slots:
68    void updateCommand(int newCommand);
69    void updateHit(int newHit);
70
71signals:
72    void scrollingPreferences(bool isStickyActivate);
73    void showStyle(bool isSingleCommand);
74    void visibilityFilter(bool isEnabled);
75#if SK_SUPPORT_GPU
76    void glSettingsChanged();
77#endif
78
79private:
80    QVBoxLayout mainFrameLayout;
81    QFrame mainFrame;
82    QVBoxLayout fVerticalLayout;
83
84    QLabel fVisibileText;
85    QFrame fVisibleFrame;
86    QVBoxLayout fVisibleFrameLayout;
87    QRadioButton fVisibleOn;
88    QRadioButton fVisibleOff;
89
90    QLabel fCommandToggle;
91    QFrame fCommandFrame;
92    QVBoxLayout fCommandLayout;
93
94    QHBoxLayout fCurrentCommandLayout;
95    QLabel fCurrentCommandLabel;
96    QLineEdit fCurrentCommandBox;
97
98    QHBoxLayout fCommandHitLayout;
99    QLabel fCommandHitLabel;
100    QLineEdit fCommandHitBox;
101
102    QFrame fCanvasFrame;
103    QVBoxLayout fCanvasLayout;
104    QLabel fCanvasToggle;
105
106    QHBoxLayout fRasterLayout;
107    QLabel fRasterLabel;
108    QCheckBox fRasterCheckBox;
109
110    QHBoxLayout fOverdrawVizLayout;
111    QLabel fOverdrawVizLabel;
112    QCheckBox fOverdrawVizCheckBox;
113
114#if SK_SUPPORT_GPU
115    QHBoxLayout fGLLayout;
116    QLabel fGLLabel;
117    QCheckBox fGLCheckBox;
118    QGroupBox fGLMSAAButtonGroup;
119    QVBoxLayout fGLMSAALayout;
120    QRadioButton fGLMSAAOff;
121    QRadioButton fGLMSAA4On;
122    QRadioButton fGLMSAA16On;
123#endif
124
125    QFrame fZoomFrame;
126    QHBoxLayout fZoomLayout;
127    QLabel fZoomSetting;
128    QLineEdit fZoomBox;
129};
130
131#endif /* SKSETTINGSWIDGET_H_ */
132