# HG changeset patch # User Jacob Dawid # Date 1303292129 -7200 # Node ID 3b7573c783cc1f9a522f59dc6130be9844ae38d0 # Parent ba1f40c33359e49a0434cda445f1688de33c6dcf Build data source selection. diff -r ba1f40c33359 -r 3b7573c783cc gui/src/Plot2dWidget.cpp --- a/gui/src/Plot2dWidget.cpp Wed Apr 20 10:57:58 2011 +0200 +++ b/gui/src/Plot2dWidget.cpp Wed Apr 20 11:35:29 2011 +0200 @@ -3,6 +3,7 @@ #include #include #include +#include #include Plot2dView::Plot2dView(QWidget *parent) @@ -121,6 +122,14 @@ construct(); } +void Plot2dWidget::dataSourceTypeChanged(QString type) { + if(type == "Sampled") { + m_dataSourceStackedWidget->setCurrentIndex(0); + } else if(type == "Parameterized") { + m_dataSourceStackedWidget->setCurrentIndex(1); + } +} + void Plot2dWidget::construct() { QVBoxLayout *layout = new QVBoxLayout(); m_plot2dView = new Plot2dView(this); @@ -131,24 +140,68 @@ m_tabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); layout->addWidget(m_tabWidget); + m_generalTab = new QWidget(this); m_dataSourceTab = new QWidget(this); m_verticalAxisTab = new QWidget(this); m_horizontalAxisTab = new QWidget(this); + m_tabWidget->addTab(m_generalTab, tr("General")); m_tabWidget->addTab(m_dataSourceTab, tr("Data Source")); m_tabWidget->addTab(m_verticalAxisTab, tr("Vertical Axis")); m_tabWidget->addTab(m_horizontalAxisTab, tr("Horizontal Axis")); + // Build general tab. + QHBoxLayout *generalTabLayout = new QHBoxLayout(); + m_generalTab->setLayout(generalTabLayout); + // Build data source tab. QHBoxLayout *dataSourceTabLayout = new QHBoxLayout(); - m_dataSourceTypeComboBox = new QComboBox(this); + m_dataSourceTypeComboBox->addItem(tr("Sampled")); m_dataSourceTypeComboBox->addItem(tr("Parameterized")); - m_dataSourceTypeComboBox->addItem(tr("Sampled")); + + m_dataSourceStackedWidget = new QStackedWidget(this); + m_sampledFromLineEdit = new QLineEdit("0", this); + m_sampledToLineEdit = new QLineEdit("4096", this); + m_parameterizedFromLineEdit = new QLineEdit("0.0", this); + m_parameterizedToLineEdit = new QLineEdit("1.0", this); + + m_sampledFromLineEdit->setAlignment(Qt::AlignRight); + m_sampledToLineEdit->setAlignment(Qt::AlignRight); + m_parameterizedFromLineEdit->setAlignment(Qt::AlignRight); + m_parameterizedToLineEdit->setAlignment(Qt::AlignRight); + + QWidget *sampledDataSourceRange = new QWidget(this); + QHBoxLayout *sampledDataSourceLayout = new QHBoxLayout(); + sampledDataSourceLayout->addWidget(new QLabel(tr("From sample"), this)); + sampledDataSourceLayout->addWidget(m_sampledFromLineEdit); + sampledDataSourceLayout->addWidget(new QLabel(tr("to sample"), this)); + sampledDataSourceLayout->addWidget(m_sampledToLineEdit); + sampledDataSourceLayout->addWidget(new QLabel(".", this)); + sampledDataSourceLayout->setMargin(0); + sampledDataSourceRange->setLayout(sampledDataSourceLayout); + + QWidget *parameterizedDataSourceRange = new QWidget(this); + QHBoxLayout *parameterizedDataSourceLayout = new QHBoxLayout(); + parameterizedDataSourceLayout->addWidget(new QLabel(tr("From value"), this)); + parameterizedDataSourceLayout->addWidget(m_parameterizedFromLineEdit); + parameterizedDataSourceLayout->addWidget(new QLabel(tr("to value"), this)); + parameterizedDataSourceLayout->addWidget(m_parameterizedToLineEdit); + parameterizedDataSourceLayout->addWidget(new QLabel(".", this)); + parameterizedDataSourceLayout->setMargin(0); + parameterizedDataSourceRange->setLayout(parameterizedDataSourceLayout); + + m_dataSourceStackedWidget->addWidget(sampledDataSourceRange); + m_dataSourceStackedWidget->addWidget(parameterizedDataSourceRange); + + m_refreshDataRangeButton = new QPushButton(tr("Refresh"), this); + dataSourceTabLayout->addWidget(new QLabel(tr("Type:"), this)); dataSourceTabLayout->addWidget(m_dataSourceTypeComboBox); - dataSourceTabLayout->addStretch(); + dataSourceTabLayout->addWidget(m_dataSourceStackedWidget); + dataSourceTabLayout->addWidget(m_refreshDataRangeButton); m_dataSourceTab->setLayout(dataSourceTabLayout); layout->setMargin(0); setLayout(layout); + connect(m_dataSourceTypeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(dataSourceTypeChanged(QString))); } diff -r ba1f40c33359 -r 3b7573c783cc gui/src/Plot2dWidget.h --- a/gui/src/Plot2dWidget.h Wed Apr 20 10:57:58 2011 +0200 +++ b/gui/src/Plot2dWidget.h Wed Apr 20 11:35:29 2011 +0200 @@ -4,9 +4,12 @@ #include #include #include +#include #include #include #include +#include +#include class Plot2dView : public QGLWidget { Q_OBJECT @@ -45,17 +48,24 @@ signals: public slots: + void dataSourceTypeChanged(QString type); private: void construct(); Plot2dView *m_plot2dView; QTabWidget *m_tabWidget; + QWidget *m_generalTab; QWidget *m_dataSourceTab; QWidget *m_verticalAxisTab; QWidget *m_horizontalAxisTab; QComboBox *m_dataSourceTypeComboBox; - + QStackedWidget *m_dataSourceStackedWidget; + QLineEdit *m_sampledFromLineEdit; + QLineEdit *m_sampledToLineEdit; + QLineEdit *m_parameterizedFromLineEdit; + QLineEdit *m_parameterizedToLineEdit; + QPushButton *m_refreshDataRangeButton; }; #endif // PLOT2DWIDGET_H