Example #1
0
void AlarmWidget::initLayouts()
{
    mainVlayout =  new QVBoxLayout();
    radioTimeVlayout =  new QVBoxLayout();
    radioSoundVlayout =  new QVBoxLayout();
    textVlayout =  new QVBoxLayout();
    TimeInsVlayout =  new QVBoxLayout();
    hLayoutBtns  =  new QHBoxLayout();
    hLayoutTime  =  new QHBoxLayout();
    hLayoutRemainTime  =  new QHBoxLayout();
    hLayoutTimeShow  =  new QHBoxLayout();
    
    QGroupBox *groupBoxTime = new QGroupBox();

    radioTimeVlayout->addWidget(radioMin);
    radioTimeVlayout->addWidget(radioSec);
    groupBoxTime->setMaximumHeight(55);
    groupBoxTime->setFlat(true);
    //radioTimeVlayout->addStretch(1);    
    groupBoxTime->setLayout(radioTimeVlayout);
    
    QGroupBox *groupBoxSound = new QGroupBox();
    radioSoundVlayout->addWidget(radioSoundOn);
    radioSoundVlayout->addWidget(radioSoundOFF);
    groupBoxSound->setMaximumHeight(55);
    groupBoxSound->setFlat(true);
    groupBoxSound->setLayout(radioSoundVlayout);

    hLayoutTime->addWidget(timerValue);
    hLayoutTime->addWidget(groupBoxTime);//orig - radioTimeVlayout

    textVlayout->addWidget(lblSetTime);
    textVlayout->addWidget(lblRTime);

    hLayoutRemainTime->addWidget(txtRemain);    
    hLayoutRemainTime->addWidget(groupBoxSound);

    TimeInsVlayout->addLayout(hLayoutTime);
    TimeInsVlayout->addLayout(hLayoutRemainTime);    

    hLayoutTimeShow->addLayout(textVlayout);
    hLayoutTimeShow->addLayout(TimeInsVlayout);

    //set buttons to layout:
    hLayoutBtns->addWidget(btnStart);
    hLayoutBtns->addWidget(btnPause);
    hLayoutBtns->addWidget(btnQuit);

    mainVlayout->addLayout(hLayoutTimeShow);
    mainVlayout->addLayout(hLayoutBtns);

    mainVlayout->setMargin(0);
    //mainVlayout->setSpacing(0);
    

    setLayout(mainVlayout);
}
BioXASCarbonFilterFarmView::BioXASCarbonFilterFarmView(BioXASCarbonFilterFarm *control, QWidget *parent) :
	QWidget(parent)
{
	// Initialize class variables.

	filterFarm_ = 0;

	// Create UI elements.

	filterEditor_ = new CLSControlEditor(0);
	filterEditor_->setTitle("Effective filter");

	upstreamActuatorView_ = new BioXASCarbonFilterFarmActuatorView(0);

	downstreamActuatorView_ = new BioXASCarbonFilterFarmActuatorView(0);

	// Create and set layouts.

	QVBoxLayout *upstreamLayout = new QVBoxLayout();
	upstreamLayout->setMargin(0);
	upstreamLayout->addWidget(upstreamActuatorView_);

	QGroupBox *upstreamBox = new QGroupBox();
	upstreamBox->setTitle("Upstream Actuator");
	upstreamBox->setFlat(true);
	upstreamBox->setLayout(upstreamLayout);

	QVBoxLayout *downstreamLayout = new QVBoxLayout();
	downstreamLayout->setMargin(0);
	downstreamLayout->addWidget(downstreamActuatorView_);

	QGroupBox *downstreamBox = new QGroupBox();
	downstreamBox->setTitle("Downstream Actuator");
	downstreamBox->setFlat(true);
	downstreamBox->setLayout(downstreamLayout);

	QHBoxLayout *actuatorsLayout = new QHBoxLayout();
	actuatorsLayout->addWidget(upstreamBox);
	actuatorsLayout->addWidget(downstreamBox);

	QVBoxLayout *layout = new QVBoxLayout();
	layout->setMargin(0);
	layout->addWidget(filterEditor_);
	layout->addLayout(actuatorsLayout);

	setLayout(layout);

	// Current settings.

	setControl(control);
	refresh();
}
Example #3
0
//! [7]
QGroupBox *Window::createNonExclusiveGroup()
{
    QGroupBox *groupBox = new QGroupBox(tr("Non-Exclusive Checkboxes"));
    groupBox->setFlat(true);
//! [7]

//! [8]
    QCheckBox *checkBox1 = new QCheckBox(tr("&Checkbox 1"));
    QCheckBox *checkBox2 = new QCheckBox(tr("C&heckbox 2"));
    checkBox2->setChecked(true);
    QCheckBox *tristateBox = new QCheckBox(tr("Tri-&state button"));
    tristateBox->setTristate(true);
//! [8]
    tristateBox->setCheckState(Qt::PartiallyChecked);

//! [9]
    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(checkBox1);
    vbox->addWidget(checkBox2);
    vbox->addWidget(tristateBox);
    vbox->addStretch(1);
    groupBox->setLayout(vbox);

    return groupBox;
}
Example #4
0
BioXASValvesView::BioXASValvesView(CLSValves *valves, QWidget *parent) :
    QWidget(parent)
{
	// Initialize class variables.

	valves_ = 0;

	// Create UI elements.

	valvesEditor_ = new AMExtendedControlEditor(0);
	valvesEditor_->setNoUnitsBox(true);

	// Create and set layouts.

	childValvesLayout_ = new QVBoxLayout();

	QGroupBox *childValvesBox = new QGroupBox();
	childValvesBox->setFlat(true);
	childValvesBox->setLayout(childValvesLayout_);

	QVBoxLayout *layout = new QVBoxLayout();
	layout->setMargin(0);
	layout->addWidget(valvesEditor_);
	layout->addWidget(childValvesBox);

	setLayout(layout);

	// Current settings.

	setValves(valves);

	refresh();
}
Example #5
0
HardwareSdriq :: HardwareSdriq (Connection *pC, QWidget *pW): Hardware (pC, pW)
{

    // Attenuator
    QGroupBox *attGroupBox = new QGroupBox(tr("Attenuator"));
    attGroupBox->setFlat ( true );

    QRadioButton *att0Db  = new QRadioButton(tr("&0 dB"));
    QRadioButton *att10Db = new QRadioButton(tr("-&10 dB"));
    QRadioButton *att20Db = new QRadioButton(tr("-&20 dB"));
    QRadioButton *att30Db = new QRadioButton(tr("-&30 dB"));
    
    QVBoxLayout *vbox = new QVBoxLayout;

    vbox->addWidget(att0Db);
    vbox->addWidget(att10Db);
    vbox->addWidget(att20Db);
    vbox->addWidget(att30Db);
    vbox->addStretch(1);

    attGroupBox->setLayout(vbox);

    // Main layout of dialog
    QHBoxLayout *grid = new QHBoxLayout;

    // add objects
    grid->addWidget (attGroupBox);

    // use grid obecjt as main dialog's layout 
    setLayout(grid);

    // general features
    setWindowTitle(tr("SDR-IQ"));
    resize(240, 200);

    // interconnects
    attMapper = new QSignalMapper(this);
    connect(att0Db,  SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att0Db, 0);

    connect(att10Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att10Db, 10);

    connect(att20Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att20Db, 20);

    connect(att30Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att30Db, 30);

    connect(attMapper, SIGNAL(mapped(int)), this, SLOT(attClicked(int)));

    // update the serial number in title bar
    QString command;
    command.clear(); QTextStream(&command) << "*getserial?";
    pConn->sendCommand (command);

    // defaults
    att0Db->setChecked(true);              // attenuator 0 dB
}
void Ur5LungSimulationTab::setSettingsLayout(QVBoxLayout *parent)
{
    QGroupBox* group = new QGroupBox("Setup simulation");
    group->setFlat(true);
    parent->addWidget(group);

    QGridLayout *mainLayout = new QGridLayout();
    group->setLayout(mainLayout);

    int row = 0;
    startPosLineEdit = new QLineEdit();
    setStartPosButton = new QPushButton(tr("Set position"));

    mainLayout->addWidget(new QLabel("Inspiration position: "), row, 0, 1, 1);
    mainLayout->addWidget(startPosLineEdit, row, 1,1,2);
    mainLayout->addWidget(setStartPosButton,row,3,1,1);

    row ++;
    stopPosLineEdit = new QLineEdit();
    setStopPosButton = new QPushButton(tr("Set position"));
    mainLayout->addWidget(new QLabel("Expiration position: "), row, 0, 1, 1);
    mainLayout->addWidget(stopPosLineEdit, row, 1,1,2);
    mainLayout->addWidget(setStopPosButton,row,3,1,1);

    row++;
    velocityProfileCBox = new QComboBox;
    velocityProfileCBox->addItem(tr("Trapezoidal"));
    mainLayout->addWidget(new QLabel("Velocity profile: "), row, 0, 1, 1);
    mainLayout->addWidget(velocityProfileCBox,row,1,1,1);

    row++;
    inspirationTimeLineEdit = new QLineEdit(tr("1.5"));
    mainLayout->addWidget(new QLabel("Inspiration time: "), row, 0, 1, 1);
    mainLayout->addWidget(inspirationTimeLineEdit,row,1,1,1);
    mainLayout->addWidget(new QLabel("s"), row, 2,1,1);

    row++;
    inspiratoryPauseTimeLineEdit = new QLineEdit(tr("0"));
    mainLayout->addWidget(new QLabel("Inspiratory pause time: "), row, 0, 1, 1);
    mainLayout->addWidget(inspiratoryPauseTimeLineEdit,row,1,1,1);
    mainLayout->addWidget(new QLabel("s"), row, 2,1,1);

    row++;
    expirationTimeLineEdit = new QLineEdit(tr("1.5"));
    mainLayout->addWidget(new QLabel("Expiration time: "), row, 0, 1, 1);
    mainLayout->addWidget(expirationTimeLineEdit,row,1,1,1);
    mainLayout->addWidget(new QLabel("s"),row,2,1,1);

    row++;
    expiratoryPauseTimeLineEdit = new QLineEdit(tr("2"));
    mainLayout->addWidget(new QLabel("Expiratory pause time: "), row, 0, 1, 1);
    mainLayout->addWidget(expiratoryPauseTimeLineEdit,row,1,1,1);
    mainLayout->addWidget(new QLabel("s"),row,2,1,1);

}
Example #7
0
void createFilterWidget(QPlainTextEdit **edit, QLayout  *layout)
{
  QGroupBox *box = new QGroupBox(QObject::tr("JSON filter"));
  box->setFlat(true);
  QVBoxLayout  *boxLayout = new QVBoxLayout(box);

  *edit = new QPlainTextEdit;

  boxLayout->addWidget(*edit);
  layout->addWidget(box);
}
void Ur5LungSimulationTab::setMoveLayout(QVBoxLayout *parent)
{
    QGroupBox* group = new QGroupBox("Run simulation");
    group->setFlat(true);
    parent->addWidget(group);

    QGridLayout *mainLayout = new QGridLayout();
    group->setLayout(mainLayout);

    int row = 0;
    startMoveButton = new QPushButton(tr("Start simulation"));
    mainLayout->addWidget(startMoveButton, row, 0, 1, 1);
    stopMoveButton = new QPushButton(tr("Stop simulation"));
    mainLayout->addWidget(stopMoveButton,row,1,1,1);
}
Example #9
0
QWidget *MainWindow::createLogWidget()
{
  QGroupBox *box = new QGroupBox(QObject::tr("Log"));
  box->setFlat(true);
  QVBoxLayout  *layout = new QVBoxLayout(box);

  m_debugMode = new QCheckBox(tr("Debug mode"));
  layout->addWidget(m_debugMode);

  m_log = new QPlainTextEdit(box);
  m_log->setCenterOnScroll(true);
  m_log->setMaximumBlockCount(10000);
  layout->addWidget(m_log);

  return box;
}
ImportDialog::ImportDialog( const KUrl &url, QWidget *parent, bool isPart )
  : KDialog( parent ), mUrl( url )
{
  setCaption( i18n( "Import Calendar" ) );
  setButtons( Ok | Cancel );
  setDefaultButton( Ok );
  setModal( true );
  showButtonSeparator( true );
  QFrame *topFrame = new QFrame( this );
  setMainWidget( topFrame );
  QVBoxLayout *topLayout = new QVBoxLayout( topFrame );
  topLayout->setSpacing( spacingHint() );
  topLayout->setMargin( 0 );

  QString txt = i18n( "Please select import method for calendar at\n\n%1.",
                  mUrl.prettyUrl() );
  KSqueezedTextLabel *lbl = new KSqueezedTextLabel( txt, topFrame );
  lbl->setTextElideMode( Qt::ElideMiddle );
  topLayout->addWidget( lbl );

  QGroupBox *radioBox = new QGroupBox( topFrame );
  QBoxLayout *boxLayout = new QVBoxLayout( radioBox );
  radioBox->setFlat( true );
  topLayout->addWidget( radioBox );

  mAddButton = new QRadioButton( i18n( "Add as new calendar" ), radioBox );
  boxLayout->addWidget( mAddButton );

  mMergeButton = new QRadioButton( i18n( "Merge into existing calendar" ), radioBox );
  boxLayout->addWidget( mMergeButton );

  if ( isPart ) {
    mOpenButton = 0;
  } else {
    mOpenButton = new QRadioButton( i18n( "Open in separate window" ), radioBox );
    boxLayout->addWidget( mOpenButton );
  }

  mAddButton->setChecked( true );
  connect( this, SIGNAL(okClicked()), SLOT(slotOk()) );
}
Example #11
0
void YourAccounts::createAccountWidget()
{
	CreateAddAccountContainer = new QWidget(this);
	CreateAddAccountContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	MainStack->addWidget(CreateAddAccountContainer);
	MainStack->setCurrentWidget(CreateAddAccountContainer);

	QVBoxLayout *newAccountLayout = new QVBoxLayout(CreateAddAccountContainer);

	MainAccountLabel = new QLabel();
	newAccountLayout->addWidget(MainAccountLabel);

	QGroupBox *selectNetworkGroupbox = new QGroupBox(CreateAddAccountContainer);
	selectNetworkGroupbox->setFlat(true);

	QFormLayout *selectNetworkLayout = new QFormLayout(selectNetworkGroupbox);

	QLabel *imNetworkLabel = new QLabel(tr("IM Network") + ':', CreateAddAccountContainer);
	Protocols = m_injectedFactory->makeInjected<ProtocolsComboBox>(CreateAddAccountContainer);
	Protocols->addFilter(CanRegisterFilter);
	selectNetworkLayout->addRow(imNetworkLabel, Protocols);

	newAccountLayout->addWidget(selectNetworkGroupbox);

	MainAccountGroupBox = new QGroupBox(CreateAddAccountContainer);
	MainAccountGroupBox->setFlat(true);

	QGridLayout *createAccountLayout = new QGridLayout(MainAccountGroupBox);

	CreateAddStack = new QStackedWidget(MainAccountGroupBox);
	createAccountLayout->addWidget(CreateAddStack, 0, 1, 1, 1);

	newAccountLayout->addWidget(MainAccountGroupBox, Qt::AlignTop);

	connect(Protocols, SIGNAL(currentIndexChanged(int)),
			this, SLOT(protocolChanged()));

	switchToCreateMode();
}
Example #12
0
void GeneneralConf::initConfingButtons() {
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    m_layout->addStretch();
    QGroupBox *box = new QGroupBox(tr("Configuration File"));
    box->setFlat(true);
    box->setLayout(buttonLayout);
    m_layout->addWidget(box);

    m_exportButton = new QPushButton(tr("Export"));
    buttonLayout->addWidget(m_exportButton);
    connect(m_exportButton, &QPushButton::clicked, this,
            &GeneneralConf::exportFileConfiguration);

    m_importButton = new QPushButton(tr("Import"));
    buttonLayout->addWidget(m_importButton);
    connect(m_importButton, &QPushButton::clicked, this,
            &GeneneralConf::importConfiguration);

    m_resetButton = new QPushButton(tr("Reset"));
    buttonLayout->addWidget(m_resetButton);
    connect(m_resetButton, &QPushButton::clicked, this,
            &GeneneralConf::resetConfiguration);
}
HardwarePerseus :: HardwarePerseus (Connection *pC, QWidget *pW): DlgHardware (pC, pW)
{

    // Attenuator
    QGroupBox *attGroupBox = new QGroupBox(tr("Attenuator"));
    attGroupBox->setFlat ( true );

    QRadioButton *att0Db  = new QRadioButton(tr("&0 dB"));
    QRadioButton *att10Db = new QRadioButton(tr("-&10 dB"));
    QRadioButton *att20Db = new QRadioButton(tr("-&20 dB"));
    QRadioButton *att30Db = new QRadioButton(tr("-&30 dB"));
    
    QVBoxLayout *vbox = new QVBoxLayout;

    vbox->addWidget(att0Db);
    vbox->addWidget(att10Db);
    vbox->addWidget(att20Db);
    vbox->addWidget(att30Db);
    vbox->addStretch(1);

    attGroupBox->setLayout(vbox);

    // att slider
    QSlider *pAttSlider = new QSlider(this);
    pAttSlider->setMaximum ( 0 );
    pAttSlider->setMinimum ( -40 );
    pAttSlider->setPageStep( 10 );

    // Dither
    QCheckBox *ditherCB = new QCheckBox(tr("Di&ther"));

    // Preamp
    QCheckBox *preampCB = new QCheckBox(tr("Pre&amplifier"));

    // Main layout of dialog
    QHBoxLayout *grid = new QHBoxLayout;

    // add objects
    grid->addWidget (attGroupBox);
    grid->addWidget (pAttSlider);
    grid->addWidget (ditherCB);
    grid->addWidget (preampCB);


    // use grid obecjt as main dialog's layout 
    setLayout(grid);

    // general features
    setWindowTitle(tr("Perseus"));
    //resize(240, 160);

    // interconnects
    attMapper = new QSignalMapper(this);
    connect(att0Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att0Db, 0);

    connect(att10Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att10Db, 10);

    connect(att20Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att20Db, 20);

    connect(att30Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att30Db, 30);

    connect(attMapper, SIGNAL(mapped(int)), this, SLOT(attClicked(int)));

    connect(pAttSlider, SIGNAL(valueChanged(int)), this, SLOT(attClicked(int)));

    connect(ditherCB, SIGNAL(stateChanged(int)),  this, SLOT(ditherChanged(int)));
    connect(preampCB, SIGNAL(stateChanged(int)),  this, SLOT(preampChanged(int)));

    // update the serial number in title bar
    QString command;
    command.clear(); QTextStream(&command) << "*getserial?";
    pConn->sendCommand (command);

    // defaults
    ditherCB->setCheckState(Qt::Checked);  // dither ON
    preampCB->setCheckState(Qt::Checked);  // preamp ON
    att0Db->setChecked(true);              // attenuator 0 dB
}
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();
}
AMGenericStepScanConfigurationView::AMGenericStepScanConfigurationView(AMGenericStepScanConfiguration *configuration, AMControlSet *controls, AMDetectorSet *detectors, QWidget *parent)
	: AMScanConfigurationView(parent)
{
	configuration_ = configuration;
	controls_ = 0;
	detectors_ = 0;

	scanName_ = new QLineEdit;
	scanName_->setText(configuration_->name());
	scanName_->setAlignment(Qt::AlignCenter);
	connect(scanName_, SIGNAL(editingFinished()), this, SLOT(onScanNameEdited()));
	connect(configuration_, SIGNAL(nameChanged(QString)), scanName_, SLOT(setText(QString)));
	onScanNameEdited();

	// Dwell time.
	dwellTime_ = new QDoubleSpinBox;
	dwellTime_->setRange(0, 1000000);
	dwellTime_->setSuffix(" s");
	dwellTime_->setAlignment(Qt::AlignCenter);
	dwellTime_->setDecimals(1);
	dwellTime_->setValue(configuration_->scanAxes().size() > 0 ? double(configuration_->scanAxisAt(0)->regionAt(0)->regionTime()) : 1.0);
	dwellTime_->setMinimumWidth(100);
	connect(dwellTime_, SIGNAL(editingFinished()), this, SLOT(onDwellTimeChanged()));

	QHBoxLayout *timeLayout = new QHBoxLayout;
	timeLayout->addWidget(new QLabel("Dwell Time:"));
	timeLayout->addWidget(dwellTime_);

	// The estimated scan time.
	estimatedTime_ = new QLabel;
	connect(configuration_, SIGNAL(totalTimeChanged(double)), this, SLOT(onEstimatedTimeChanged()));
	onEstimatedTimeChanged();

	scanInformation_ = new QLabel("Scan Size:");

	QVBoxLayout *timeBoxLayout = new QVBoxLayout;
	timeBoxLayout->addLayout(timeLayout);
	timeBoxLayout->addWidget(estimatedTime_);
	timeBoxLayout->addWidget(scanInformation_);

	QGroupBox *timeGroupBox = new QGroupBox("Time");
	timeGroupBox->setLayout(timeBoxLayout);

	axisControlChoice1_ = new QComboBox;
	axisControlChoice2_ = new QComboBox;

	setControls(controls);

	connect(axisControlChoice1_, SIGNAL(currentIndexChanged(int)), this, SLOT(onAxisControlChoice1Changed()));
	connect(axisControlChoice2_, SIGNAL(currentIndexChanged(int)), this, SLOT(onAxisControlChoice2Changed()));

	// Setup the group box for setting the start and end points.
	QGroupBox *positionsBox = new QGroupBox("Positions");

	axisStart1_ = createPositionDoubleSpinBox("Start: ", "", configuration_->scanAxes().size() > 0 ? double(configuration_->scanAxisAt(0)->regionAt(0)->regionStart()) : -1.0, 3);
	axisStep1_ = createPositionDoubleSpinBox("Step: ", "", configuration_->scanAxes().size() > 0 ? double(configuration_->scanAxisAt(0)->regionAt(0)->regionStep()) : -1.0, 3);
	axisEnd1_ = createPositionDoubleSpinBox("End: ", "", configuration_->scanAxes().size() > 0 ? double(configuration_->scanAxisAt(0)->regionAt(0)->regionEnd()) : -1.0, 3);
	axisStart2_ = createPositionDoubleSpinBox("Start: ", "", configuration_->scanAxes().size() > 1 ? double(configuration_->scanAxisAt(1)->regionAt(0)->regionStart()) : -1.0, 3);
	axisStep2_ = createPositionDoubleSpinBox("Step: ", "", configuration_->scanAxes().size() > 1 ? double(configuration_->scanAxisAt(1)->regionAt(0)->regionStep()) : -1.0, 3);
	axisEnd2_ = createPositionDoubleSpinBox("End: ", "", configuration_->scanAxes().size() > 1 ? double(configuration_->scanAxisAt(1)->regionAt(0)->regionEnd()) : -1.0, 3);

	connect(configuration_, SIGNAL(scanAxisAdded(AMScanAxis*)), this, SLOT(onScanAxisAdded(AMScanAxis*)));

	QList<AMScanAxis*> axisList = configuration_->scanAxes();
	foreach (AMScanAxis *axis, axisList) {
		if (axis)
			onScanAxisAdded(axis);
	}

	QHBoxLayout *axis1Layout = new QHBoxLayout;
	axis1Layout->addWidget(axisStart1_);
	axis1Layout->addWidget(axisStep1_);
	axis1Layout->addWidget(axisEnd1_);
	axis1Layout->addWidget(axisControlChoice1_);

	QHBoxLayout *axis2Layout = new QHBoxLayout;
	axis2Layout->addWidget(axisStart2_);
	axis2Layout->addWidget(axisStep2_);
	axis2Layout->addWidget(axisEnd2_);
	axis2Layout->addWidget(axisControlChoice2_);

	QVBoxLayout *positionLayout = new QVBoxLayout;
	positionLayout->addLayout(axis1Layout);
	positionLayout->addLayout(axis2Layout);

	positionsBox->setLayout(positionLayout);

	// Set initial spinbox values in cases where we don't yet have axes:
	if(configuration_->scanAxes().count() == 0) {
		// Set defaults for axis 1 and 2
		onAxisControlChoice1Changed();
		onAxisControlChoice2Changed();
	} else if(configuration_->scanAxes().count() == 1) {
		// Set defaults just for axis 2
		onAxisControlChoice2Changed();
	}

	// Create I0 box and detectors view.

	i0ComboBox_ = new QComboBox;
	connect( configuration_, SIGNAL(i0DetectorChanged()), this, SLOT(updateI0Box()) );
	connect(i0ComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onI0ChoiceChanged(int)));

	QHBoxLayout *i0Layout = new QHBoxLayout;
	i0Layout->addWidget(new QLabel("I0:"));
	i0Layout->addWidget(i0ComboBox_);

	detectorsView_ = new AMGenericStepScanConfigurationDetectorsView(configuration_, 0);

	setDetectors(detectors);

	QVBoxLayout *detectorsBoxLayout = new QVBoxLayout();
	detectorsBoxLayout->addWidget(detectorsView_);

	QGroupBox *detectorsBox = new QGroupBox("Detectors");
	detectorsBox->setFlat(true);
	detectorsBox->setLayout(detectorsBoxLayout);

	QScrollArea *detectorScrollArea = new QScrollArea;
	detectorScrollArea->setWidget(detectorsBox);
	detectorScrollArea->setFrameStyle(QFrame::NoFrame);

	QVBoxLayout *detectorsAndI0Layout = new QVBoxLayout;
	detectorsAndI0Layout->addLayout(i0Layout);
	detectorsAndI0Layout->addWidget(detectorScrollArea);

	// Create and set main layouts.

	QVBoxLayout *layout = new QVBoxLayout;
	layout->addWidget(positionsBox);
	layout->addWidget(scanName_);
	layout->addWidget(timeGroupBox);

	QHBoxLayout *moreLayout = new QHBoxLayout;
	moreLayout->addStretch();
	moreLayout->addLayout(layout);
	moreLayout->addLayout(detectorsAndI0Layout);
	moreLayout->addStretch();

	QVBoxLayout *configViewLayout = new QVBoxLayout;
	configViewLayout->addStretch();
	configViewLayout->addLayout(moreLayout);
	configViewLayout->addStretch();

	setLayout(configViewLayout);
}
Example #16
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
    QGLFormat glFormat;
    glFormat.setVersion(3, 3);
    glFormat.setProfile(QGLFormat::CoreProfile);
    glFormat.setSampleBuffers(true);

    viewer = new ModelViewer(glFormat, this);    
    connect(viewer, SIGNAL(openGLInitialized()), this, SLOT(setTerrain()));

    //--------------------------------------------------------------------------------

    QGroupBox *gbStaticOptions = new QGroupBox("Static", this);
    gbStaticOptions->setFlat(true);

    sbPCount = new QSpinBox(this);
    sbPCount->setRange(4, 100000);
    sbPCount->setSingleStep(50);
    sbPCount->setValue(10000);

    sbPSSize = new QSpinBox(this);
    sbPSSize->setRange(50, 1000);
    sbPSSize->setSingleStep(50);
    sbPSSize->setValue(400);

    sbTCSize = new QSpinBox(this);
    sbTCSize->setRange(1, 400);
    sbTCSize->setSingleStep(1);
    sbTCSize->setValue(2);

    QGridLayout *statLayout = new QGridLayout();
    statLayout->setContentsMargins(0, 0, 0, 0);
    statLayout->setSpacing(5);
    statLayout->setColumnStretch(0, 0);
    statLayout->setColumnStretch(1, 1);
    statLayout->addWidget(new QLabel("Max particles:", this), 1, 0);
    statLayout->addWidget(sbPCount, 1, 1);
    statLayout->addWidget(new QLabel("Cube size:", this), 2, 0);
    statLayout->addWidget(sbPSSize, 2, 1);
    statLayout->addWidget(new QLabel("Terrain grid size:", this), 3, 0);
    statLayout->addWidget(sbTCSize, 3, 1);
    gbStaticOptions->setLayout(statLayout);

    //--------------------------------------------------------------------------------

    QGroupBox *gbDynamicOptions = new QGroupBox("Dynamic", this);
    gbDynamicOptions->setFlat(true);

    QComboBox *cbBType = new QComboBox(this);
    cbBType->addItem("perspective");
    cbBType->addItem("fixed size");
    cbBType->setCurrentIndex(0);
    connect(cbBType, SIGNAL(currentIndexChanged(int)), viewer, SLOT(setBillboardType(int)));

    sbTDist = new QDoubleSpinBox(this);
    sbTDist->setRange(0, 100);
    sbTDist->setSingleStep(1);
    sbTDist->setValue(50);
    connect(sbTDist, SIGNAL(valueChanged(double)), viewer, SLOT(setDistanceThreshold(double)));

    QCheckBox *cbShowTerrain = new QCheckBox("Show skybox", this);
    cbShowTerrain->setChecked(true);
    connect(cbShowTerrain, SIGNAL(toggled(bool)), viewer, SLOT(setShowTerrain(bool)));

    QCheckBox *cbShowWireframe = new QCheckBox("Wireframe", this);
    cbShowWireframe->setChecked(false);
    connect(cbShowWireframe, SIGNAL(toggled(bool)), viewer, SLOT(setWireframeMode(bool)));

    QPushButton *pbGenerate = new QPushButton("Generate", this);
    connect(pbGenerate, SIGNAL(clicked()), this, SLOT(generateParticles()));

    QGridLayout *dynLayout = new QGridLayout();
    dynLayout->setContentsMargins(0, 0, 0, 0);
    dynLayout->setSpacing(5);
    dynLayout->setColumnStretch(0, 0);
    dynLayout->setColumnStretch(1, 1);
    dynLayout->addWidget(new QLabel("Billboard type:", this), 0, 0);
    dynLayout->addWidget(cbBType, 0, 1);
    dynLayout->addWidget(new QLabel("Thres distance:", this), 1, 0);
    dynLayout->addWidget(sbTDist, 1, 1);
    dynLayout->addWidget(cbShowTerrain, 2, 0, 1, 2);
    dynLayout->addWidget(cbShowWireframe, 3, 0, 1, 2);
    dynLayout->addWidget(pbGenerate, 4, 0, 1, 2);
    gbDynamicOptions->setLayout(dynLayout);

    //--------------------------------------------------------------------------------

    QGroupBox *gbTerrainOptions = new QGroupBox("Terrain", this);
    gbTerrainOptions->setFlat(true);

    cbTerrainTexture = new QComboBox(this);
    cbTerrainTexture->addItem("texture 1");
    connect(cbTerrainTexture, SIGNAL(currentIndexChanged(int)), this, SLOT(setTerrainTexture(int)));

    QComboBox *cbTerrainMode = new QComboBox(this);
    cbTerrainMode->addItem("texture");
    cbTerrainMode->addItem("normal");
    cbTerrainMode->addItem("facet norm.");
    cbTerrainMode->addItem("vertex norm.");
    connect(cbTerrainMode, SIGNAL(currentIndexChanged(int)), viewer, SLOT(setTerrainTexMode(int)));

    QDoubleSpinBox *sbContrast = new QDoubleSpinBox(this);
    sbContrast->setRange(0.1, 10.0);
    sbContrast->setSingleStep(0.1);
    sbContrast->setValue(1.0);
    connect(sbContrast, SIGNAL(valueChanged(double)), viewer, SLOT(setTerrainContrast(double)));

    sbTPers = new QSpinBox(this);
    sbTPers->setRange(1, 500);
