Added stubs for zoom info panel.
Review URL: https://codereview.appspot.com/6350071
git-svn-id: http://skia.googlecode.com/svn/trunk@4493 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkSettingsWidget.cpp b/debugger/QT/SkSettingsWidget.cpp
index 0c94b3d..117e7bf 100644
--- a/debugger/QT/SkSettingsWidget.cpp
+++ b/debugger/QT/SkSettingsWidget.cpp
@@ -8,70 +8,115 @@
#include "SkSettingsWidget.h"
+#include <iostream>
+#include <math.h>
-SkSettingsWidget::SkSettingsWidget(QWidget *parent) : QWidget(parent) {
- mainFrameLayout = new QVBoxLayout(this);
- mainFrameLayout->setSpacing(6);
- mainFrameLayout->setContentsMargins(0,0,0,0);
+SkSettingsWidget::SkSettingsWidget(QWidget *parent) : QWidget(parent)
+ , mainFrameLayout(this)
+ , fVerticalLayout(&mainFrame)
+ , fVisibleFrameLayout(&fVisibleFrame)
+ , fVisibleOn(&fVisibleFrame)
+ , fVisibleOff(&fVisibleFrame)
+ , fCommandLayout(&fCommandFrame)
+ , fCurrentCommandBox(&fCommandFrame)
+ , fCommandCheckBox(&fCommandFrame)
+ , fZoomBox(&fZoomFrame)
+ , fZoomLayout(&fZoomFrame)
+{
+ // Sets up the container and it's alignment around the settings widget.
+ mainFrame.setFrameShape(QFrame::StyledPanel);
+ mainFrame.setFrameShadow(QFrame::Raised);
+ mainFrameLayout.setSpacing(6);
+ mainFrameLayout.setContentsMargins(0,0,0,0);
+ mainFrameLayout.addWidget(&mainFrame);
+ // Vertical Layout is the alignment inside of the main frame.
+ fVerticalLayout.setContentsMargins(11,11,11,11);
+ fVerticalLayout.setAlignment(Qt::AlignTop);
- mainFrame = new QFrame();
- mainFrame->setFrameShape(QFrame::StyledPanel);
- mainFrame->setFrameShadow(QFrame::Raised);
+ // Visible Toggle
+ fVisibileText.setText("Visibility Filter");
+ fVisibleFrame.setFrameShape(QFrame::StyledPanel);
+ fVisibleFrame.setFrameShadow(QFrame::Raised);
+ fVisibleOn.setText("On");
+ fVisibleOff.setText("Off");
+ fVisibleOff.setChecked(true);
+ fVisibleFrameLayout.setSpacing(6);
+ fVisibleFrameLayout.setContentsMargins(11,11,11,11);
+ fVisibleFrameLayout.addWidget(&fVisibleOn);
+ fVisibleFrameLayout.addWidget(&fVisibleOff);
- mainFrameLayout->addWidget(mainFrame);
+ // Command Toggle
+ fCommandToggle.setText("Command Scrolling Preferences");
+ fCommandFrame.setFrameShape(QFrame::StyledPanel);
+ fCommandFrame.setFrameShadow(QFrame::Raised);
- fVerticalLayout = new QVBoxLayout(mainFrame);
- fVerticalLayout->setContentsMargins(11,11,11,11);
- fVerticalLayout->setAlignment(Qt::AlignTop);
+ fCurrentCommandLabel.setText("Current Command: ");
+ fCurrentCommandLabel.setMinimumWidth(178);
+ fCurrentCommandLabel.setMaximumWidth(178);
+ fCurrentCommandBox.setText("0");
+ fCurrentCommandBox.setMinimumSize(QSize(50,25));
+ fCurrentCommandBox.setMaximumSize(QSize(50,25));
+ fCurrentCommandBox.setAlignment(Qt::AlignRight);
- fVisibility = new QLabel();
- fVisibility->setText("Visibility Filter");
+ fCurrentCommandLayout.setSpacing(0);
+ fCurrentCommandLayout.setContentsMargins(0,0,0,0);
+ fCurrentCommandLayout.setAlignment(Qt::AlignLeft);
+ fCurrentCommandLayout.addWidget(&fCurrentCommandLabel);
+ fCurrentCommandLayout.addWidget(&fCurrentCommandBox);
- fFrame = new QFrame();
- fFrame->setFrameShape(QFrame::StyledPanel);
- fFrame->setFrameShadow(QFrame::Raised);
+ fCommandCheckBox.setText("Pause");
+ fCommandLayout.setSpacing(6);
+ fCommandLayout.setContentsMargins(11,11,11,11);
+ fCommandLayout.addLayout(&fCurrentCommandLayout);
+ fCommandLayout.addWidget(&fCommandCheckBox);
- fVerticalLayout_2 = new QVBoxLayout(fFrame);
- fVerticalLayout_2->setSpacing(6);
- fVerticalLayout_2->setContentsMargins(11,11,11,11);
+ // Zoom Info
+ fZoomSetting.setText("Zoom Level: ");
+ fZoomSetting.setMinimumWidth(178);
+ fZoomSetting.setMaximumWidth(178);
+ fZoomFrame.setFrameShape(QFrame::StyledPanel);
+ fZoomFrame.setFrameShadow(QFrame::Raised);
+ fZoomBox.setText("100%");
+ fZoomBox.setMinimumSize(QSize(50,25));
+ fZoomBox.setMaximumSize(QSize(50,25));
+ fZoomBox.setAlignment(Qt::AlignRight);
+ fZoomLayout.setSpacing(6);
+ fZoomLayout.setContentsMargins(11,11,11,11);
+ fZoomLayout.addWidget(&fZoomSetting);
+ fZoomLayout.addWidget(&fZoomBox);
- fVerticalLayout->addWidget(fVisibility);
- fVerticalLayout->addWidget(fFrame);
+ // Adds all widgets to settings container
+ fVerticalLayout.addWidget(&fVisibileText);
+ fVerticalLayout.addWidget(&fVisibleFrame);
+ fVerticalLayout.addWidget(&fCommandToggle);
+ fVerticalLayout.addWidget(&fCommandFrame);
+ fVerticalLayout.addWidget(&fZoomFrame);
- fVisibleOn = new QRadioButton(fFrame);
- fVisibleOn->setText("On");
- fVisibleOff = new QRadioButton(fFrame);
- fVisibleOff->setText("Off");
-
- fVisibleOff->setChecked(true);
-
- fVerticalLayout_2->addWidget(fVisibleOn);
- fVerticalLayout_2->addWidget(fVisibleOff);
-
- fCommandToggle = new QLabel();
- fCommandToggle->setText("Command Scrolling Preferences");
-
- fCommandFrame = new QFrame();
- fCommandFrame->setFrameShape(QFrame::StyledPanel);
- fCommandFrame->setFrameShadow(QFrame::Raised);
-
- fCommandLayout = new QVBoxLayout(fCommandFrame);
- fCommandLayout->setSpacing(6);
- fCommandLayout->setContentsMargins(11,11,11,11);
-
- fVerticalLayout->addWidget(fCommandToggle);
- fVerticalLayout->addWidget(fCommandFrame);
-
- fCommandCheckBox = new QCheckBox(fCommandFrame);
- fCommandCheckBox->setText("Toggle Sticky Activate");
- fCommandSingleDraw = new QCheckBox(fCommandFrame);
- fCommandSingleDraw->setText("Display Single Command");
-
- fCommandLayout->addWidget(fCommandCheckBox);
- fCommandLayout->addWidget(fCommandSingleDraw);
-
- this->setDisabled(true);
+ //this->setDisabled(true);
}
SkSettingsWidget::~SkSettingsWidget() {}
+
+
+void SkSettingsWidget::updateCommand(int newCommand) {
+ fCurrentCommandBox.setText(QString::number(newCommand));
+}
+
+QCheckBox* SkSettingsWidget::getCommandCheckBox() {
+ return &fCommandCheckBox;
+}
+
+QRadioButton* SkSettingsWidget::getVisibilityButton() {
+ return &fVisibleOn;
+}
+
+void SkSettingsWidget::setZoomText(int scaleFactor) {
+ if(scaleFactor == 1 || scaleFactor == -1) {
+ fZoomBox.setText("100%");
+ } else if (scaleFactor > 1) {
+ fZoomBox.setText(QString::number(scaleFactor*100).append("%"));
+ } else if (scaleFactor < -1) {
+ fZoomBox.setText(QString::number(100 / pow(2, (-scaleFactor - 1))).append("%"));
+ }
+}