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 #include "SkSettingsWidget.h"
     11 #include <iostream>
     12 #include <math.h>
     13 
     14 // TODO(chudy): See if the layout can't be attached to the frame post construction.
     15 SkSettingsWidget::SkSettingsWidget() : QFrame()
     16 {
     17     this->setLayout(&fVerticalLayout);
     18     this->setFrameStyle(QFrame::Panel);
     19     // Vertical Layout is the alignment inside of the main frame.
     20     fVerticalLayout.setAlignment(Qt::AlignTop);
     21 
     22     // Visualizations toggles.
     23     fVisualizationsGroup.setTitle("Visualizations");
     24 
     25     fVisibilityFilterCheckBox.setText("Visibility Filter");
     26     fVisualizationsLayout.addWidget(&fVisibilityFilterCheckBox);
     27 
     28     fMegaVizCheckBox.setText("Mega Viz");
     29     fVisualizationsLayout.addWidget(&fMegaVizCheckBox);
     30 
     31     fPathOpsCheckBox.setText("PathOps ");
     32     fVisualizationsLayout.addWidget(&fPathOpsCheckBox);
     33 
     34     fOverdrawVizCheckBox.setText("Overdraw Viz");
     35     fVisualizationsLayout.addWidget(&fOverdrawVizCheckBox);
     36 
     37     fVisualizationsGroup.setLayout(&fVisualizationsLayout);
     38 
     39     connect(&fVisibilityFilterCheckBox, SIGNAL(toggled(bool)), this,
     40             SIGNAL(visualizationsChanged()));
     41     connect(&fMegaVizCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(visualizationsChanged()));
     42     connect(&fPathOpsCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(visualizationsChanged()));
     43     connect(&fOverdrawVizCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(visualizationsChanged()));
     44 
     45     fVerticalLayout.addRow(&fVisualizationsGroup);
     46 
     47     // Raster toggles.
     48     fRasterGroup.setTitle("Raster");
     49     fRasterGroup.setCheckable(true);
     50     fRasterGroup.setLayout(&fRasterLayout);
     51     fVerticalLayout.addRow(&fRasterGroup);
     52 
     53     connect(&fRasterGroup, SIGNAL(toggled(bool)), this, SIGNAL(rasterSettingsChanged()));
     54 
     55 #if SK_SUPPORT_GPU
     56     fGLGroup.setTitle("OpenGL");
     57     fGLGroup.setCheckable(true);
     58     fGLGroup.setChecked(false);
     59     fGLMSAACombo.addItem("Off", QVariant(0));
     60     fGLMSAACombo.addItem("4", QVariant(4));
     61     fGLMSAACombo.addItem("16", QVariant(16));
     62     fGLLayout.addRow("MSAA",  &fGLMSAACombo);
     63     fGLGroup.setLayout(&fGLLayout);
     64 
     65     connect(&fGLGroup, SIGNAL(toggled(bool)), this,
     66             SIGNAL(glSettingsChanged()));
     67     connect(&fGLMSAACombo, SIGNAL(activated(int)), this,
     68             SIGNAL(glSettingsChanged()));
     69 
     70     fVerticalLayout.addRow(&fGLGroup);
     71 #endif
     72 
     73     fFilterCombo.addItem("As encoded", QVariant(kNone_SkFilterQuality));
     74     fFilterCombo.addItem("None", QVariant(kNone_SkFilterQuality));
     75     fFilterCombo.addItem("Low", QVariant(kLow_SkFilterQuality));
     76     fFilterCombo.addItem("Medium", QVariant(kMedium_SkFilterQuality));
     77     fFilterCombo.addItem("High", QVariant(kHigh_SkFilterQuality));
     78     connect(&fFilterCombo, SIGNAL(activated(int)), this, SIGNAL(texFilterSettingsChanged()));
     79 
     80     fVerticalLayout.addRow("Filtering", &fFilterCombo);
     81     this->setDisabled(true);
     82 }
     83 
     84