//    sbTPers->setSingleStep(10);
    sbTPers->setValue(10);

    sbTFreq = new QSpinBox(this);
    sbTFreq->setRange(1, 500);
//    sbTFreq->setSingleStep(10);
    sbTFreq->setValue(10);

    sbTAmp = new QDoubleSpinBox(this);
    sbTAmp->setRange(0.1, 100.0);
    sbTAmp->setValue(30.0);

    sbTOct = new QSpinBox(this);
    sbTOct->setRange(1, 10);
    sbTOct->setValue(3);

    QPushButton *pbUpdateTerrain = new QPushButton("Update terrain", this);
    connect(pbUpdateTerrain, SIGNAL(clicked()), this, SLOT(generateTerrain()));

    QGridLayout *terLayout = new QGridLayout();
    terLayout->setContentsMargins(0, 0, 0, 0);
    terLayout->setSpacing(5);
    terLayout->addWidget(new QLabel("Texture:", this), 0, 0);
    terLayout->addWidget(cbTerrainTexture, 0, 1);
    terLayout->addWidget(new QLabel("Mode:", this), 1, 0);
    terLayout->addWidget(cbTerrainMode, 1, 1);
    terLayout->addWidget(new QLabel("Contrast:", this), 2, 0);
    terLayout->addWidget(sbContrast, 2, 1);
    terLayout->addWidget(new QLabel("Persistence:", this), 3, 0);
    terLayout->addWidget(sbTPers, 3, 1);
    terLayout->addWidget(new QLabel("Frequency:", this), 4, 0);
    terLayout->addWidget(sbTFreq, 4, 1);
    terLayout->addWidget(new QLabel("Amplitude:", this), 5, 0);
    terLayout->addWidget(sbTAmp, 5, 1);
    terLayout->addWidget(new QLabel("Octaves:", this), 6, 0);
    terLayout->addWidget(sbTOct, 6, 1);
    terLayout->addWidget(pbUpdateTerrain, 7, 0, 1, 2);
    gbTerrainOptions->setLayout(terLayout);

    //--------------------------------------------------------------------------------

    QGroupBox *gbCameraOptions = new QGroupBox("Camera", this);
    gbCameraOptions->setFlat(true);

    cbCameraMode = new QCheckBox("Single camera", this);
    cbCameraMode->setChecked(true);
    connect(cbCameraMode, SIGNAL(toggled(bool)), this, SLOT(setCameraMode(bool)));

    cbCurrentCamera = new QComboBox(this);
    cbCurrentCamera->addItem("particles");
    cbCurrentCamera->addItem("free");
    cbCurrentCamera->setEnabled(false);
    connect(cbCurrentCamera, SIGNAL(currentIndexChanged(int)), viewer, SLOT(setCurrentCamera(int)));

    QGridLayout *camLayout = new QGridLayout();
    camLayout->setContentsMargins(0, 0, 0, 0);
    camLayout->setSpacing(5);
    camLayout->addWidget(cbCameraMode, 0, 0, 1, 2);
    camLayout->addWidget(new QLabel("Camera:", this), 1, 0);
    camLayout->addWidget(cbCurrentCamera, 1, 1);
    gbCameraOptions->setLayout(camLayout);

    //--------------------------------------------------------------------------------

    QGroupBox *gbOptions = new QGroupBox("Options", this);
    QGridLayout *optLayout = new QGridLayout();
    optLayout->setSpacing(5);
    optLayout->setContentsMargins(5, 5, 5, 5);
    optLayout->setColumnStretch(0, 0);
    optLayout->setColumnStretch(1, 1);
    optLayout->addWidget(gbStaticOptions, 0, 0, 1, 2);
    optLayout->addWidget(gbDynamicOptions, 1, 0, 1, 2);
    optLayout->addWidget(gbTerrainOptions, 3, 0, 1, 2);
    optLayout->addWidget(gbCameraOptions, 4, 0, 1, 2);

    optLayout->setRowStretch(2, 1);
    gbOptions->setLayout(optLayout);

    QWidget *w = new QWidget(this);
    QHBoxLayout *layout = new QHBoxLayout();
    layout->setContentsMargins(5, 5, 5, 5);
    layout->setSpacing(5);
    layout->addWidget(viewer, 1);
    layout->addWidget(gbOptions, 0);
    w->setLayout(layout);

    this->setCentralWidget(w);
    this->setWindowTitle("CG Task 4");
}
Example #17
0
 QGroupBox *ExportBox::createNonExclusiveGroup(QVBoxLayout *pvbox)
 {
     QGroupBox *groupBox = new QGroupBox(tr("Select Columns to Export"));
     groupBox->setFlat(true);

     QGridLayout *grid = new QGridLayout;
     for(unsigned int i=0; i < this->td->getHeaders().size(); i++ ) {
         QCheckBox *checkBox1 = new QCheckBox(this->td->getHeader(i));
         connect(checkBox1, SIGNAL( clicked()), this, SLOT(clickedChoice()) );
         grid->addWidget(checkBox1,(int)i/5, i%5);
         EXPORT_SELECT s;
         s.checkbox=checkBox1;
         s.rank = -1;
         s.name = this->td->getHeader(i);
         s.col = i;

         this->Columns.append(s);
     }

     QGroupBox *control = new QGroupBox;
     QHBoxLayout *controlLayout = new QHBoxLayout;

     QPushButton *selectAll = new QPushButton("Select All");
     QPushButton *clearAll = new QPushButton("Clear All");
     controlLayout->addWidget(selectAll);
     controlLayout->addWidget(clearAll);
     control->setLayout(controlLayout);
     controlLayout->addStretch(1);

     groupBox->setLayout(grid);
     pvbox->addWidget(groupBox);
     pvbox->addWidget(control);
     connect(selectAll, SIGNAL(clicked()), this, SLOT(selectAllHeadersSlot()));
     connect(clearAll, SIGNAL(clicked()), this, SLOT(clearAllHeadersSlot()));


     /////////////////////////

     if( this->td->isMultiSampleMode()) {
         this->samplesCheckboxes.clear();
        // qDebug() << "multisample";
         QGroupBox *sampleGroupBox = new QGroupBox(tr("Select Samples (to export sequences)"));
         sampleGroupBox->setFlat(true);
         QGridLayout *sampleGrid = new QGridLayout;
         for(unsigned int i=0; i < this->td->getSampleNames().size(); i++ ) {
             QCheckBox *checkBox1 = new QCheckBox(this->td->getSampleName(i));
             connect(checkBox1, SIGNAL( clicked()), this, SLOT(clickedChoice()) );
             sampleGrid->addWidget(checkBox1,(int)i/5, i%5);
             this->samplesCheckboxes.append(checkBox1);
         }

         control = new QGroupBox;
         controlLayout = new QHBoxLayout;

         selectAll = new QPushButton("Select All");
         clearAll = new QPushButton("Clear All");
         controlLayout->addWidget(selectAll);
         controlLayout->addWidget(clearAll);
         control->setLayout(controlLayout);
         controlLayout->addStretch(1);

         sampleGroupBox->setLayout(sampleGrid);
         pvbox->addWidget(sampleGroupBox);
         pvbox->addWidget(control);

         connect(selectAll, SIGNAL(clicked()), this, SLOT(selectAllSamplesSlot()));
         connect(clearAll, SIGNAL(clicked()), this, SLOT(clearAllSamplesSlot()));
     }



     exportFormat = new QGroupBox(tr("Export Format"));
     tsvRadio = new QCheckBox(tr("tsv"));
     csvRadio = new QCheckBox(tr("csv"));
     tsvRadio->setChecked(true);

     vbox = new QHBoxLayout;
     vbox->addWidget(tsvRadio);
     vbox->addWidget(csvRadio);

     fasta = new QCheckBox(tr("Contigs"));
     fna = new QCheckBox(tr("ORFs"));
     faa = new QCheckBox(tr("Amino"));
     megan = new QCheckBox(tr("MEGAN"));

     tsvRadio->setToolTip("Exports the table in the tsv format");
     csvRadio->setToolTip("Exports the table in the csv format");
     fasta->setToolTip("Exports the contigs (nucleotide sequences) where the ORFs originated");
     fna->setToolTip("Exports the ORFs (predicted gene coding regions of the nucleotide sequences)");
     faa->setToolTip("Exports the amino acid sequences");
     megan->setToolTip("Exports the ORF-wise homology search results to further analyze using the MEGAN software");

     vbox->addWidget(fasta);
     vbox->addWidget(fna);
     vbox->addWidget(faa);
     vbox->addWidget(megan);


     if(this->exportType == rRNATABLEEXP) {
         fna->hide();
         faa->hide();
         fasta->setText(tr("rRNA"));
         fasta->setToolTip("Exports the region of the contigs that has a hit in the rRNA database");
     }
     else if(this->exportType == tRNATABLEEXP ) {
         fna->hide();
         faa->hide();
         fasta->setText(tr("tRNA"));
         fasta->setToolTip("Exports the region of the contigs that has the tRNA");
     }
     else {
         fasta->show();
         fna->show();
         faa->show();
         megan->show();
     }

     vbox->addStretch(1);
     exportFormat->setLayout(vbox);
     pvbox->addWidget(exportFormat, this->td->getHeaders().size(), 0);
     cancelButton = new QPushButton("Cancel");
     exportButton = new QPushButton("Export");
     vbox->addWidget(cancelButton);
     vbox->addWidget(exportButton);


     return groupBox;
 }
