コード例 #1
0
FlattenDlg::FlattenDlg( QWidget* parent, const char* name )
    : KDialog( parent )
{
    setObjectName(name);
    setModal(true);
    setCaption( i18n( "Flatten Path" ) );
    setButtons( Ok | Cancel );

    // add input fields on the left:
    QGroupBox* group = new QGroupBox( i18n( "Properties" ), this );

    QHBoxLayout* layout = new QHBoxLayout;

    layout->addWidget(new QLabel( i18n( "Flatness:" )));
    m_flatness = new KDoubleNumInput(group);
    layout->addWidget(m_flatness);

    group->setLayout(layout);
    group->setMinimumWidth( 300 );

    // signals and slots:
    connect( this, SIGNAL( okClicked() ), this, SLOT( accept() ) );
    connect( this, SIGNAL( cancelClicked() ), this, SLOT( reject() ) );

    setMainWidget( group );
}
コード例 #2
0
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// MainWindow::createGroupDisplay:
//
// Create group box for displaying images.
//
QGroupBox*
MainWindow::createGroupDisplay()
{
	// init group box
	QGroupBox *groupBox = new QGroupBox;
	groupBox->setMinimumWidth (700);
	groupBox->setMinimumHeight(700);
	groupBox->setStyleSheet(GroupBoxStyle);

	// create stacked widget for input/output images
	m_stackWidgetImages = new QStackedWidget;

	// add QLabels to image stacked widget to display input/output images
	for(int i = 0; i<2; ++i)
		m_stackWidgetImages->addWidget(new QLabel);

	// add centering alignment on both labels
	QLabel *label;
	label = (QLabel *) m_stackWidgetImages->widget(0); label->setAlignment(Qt::AlignCenter);
	label = (QLabel *) m_stackWidgetImages->widget(1); label->setAlignment(Qt::AlignCenter);

	// set stacked widget to default setting: input image
	m_stackWidgetImages->setCurrentIndex(0);

	// assemble stacked widget in vertical layout
	QVBoxLayout *vbox = new QVBoxLayout;
	vbox->addWidget(m_stackWidgetImages);
	groupBox->setLayout(vbox);

	return groupBox;
}
コード例 #3
0
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// HW3a::controlPanel:
//
// Create control panel groupbox.
//
QGroupBox*
HW3a::controlPanel()
{
	// init group box
	QGroupBox *groupBox = new QGroupBox("Homework 3a");

	// add your code here
//	.........

    groupBox->setMinimumWidth(300);

    m_sliderSubdiv = new QSlider(Qt::Horizontal);
    m_sliderSubdiv->setRange(0, 8);
    m_sliderSubdiv->setValue(0);

    // create spinBox
    m_spinBoxSubdiv = new QSpinBox;
    m_spinBoxSubdiv->setRange(0, 8);
    m_spinBoxSubdiv->setValue(0);

    m_sliderTheta = new QSlider(Qt::Horizontal);
    m_sliderTheta->setRange(0, 360);
    m_sliderTheta->setValue(0);

    m_spinBoxTheta = new QSpinBox;
    m_spinBoxTheta->setRange(0, 360);
    m_spinBoxTheta->setValue(0);

    QGridLayout *layout = new QGridLayout;
    QLabel *label = new QLabel("Subdivide");
    QLabel *label2 = new QLabel("Theta");

    m_checkBoxTwist = new QCheckBox("Twist");
    m_checkBoxWire = new QCheckBox("Wire");

    layout->addWidget(label,0,0,1,1);
    layout->addWidget(m_sliderSubdiv,0,1,1,3);
    layout->addWidget(m_spinBoxSubdiv,0,4);

    layout->addWidget(label2,2,0,3,1);
    layout->addWidget(m_sliderTheta, 2, 1, 3, 3);
    layout->addWidget(m_spinBoxTheta,3,4);

    layout->addWidget(m_checkBoxTwist, 5,0,2,2);
    layout->addWidget(m_checkBoxWire,5,2,2,2);

    connect(m_sliderSubdiv, SIGNAL(valueChanged(int)), this, SLOT(changeSubdiv(int)));
    connect(m_spinBoxSubdiv, SIGNAL(valueChanged(int)), this, SLOT(changeSubdiv(int)));

    connect(m_sliderTheta, SIGNAL(valueChanged(int)),this, SLOT(changeTheta(int)));
    connect(m_spinBoxTheta, SIGNAL(valueChanged(int)), this, SLOT(changeTheta(int)));

    connect(m_checkBoxTwist, SIGNAL(stateChanged(int)), this, SLOT(changeTwist(int)));
    connect(m_checkBoxWire, SIGNAL(stateChanged(int)), this, SLOT(changeWire(int)));

    groupBox->setLayout(layout);

	return(groupBox);
}
コード例 #4
0
QGroupBox*
HW1b::controlPanel()
{
	// init group box
	QGroupBox *groupBox = new QGroupBox("Homework 1b");
	groupBox->setMinimumWidth(300);

	m_sliderDividing = new QSlider(Qt::Horizontal);
	m_sliderDividing->setRange(0, 8);
	m_sliderDividing->setValue(0);

	// create spinBox
	m_spinBoxDividing = new QSpinBox;
	m_spinBoxDividing->setRange(0, 8);
	m_spinBoxDividing->setValue(0);
	
	m_sliderTheta = new QSlider(Qt::Horizontal);
	m_sliderTheta->setRange(0, 360);
	m_sliderTheta->setValue(0);

	m_spinBoxTheta = new QSpinBox;
	m_spinBoxTheta->setRange(0, 360);
	m_spinBoxTheta->setValue(0);

	QGridLayout *layout = new QGridLayout;
	QLabel *label = new QLabel("Subdivide");
	QLabel *label2 = new QLabel("Theta");

	m_checkBoxTwist = new QCheckBox("Twist");

	layout->addWidget(label,0,0,1,1);
	layout->addWidget(m_sliderDividing,0,1,1,3);
	layout->addWidget(m_spinBoxDividing,0,4);
	
	layout->addWidget(label2,2,0,3,1);
	layout->addWidget(m_sliderTheta, 2, 1, 3, 3);
	layout->addWidget(m_spinBoxTheta,3,4);

	layout->addWidget(m_checkBoxTwist, 4, 0);
	
	connect(m_sliderDividing, SIGNAL(valueChanged(int)), this, SLOT(changeDividing(int)));
	connect(m_spinBoxDividing, SIGNAL(valueChanged(int)), this, SLOT(changeDividing(int)));

	connect(m_sliderTheta, SIGNAL(valueChanged(int)),this, SLOT(changeTheta(int)));
	connect(m_spinBoxTheta, SIGNAL(valueChanged(int)), this, SLOT(changeTheta(int)));

	connect(m_checkBoxTwist, SIGNAL(stateChanged(int)), this, SLOT(setToTwist(int)));

	groupBox->setLayout(layout);

	

	return(groupBox);
}
コード例 #5
0
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// HW0b::controlPanel:
//
// Create control panel groupbox.
//
QGroupBox*
HW0b::controlPanel()
{
	// init group box
	QGroupBox *groupBox = new QGroupBox("Homework 0b");
	groupBox->setMinimumWidth(300);

	// layout for assembling widgets
	QGridLayout *layout = new QGridLayout;

	// create checkboxes
	m_checkBoxFlip = new QCheckBox("Flip y-coordinates");
	m_checkBoxAR   = new QCheckBox("Maintain aspect ratio");
	m_checkBoxFlip->setChecked(false);
	m_checkBoxAR  ->setChecked(true );

	// create slider to rotate data
	m_slider = new QSlider(Qt::Horizontal);
	m_slider->setRange(0, 360);
	m_slider->setValue(0);

	// create spinBox
	m_spinBox = new QSpinBox;
	m_spinBox->setRange(0, 360);
	m_spinBox->setValue(0);

	// slider label to display name
	QLabel *label = new QLabel("Rotation");

	// assemble widgets into layout
	layout->addWidget(m_checkBoxFlip, 0, 0, 1, 3);
	layout->addWidget(m_checkBoxAR  , 1, 0, 1, 3);
	layout->addWidget(label,     2, 0);
	layout->addWidget(m_slider,  2, 1);
	layout->addWidget(m_spinBox, 2, 2);

	// assign layout to group box
	groupBox->setLayout(layout);

	// init signal/slot connections
	connect(m_checkBoxFlip, SIGNAL(stateChanged(int)), this, SLOT(flipY(int)));
	connect(m_checkBoxAR  , SIGNAL(stateChanged(int)), this, SLOT(aspect(int)));
	connect(m_slider,	SIGNAL(valueChanged(int)), this, SLOT(rotate(int)));
	connect(m_spinBox,	SIGNAL(valueChanged(int)), this, SLOT(rotate(int)));

	return(groupBox);
}
コード例 #6
0
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// MainWindow::createGroupPanel:
//
// Create group box for control panel.
//
QGroupBox*
MainWindow::createGroupPanel()
{
	// init group box
	QGroupBox *groupBox = new QGroupBox;
	groupBox->setMinimumWidth(350);

	// filter's enum indexes into container of image filters
	m_imageFilterType[DUMMY	   ] = new Dummy;
	m_imageFilterType[THRESHOLD] = new Threshold;
	m_imageFilterType[CONTRAST ] = new Contrast;
	m_imageFilterType[QUANTIZATION] = new Quantization;
	m_imageFilterType[GAMMA] = new Gamma;
	m_imageFilterType[INTENSITY] = new Intensity;

	// create a stacked widget to hold multiple control panels
	m_stackWidgetPanels = new QStackedWidget;

	// add filter control panels to stacked widget
	m_stackWidgetPanels->addWidget(m_imageFilterType[DUMMY    ]->controlPanel());
	m_stackWidgetPanels->addWidget(m_imageFilterType[THRESHOLD]->controlPanel());
	m_stackWidgetPanels->addWidget(m_imageFilterType[CONTRAST ]->controlPanel());
	m_stackWidgetPanels->addWidget(m_imageFilterType[QUANTIZATION]->controlPanel());
	m_stackWidgetPanels->addWidget(m_imageFilterType[GAMMA]->controlPanel());
	m_stackWidgetPanels->addWidget(m_imageFilterType[INTENSITY]->controlPanel());

	// display blank dummmy panel initially
	m_stackWidgetPanels->setCurrentIndex(0);

	// assemble display and mode groups into horizontal layout
	QHBoxLayout *hbox = new QHBoxLayout;
	hbox->addWidget(createDisplayButtons());
	hbox->addWidget(createModeButtons   ());

	// assemble stacked widget in vertical layout
	QVBoxLayout *vbox = new QVBoxLayout;
	vbox->addLayout(hbox);
	vbox->addWidget(m_stackWidgetPanels);
	vbox->addStretch(1);
	vbox->addLayout(createExitButtons());
	groupBox->setLayout(vbox);

	return groupBox;
}
コード例 #7
0
RoundCornersDlg::RoundCornersDlg(QWidget* parent, const char* name)
        : QDialog(parent)
{
    setObjectName(name);
    setModal(true);
    setWindowTitle(i18n("Round Corners"));
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    QWidget *mainWidget = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    mainLayout->addWidget(mainWidget);

    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);

    // add input:
    QGroupBox* group = new QGroupBox(i18n("Properties"), this);

    QHBoxLayout* layout = new QHBoxLayout;

    layout->addWidget(new QLabel(i18n("Radius:")));
    m_radius = new KoUnitDoubleSpinBox(group);
    m_radius->setMinimum(1.0);
    layout->addWidget(m_radius);

    group->setLayout(layout);
    group->setMinimumWidth(300);

    // signals and Q_SLOTS:
    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
    connect(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));

    mainLayout->addWidget(group);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    //PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in layout. Please move it.
    mainLayout->addWidget(buttonBox);
}
コード例 #8
0
ファイル: FlattenPathPlugin.cpp プロジェクト: KDE/calligra
FlattenDlg::FlattenDlg(QWidget* parent, const char* name)
        : QDialog(parent)
{
    setObjectName(name);
    setModal(true);
    setWindowTitle(i18n("Flatten Path"));
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    QWidget *mainWidget = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
    mainLayout->addWidget(mainWidget);
    
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);

    // add input fields on the left:
    QGroupBox* group = new QGroupBox(i18n("Properties"), this);

    QHBoxLayout* layout = new QHBoxLayout;

    layout->addWidget(new QLabel(i18n("Flatness:")));
    m_flatness = new QDoubleSpinBox(group);
    layout->addWidget(m_flatness);

    group->setLayout(layout);
    group->setMinimumWidth(300);

    // signals and Q_SLOTS:
    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
    connect(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));

    mainLayout->addWidget(group);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    mainLayout->addWidget(buttonBox);
}
コード例 #9
0
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// HW1b::controlPanel:
//
// Create control panel groupbox.
//
QGroupBox*
HW1b::controlPanel()
{
    // init group box
    QGroupBox *groupBox = new QGroupBox("Homework 1b");
    groupBox->setMinimumWidth(300);

    // layout for assembling widgets
    QGridLayout *layout = new QGridLayout;

    // create sliders
    m_thetaSlider = new QSlider(Qt::Horizontal);
    m_thetaSlider->setRange(0, 360);
    m_thetaSlider->setValue(0);
    m_angle = 0;

    m_subdivideSlider = new QSlider(Qt::Horizontal);
    m_subdivideSlider -> setRange(0, 6);
    m_subdivideSlider -> setValue(0);

    // create spinBoxes
    m_thetaSpinBox = new QSpinBox;
    m_thetaSpinBox->setRange(0, 360);
    m_thetaSpinBox->setValue(0);

    m_subdivideSpinBox = new QSpinBox;
    m_subdivideSpinBox -> setRange (0, 6);
    m_subdivideSpinBox -> setValue(0);

    // create radioButtons
    m_yesTwist = new QRadioButton("Yes");
    m_yesTwist -> setChecked(false);
    m_noTwist = new QRadioButton("No");
    m_noTwist -> setChecked(true);
    m_twist = false;

    // slider label to display name
    QLabel *thetaLabel = new QLabel ("Theta");
    QLabel *subdivideLabel = new QLabel ("Subdivisions:");
    QLabel *twistLabel = new QLabel ("Twist:");

    // assemble widgets into layout
    layout->addWidget   (thetaLabel, 0,0);
    layout->addWidget   (m_thetaSlider,0,1);
    layout->addWidget   (m_thetaSpinBox, 0,2);
    layout->addWidget   (subdivideLabel, 1,0);
    layout->addWidget   (m_subdivideSlider,1,1);
    layout->addWidget   (m_subdivideSpinBox,1,2);
    layout->addWidget   (twistLabel,2,0);
    layout->addWidget   (m_yesTwist,2,1);
    layout->addWidget   (m_noTwist,2,2);


    // assign layout to group box
    groupBox->setLayout(layout);

    // init signal/slot connections
    connect(m_thetaSlider,	SIGNAL(valueChanged(int)), this, SLOT(setTheta(int)));
    connect(m_thetaSpinBox,	SIGNAL(valueChanged(int)), this, SLOT(setTheta(int)));
    connect(m_subdivideSlider, SIGNAL(valueChanged(int)), this, SLOT(setSubdivide(int)));
    connect(m_subdivideSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setSubdivide(int)));
    connect(m_yesTwist, SIGNAL(clicked()),this, SLOT(setYesTwist()));
    connect(m_noTwist, SIGNAL(clicked()),this, SLOT(setNoTwist()));

    return(groupBox);
}
コード例 #10
0
BioXASSSRLMonochromatorConfigurationView::BioXASSSRLMonochromatorConfigurationView(BioXASSSRLMonochromator *mono, QWidget *parent) :
    QWidget(parent)
{
	// Initialize member variables.

	mono_ = 0;

	// Create motors column contents.

	maskView_ = new BioXASSSRLMonochromatorMaskView(0);

	QVBoxLayout *maskBoxLayout = new QVBoxLayout();
	maskBoxLayout->addWidget(maskView_);

	QGroupBox *maskBox = new QGroupBox();
	maskBox->setTitle("Mask");
	maskBox->setLayout(maskBoxLayout);

	heightEditor_ = new CLSControlEditor(0);
	heightEditor_->setTitle("Height");
	heightEditor_->setFormat('f');
        heightEditor_->setPrecision(5);

	lateralEditor_ = new CLSControlEditor(0);
	lateralEditor_->setTitle("Lateral");
	lateralEditor_->setFormat('f');
        lateralEditor_->setPrecision(5);

	paddleEditor_ = new CLSControlEditor(0);
	paddleEditor_->setTitle("Paddle");

	QVBoxLayout *motorsBoxLayout = new QVBoxLayout();
	motorsBoxLayout->setMargin(0);
	motorsBoxLayout->addWidget(maskBox);
	motorsBoxLayout->addWidget(heightEditor_);
	motorsBoxLayout->addWidget(lateralEditor_);
	motorsBoxLayout->addWidget(paddleEditor_);

	QWidget *motorsBox = new QWidget();
	motorsBox->setLayout(motorsBoxLayout);
	motorsBox->setMinimumWidth(BIOXASSSRLMONOCHROMATORCONFIGURATIONVIEW_COLUMN_WIDTH_MIN);

	// Create energy column contents.

	energyView_ = new BioXASSSRLMonochromatorEnergyView(0);

	QVBoxLayout *energyBoxLayout = new QVBoxLayout();
	energyBoxLayout->addWidget(energyView_);

	QGroupBox *energyBox = new QGroupBox();
	energyBox->setTitle("Energy");
	energyBox->setLayout(energyBoxLayout);
	energyBox->setMinimumWidth(BIOXASSSRLMONOCHROMATORCONFIGURATIONVIEW_COLUMN_WIDTH_MIN);

	// Create crystals column contents.

	regionEditor_ = new BioXASSSRLMonochromatorRegionControlEditor(0);
	regionEditor_->setTitle("Region");

	regionStatusWidget_ = new BioXASSSRLMonochromatorRegionControlView(0);

	crystalsView_ = new BioXASSSRLMonochromatorCrystalsView(0);

	QVBoxLayout *regionStatusViewLayout = new QVBoxLayout();
	regionStatusViewLayout->setMargin(0);
	regionStatusViewLayout->addWidget(regionStatusWidget_);

	QGroupBox *regionStatusView = new QGroupBox("Region Status");
	regionStatusView->setFlat(true);
	regionStatusView->setLayout(regionStatusViewLayout);

	QVBoxLayout *crystalsBoxLayout = new QVBoxLayout();
	crystalsBoxLayout->addWidget(regionEditor_);
	crystalsBoxLayout->addWidget(regionStatusView);
	crystalsBoxLayout->addWidget(crystalsView_);
	crystalsBoxLayout->addStretch();

	QGroupBox *crystalsBox = new QGroupBox("Crystals");
	crystalsBox->setLayout(crystalsBoxLayout);
	crystalsBox->setMinimumWidth(BIOXASSSRLMONOCHROMATORCONFIGURATIONVIEW_COLUMN_WIDTH_MIN);

	// Create and set main layouts.

	QVBoxLayout *motorsColumnLayout = new QVBoxLayout();
	motorsColumnLayout->addWidget(motorsBox);
	motorsColumnLayout->addStretch();

	QVBoxLayout *energyColumnLayout = new QVBoxLayout();
	energyColumnLayout->addWidget(energyBox);
	energyColumnLayout->addStretch();

	QVBoxLayout *crystalsColumnLayout = new QVBoxLayout();
	crystalsColumnLayout->addWidget(crystalsBox);
	crystalsColumnLayout->addStretch();

	QHBoxLayout *layout = new QHBoxLayout();
	layout->addLayout(motorsColumnLayout);
	layout->addLayout(energyColumnLayout);
	layout->addLayout(crystalsColumnLayout);

	setLayout(layout);

	// Current settings

	setMono(mono);

	refresh();
}
コード例 #11
0
BioXASMirrorView::BioXASMirrorView(BioXASMirror *mirror, QWidget *parent) :
    QWidget(parent)
{
	// Initialize member variables.

	mirror_ = 0;

	// Create basic controls view.

	pitchEditor_ = new CLSControlEditor(0);
	pitchEditor_->setTitle("Pitch");
        pitchEditor_->setFormat('f');
        pitchEditor_->setPrecision(3);

	rollEditor_ = new CLSControlEditor(0);
	rollEditor_->setTitle("Roll");
        rollEditor_->setFormat('f');
        rollEditor_->setPrecision(3);

	yawEditor_ = new CLSControlEditor(0);
	yawEditor_->setTitle("Yaw");
        yawEditor_->setFormat('f');
        yawEditor_->setPrecision(3);

	heightEditor_ = new CLSControlEditor(0);
	heightEditor_->setTitle("Height");
        heightEditor_->setFormat('f');
        heightEditor_->setPrecision(3);

	lateralEditor_ = new CLSControlEditor(0);
	lateralEditor_->setTitle("Lateral");
        lateralEditor_->setFormat('f');
        lateralEditor_->setPrecision(3);

	QVBoxLayout *controlsBoxLayout = new QVBoxLayout();
	controlsBoxLayout->addWidget(pitchEditor_);
	controlsBoxLayout->addWidget(rollEditor_);
	controlsBoxLayout->addWidget(yawEditor_);
	controlsBoxLayout->addWidget(heightEditor_);
	controlsBoxLayout->addWidget(lateralEditor_);

	QGroupBox *controlsBox = new QGroupBox();
	controlsBox->setTitle("Mirror");
	controlsBox->setLayout(controlsBoxLayout);
	controlsBox->setMinimumWidth(350);

	// Create bend view.

	bendView_ = new BioXASMirrorBendView(0);

	QVBoxLayout *bendBoxLayout = new QVBoxLayout();
	bendBoxLayout->addWidget(bendView_);
	bendBoxLayout->addStretch();

	QGroupBox *bendBox = new QGroupBox();
	bendBox->setTitle("Bend");
	bendBox->setLayout(bendBoxLayout);
	bendBox->setMinimumWidth(350);

	// Create and set layouts.

	QHBoxLayout *layout = new QHBoxLayout();
	layout->setMargin(0);
	layout->addWidget(controlsBox);
	layout->addWidget(bendBox);

	setLayout(layout);

	// Current settings.

	setMirror(mirror);

	refresh();
}
コード例 #12
0
ファイル: Robot.cpp プロジェクト: Illutron/N7331227
void Robot::init(myData * _data,  QVBoxLayout * boxLayout)
{
	
	initFlag = true;
	addBaseGui(boxLayout);
	data = _data;
	industrialRobot = new ofxIndustrialRobot(data->baseApp);
	nameid = "Robot";
	
	QTabWidget *robotTab = new QTabWidget();
	
	QWidget * robotGeneralTab = new QWidget();
	QGridLayout *robotGeneralTabLayout = new QGridLayout();
	
	//
	//Motor control
	//
	
	QGroupBox * robotMotorArea = new QGroupBox("Motors");
	QGridLayout *robotMotorLayout = new QGridLayout;
	
	//	if(industrialRobot->thread.lock()){
	
	for(int i=0;i<5;i++){
		motorSlider[i] = new QSlider(Qt::Horizontal);
		//			motorSlider[i]->setValue(industrialRobot->thread.coreData.arms[i].rotation);
		//	motorSlider[i]->setFixedWidth(220);
		motorLabel[i] = new QLabel("");
		motorLabel[i]->setFixedWidth(55);
		motorLabel2[i] = new QLabel("");
		motorLabel2[i]->setFixedWidth(55);
		setValue[i] = new QPushButton("Set");
		robotMotorLayout->addWidget( new QLabel(("Motor "+ofToString(i, 0)).c_str()),i,0);	
		robotMotorLayout->addWidget(motorSlider[i],i,1);
		robotMotorLayout->addWidget(motorLabel[i],i,2);
		robotMotorLayout->addWidget(motorLabel2[i],i,3);
		robotMotorLayout->addWidget(setValue[i],i,4);
	} 
	loadXmlButton = new QPushButton("Load xml");
	robotMotorLayout->addWidget(loadXmlButton,6,0);
	
	variantSlider = new QSlider(Qt::Horizontal);
	variantSlider->setEnabled(false);
	variantSlider->setMinimum(0);
	variantSlider->setMaximum(1000.0);
	robotMotorLayout->addWidget( new QLabel("Variant"),5,0);	
	robotMotorLayout->addWidget(variantSlider,5,1);
	
	
	//	}
	robotMotorLayout->setAlignment(Qt::AlignTop);
	robotMotorArea->setLayout(robotMotorLayout);	
	robotMotorArea->setMinimumWidth(460);
	
	robotGeneralTabLayout->addWidget(robotMotorArea,0,0);	
	
	//
	//Mode/input selector
	//
	
	QWidget * robotModePositionArea = new QWidget();
	QGridLayout *robotModePositionLayout = new QGridLayout;	
	
	
	QGroupBox * robotModeArea = new QGroupBox("Mode");
	QGridLayout *robotModeLayout = new QGridLayout;	
	
	inputRadio[0] = new QRadioButton("Timeline", robotModeArea);
	inputRadio[1] = new QRadioButton("Manual Motor", robotModeArea);	
	inputRadio[1]->setChecked(true);
	inputRadio[2] = new QRadioButton("Gravity", robotModeArea);	
	inputRadio[3] = new QRadioButton("Manual position", robotModeArea);	
//	inputRadio[4] = new QRadioButton("Change Variant", robotModeArea);	

	setControlMode(CONTROL_MODE_MOTOR);
	
	
	robotModeLayout->addWidget(inputRadio[0],0,0);
	robotModeLayout->addWidget(inputRadio[1],1,0);
	robotModeLayout->addWidget(inputRadio[2],2,0);
	robotModeLayout->addWidget(inputRadio[3],3,0);	
//	robotModeLayout->addWidget(inputRadio[4],4,0);		
	//	robotModeArea->setMinimumWidth(460);
	robotModeArea->setLayout(robotModeLayout);
	robotModePositionLayout->addWidget(robotModeArea,0,0);	
	
	
	
	QGroupBox * robotPositionArea = new QGroupBox("Position");
	QGridLayout *robotPositionLayout = new QGridLayout;	
	
	robotPositionArea->setLayout(robotPositionLayout);
	robotModePositionLayout->addWidget(robotPositionArea,0,1);	
	
	int n = 0, l =0;
	for(int i=0;i<6;i++){
		manualPosition[i] = new QDoubleSpinBox();
		robotPositionLayout->addWidget(manualPosition[i],l,1+n);
		if(i>2){
			manualPosition[i]->setSingleStep(0.1);
		}
		n++;
		if(n>2){
			n = 0;
			l++;
		}
	}
	manualPosition[0]->setMinimum(-300.0);
	manualPosition[0]->setMaximum(300.0);	
	manualPosition[1]->setMinimum(00.0);
	manualPosition[1]->setMaximum(300.0);	
	manualPosition[2]->setMinimum(-300.0);
	manualPosition[2]->setMaximum(300.0);	
	for(int i=3;i<6;i++){
		manualPosition[i]->setMinimum(-1.0);
		manualPosition[i]->setMaximum(1.0);	
	}
	
	robotPositionLayout->addWidget(new QLabel("Pos"),0,0);
	robotPositionLayout->addWidget(new QLabel("Dir"),1,0);
	
	
	
	
	robotModePositionArea->setLayout(robotModePositionLayout);	
	robotGeneralTabLayout->addWidget(robotModePositionArea,1,0);
	
	
	//
	//Serial control
	//
	QWidget * robotGeneralTabBottomWidget = new QWidget();
	QGridLayout *robotGeneralTabBottomLayout = new QGridLayout;	
	QWidget * robotSerialControlArea = new QWidget();
	QGridLayout *robotSerialControlLayout = new QGridLayout;	
	
	
	for(int i=0;i<5;i++){
		motorStatusLabel[i] = new QLabel("");
		robotSerialControlLayout->addWidget(motorStatusLabel[i],i,0);
	}
	
	panicStatus =  new QLabel("Status: OK");
	resetMotors = new QPushButton("Reset all motors");
	
	unlockMotors = new QPushButton("Un&lock");
	unlockMotors->setCheckable(true);
	
	robotSerialControlLayout->addWidget(panicStatus,6,0);
	robotSerialControlLayout->addWidget(resetMotors,7,0);	
	robotSerialControlLayout->addWidget(unlockMotors,8,0);	
	
	robotSerialControlArea->setLayout(robotSerialControlLayout);	
	robotGeneralTabBottomLayout->addWidget(robotSerialControlArea,0,0);
	robotGeneralTabBottomWidget->setLayout(robotGeneralTabBottomLayout);
	
	robotGeneralTabLayout->addWidget(robotGeneralTabBottomWidget,2,0);
	
	QWidget * robotControllerWidget = new QWidget();
	robotControllerLayout = new QVBoxLayout();
	
	robotControllerLayout->setAlignment(Qt::AlignTop);
	robotControllerWidget->setLayout(robotControllerLayout);
	robotGeneralTabBottomLayout->addWidget(robotControllerWidget,0,1);
	
	controllerItemLocked = new QCheckBox("Locked");
	controllerItemLocked->setEnabled(false);
	robotControllerLayout->addWidget(controllerItemLocked);
	
	
	
	QWidget * robotSerialTab = new QWidget();
	QGridLayout *robotSerialTabLayout = new QGridLayout();
	
	for(int i=0;i<8;i++){
		byteone[i] = new QCheckBox(("Byte 1-"+ofToString(i, 0)).c_str());
		bytetwo[i] = new QCheckBox(("Byte 2-"+ofToString(i, 0)).c_str());
		bytestatus[i] = new QCheckBox(("Byte status-"+ofToString(i, 0)).c_str());
		robotSerialTabLayout->addWidget(byteone[i],i,0);
		robotSerialTabLayout->addWidget(bytetwo[i],i,1);
		robotSerialTabLayout->addWidget(bytestatus[i],i,2);
	}
	
	
	
	robotGeneralTabLayout->setAlignment(Qt::AlignTop);
	robotGeneralTab->setMinimumWidth(500);
	robotGeneralTab->setLayout(robotGeneralTabLayout);
	
	robotSerialTabLayout->setAlignment(Qt::AlignTop);
	robotSerialTab->setMinimumWidth(500);
	robotSerialTab->setLayout(robotSerialTabLayout);
	
	
	robotTab->addTab(robotGeneralTab,"General");
	robotTab->addTab(robotSerialTab,"Serial");
	//robotTab->addTab(robotControllerTab,"Robot controller");
	
	robotGeneralTabLayout->setAlignment(Qt::AlignTop);
	//	robotInputTab->setLayout(robotInputTabLayout);
	//	robotTab->addTab(robotInputTab,"Inputs");
	
	
	
	
	boxLayout->addWidget(robotTab);
	boxLayout->setAlignment(Qt::AlignTop);
	
	//	lastReverseHead = true;
	resetting = 0;
	
	
	manualControllerItem =addRobotController("Manual", CONTROL_MODE_MOTOR);
	currentControllerItem = manualControllerItem;
	setRobotController(manualControllerItem);
	
	warningShown = false;
}
コード例 #13
0
QGroupBox*
HW3b::controlPanel()
{
    // init group box
    QGroupBox *groupBox = new QGroupBox("Homework 3a");

    groupBox->setMinimumWidth(300);
    QGridLayout *layout = new QGridLayout;
    m_comboBox = new QComboBox();
    m_comboBox->addItem("Texture");
    m_comboBox->addItem("Wireframe");
    m_comboBox->addItem("Tex+Wire");
    m_comboBox->setCurrentIndex(TEX_WIRE);
    
    
    m_comboBox_mode = new QComboBox();
    m_comboBox_mode->addItem("FLAT");
    m_comboBox_mode->addItem("SPIKE");
    m_comboBox_mode->addItem("DIAGONALWALL");
    m_comboBox_mode->addItem("SIDEWALL");
    m_comboBox_mode->addItem("HOLE");
    m_comboBox_mode->addItem("MIDDLEBLOCK");
    m_comboBox_mode->addItem("DIAGONALBLOCK");
    m_comboBox_mode->addItem("CORNERBLOCK");
    m_comboBox_mode->addItem("HILL");
    m_comboBox_mode->addItem("HILLFOUR");
    m_comboBox_mode->setCurrentIndex(HILLFOUR);
    
    
    
    m_PushbottonGo = new QPushButton("go");
    m_PushbottonStop = new QPushButton("Stop");
    layout->addWidget(m_PushbottonGo,0,0,1,2);
    layout->addWidget(m_PushbottonStop,1,0,1,2);
    layout->addWidget(m_comboBox,2,0,1,2);
    layout->addWidget(m_comboBox_mode,3,0,1,2);
    
    m_sliderGrid = new QSlider(Qt::Horizontal);
    m_sliderGrid->setRange(2, 64);
    m_sliderGrid->setValue(16);
    
    m_spinboxGrid = new QSpinBox;
    m_spinboxGrid->setRange(2,64);
    m_spinboxGrid->setValue(16);
    
    
    m_sliderSpeed = new QSlider(Qt::Horizontal);
    m_sliderSpeed->setRange(1, 20);
    m_sliderSpeed->setValue(6);
    
    
    m_spinboxSpeed = new QSpinBox;
    m_spinboxSpeed->setRange(1,20);
    m_spinboxSpeed->setValue(6);
    
    
    m_labelGrid = new QLabel("Grid");
    m_labelSpeed = new QLabel("Speed");
    
    layout->addWidget(m_labelGrid,4,0,1,1);
    layout->addWidget(m_sliderGrid,4,1,1,1);
    layout->addWidget(m_spinboxGrid,4,3,1,1);
    
    layout->addWidget(m_labelSpeed,5,0,1,1);
    layout->addWidget(m_sliderSpeed,5,1,1,1);
    layout->addWidget(m_spinboxSpeed,5,3,1,1);

    
    connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(displayChange(int)));
    connect(m_comboBox_mode, SIGNAL(currentIndexChanged(int)), this, SLOT(selectMode(int)));
    connect(m_PushbottonGo, SIGNAL(clicked()), this, SLOT(begintimer()));
    connect(m_PushbottonStop, SIGNAL(clicked()), this, SLOT(stopTimer()));
    
    connect(m_sliderGrid, SIGNAL(valueChanged(int)), this, SLOT(setsize(int)));
    connect(m_spinboxGrid, SIGNAL(valueChanged(int)), this, SLOT(setsize(int)));
    connect(m_sliderSpeed, SIGNAL(valueChanged(int)), this, SLOT(setSpeed(int)));
