Home | History | Annotate | Download | only in QT
      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 <QCheckBox>
     20 #include <QLineEdit>
     21 #include <QComboBox>
     22 #include <QFormLayout>
     23 
     24 #include "SkPaint.h"
     25 
     26 /** \class SkSettingsWidget
     27 
     28     The SettingsWidget contains multiple checkboxes and toggles for altering
     29     the visualizations.
     30  */
     31 class SkSettingsWidget : public QFrame {
     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      */
     39     SkSettingsWidget();
     40 
     41 
     42 #if SK_SUPPORT_GPU
     43     // GL settings.
     44     bool isGLActive() const {
     45         return fGLGroup.isChecked();
     46     }
     47 
     48     int getGLSampleCount() const {
     49         return fGLMSAACombo.itemData(fGLMSAACombo.currentIndex()).toInt();
     50     }
     51 
     52 #endif
     53 
     54     bool getFilterOverride(SkFilterQuality* filterQuality) const {
     55         int index = fFilterCombo.currentIndex();
     56         *filterQuality = (SkFilterQuality)fFilterCombo.itemData(index).toUInt();
     57 
     58         return index > 0;
     59     }
     60 
     61 
     62     // Raster settings.
     63     bool isRasterEnabled() {
     64         return fRasterGroup.isChecked();
     65     }
     66 
     67     bool isOverdrawVizEnabled() {
     68         return fOverdrawVizCheckBox.isChecked();
     69     }
     70 
     71     // Visualizations.
     72     bool isVisibilityFilterEnabled() const {
     73         return fVisibilityFilterCheckBox.isChecked();
     74     }
     75 
     76     bool isMegaVizEnabled() {
     77         return fMegaVizCheckBox.isChecked();
     78     }
     79 
     80     bool isPathOpsEnabled() {
     81         return fPathOpsCheckBox.isChecked();
     82     }
     83 
     84 private slots:
     85 
     86 signals:
     87     void visualizationsChanged();
     88     void texFilterSettingsChanged();
     89 #if SK_SUPPORT_GPU
     90     void glSettingsChanged();
     91 #endif
     92     void rasterSettingsChanged();
     93 
     94 private:
     95     QFormLayout fVerticalLayout;
     96 
     97     QGroupBox fVisualizationsGroup;
     98     QVBoxLayout fVisualizationsLayout;
     99     QCheckBox fVisibilityFilterCheckBox;
    100 
    101     QGroupBox fRasterGroup;
    102     QVBoxLayout fRasterLayout;
    103     QCheckBox fOverdrawVizCheckBox;
    104     QCheckBox fMegaVizCheckBox;
    105     QCheckBox fPathOpsCheckBox;
    106 
    107 #if SK_SUPPORT_GPU
    108     QGroupBox fGLGroup;
    109     QFormLayout fGLLayout;
    110     QComboBox fGLMSAACombo;
    111 #endif
    112 
    113     QComboBox fFilterCombo;
    114 };
    115 
    116 #endif /* SKSETTINGSWIDGET_H_ */
    117