Example #18
0
//--------------------------------------------------------------------------
// PROGRESS PAGE
//--------------------------------------------------------------------------
ProgressPage::ProgressPage(AddDatabase* addDatabase, QWidget* parent) : QWidget(parent)
{
  addDatabase_ = addDatabase;
  labelInitializeGames = new QLabel("Initialize Games");
  labelDuplicateCheck = new QLabel("Duplicate Check");
  labelParseGames = new QLabel("Parsing Games");
  labelInitializePatterns = new QLabel("Generating Patterns");
  labelOverall = new QLabel("Overall");
  labelInitializeGames->setMaximumHeight(20);
  labelDuplicateCheck->setMaximumHeight(20);
  labelParseGames->setMaximumHeight(20);
  labelInitializePatterns->setMaximumHeight(20);
  labelOverall->setMaximumHeight(20);
  
  labelCurrentTime = new QLabel("Elapsed time");
  labelEstimateTime = new QLabel("Estimated time");
  labelTotalGames = new QLabel("Number of Games found");
  labelDuplicateGames = new QLabel("Duplicate Games found");
  
  labelCurrentTime->setMaximumHeight(20);
  labelEstimateTime->setMaximumHeight(20);
  labelTotalGames->setMaximumHeight(20);
  labelDuplicateGames->setMaximumHeight(20);
  
  labelCurrentTimeData = new QLabel;
  labelEstimateTimeData = new QLabel;
  labelTotalGamesData = new QLabel;
  labelDuplicateGamesData = new QLabel;
    
  labelCurrentTimeData->setMaximumHeight(20);
  labelEstimateTimeData->setMaximumHeight(20);
  labelTotalGamesData->setMaximumHeight(20);
  labelDuplicateGamesData->setMaximumHeight(20);
  
  progressBarInitializeGames = new QProgressBar;
  progressBarDuplicateCheck = new QProgressBar;
  progressBarParseGames = new QProgressBar;
  progressBarInitializePatterns = new QProgressBar;
  progressBarInitializeGames->setMaximumHeight(20);
  progressBarDuplicateCheck->setMaximumHeight(20);
  progressBarParseGames->setMaximumHeight(20);
  progressBarInitializePatterns->setMaximumHeight(20);
  
  cancelButton = new QPushButton("&Cancel", this);
  backButton = new QPushButton("< &Back", this);
  finishButton = new QPushButton("&Finish", this);
  
  QGridLayout *layout = new QGridLayout;
  
  QGroupBox *groupBoxProgress = new QGroupBox(tr("Progress"));
  QGridLayout *gridLayoutProgress = new QGridLayout;
  gridLayoutProgress->addWidget(labelInitializeGames, 0, 0);
  gridLayoutProgress->addWidget(progressBarInitializeGames, 0, 1, 1, 2);
  gridLayoutProgress->addWidget(labelDuplicateCheck, 1, 0);
  gridLayoutProgress->addWidget(progressBarDuplicateCheck, 1, 1, 1, 2);
  gridLayoutProgress->addWidget(labelParseGames, 2, 0);
  gridLayoutProgress->addWidget(progressBarParseGames, 2, 1, 1, 2);
  gridLayoutProgress->addWidget(labelInitializePatterns, 3, 0);
  gridLayoutProgress->addWidget(progressBarInitializePatterns, 3, 1, 1, 2);
  groupBoxProgress->setLayout(gridLayoutProgress);
  groupBoxProgress->setMaximumHeight(150);
  groupBoxProgress->setFlat(true);
  layout->addWidget(groupBoxProgress, 0, 0, 1, 3);
  
  QGroupBox *groupBoxDetails = new QGroupBox(tr("Details"));
  QGridLayout *gridLayoutDetails = new QGridLayout;
  gridLayoutDetails->addWidget(labelCurrentTime, 0, 0, 1, 2);
  gridLayoutDetails->addWidget(labelCurrentTimeData, 0, 2);
  gridLayoutDetails->addWidget(labelTotalGames, 2, 0, 1, 2);
  gridLayoutDetails->addWidget(labelTotalGamesData, 2, 2);
  gridLayoutDetails->addWidget(labelDuplicateGames, 3, 0, 1, 2);
  gridLayoutDetails->addWidget(labelDuplicateGamesData, 3, 2);
  groupBoxDetails->setLayout(gridLayoutDetails);
  groupBoxDetails->setFlat(true);
  groupBoxDetails->setMaximumHeight(100);
  layout->addWidget(groupBoxDetails, 1, 0 , 1, 3);
  
  QSpacerItem* spacerButtons = new QSpacerItem(0, 0);
  QGridLayout *layoutButtons = new QGridLayout;
  QSpacerItem* spacer = new QSpacerItem(0, 0);
  layoutButtons->addItem(spacer, 0, 0);
  layoutButtons->addWidget(cancelButton, 0, 1);
  layoutButtons->addWidget(backButton, 0, 2);
  layoutButtons->addWidget(finishButton, 0, 3);
  layoutButtons->setColumnStretch(0, 1);
  layout->addItem(spacerButtons, 2, 0, 1, 3);
  layout->addItem(layoutButtons, 3, 0, 1, 3);  
  layout->setOriginCorner(Qt::TopLeftCorner);
  
  layout->setColumnMinimumWidth(0,100);
  layout->setColumnMinimumWidth(1,100);
  layout->setColumnMinimumWidth(2,100);
  setLayout(layout);

  connect(cancelButton, SIGNAL(clicked()),
          this, SLOT(cancelClick()));
  connect(backButton, SIGNAL(clicked()),
          this, SLOT(backClick()));
  connect(finishButton, SIGNAL(clicked()),
          addDatabase_, SLOT(accept()));

  finishButton->setEnabled(false);
  hasCancelled_ = false;
  isBackClicked_ = false;
}
HardwareRtlsdr :: HardwareRtlsdr (Connection *pC, QWidget *pW): DlgHardware (pC, pW)
{
    // Attenuator
    QGroupBox *attGroupBox = new QGroupBox(tr("Attenuator"));
    attGroupBox->setFlat ( true );

    QRadioButton *att1Db  = new QRadioButton(tr("-&1.0 dB"));
    QRadioButton *att15Db = new QRadioButton(tr("&1.5 dB"));
    QRadioButton *att40Db = new QRadioButton(tr("&4 dB"));
    QRadioButton *att65Db = new QRadioButton(tr("&6.5 dB"));
    QRadioButton *att90Db = new QRadioButton(tr("&9.0 dB"));
    QRadioButton *att115Db = new QRadioButton(tr("1&1.5 dB"));
    QRadioButton *att140Db = new QRadioButton(tr("1&4.0 dB"));
    QRadioButton *att165Db = new QRadioButton(tr("1&6.5 dB"));
    QRadioButton *att190Db = new QRadioButton(tr("1&9.0 dB"));
    QRadioButton *att215Db = new QRadioButton(tr("2&1.5 dB"));
    QRadioButton *att240Db = new QRadioButton(tr("2&4.0 dB"));
    QRadioButton *att290Db = new QRadioButton(tr("2&9.0 dB"));
    QRadioButton *att340Db = new QRadioButton(tr("3&4.0 dB"));
    QRadioButton *att420Db = new QRadioButton(tr("4&2.0 dB"));
    QRadioButton *att430Db = new QRadioButton(tr("4&3.0 dB"));
    QRadioButton *att450Db = new QRadioButton(tr("4&5.0 dB"));
    QRadioButton *att470Db = new QRadioButton(tr("4&7.0 dB"));
    QRadioButton *att490Db = new QRadioButton(tr("4&9.0 dB"));
    
    QVBoxLayout *vbox = new QVBoxLayout;

    vbox->addWidget(att1Db  );
    vbox->addWidget(att15Db );
    vbox->addWidget(att40Db );
    vbox->addWidget(att65Db );
    vbox->addWidget(att90Db );

    vbox->addWidget(att115Db);
    vbox->addWidget(att140Db);
    vbox->addWidget(att165Db);
    vbox->addWidget(att190Db);
    vbox->addWidget(att215Db);
    vbox->addWidget(att240Db);
    vbox->addWidget(att290Db);
    vbox->addWidget(att340Db);
    vbox->addWidget(att420Db);
    vbox->addWidget(att430Db);
    vbox->addWidget(att450Db);
    vbox->addWidget(att470Db);
    vbox->addWidget(att490Db);

    vbox->addStretch(1);

    attGroupBox->setLayout(vbox);

    // Main layout of dialog
    QHBoxLayout *grid = new QHBoxLayout;

    // add objects
    grid->addWidget (attGroupBox);

    // use grid obecjt as main dialog's layout 
    setLayout(grid);

    // general features
    setWindowTitle(tr("RTL SDR"));
    resize(240, 200);

    // interconnects
    attMapper = new QSignalMapper(this);
    connect(att1Db,  SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att1Db, -10);

    connect(att15Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att15Db, 15);

    connect(att40Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att40Db, 40);

    connect(att65Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att65Db, 65);

    connect(att90Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att90Db, 90);

    connect(att115Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att115Db, 115);

    connect(att140Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att140Db, 140);

    connect(att165Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att165Db, 165);

    connect(att190Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att190Db, 190);

    connect(att215Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att215Db, 215);

    connect(att240Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att240Db, 240);

    connect(att340Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att340Db, 340);

    connect(att420Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att420Db, 420);

    connect(att430Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att430Db, 430);

    connect(att450Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att450Db, 470);

    connect(att490Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att490Db, 490);

    connect(attMapper, SIGNAL(mapped(int)), this, SLOT(attClicked(int)));

    // update the serial number in title bar
    QString command;
    command.clear(); QTextStream(&command) << "*getserial?";
    pConn->sendCommand (command);

    // defaults
    attenuatorVal = -1;

    att1Db->setChecked(true);              // attenuator -1 dB
}
BioXASSSRLMonochromatorEnergyView::BioXASSSRLMonochromatorEnergyView(BioXASSSRLMonochromator *mono, QWidget *parent) :
    QWidget(parent)
{
    // Initialize class variables.

    mono_ = 0;

    // Create energy editors.

    stepEnergyEditor_ = new CLSControlEditor(0);
    stepEnergyEditor_->setTitle("Energy (step)");
    stepEnergyEditor_->setFormat('f');

    encoderEnergyEditor_ = new CLSControlEditor(0);
    encoderEnergyEditor_->setTitle("Energy (encoder)");
    encoderEnergyEditor_->setFormat('f');
    encoderEnergyEditor_->setReadOnly(true);

    stepBraggEditor_ = new CLSControlEditor(0);
    stepBraggEditor_->setTitle("Goniometer (step)");
    stepBraggEditor_->setFormat('f');
    stepBraggEditor_->setPrecision(3);

    encoderBraggEditor_ = new CLSControlEditor(0);
    encoderBraggEditor_->setTitle("Goniometer (encoder)");
    encoderBraggEditor_->setFormat('f');
    encoderBraggEditor_->setPrecision(3);
    encoderBraggEditor_->setReadOnly(true);

    mirrorPitchEditor_ = new CLSControlEditor(0);
    mirrorPitchEditor_->setTitle("M1 mirror pitch");
    mirrorPitchEditor_->setFormat('f');
    mirrorPitchEditor_->setPrecision(3);

    // Create bragg configuration view.

    braggConfigurationView_ = new CLSMAXvMotorConfigurationView(0);

    QVBoxLayout *braggConfigBoxLayout = new QVBoxLayout();
    braggConfigBoxLayout->addWidget(braggConfigurationView_);

    QGroupBox *braggConfigBox = new QGroupBox();
    braggConfigBox->setTitle("Goniometer Configuration");
    braggConfigBox->setFlat(true);
    braggConfigBox->setLayout(braggConfigBoxLayout);

    // Create and set main layout.

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

    QVBoxLayout *layout = new QVBoxLayout();
    layout->setMargin(0);
    layout->addLayout(energyEditorsLayout);
    layout->addWidget(braggConfigBox);

    setLayout(layout);

    // Current settings.

    setMono(mono);

    refresh();
}
Example #21
0
void VirshGui::populateVMInfos(string vmname)
{
    VMStatus vmstatus = vmlist[vmname].getStatus();
    string strstatus = vmlist[vmname].statusToString(vmstatus);
    string memory = vmlist[vmname].getMemory();
    string vmxml = vmlist[vmname].dumpXML();
    string cpuCount = vmlist[vmname].getCPUCount();
    string ostype = vmlist[vmname].getOSType();
    string arch = vmlist[vmname].getArch();
    vector<string> bootDevs = vmlist[vmname].getBootDevs();
    vector<string> hvFeatures = vmlist[vmname].getHVFeatures();
    vector<string> cpuFeatures = vmlist[vmname].getCPUFeatures();

    string bootDevStr = join(bootDevs, ", ");
    string hvFeatureStr = join(hvFeatures, ", ");
    string cpuFeatureStr = join(cpuFeatures, ", ");

    if (vmstatus == VMStatus::shutoff) {
        ui->startStopButton->setText("VM starten");
        ui->startStopButton->setEnabled(true);
        ui->shutdownButton->setDisabled(true);
        ui->rebootButton->setDisabled(true);
        ui->virtViewerButton->setDisabled(true);
    } else if (vmstatus == VMStatus::running) {
        ui->startStopButton->setText("VM ausschalten");
        ui->startStopButton->setEnabled(true);
        ui->shutdownButton->setEnabled(true);
        ui->rebootButton->setEnabled(true);
        ui->virtViewerButton->setEnabled(true);
    } else {
        ui->startStopButton->setText("keine Aktion");
        ui->startStopButton->setDisabled(true);
        ui->shutdownButton->setDisabled(true);
        ui->rebootButton->setDisabled(true);
        ui->virtViewerButton->setDisabled(true);
    }

    while (ui->snapshotsTabLayout->count() > 0) {
        QLayoutItem *item = ui->snapshotsTabLayout->takeAt(0);
        delete item->widget();
        delete item;
    }

    int snapshotTableCount = 0;
    for (auto hdd : vmlist[vmname].getHDDImages()) {
        int row = 0;
        QGroupBox *hddGroupBox = new QGroupBox(QString::fromStdString(hdd.getPath()));
        hddGroupBox->setFlat(false);

        QVBoxLayout *hddVBox = new QVBoxLayout;
        QTableWidget *snapshotTable = new QTableWidget(0, 5, this);
        snapshotTable->setSelectionMode(QAbstractItemView::SingleSelection);
        snapshotTable->setHorizontalHeaderLabels(QStringList() << "ID" << "Tag" << "VM Size" << "Date" << "VM Clock");
        snapshotTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
        //snapshotTable->setColumnWidth(0, 45);
        snapshotTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
        snapshotTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
        snapshotTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
        snapshotTable->horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
        snapshotTable->verticalHeader()->hide();
        snapshotTable->setAlternatingRowColors(true);
        //snapshotTable->setSortingEnabled(true);
        snapshotTable->setEditTriggers(QTableWidget::NoEditTriggers);
        connect(snapshotTable, &QTableWidget::cellPressed, [this, snapshotTableCount](){ clearSnapshotSelectionsExcept(snapshotTableCount); });
        snapshotTableCount++;

        for (auto snapshot : hdd.getSnapshots()) {
            snapshotTable->setRowCount(row + 1);
            QTableWidgetItem *id = new QTableWidgetItem(
                    QString::fromStdString(snapshot.getID()));
            QTableWidgetItem *tag = new QTableWidgetItem(
                    QString::fromStdString(snapshot.getTag()));
            QTableWidgetItem *size = new QTableWidgetItem(
                    QString::fromStdString(snapshot.getSize()));
            QTableWidgetItem *date = new QTableWidgetItem(
                    QString::fromStdString(snapshot.getDate()));
            QTableWidgetItem *clock = new QTableWidgetItem(
                    QString::fromStdString(snapshot.getClock()));

            snapshotTable->setItem(row, 0, id);
            snapshotTable->setItem(row, 1, tag);
            snapshotTable->setItem(row, 2, size);
            snapshotTable->setItem(row, 3, date);
            snapshotTable->setItem(row, 4, clock);

            row++;
        }
        hddVBox->addWidget(snapshotTable);

        QHBoxLayout *addSnapHBox = new QHBoxLayout;
        QLineEdit *addSnapNameEdit = new QLineEdit;
        QPushButton *addSnapButton = new QPushButton;
        addSnapButton->setText("Snapshot erstellen");
        addSnapButton->setEnabled(false);
        string hddPath = hdd.getPath();
        connect(addSnapNameEdit, &QLineEdit::textChanged, [this, addSnapButton, addSnapNameEdit](){ toggleAddSnapshotButton(addSnapButton, addSnapNameEdit); });
        connect(addSnapButton, &QPushButton::clicked, [this, hddPath, vmname, addSnapNameEdit](){ createSnapshot(hddPath, vmname, addSnapNameEdit->text().toStdString()); });
        addSnapHBox->addWidget(addSnapNameEdit);
        addSnapHBox->addWidget(addSnapButton);

        hddVBox->addLayout(addSnapHBox);
        hddGroupBox->setLayout(hddVBox);
        ui->snapshotsTabLayout->addWidget(hddGroupBox);
    }

    QPushButton *applySnapshotButton = new QPushButton("Snapshot Anwenden", this);
    connect(applySnapshotButton, SIGNAL(clicked(bool)), this, SLOT(applySnapshot()));
    //connect(applySnapshotButton, &QPushButton::clicked, [this](){ clearSnapshotSelectionsExcept(1); });
    ui->snapshotsTabLayout->addWidget(applySnapshotButton);

    ui->xmlDisplay->setText(QString::fromStdString(vmxml));
    ui->vmnameLabel->setText(QString::fromStdString(vmname));
    ui->statusLabel->setText(QString::fromStdString(strstatus));
    ui->memoryLabel->setText(QString::fromStdString(memory));
    ui->cpucountLabel->setText(QString::fromStdString(cpuCount));
    ui->typeLabel->setText(QString::fromStdString(ostype));
    ui->archLabel->setText(QString::fromStdString(arch));
    ui->bootdevLabel->setText(QString::fromStdString(bootDevStr));
    ui->hvFeaturesLabel->setText(QString::fromStdString(hvFeatureStr));
    ui->hvFeaturesLabel->setWordWrap(true);
    ui->cpuFeaturesLabel->setText(QString::fromStdString(cpuFeatureStr));
    ui->cpuFeaturesLabel->setWordWrap(true);
}
Example #22
0
WorldView::WorldView(QWidget* parent)
    : portals::Module(),
      QWidget(parent),
      commThread("comm", COMM_FRAME_LENGTH_uS),
      wviewComm(16,0),
      sharedBallOut(base()),
      locOut(base()),
      wviewShared(1),
      newTeam(0),
      mutex()
{
    commThread.addModule(*this);
    commThread.addModule(wviewComm);
    commThread.addModule(wviewShared);

#ifdef USE_LAB_FIELD
    fieldPainter = new WorldViewPainter(this, 2.);
#else
    fieldPainter = new WorldViewPainter(this, 1.);
#endif

    QHBoxLayout *mainLayout = new QHBoxLayout(this);

    QHBoxLayout *field = new QHBoxLayout();
    field->addWidget(fieldPainter);

    QVBoxLayout *rightBar = new QVBoxLayout();

    QVBoxLayout *options = new QVBoxLayout();
    options->setAlignment(Qt::AlignTop);
    startButton = new QPushButton(QString("Start World Viewer"));
    flipButton = new QPushButton(QString("FLIP"));
    options->addWidget(flipButton);
    options->addWidget(startButton);

    QHBoxLayout *teamLayout = new QHBoxLayout();
    QLabel *teamLabel = new QLabel(tr("Listening to Team: "));
    teamSelector = new QLineEdit(tr("16"));
    QValidator *teamVal = new QIntValidator(1, 255);
    teamSelector->setValidator(teamVal);
    teamLayout->addWidget(teamLabel);
    teamLayout->addWidget(teamSelector);
    options->addLayout(teamLayout);

    connect(teamSelector, SIGNAL(editingFinished()), this, SLOT(teamChanged()));

    QVBoxLayout *stateLayout = new QVBoxLayout();
    stateLayout->setAlignment(Qt::AlignTop);

    QGroupBox *stateBox = new QGroupBox(tr("Robot States"));
    QVBoxLayout *boxLayout = new QVBoxLayout();
    for (int i = 0; i < NUM_PLAYERS_PER_TEAM; ++i)
    {
        roleLabels[i] = new QLabel(tr("Inactive"));
    }
    QHBoxLayout *p1Layout = new QHBoxLayout();
    QLabel *p1Label = new QLabel(tr("Player 1: "));
    QHBoxLayout *p2Layout = new QHBoxLayout();
    QLabel *p2Label = new QLabel(tr("Player 2: "));
    QHBoxLayout *p3Layout = new QHBoxLayout();
    QLabel *p3Label = new QLabel(tr("Player 3: "));
    QHBoxLayout *p4Layout = new QHBoxLayout();
    QLabel *p4Label = new QLabel(tr("Player 4: "));
    QHBoxLayout *p5Layout = new QHBoxLayout();
    QLabel *p5Label = new QLabel(tr("Player 5: "));

    p1Layout->addWidget(p1Label);
    p1Layout->addWidget(roleLabels[0]);

    p2Layout->addWidget(p2Label);
    p2Layout->addWidget(roleLabels[1]);

    p3Layout->addWidget(p3Label);
    p3Layout->addWidget(roleLabels[2]);

    p4Layout->addWidget(p4Label);
    p4Layout->addWidget(roleLabels[3]);

    p5Layout->addWidget(p5Label);
    p5Layout->addWidget(roleLabels[4]);

    boxLayout->addLayout(p1Layout);
    boxLayout->addLayout(p2Layout);
    boxLayout->addLayout(p3Layout);
    boxLayout->addLayout(p4Layout);
    boxLayout->addLayout(p5Layout);
    boxLayout->setSpacing(20);

    stateBox->setFlat(false);

    stateBox->setLayout(boxLayout);
    stateLayout->addWidget(stateBox);

    rightBar->addLayout(options);
    rightBar->addLayout(stateLayout);

    mainLayout->addLayout(field);
    mainLayout->addLayout(rightBar);

    this->setLayout(mainLayout);

    connect(startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
    connect(flipButton, SIGNAL(clicked()), this, SLOT(flipButtonClicked()));

    for (int i = 0; i < NUM_PLAYERS_PER_TEAM; ++i)
    {
        commIn[i].wireTo(wviewComm._worldModels[i]);
        wviewShared.worldModelIn[i].wireTo(wviewComm._worldModels[i]);
    }

    wviewShared.ballIn.wireTo(&sharedBallOut,true);
    wviewShared.locIn.wireTo(&locOut,true);

    sharedIn.wireTo(&wviewShared.sharedBallOutput);
}
Example #23
0
HardwareHiqsdr :: HardwareHiqsdr (Connection *pC, QWidget *pW): Hardware (pC, pW)
{
    // Attenuator
    QGroupBox *attGroupBox = new QGroupBox(tr("Attenuator"));
    attGroupBox->setFlat ( true );

    QRadioButton *att0Db  = new QRadioButton(tr("&0 dB"));
    QRadioButton *att10Db = new QRadioButton(tr("-&10 dB"));
    QRadioButton *att20Db = new QRadioButton(tr("-&20 dB"));
    QRadioButton *att30Db = new QRadioButton(tr("-&30 dB"));
    QRadioButton *att40Db = new QRadioButton(tr("-&40 dB"));
    
    QVBoxLayout *vbox = new QVBoxLayout;

    vbox->addWidget(att0Db);
    vbox->addWidget(att10Db);
    vbox->addWidget(att20Db);
    vbox->addWidget(att30Db);
    vbox->addWidget(att40Db);
    vbox->addStretch(1);

    attGroupBox->setLayout(vbox);

    // Antenna selector
    QGroupBox *antGroupBox = new QGroupBox(tr("Antenna"));

    QRadioButton *ant0  = new QRadioButton(tr("Antenna input # &0"));
    QRadioButton *ant1  = new QRadioButton(tr("Antenna input # &1"));

    QVBoxLayout *vabox = new QVBoxLayout;

    vabox->addWidget(ant0);
    vabox->addWidget(ant1);
    antGroupBox->setLayout(vabox);

    // preselector
    QGroupBox *preselGroupBox = new QGroupBox(tr("Preselector"));
    QVBoxLayout *vpbox = new QVBoxLayout;

    for (int i = 0; i < 16; ++i) {
        char s[16];
        sprintf (s, "%d", i);
        psel[i] = new QRadioButton(tr(s));
        vpbox->addWidget(psel[i]);
    }
    preselGroupBox->setLayout(vpbox);

   // preamplifier
    QGroupBox *preampGroupBox = new QGroupBox(tr("Preamplifier"));
    QVBoxLayout *vpabox = new QVBoxLayout;
    preamp = new QCheckBox(tr("Pre&amplifier"));
    vpabox->addWidget(preamp);
    preampGroupBox->setLayout(vpabox);
    
    
    // Main layout of dialog
    QHBoxLayout *grid = new QHBoxLayout;
    
    // left sub pane
    QVBoxLayout *leftsp = new QVBoxLayout;
    leftsp->addWidget (attGroupBox);
    leftsp->addWidget (preampGroupBox);
    leftsp->addWidget (antGroupBox);
    
    // add objects to main layout
    grid->addLayout (leftsp);
    
    // add objects to main layout 
    grid->addWidget (preselGroupBox);

    // use grid obecjt as main dialog's layout 
    setLayout(grid);

    // general features
    setWindowTitle(tr("HiQSDR"));
    resize(240, 200);

    // interconnects
    attMapper = new QSignalMapper(this);
    connect(att0Db,  SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att0Db, 0);

    connect(att10Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att10Db, 10);

    connect(att20Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att20Db, 20);

    connect(att30Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att30Db, 30);

    connect(att40Db, SIGNAL(toggled(bool)), attMapper, SLOT(map()));
    attMapper->setMapping(att40Db, 40);

    connect(attMapper, SIGNAL(mapped(int)), this, SLOT(attClicked(int)));

    // antenna mapper
    antMapper = new QSignalMapper(this);
    connect(ant0,  SIGNAL(toggled(bool)), antMapper, SLOT(map()));
    antMapper->setMapping(ant0, 0);

    connect(ant1, SIGNAL(toggled(bool)), antMapper, SLOT(map()));
    antMapper->setMapping(ant1, 1);

    connect(antMapper, SIGNAL(mapped(int)), this, SLOT(antClicked(int)));

    // preselector mapper
    preselMapper = new QSignalMapper(this);
    for (int i = 0; i < 16; ++i) {
        connect(psel[i],  SIGNAL(toggled(bool)), preselMapper, SLOT(map()));
        preselMapper->setMapping(psel[i], i);
    }
    connect(preselMapper, SIGNAL(mapped(int)), this, SLOT(preselClicked(int)));

    // preamplifier event connection
    connect(preamp, SIGNAL(stateChanged(int)),  this, SLOT(preampChanged(int)));
 
    // update the serial number in title bar
    QString command;
    command.clear(); QTextStream(&command) << "*getserial?";
    pConn->sendCommand (command);

    // defaults
    attenuatorVal = -1;
    antennaVal = -1;
    preampVal = 0;

    att0Db->setChecked(true);              // attenuator 0 dB
    ant0->setChecked(true);                // antenna #0
    psel[0]->setChecked(true);
    preamp->setChecked(false);             // preamplifier off

    // update local preselector labels querying the remote server
    for (int n=0; n < 16; ++n) {
        QString command;
        command.clear(); QTextStream(&command) << "*getpreselector? " << n;
        pConn->sendCommand (command);
    }
    // update local preaplifier status querying the remote server
    {
        QString command;
        command.clear(); QTextStream(&command) << "*getpreampstatus?";
        pConn->sendCommand (command);
    }
}
Example #24
0
KCMStyle::KCMStyle( QWidget* parent, const char* name )
	: KCModule( parent, name ), appliedStyle(NULL)
{
    setQuickHelp( i18n("<h1>Style</h1>"
			"This module allows you to modify the visual appearance "
			"of user interface elements, such as the widget style "
			"and effects."));

	m_bEffectsDirty = false;
	m_bStyleDirty= false;
	m_bToolbarsDirty = false;

	KGlobal::dirs()->addResourceType("themes",
		KStandardDirs::kde_default("data") + "kstyle/themes");

	KAboutData *about =
		new KAboutData( I18N_NOOP("kcmstyle"),
						I18N_NOOP("KDE Style Module"),
						0, 0, KAboutData::License_GPL,
						I18N_NOOP("(c) 2002 Karol Szwed, Daniel Molkentin"));

	about->addAuthor("Karol Szwed", 0, "*****@*****.**");
	about->addAuthor("Daniel Molkentin", 0, "*****@*****.**");
	about->addAuthor("Ralf Nolden", 0, "*****@*****.**");
	setAboutData( about );

	// Setup pages and mainLayout
	mainLayout = new QVBoxLayout( this );
	tabWidget  = new QTabWidget( this );
	mainLayout->addWidget( tabWidget );

	page1 = new QWidget( tabWidget );
	page1Layout = new QVBoxLayout( page1, KDialog::marginHint(), KDialog::spacingHint() );
	page2 = new QWidget( tabWidget );
	page2Layout = new QVBoxLayout( page2, KDialog::marginHint(), KDialog::spacingHint() );
	page3 = new QWidget( tabWidget );
	page3Layout = new QVBoxLayout( page3, KDialog::marginHint(), KDialog::spacingHint() );

	// Add Page1 (Style)
	// -----------------
	gbWidgetStyle = new QGroupBox( i18n("Widget Style"), page1, "gbWidgetStyle" );
	gbWidgetStyle->setColumnLayout( 0, Qt::Vertical );
	gbWidgetStyle->layout()->setMargin( KDialog::marginHint() );
	gbWidgetStyle->layout()->setSpacing( KDialog::spacingHint() );

	gbWidgetStyleLayout = new QVBoxLayout( gbWidgetStyle->layout() );
	gbWidgetStyleLayout->setAlignment( Qt::AlignTop );
	hbLayout = new QHBoxLayout( KDialog::spacingHint(), "hbLayout" );

	cbStyle = new KComboBox( gbWidgetStyle, "cbStyle" );
	cbStyle->setEditable( FALSE );
	hbLayout->addWidget( cbStyle );

	pbConfigStyle = new QPushButton( i18n("Con&figure..."), gbWidgetStyle );
	pbConfigStyle->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum );
	pbConfigStyle->setEnabled( FALSE );
	hbLayout->addWidget( pbConfigStyle );

	gbWidgetStyleLayout->addLayout( hbLayout );

	lblStyleDesc = new QLabel( gbWidgetStyle );
	lblStyleDesc->setTextFormat(Qt::RichText);
	gbWidgetStyleLayout->addWidget( lblStyleDesc );

	cbIconsOnButtons = new QCheckBox( i18n("Sho&w icons on buttons"), gbWidgetStyle );
	gbWidgetStyleLayout->addWidget( cbIconsOnButtons );
	cbEnableTooltips = new QCheckBox( i18n("E&nable tooltips"), gbWidgetStyle );
	gbWidgetStyleLayout->addWidget( cbEnableTooltips );
	cbTearOffHandles = new QCheckBox( i18n("Show tear-off handles in &popup menus"), gbWidgetStyle );
	gbWidgetStyleLayout->addWidget( cbTearOffHandles );
	cbTearOffHandles->hide(); // reenable when the corresponding Qt method is virtual and properly reimplemented

    QGroupBox *gbPreview = new QGroupBox( i18n( "Preview" ), page1 );
	gbPreview->setColumnLayout( 0, Vertical );
	gbPreview->layout()->setMargin( 0 );
	gbPreview->layout()->setSpacing( KDialog::spacingHint() );
	gbPreview->setFlat( true );
	stylePreview = new StylePreview( gbPreview );
	gbPreview->layout()->add( stylePreview );

	page1Layout->addWidget( gbWidgetStyle );
	page1Layout->addWidget( gbPreview );

	// Connect all required stuff
	connect( cbStyle, SIGNAL(activated(int)), this, SLOT(styleChanged()) );
	connect( cbStyle, SIGNAL(activated(int)), this, SLOT(updateConfigButton()));
	connect( pbConfigStyle, SIGNAL(clicked()), this, SLOT(styleSpecificConfig()));

	// Add Page2 (Effects)
	// -------------------
	cbEnableEffects = new QCheckBox( i18n("&Enable GUI effects"), page2 );
	containerFrame = new QFrame( page2 );
	containerFrame->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
	containerFrame->setMargin(0);
	containerLayout = new QGridLayout( containerFrame, 1, 1,	// rows, columns
		KDialog::marginHint(), KDialog::spacingHint() );

	comboComboEffect = new QComboBox( FALSE, containerFrame );
	comboComboEffect->insertItem( i18n("Disable") );
	comboComboEffect->insertItem( i18n("Animate") );
	lblComboEffect = new QLabel( i18n("Combobo&x effect:"), containerFrame );
	lblComboEffect->setBuddy( comboComboEffect );
	containerLayout->addWidget( lblComboEffect, 0, 0 );
	containerLayout->addWidget( comboComboEffect, 0, 1 );

	comboTooltipEffect = new QComboBox( FALSE, containerFrame );
	comboTooltipEffect->insertItem( i18n("Disable") );
	comboTooltipEffect->insertItem( i18n("Animate") );
	comboTooltipEffect->insertItem( i18n("Fade") );
	lblTooltipEffect = new QLabel( i18n("&Tool tip effect:"), containerFrame );
	lblTooltipEffect->setBuddy( comboTooltipEffect );
	containerLayout->addWidget( lblTooltipEffect, 1, 0 );
	containerLayout->addWidget( comboTooltipEffect, 1, 1 );

	comboMenuEffect = new QComboBox( FALSE, containerFrame );
	comboMenuEffect->insertItem( i18n("Disable") );
	comboMenuEffect->insertItem( i18n("Animate") );
	comboMenuEffect->insertItem( i18n("Fade") );
	comboMenuEffect->insertItem( i18n("Make Translucent") );
	lblMenuEffect = new QLabel( i18n("&Menu effect:"), containerFrame );
	lblMenuEffect->setBuddy( comboMenuEffect );
	containerLayout->addWidget( lblMenuEffect, 2, 0 );
	containerLayout->addWidget( comboMenuEffect, 2, 1 );

	comboMenuHandle = new QComboBox( FALSE, containerFrame );
	comboMenuHandle->insertItem( i18n("Disable") );
	comboMenuHandle->insertItem( i18n("Application Level") );
//	comboMenuHandle->insertItem( i18n("Enable") );
	lblMenuHandle = new QLabel( i18n("Me&nu tear-off handles:"), containerFrame );
	lblMenuHandle->setBuddy( comboMenuHandle );
	containerLayout->addWidget( lblMenuHandle, 3, 0 );
	containerLayout->addWidget( comboMenuHandle, 3, 1 );

	cbMenuShadow = new QCheckBox( i18n("Menu &drop shadow"), containerFrame );
	containerLayout->addWidget( cbMenuShadow, 4, 0 );

	// Push the [label combo] to the left.
	comboSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	containerLayout->addItem( comboSpacer, 1, 2 );

	// Separator.
	QFrame* hline = new QFrame ( page2 );
	hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );

	// Now implement the Menu Transparency container.
	menuContainer = new QFrame( page2 );
	menuContainer->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
	menuContainer->setMargin(0);
	menuContainerLayout = new QGridLayout( menuContainer, 1, 1,    // rows, columns
		KDialog::marginHint(), KDialog::spacingHint() );

	menuPreview = new MenuPreview( menuContainer, /* opacity */ 90, MenuPreview::Blend );

	comboMenuEffectType = new QComboBox( FALSE, menuContainer );
	comboMenuEffectType->insertItem( i18n("Software Tint") );
	comboMenuEffectType->insertItem( i18n("Software Blend") );