//    connect(m_spinboxSpeed, SIGNAL(valueChanged(int)), this, SLOT(setSpeed(int)));

    
    groupBox->setLayout(layout);
    

    return(groupBox);
}
コード例 #14
0
//-------------------------------------------------------------------------------------------------
ExchangeRate::ExchangeRate() : QWidget(),
    nam(new QNetworkAccessManager(this)),
    iPrecision(2),
    bUseProxy(false),
    bProxyIsSocks(false),
    iPort(3128),
    bAuth(false),
    dMaxSum(100000000000000000000.05)
{
    const QString strAppName = qAppName(),
            strAppDir = qApp->applicationDirPath();
    strAppStg = strAppDir + '/' + strAppName + ".ini";
    QTranslator *translator = new QTranslator(this);
    if (translator->load(strAppName, strAppDir) || translator->load(strAppName + '_' + QLocale::system().name(), strAppDir))
        qApp->installTranslator(translator);

    leUah = new QLineEdit(this);
    QVBoxLayout *vblSpacing = new QVBoxLayout;
    vblSpacing->addSpacing(15);
    leUsd = new QLineEdit(this);
    leEur = new QLineEdit(this);
    leRub = new QLineEdit(this);
    gbMain = new QGroupBox(this);
    gbMain->setEnabled(false);
    QFormLayout *frml = new QFormLayout(gbMain);
    frml->addRow("UAH:", leUah);
    frml->addRow(vblSpacing);
    frml->addRow("USD:", leUsd);
    frml->addRow("EUR:", leEur);
    frml->addRow("RUB:", leRub);

    QPushButton *pbUpdate = new QPushButton(style()->standardIcon(QStyle::SP_BrowserReload), tr("Update"), this);
    lblInfo = new QLabel(this);
    QFont fontSaved = lblInfo->font();
    fontSaved.setItalic(true);
    lblInfo->setFont(fontSaved);
    QHBoxLayout *hblUpdate = new QHBoxLayout;
    hblUpdate->setContentsMargins(0, 0, 0, 0);
    hblUpdate->addWidget(pbUpdate);
    hblUpdate->addWidget(lblInfo);
    lblNote = new QLabel("?\n1 USD = ?\n1 EUR = ?\n1 UAH = ?", this);
    QGroupBox *gbNote = new QGroupBox(this);
    gbNote->setMinimumWidth(170);
    QVBoxLayout *vbNote = new QVBoxLayout(gbNote);
    vbNote->addLayout(hblUpdate);
    vbNote->addWidget(lblNote);

    QLabel *lblVer = new QLabel(cFullVersion, this);
    QPushButton *pbSettings = new QPushButton(style()->standardIcon(QStyle::SP_FileDialogDetailedView), 0, this);
    QHBoxLayout *hblBottom = new QHBoxLayout;
    hblBottom->addStretch();
    hblBottom->addWidget(lblVer);
    hblBottom->addWidget(pbSettings);
    QVBoxLayout *vblRight = new QVBoxLayout;
    vblRight->addWidget(gbNote);
    vblRight->addLayout(hblBottom, Qt::AlignRight);

    QHBoxLayout *hblMain = new QHBoxLayout(this);
    hblMain->addWidget(gbMain);
    hblMain->addLayout(vblRight);

    this->setMaximumHeight(this->minimumSizeHint().height());

    //connects
    connect(leUah, SIGNAL(textEdited(QString)), this, SLOT(slotFromUah(QString)));
    connect(leUsd, SIGNAL(textEdited(QString)), this, SLOT(slotFromUsd(QString)));
    connect(leEur, SIGNAL(textEdited(QString)), this, SLOT(slotFromEur(QString)));
    connect(leRub, SIGNAL(textEdited(QString)), this, SLOT(slotFromRub(QString)));
    connect(pbUpdate, SIGNAL(clicked()), this, SLOT(slotUpdate()));
    connect(pbSettings, SIGNAL(clicked()), this, SLOT(slotShowSettings()));
    connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotReplyFin(QNetworkReply*)));

    //settings
    QSettings stg(strAppStg, QSettings::IniFormat);
    stg.setIniCodec("UTF-8");
    if (stg.childGroups().contains("Settings"))
    {
        stg.beginGroup("Settings");
        const QString strDate = stg.value("DateTime").toString();
        if (QDateTime::fromString(strDate, "dd.MM.yyyy").isValid() &&
                (dUahPerUsd = stg.value("USD").toDouble()) > 3.0 && dUahPerUsd < 80.0 &&
                (dUahPerEur = stg.value("EUR").toDouble()) > 3.0 && dUahPerEur < 80.0 &&
                (dUahPerRub = stg.value("RUB").toDouble()) > 0.1 && dUahPerRub < 1.0)
        {
            lblNote->setText(strDate +
                             "\n1 USD = " + QString::number(dUahPerUsd, 'f', 6) +
                             " UAH\n1 EUR = " + QString::number(dUahPerEur, 'f', 6) +
                             " UAH\n1 UAH = " + QString::number(1.0/dUahPerRub, 'f', 6) +
                             " RUB");
            gbMain->setEnabled(true);
        }
        int iTemp = stg.value("Precision", -1).toInt();
        if (iTemp >= 0 && iTemp <= 10)
            iPrecision = iTemp;
        if (stg.value("UseProxy").toString() == "1")
            bUseProxy = true;
        if (stg.value("ProxyType") == "SOCKS5")
            bProxyIsSocks = true;
        strServer = stg.value("Server").toString();
        iTemp = stg.value("Port").toInt();
        if (iTemp > 0 && iTemp <= 65535)
            iPort = iTemp;
        if (stg.value("Auth").toString() == "1")
            bAuth = true;
        strUser = stg.value("User").toString();
        strPassword = stg.value("Password").toString();
        stg.endGroup();

        if (bUseProxy)
        {
            QNetworkProxy netProxy(bProxyIsSocks ? QNetworkProxy::Socks5Proxy : QNetworkProxy::HttpProxy, strServer, iPort);
            if (bAuth)
            {
                netProxy.setUser(strUser);
                netProxy.setPassword(strPassword);
            }
            nam->setProxy(netProxy);
        }
    }

    this->restoreGeometry(QSettings("UserPrograms", strAppName).value("Geometry").toByteArray());
}
コード例 #15
0
ファイル: qbicwin.cpp プロジェクト: Archi0/QtBiVis
qBicWin::qBicWin(QWidget *parent) : QWidget(parent)
{
    resize(800,800);
    QGridLayout* mainLayout = new QGridLayout(this);
    QGroupBox* valGb = new QGroupBox(tr("Bicluster Values"));
    QGroupBox* percGb = new QGroupBox(tr("Neighbourhood"));
    QGridLayout* valGrid = new QGridLayout();
    QGridLayout* percGrid = new QGridLayout();
    QSplitter* splitter = new QSplitter();

    m_pbtnOkButton = new QPushButton(tr("Ok"));
    m_pbtnOkButton->setFixedHeight(50);
    m_pbtnParallel = new QPushButton(tr("Parallel Coords"));
    m_pbtnParallel->setFixedHeight(50);
    m_pbtnStats = new QPushButton(tr("Stats"));
    m_pbtnStats->setFixedHeight(50);
    m_pbtnPerc = new QPushButton(tr("Coverage"));
    m_pbtnPerc->setFixedHeight(50);
    m_pbtnSort = new QPushButton(tr("Sort"));
    m_pbtnSort->setFixedHeight(50);

    m_ptbValView = new QTableView();
    m_ptbValView->horizontalHeader()->setStretchLastSection(true);
    valGb->setMinimumWidth(400);
    m_ptbPercView = new QTableView();
    m_ptbPercView->horizontalHeader()->setStretchLastSection(true);
  //  percGb->setMaximumWidth(400);
    m_ptbGoView = new QTableView();
    m_ptbGoView->horizontalHeader()->setStretchLastSection(true);
    m_ptbGoView->setMaximumHeight(200);
    m_pValModel = new QStandardItemModel();
    m_pPercModel = new QStandardItemModel();
    m_pGoModel = new QStandardItemModel();

    plot = new QCustomPlot(this);
    plot->setMinimumWidth(400);
    plot->setMinimumHeight(500);
    plot->setInteractions(QCP::iRangeZoom|QCP::iRangeDrag);
    colorMap = new QCPColorMap(plot->xAxis,plot->yAxis);
    colorMap->data()->fill(0);
   curve = new QCPCurve(plot->xAxis,plot->yAxis);

    valGrid->addWidget(m_ptbValView,0,0,2,2);
    valGrid->addWidget(m_ptbGoView, 2,0,1,2);
    percGrid->addWidget(plot,0,0);
    percGrid->addWidget(m_ptbPercView,1,0);
    valGb->setLayout(valGrid);
    percGb->setLayout(percGrid);
    splitter->addWidget(valGb);
    splitter->addWidget(percGb);
   // mainLayout->addWidget(valGb, 0,0,2,3);
    //mainLayout->addWidget(percGb,0,3,2,1);
    mainLayout->addWidget(splitter,0,0,2,4);
    mainLayout->addWidget(m_pbtnOkButton, 2, 0,1,1);
    mainLayout->addWidget(m_pbtnParallel,2,1,1,1);
    mainLayout->addWidget(m_pbtnPerc, 2,2,1,1);
    mainLayout->addWidget(m_pbtnStats, 2,3,1,1);
    mainLayout->addWidget(m_pbtnSort,3,0,1,4);
    setLayout(mainLayout);
    plot->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(plot, SIGNAL(customContextMenuRequested(QPoint)),this, SLOT(contextPlot(QPoint)));
    connect(m_pbtnOkButton, SIGNAL(clicked()),this, SLOT(goClose()));
    connect(m_pbtnParallel, SIGNAL(clicked(bool)), this, SLOT(showParallelCords()));
    connect(m_pbtnPerc, SIGNAL(clicked()),this,SLOT(showPerc()));
    connect(m_pbtnStats, SIGNAL(clicked()),this, SLOT(showStats()));
    connect(m_pbtnSort,SIGNAL(clicked()),this,SLOT(sort()));
}
コード例 #16
0
BioXASSSRLMonochromatorConfigurationView::BioXASSSRLMonochromatorConfigurationView(BioXASSSRLMonochromator *mono, QWidget *parent) :
    QWidget(parent)
{
	// Initialize member variables.

	mono_ = 0;

	// Create UI elements.

	upperSlitEditor_ = new AMExtendedControlEditor(0);
	upperSlitEditor_->setTitle("Upper slit blade");
	upperSlitEditor_->setControlFormat('f', 3);

	lowerSlitEditor_ = new AMExtendedControlEditor(0);
	lowerSlitEditor_->setTitle("Lower slit blade");
	lowerSlitEditor_->setControlFormat('f', 3);

	heightEditor_ = new AMExtendedControlEditor(0);
	heightEditor_->setTitle("Height");
	heightEditor_->setControlFormat('f', 3);

	lateralEditor_ = new AMExtendedControlEditor(0);
	lateralEditor_->setTitle("Lateral");
	lateralEditor_->setControlFormat('f', 3);

	paddleEditor_ = new AMExtendedControlEditor(0);
	paddleEditor_->setTitle("Paddle");

	crystal1PitchEditor_ = new AMExtendedControlEditor(0);
	crystal1PitchEditor_->setTitle("Crystal 1 Pitch");

	crystal1RollEditor_ = new AMExtendedControlEditor(0);
	crystal1RollEditor_->setTitle("Crystal 1 Roll");

	crystal2PitchEditor_ = new AMExtendedControlEditor(0);
	crystal2PitchEditor_->setTitle("Crystal 2 Pitch");

	crystal2RollEditor_ = new AMExtendedControlEditor(0);
	crystal2RollEditor_->setTitle("Crystal 2 Roll");

	stepEnergyEditor_ = new AMExtendedControlEditor(0);
	stepEnergyEditor_->setTitle("Energy (step)");
	stepEnergyEditor_->setControlFormat('f', 2);

	encoderEnergyEditor_ = new AMExtendedControlEditor(0, 0, true);
	encoderEnergyEditor_->setTitle("Energy (encoder)");
	encoderEnergyEditor_->setControlFormat('f', 2);

	stepBraggEditor_ = new AMExtendedControlEditor(0);
	stepBraggEditor_->setTitle("Goniometer (step)");
	stepBraggEditor_->setControlFormat('f', 2);

	encoderBraggEditor_ = new AMExtendedControlEditor(0, 0, true);
	encoderBraggEditor_->setTitle("Goniometer (encoder)");
	encoderBraggEditor_->setControlFormat('f', 2);

	m1PitchEditor_ = new AMExtendedControlEditor(0);
	m1PitchEditor_->setTitle("M1 Mirror Pitch");
	m1PitchEditor_->setControlFormat('f', 2);

	braggConfigWidget_ = new BioXASSSRLMonochromatorBraggConfigurationView(0);

	calibrateEnergyButton_ = new QPushButton("Calibrate Energy");
	calibrateGoniometerButton_ = new QPushButton("Calibrate Goniometer");

	regionEditor_ = new BioXASSSRLMonochromatorRegionControlEditor(0);
	regionEditor_->setTitle("Region");

	regionStatusWidget_ = new BioXASSSRLMonochromatorRegionControlView(0);

	// Create and set layouts.
	// Motors view

	QVBoxLayout *motorsViewLayout = new QVBoxLayout();
	motorsViewLayout->addWidget(upperSlitEditor_);
	motorsViewLayout->addWidget(lowerSlitEditor_);
	motorsViewLayout->addWidget(heightEditor_);
	motorsViewLayout->addWidget(lateralEditor_);
	motorsViewLayout->addWidget(paddleEditor_);
	motorsViewLayout->addWidget(crystal1PitchEditor_);
	motorsViewLayout->addWidget(crystal1RollEditor_);
	motorsViewLayout->addWidget(crystal2PitchEditor_);
	motorsViewLayout->addWidget(crystal2RollEditor_);

	QGroupBox *motorsView = new QGroupBox("Motors");
	motorsView->setLayout(motorsViewLayout);
	motorsView->setMinimumWidth(VIEW_WIDTH_MIN);

	// Energy view

	QGridLayout *energyGridLayout = new QGridLayout();
	energyGridLayout->addWidget(stepEnergyEditor_, 0, 0);
	energyGridLayout->addWidget(encoderEnergyEditor_, 0, 1);
	energyGridLayout->addWidget(stepBraggEditor_, 1, 0);
	energyGridLayout->addWidget(encoderBraggEditor_, 1, 1);

	QHBoxLayout *energyM1Layout = new QHBoxLayout();
	energyM1Layout->addStretch();
	energyM1Layout->addWidget(m1PitchEditor_);
	energyM1Layout->addStretch();

	QVBoxLayout *energyViewLayout = new QVBoxLayout();
	energyViewLayout->addLayout(energyGridLayout);
	energyViewLayout->addLayout(energyM1Layout);

	QGroupBox *energyView = new QGroupBox("Energy");
	energyView->setLayout(energyViewLayout);
	energyView->setMinimumWidth(VIEW_WIDTH_MIN);

	// Bragg config view

	QVBoxLayout *braggConfigViewLayout = new QVBoxLayout();
	braggConfigViewLayout->setMargin(0);
	braggConfigViewLayout->addWidget(braggConfigWidget_);

	QGroupBox *braggConfigView = new QGroupBox("Goniometer configuration");
	braggConfigView->setLayout(braggConfigViewLayout);

	// Calibrate buttons view.

	QHBoxLayout *calibrateButtonsLayout = new QHBoxLayout();
	calibrateButtonsLayout->addWidget(calibrateEnergyButton_);
	calibrateButtonsLayout->addWidget(calibrateGoniometerButton_);

	QGroupBox *calibrateButtonsView = new QGroupBox("Calibration");
	calibrateButtonsView->setLayout(calibrateButtonsLayout);

	// Region view

	QVBoxLayout *regionStatusViewLayout = new QVBoxLayout();
	regionStatusViewLayout->setMargin(0);
	regionStatusViewLayout->addWidget(regionStatusWidget_);

	QGroupBox *regionStatusView = new QGroupBox("Status");
	regionStatusView->setLayout(regionStatusViewLayout);

	QVBoxLayout *regionViewLayout = new QVBoxLayout();
	regionViewLayout->addWidget(regionEditor_);
	regionViewLayout->addWidget(regionStatusView);

	QGroupBox *regionView = new QGroupBox("Region");
	regionView->setLayout(regionViewLayout);
	regionView->setMinimumWidth(VIEW_WIDTH_MIN);

	// Main layouts

	QVBoxLayout *leftLayout = new QVBoxLayout();
	leftLayout->addWidget(motorsView);
	leftLayout->addStretch();

	QVBoxLayout *centerLayout = new QVBoxLayout();
	centerLayout->addWidget(energyView);
	centerLayout->addWidget(calibrateButtonsView);
	centerLayout->addWidget(braggConfigView);
	centerLayout->addStretch();

	QVBoxLayout *rightLayout = new QVBoxLayout();
	rightLayout->addWidget(regionView);
	rightLayout->addStretch();

	QHBoxLayout *layout = new QHBoxLayout();
	layout->addLayout(leftLayout);
	layout->addLayout(centerLayout);
	layout->addLayout(rightLayout);

	setLayout(layout);

	// Make connections

	connect( calibrateEnergyButton_, SIGNAL(clicked()), this, SLOT(onCalibrateEnergyButtonClicked()) );
	connect( calibrateGoniometerButton_, SIGNAL(clicked()), this, SLOT(onCalibrateGoniometerButtonClicked()) );

	// Current settings

	setMono(mono);
}