#ifdef HAVE_XRENDER
	comboMenuEffectType->insertItem( i18n("XRender Blend") );
#endif

	// So much stuffing around for a simple slider..
	sliderBox = new QVBox( menuContainer );
	sliderBox->setSpacing( KDialog::spacingHint() );
	sliderBox->setMargin( 0 );
	slOpacity = new QSlider( 0, 100, 5, /*opacity*/ 90, Qt::Horizontal, sliderBox );
	slOpacity->setTickmarks( QSlider::Below );
	slOpacity->setTickInterval( 10 );
	QHBox* box1 = new QHBox( sliderBox );
	box1->setSpacing( KDialog::spacingHint() );
	box1->setMargin( 0 );
	QLabel* lbl = new QLabel( i18n("0%"), box1 );
	lbl->setAlignment( AlignLeft );
	lbl = new QLabel( i18n("50%"), box1 );
	lbl->setAlignment( AlignHCenter );
	lbl = new QLabel( i18n("100%"), box1 );
	lbl->setAlignment( AlignRight );

	lblMenuEffectType = new QLabel( comboMenuEffectType, i18n("Menu trans&lucency type:"), menuContainer );
	lblMenuEffectType->setAlignment( AlignBottom | AlignLeft );
	lblMenuOpacity    = new QLabel( slOpacity, i18n("Menu &opacity:"), menuContainer );
	lblMenuOpacity->setAlignment( AlignBottom | AlignLeft );

	menuContainerLayout->addWidget( lblMenuEffectType, 0, 0 );
	menuContainerLayout->addWidget( comboMenuEffectType, 1, 0 );
	menuContainerLayout->addWidget( lblMenuOpacity, 2, 0 );
	menuContainerLayout->addWidget( sliderBox, 3, 0 );
	menuContainerLayout->addMultiCellWidget( menuPreview, 0, 3, 1, 1 );

	// Layout page2.
	page2Layout->addWidget( cbEnableEffects );
	page2Layout->addWidget( containerFrame );
	page2Layout->addWidget( hline );
	page2Layout->addWidget( menuContainer );

	QSpacerItem* sp1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
	page2Layout->addItem( sp1 );

	// Data flow stuff.
	connect( cbEnableEffects,     SIGNAL(toggled(bool)), containerFrame, SLOT(setEnabled(bool)) );
	connect( cbEnableEffects,     SIGNAL(toggled(bool)), this, SLOT(menuEffectChanged(bool)) );
	connect( slOpacity,           SIGNAL(valueChanged(int)),menuPreview, SLOT(setOpacity(int)) );
	connect( comboMenuEffect,     SIGNAL(activated(int)), this, SLOT(menuEffectChanged()) );
	connect( comboMenuEffect,     SIGNAL(highlighted(int)), this, SLOT(menuEffectChanged()) );
	connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(menuEffectTypeChanged()) );
	connect( comboMenuEffectType, SIGNAL(highlighted(int)), this, SLOT(menuEffectTypeChanged()) );

	// Add Page3 (Miscellaneous)
	// -------------------------
	cbHoverButtons = new QCheckBox( i18n("High&light buttons under mouse"), page3 );
	cbTransparentToolbars = new QCheckBox( i18n("Transparent tool&bars when moving"), page3 );

	QWidget * dummy = new QWidget( page3 );
	
	QHBoxLayout* box2 = new QHBoxLayout( dummy, 0, KDialog::spacingHint() );
	lbl = new QLabel( i18n("Text pos&ition:"), dummy );
	comboToolbarIcons = new QComboBox( FALSE, dummy );
	comboToolbarIcons->insertItem( i18n("Icons Only") );
	comboToolbarIcons->insertItem( i18n("Text Only") );
	comboToolbarIcons->insertItem( i18n("Text Alongside Icons") );
	comboToolbarIcons->insertItem( i18n("Text Under Icons") );
	lbl->setBuddy( comboToolbarIcons );

	box2->addWidget( lbl );
	box2->addWidget( comboToolbarIcons );
	QSpacerItem* sp2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
	box2->addItem( sp2 );
	
	page3Layout->addWidget( cbHoverButtons );
	page3Layout->addWidget( cbTransparentToolbars );
	page3Layout->addWidget( dummy );
	
	// Layout page3.
	QSpacerItem* sp3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
	page3Layout->addItem( sp3 );

	// Load settings
	load();

	// Do all the setDirty connections.
	connect(cbStyle, SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	// Page2
	connect( cbEnableEffects,     SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( cbEnableEffects,     SIGNAL(toggled(bool)),    this, SLOT(setStyleDirty()));
	connect( comboTooltipEffect,  SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
	connect( comboComboEffect,    SIGNAL(activated(int)), this, SLOT(setEffectsDirty()));
	connect( comboMenuEffect,     SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	connect( comboMenuHandle,     SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(setStyleDirty()));
	connect( slOpacity,           SIGNAL(valueChanged(int)),this, SLOT(setStyleDirty()));
	connect( cbMenuShadow,        SIGNAL(toggled(bool)),    this, SLOT(setStyleDirty()));
	// Page3
	connect( cbHoverButtons,        SIGNAL(toggled(bool)),    this, SLOT(setToolbarsDirty()));
	connect( cbTransparentToolbars, SIGNAL(toggled(bool)),    this, SLOT(setToolbarsDirty()));
	connect( cbEnableTooltips,      SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( cbIconsOnButtons,      SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( cbTearOffHandles,      SIGNAL(toggled(bool)),    this, SLOT(setEffectsDirty()));
	connect( comboToolbarIcons,     SIGNAL(activated(int)), this, SLOT(setToolbarsDirty()));

	addWhatsThis();

	// Insert the pages into the tabWidget
	tabWidget->insertTab( page1, i18n("&Style"));
	tabWidget->insertTab( page2, i18n("&Effects"));
	tabWidget->insertTab( page3, i18n("&Toolbar"));

	//Enable/disable the button for the initial style
	updateConfigButton();
}