Example #1
0
QList<QWidget *> Object::getControls()
{
    QSpinBox *bonus = new QSpinBox();
    bonus->setObjectName("bonus");    
    bonus->setMaximum(1000);
    bonus->setValue(_bonus);
    connect(bonus,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_bonus = new Control("Bonificación de armadura", bonus);

    QSpinBox *time = new QSpinBox();
    time->setSuffix(" seg");
    time->setObjectName("time");
    time->setMinimum(1);
    time->setMaximum(1000);
    time->setValue(_time);
    connect(time,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_time = new Control("Tiempo de efecto", time);

    QSpinBox *cooldown = new QSpinBox();
    cooldown->setSuffix(" seg");
    cooldown->setObjectName("cooldown");
    cooldown->setMinimum(1);
    cooldown->setMaximum(1000);
    cooldown->setValue(_cooldown);
    connect(cooldown,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_cooldown = new Control("Tiempo de reaparición", cooldown);

    QList<QWidget*> controls = IObject::getControls();
    controls.append(c_bonus);
    controls.append(c_time);
    controls.append(c_cooldown);

    return controls;
}
QWidget* DashLabel::getSettingsWidget(int setting){
    QToolButton* btn;
    QLineEdit *line;
    QSpinBox *spin;
    switch(setting){
        case 0:
            line = new QLineEdit;
            line->setObjectName("Nome");
            line->setText(item->text(0));
            line->setMaxLength(14);
            connect(line, SIGNAL(textChanged(QString)), this, SLOT(setName(QString)));
            return line;
        case 2:
            spin = new QSpinBox;
            spin->setObjectName("X");
            spin->setMinimum(0);
            spin->setMaximum(1920);
            spin->setValue(x);
            connect(spin, SIGNAL(valueChanged(int)), this, SLOT(setX(int)));
            return spin;
        case 3:
            spin = new QSpinBox;
            spin->setObjectName("Y");
            spin->setMinimum(0);
            spin->setMaximum(1920);
            spin->setValue(y);
            connect(spin, SIGNAL(valueChanged(int)), this, SLOT(setY(int)));
            return spin;
        case 4:
            line = new QLineEdit;
            line->setObjectName("Testo");
            line->setText(text);
            connect(line, SIGNAL(textChanged(QString)), this, SLOT(setText(QString)));
            return line;
        case 5:
            btn = new QToolButton;
            btn->setObjectName("Font");
            btn->setText("...");
            connect(btn, SIGNAL(clicked()), this, SLOT(setFont()));
            return btn;
        default:
            return DashWidget::getSettingsWidget(setting);
    }
}
Example #3
0
//al seleccionar un modulo, se crean las etiquetas y los campos editables de los parametros de dicho modulo.
void ParameterDialog::updateField(QString module){
    ui->label->setText("Parameters of "+module+":");
    int index = ui->currentList->currentRow();
    clearLists();
    if(index < 0 )
        return;
    std::deque<parameter> parametros;
    parametros = getParameters(index);
    int j=0;
    //Se revisa la lista de parametros del module seleccionado.
    for(int i = 0; i < parametros.size(); i++){
        //por cada parametro se crea una etiqueta y su campo editor de dato dependiendo de la tipo del parametro.
        QLabel *labelTemp = new QLabel(ui->scrollAreaWidgetContents);
        parameter &p = parametros[i];
        labelTemp->setText(p.name);
        if( p.type == "int"){
            QSpinBox *lineEditTemp = new QSpinBox(ui->scrollAreaWidgetContents);
            lineEditTemp->setMaximum((va->moduleSequence[index]->listParameters[i].value.toInt())+1000);
            lineEditTemp->setValue(va->moduleSequence[index]->listParameters[i].value.toInt());
            lineEditTemp->setObjectName(va->moduleSequence[index]->listParameters[i].name);
            lineEditTemp->show();
            lineEditTemp->setGeometry(QRect(160,30+j,113,20));
            valueSB.push_back(lineEditTemp);
        }
        else if( p.type == "QString"){
            QLineEdit *lineEditTemp = new QLineEdit(ui->scrollAreaWidgetContents);
            lineEditTemp->setText(p.value);
            lineEditTemp->setObjectName(p.name);
            lineEditTemp->show();
            lineEditTemp->setGeometry(QRect(160,30+j,113,20));
            valueL.push_back(lineEditTemp);
        }
        else if( p.type == "double"){
            QDoubleSpinBox * lineEditTemp = new QDoubleSpinBox(ui->scrollAreaWidgetContents);
            lineEditTemp->setMaximum(p.value.toInt()+1000);
            lineEditTemp->setValue(p.value.toDouble());
            lineEditTemp->setObjectName(p.name);
            lineEditTemp->show();
            lineEditTemp->setGeometry(QRect(160,30+j,113,20));
            valueDSB.push_back(lineEditTemp);
        }
        else {
            QLineEdit *lineEditTemp = new QLineEdit(ui->scrollAreaWidgetContents);
            lineEditTemp->setText(p.value);
            lineEditTemp->setObjectName(p.name);
            lineEditTemp->show();
            lineEditTemp->setGeometry(QRect(160,30+j,113,20));
            valueL.push_back(lineEditTemp);
        }
        labelTemp->show();
        labelTemp->setGeometry(QRect(10,30+j,(labelTemp->text().size())*7,13));
        nameParam.push_back(labelTemp);
        j+=30;
    }
    ui->scrollAreaWidgetContents->setGeometry(ui->scrollAreaWidgetContents->x(), ui->scrollAreaWidgetContents->y(), ui->scrollAreaWidgetContents->width(), j+40);
}
QWidget* DashBar::getSettingsWidget(int setting){
    QComboBox *combo;
    QSpinBox *spin;
    switch (setting) {
        case 6:
            combo = new QComboBox;
            combo->setObjectName("Orientamento");
            combo->addItem("Verticale");
            combo->addItem("Orizzontale");
            combo->setCurrentIndex(orientation == Qt::Vertical? 0 : 1);
            connect(combo, SIGNAL(activated(int)), this, SLOT(setOrientation(int)));
            return combo;
        case 7:
            spin = new QSpinBox;
            spin->setObjectName("Min");
            spin->setMinimum(INT_MIN);
            spin->setMaximum(INT_MAX);
            spin->setValue(value1);
            connect(spin, SIGNAL(valueChanged(int)), this, SLOT(setValue1(int)));
            return spin;
        case 8:
            spin = new QSpinBox;
            spin->setObjectName("Max");
            spin->setMinimum(INT_MIN);
            spin->setMaximum(INT_MAX);
            spin->setValue(value2);
            connect(spin, SIGNAL(valueChanged(int)), this, SLOT(setValue2(int)));
            return spin;
            /*
        case 9:
            spin = new QSpinBox;
            spin->setObjectName("Value");
            spin->setMinimum(INT_MIN);
            spin->setMaximum(INT_MAX);
            spin->setValue(value);
            connect(spin, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
            return spin;
            */
        default:
            return DashWidget::getSettingsWidget(setting);
    }
}
Example #5
0
QWidget* PropertyEditor::createWidgetForInt(const QString& name, int value, const QString& detail, QWidget* parent)
{
    mProperties[name] = value;
    QSpinBox *box = new QSpinBox(parent);
    if (!detail.isEmpty())
        box->setToolTip(detail);
    box->setObjectName(name);
    box->setValue(value);
    connect(box, SIGNAL(valueChanged(int)), SLOT(onIntChange(int)));
    return box;
}
Example #6
0
QList<QWidget *> Object::getControls()
{
    QSpinBox *experience = new QSpinBox();
    experience->setObjectName("experience");
    experience->setMaximum(1000);
    experience->setValue(_experience);
    connect(experience,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_experience = new Control("Bonificación de experiencia",experience);

    QSpinBox *cooldown = new QSpinBox();
    cooldown->setSuffix(" seg");
    cooldown->setObjectName("cooldown");
    cooldown->setMaximum(1000);
    cooldown->setValue(_cooldown);

    connect(cooldown,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
    Control *c_cooldown = new Control("Tiempo de reaparición",cooldown);

    QList<QWidget*> controls = IObject::getControls();
    controls.append(c_experience);
    controls.append(c_cooldown);

    return controls;
}
Example #7
0
void DkFilePreference::createLayout() {

	// temp folder
	DkDirectoryChooser* dirChooser = new DkDirectoryChooser(Settings::param().global().tmpPath, this);
	dirChooser->setObjectName("dirChooser");

	QLabel* tLabel = new QLabel(tr("Screenshots are automatically saved to this folder"), this);
	
	DkGroupWidget* tempFolderGroup = new DkGroupWidget(tr("Use Temporary Folder"), this);
	tempFolderGroup->addWidget(dirChooser);
	tempFolderGroup->addWidget(tLabel);

	// cache size
	int maxCache = qMax(qRound(DkMemory::getTotalMemory()*0.1), 512);
	qDebug() << "max cache" << maxCache;
	QSpinBox* cacheBox = new QSpinBox(this);
	cacheBox->setObjectName("cacheBox");
	cacheBox->setMinimum(0);
	cacheBox->setMaximum(maxCache);
	cacheBox->setSuffix(" MB");
	cacheBox->setMaximumWidth(200);
	cacheBox->setValue(qRound(Settings::param().resources().cacheMemory));

	QLabel* cLabel = new QLabel(tr("We recommend to set a moderate cache value arround 100 MB"), this);
	
	DkGroupWidget* cacheGroup = new DkGroupWidget(tr("Maximal Cache Size"), this);
	cacheGroup->addWidget(cacheBox);
	cacheGroup->addWidget(cLabel);

	// history size
	// cache size
	QSpinBox* historyBox = new QSpinBox(this);
	historyBox->setObjectName("historyBox");
	historyBox->setMinimum(0);
	historyBox->setMaximum(1024);
	historyBox->setSuffix(" MB");
	historyBox->setMaximumWidth(200);
	historyBox->setValue(qRound(Settings::param().resources().historyMemory));

	QLabel* hLabel = new QLabel(tr("We recommend to set a moderate edit history value arround 100 MB"), this);

	DkGroupWidget* historyGroup = new DkGroupWidget(tr("History Size"), this);
	historyGroup->addWidget(historyBox);
	historyGroup->addWidget(hLabel);


	// loading policy
	QVector<QRadioButton*> loadButtons;
	loadButtons.append(new QRadioButton(tr("Skip Images"), this));
	loadButtons[0]->setToolTip(tr("Images are skipped until the Next key is released"));
	loadButtons.append(new QRadioButton(tr("Wait for Images to be Loaded"), this));
	loadButtons[1]->setToolTip(tr("The next image is loaded after the current image is shown."));

	// check wrt the current settings
	loadButtons[0]->setChecked(!Settings::param().resources().waitForLastImg);
	loadButtons[1]->setChecked(Settings::param().resources().waitForLastImg);

	QButtonGroup* loadButtonGroup = new QButtonGroup(this);
	loadButtonGroup->setObjectName("loadGroup");
	loadButtonGroup->addButton(loadButtons[0], 0);
	loadButtonGroup->addButton(loadButtons[1], 1);

	DkGroupWidget* loadGroup = new DkGroupWidget(tr("Image Loading Policy"), this);
	loadGroup->addWidget(loadButtons[0]);
	loadGroup->addWidget(loadButtons[1]);

	// skip images
	QSpinBox* skipBox = new QSpinBox(this);
	skipBox->setObjectName("skipBox");
	skipBox->setMinimum(2);
	skipBox->setMaximum(1000);
	skipBox->setValue(Settings::param().global().skipImgs);
	skipBox->setMaximumWidth(200);

	DkGroupWidget* skipGroup = new DkGroupWidget(tr("Number of Skipped Images on PgUp/PgDown"), this);
	skipGroup->addWidget(skipBox);

	// left column
	QWidget* leftWidget = new QWidget(this);
	QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
	leftLayout->addWidget(tempFolderGroup);
	leftLayout->addWidget(cacheGroup);
	leftLayout->addWidget(historyGroup);
	leftLayout->addWidget(loadGroup);
	leftLayout->addWidget(skipGroup);

	QHBoxLayout* layout = new QHBoxLayout(this);
	layout->setAlignment(Qt::AlignLeft);
	layout->addWidget(leftWidget);
}
Example #8
0
void DkDisplayPreference::createLayout() {

	// zoom settings
	QCheckBox* invertZoom = new QCheckBox(tr("Invert mouse wheel behaviour for zooming"), this);
	invertZoom->setObjectName("invertZoom");
	invertZoom->setToolTip(tr("If checked, the mouse wheel behaviour is inverted while zooming."));
	invertZoom->setChecked(Settings::param().display().invertZoom);

	QLabel* interpolationLabel = new QLabel(tr("Show pixels if zoom level is above"), this);

	QSpinBox* sbInterpolation = new QSpinBox(this);
	sbInterpolation->setObjectName("interpolationBox");
	sbInterpolation->setToolTip(tr("nomacs will not interpolate images if the zoom level is larger."));
	sbInterpolation->setSuffix("%");
	sbInterpolation->setMinimum(0);
	sbInterpolation->setMaximum(10000);
	sbInterpolation->setValue(Settings::param().display().interpolateZoomLevel);

	DkGroupWidget* zoomGroup = new DkGroupWidget(tr("Zoom"), this);
	zoomGroup->addWidget(invertZoom);
	zoomGroup->addWidget(interpolationLabel);
	zoomGroup->addWidget(sbInterpolation);

	// keep zoom radio buttons
	QVector<QRadioButton*> keepZoomButtons;
	keepZoomButtons.resize(DkSettings::zoom_end);
	keepZoomButtons[DkSettings::zoom_always_keep] = new QRadioButton(tr("Always keep zoom"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size] = new QRadioButton(tr("Keep zoom if the size is the same"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size]->setToolTip(tr("If checked, the zoom level is only kept, if the image loaded has the same level as the previous."));
	keepZoomButtons[DkSettings::zoom_never_keep] = new QRadioButton(tr("Never keep zoom"), this);

	QCheckBox* cbZoomToFit = new QCheckBox(tr("Always zoom to fit"), this);
	cbZoomToFit->setObjectName("zoomToFit");
	cbZoomToFit->setChecked(Settings::param().display().zoomToFit);

	// check wrt the current settings
	keepZoomButtons[Settings::param().display().keepZoom]->setChecked(true);

	QButtonGroup* keepZoomButtonGroup = new QButtonGroup(this);
	keepZoomButtonGroup->setObjectName("keepZoom");
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_always_keep], DkSettings::zoom_always_keep);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_keep_same_size], DkSettings::zoom_keep_same_size);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_never_keep], DkSettings::zoom_never_keep);

	DkGroupWidget* keepZoomGroup = new DkGroupWidget(tr("When Displaying New Images"), this);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_always_keep]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_keep_same_size]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_never_keep]);
	keepZoomGroup->addWidget(cbZoomToFit);
	
	// icon size
	QSpinBox* sbIconSize = new QSpinBox(this);
	sbIconSize->setObjectName("iconSizeBox");
	sbIconSize->setToolTip(tr("Define the icon size in pixel."));
	sbIconSize->setSuffix(" px");
	sbIconSize->setMinimum(16);
	sbIconSize->setMaximum(1024);
	sbIconSize->setValue(Settings::param().display().iconSize);

	DkGroupWidget* iconGroup = new DkGroupWidget(tr("Icon Size"), this);
	iconGroup->addWidget(sbIconSize);

	// slideshow
	QLabel* fadeImageLabel = new QLabel(tr("Image Transition"), this);

	QComboBox* cbTransition = new QComboBox(this);
	cbTransition->setObjectName("transition");
	cbTransition->setToolTip(tr("Choose a transition when loading a new image"));

	for (int idx = 0; idx < DkSettings::trans_end; idx++) {

		QString str = tr("Unknown Transition");

		switch (idx) {
		case DkSettings::trans_appear:	str = tr("Appear"); break;
		case DkSettings::trans_swipe:	str = tr("Swipe");	break;
		case DkSettings::trans_fade:	str = tr("Fade");	break;
		}

		cbTransition->addItem(str);
	}
	cbTransition->setCurrentIndex(Settings::param().display().transition);

	QDoubleSpinBox* fadeImageBox = new QDoubleSpinBox(this);
	fadeImageBox->setObjectName("fadeImageBox");
	fadeImageBox->setToolTip(tr("Define the image transition speed."));
	fadeImageBox->setSuffix(" sec");
	fadeImageBox->setMinimum(0.0);
	fadeImageBox->setMaximum(3);
	fadeImageBox->setSingleStep(.2);
	fadeImageBox->setValue(Settings::param().display().animationDuration);

	QCheckBox* cbAlwaysAnimate = new QCheckBox(tr("Always Animate Image Loading"), this);
	cbAlwaysAnimate->setObjectName("alwaysAnimate");
	cbAlwaysAnimate->setToolTip(tr("If unchecked, loading is only animated if nomacs is fullscreen"));
	cbAlwaysAnimate->setChecked(Settings::param().display().alwaysAnimate);

	QLabel* displayTimeLabel = new QLabel(tr("Display Time"), this);
	
	QDoubleSpinBox* displayTimeBox = new QDoubleSpinBox(this);
	displayTimeBox->setObjectName("displayTimeBox");
	displayTimeBox->setToolTip(tr("Define the time an image is displayed."));
	displayTimeBox->setSuffix(" sec");
	displayTimeBox->setMinimum(0.0);
	displayTimeBox->setMaximum(30);
	displayTimeBox->setSingleStep(.2);
	displayTimeBox->setValue(Settings::param().slideShow().time);

	DkGroupWidget* slideshowGroup = new DkGroupWidget(tr("Slideshow"), this);
	slideshowGroup->addWidget(fadeImageLabel);
	slideshowGroup->addWidget(cbTransition);
	slideshowGroup->addWidget(fadeImageBox);
	slideshowGroup->addWidget(cbAlwaysAnimate);
	slideshowGroup->addWidget(displayTimeLabel);
	slideshowGroup->addWidget(displayTimeBox);

	// left column
	QWidget* leftWidget = new QWidget(this);
	QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
	leftLayout->setAlignment(Qt::AlignTop);
	leftLayout->addWidget(zoomGroup);
	leftLayout->addWidget(keepZoomGroup);
	leftLayout->addWidget(iconGroup);
	leftLayout->addWidget(slideshowGroup);

	// right column
	QWidget* rightWidget = new QWidget(this);
	QVBoxLayout* rightLayout = new QVBoxLayout(rightWidget);
	rightLayout->setAlignment(Qt::AlignTop);

	QHBoxLayout* layout = new QHBoxLayout(this);
	layout->setAlignment(Qt::AlignLeft);

	layout->addWidget(leftWidget);
	layout->addWidget(rightWidget);
}
QList<QPair<QLabel*, QWidget*> > QgsVectorLayerSaveAsDialog::createControls( const QMap<QString, QgsVectorFileWriter::Option*>& options )
{
  QList<QPair<QLabel*, QWidget*> > controls;
  QMap<QString, QgsVectorFileWriter::Option*>::ConstIterator it;

  for ( it = options.constBegin(); it != options.constEnd(); ++it )
  {
    QgsVectorFileWriter::Option *option = it.value();
    QLabel *label = new QLabel( it.key() );
    QWidget *control = nullptr;
    switch ( option->type )
    {
      case QgsVectorFileWriter::Int:
      {
        QgsVectorFileWriter::IntOption *opt = dynamic_cast<QgsVectorFileWriter::IntOption*>( option );
        if ( opt )
        {
          QSpinBox *sb = new QSpinBox();
          sb->setObjectName( it.key() );
          sb->setValue( opt->defaultValue );
          control = sb;
        }
        break;
      }

      case QgsVectorFileWriter::Set:
      {
        QgsVectorFileWriter::SetOption *opt = dynamic_cast<QgsVectorFileWriter::SetOption*>( option );
        if ( opt )
        {
          QComboBox* cb = new QComboBox();
          cb->setObjectName( it.key() );
          Q_FOREACH ( const QString& val, opt->values )
          {
            cb->addItem( val, val );
          }
          if ( opt->allowNone )
            cb->addItem( tr( "<Default>" ), QVariant( QVariant::String ) );
          int idx = cb->findText( opt->defaultValue );
          if ( idx == -1 )
            idx = cb->findData( QVariant( QVariant::String ) );
          cb->setCurrentIndex( idx );
          control = cb;
        }
        break;
      }

      case QgsVectorFileWriter::String:
      {
        QgsVectorFileWriter::StringOption *opt = dynamic_cast<QgsVectorFileWriter::StringOption*>( option );
        if ( opt )
        {
          QLineEdit* le = new QLineEdit( opt->defaultValue );
          le->setObjectName( it.key() );
          control = le;
        }
        break;
      }

      case QgsVectorFileWriter::Hidden:
        control = nullptr;
        break;
    }

    if ( control )
    {
      // Pack the tooltip in some html element, so it gets linebreaks.
      label->setToolTip( QString( "<p>%1</p>" ).arg( option->docString ) );
      control->setToolTip( QString( "<p>%1</p>" ).arg( option->docString ) );

      controls << QPair<QLabel*, QWidget*>( label, control );
    }
  }

  return controls;
}
Example #10
0
void MultisigDialog::on_addInputButton_clicked()
{
    if(isFirstRawTx){
        isFirstRawTx = false;
        ui->txInputsScrollArea->show();
    }
    QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);

    QFrame* txInputFrame = new QFrame(ui->txInputsWidget);
    sizePolicy.setHeightForWidth(txInputFrame->sizePolicy().hasHeightForWidth());
    txInputFrame->setFrameShape(QFrame::StyledPanel);
    txInputFrame->setFrameShadow(QFrame::Raised);
    txInputFrame->setObjectName(QStringLiteral("txInputFrame"));

    QVBoxLayout* frameLayout = new QVBoxLayout(txInputFrame);
    frameLayout->setSpacing(1);
    frameLayout->setObjectName(QStringLiteral("txInputFrameLayout"));
    frameLayout->setContentsMargins(6, 6, 6, 6);

    QHBoxLayout* txInputLayout = new QHBoxLayout();
    txInputLayout->setObjectName(QStringLiteral("txInputLayout"));

    QLabel* txInputIdLabel = new QLabel(txInputFrame);
    txInputIdLabel->setObjectName(QStringLiteral("txInputIdLabel"));
    txInputIdLabel->setText(QApplication::translate("MultisigDialog", strprintf("%i. Tx Hash: ", ui->inputsList->count()+1).c_str(), 0));
    txInputLayout->addWidget(txInputIdLabel);

    QLineEdit* txInputId = new QLineEdit(txInputFrame);
    txInputId->setObjectName(QStringLiteral("txInputId"));

    txInputLayout->addWidget(txInputId);

    QSpacerItem* horizontalSpacer = new QSpacerItem(10, 20, QSizePolicy::Fixed, QSizePolicy::Minimum);
    txInputLayout->addItem(horizontalSpacer);

    QLabel* txInputVoutLabel = new QLabel(txInputFrame);
    txInputVoutLabel->setObjectName(QStringLiteral("txInputVoutLabel"));
    txInputVoutLabel->setText(QApplication::translate("MultisigDialog", "Vout Position: ", 0));

    txInputLayout->addWidget(txInputVoutLabel);

    QSpinBox* txInputVout = new QSpinBox(txInputFrame);
    txInputVout->setObjectName("txInputVout");
    sizePolicy.setHeightForWidth(txInputVout->sizePolicy().hasHeightForWidth());
    txInputVout->setSizePolicy(sizePolicy);
    txInputLayout->addWidget(txInputVout);

    QPushButton* inputDeleteButton = new QPushButton(txInputFrame);
    inputDeleteButton->setObjectName(QStringLiteral("inputDeleteButton"));
    QIcon icon;
    icon.addFile(QStringLiteral(":/icons/remove"), QSize(), QIcon::Normal, QIcon::Off);
    inputDeleteButton->setIcon(icon);
    inputDeleteButton->setAutoDefault(false);
    connect(inputDeleteButton, SIGNAL(clicked()), this, SLOT(deleteFrame()));
    txInputLayout->addWidget(inputDeleteButton);

    frameLayout->addLayout(txInputLayout);

    ui->inputsList->addWidget(txInputFrame);
}
Example #11
0
QWidget* WidgetStyle::createWidget(const QString& name)
{
    if(name == "CheckBox")
    {
        QCheckBox* box = new QCheckBox("CheckBox");
        box->setObjectName("CheckBox");
        return setLayoutWidget({ box }, { 100, 30 });
    }
    else if(name == "ComboBox")
    {
        QComboBox* box = new QComboBox;
        box->addItem("Item1");
        box->addItem("Item3");
        box->addItem("Item3");
        box->setObjectName("ComboBox");
        return setLayoutWidget({ box }, { 70, 30 });
    }
    else if(name == "DateEdit")
    {
        QDateEdit* date = new QDateEdit;
        date->setObjectName("DateEdit");
        return setLayoutWidget({ date }, { 110, 40 });
    }
    else if(name == "DateTimeEdit")
    {
        QDateTimeEdit* date = new QDateTimeEdit;
        date->setObjectName("DateTimeEdit");
        return setLayoutWidget({ date }, { 160, 30 });
    }
    else if(name == "Dialog")
    {
        QDialog* dialog = new QDialog;
        dialog->setObjectName("Dialog");
        return setLayoutWidget({ dialog }, { 160, 110 });
    }
    else if(name == "DockWidget") //?
    {
        QDockWidget* widget = new QDockWidget;
        widget->setObjectName("DockWidget");
        widget->resize(61, 22);
        return widget;
    }
    else if(name == "DoubleSpinBox")
    {
        QDoubleSpinBox* box = new QDoubleSpinBox;
        box->setObjectName("DoubleSpinBox");
        return setLayoutWidget({ box }, { 90, 40 });
    }
    else if(name == "Frame") //??
    {
        QFrame* frame = new QFrame;
        frame->setObjectName("Frame");
        frame->resize(150, 100);
        return frame;
    }
    else if(name == "GroupBox")
    {
        QGroupBox* box = new QGroupBox("GroupBox");
        box->setObjectName("GroupBox");
        return setLayoutWidget({ box }, { 160, 110 });
    }
    else if(name == "Label")
    {
        QLabel* label = new QLabel("Label");
        label->setObjectName("Label");
        return setLayoutWidget({ label }, { 40, 20});
    }
    else if(name == "LineEdit")
    {
        QLineEdit* line = new QLineEdit;
        line->setObjectName("LineEdit");
        return setLayoutWidget({ line }, { 30, 30 });
    }
    else if(name == "ListView") //??
    {
        QListView* view = new QListView;
        view->setObjectName("ListView");
        view->resize(71, 71);
        return view;
    }
    else if(name == "ListWidget")
    {
        QListWidget* list = new QListWidget;
        list->setObjectName("ListWidget");
        for(int i = 0; i < 20; i++)
            list->addItem(QString("Item %1").arg(i));
        return setLayoutWidget({ list }, { 80, 80 });
    }
    else if(name == "MainWindow")
    {
        QMainWindow* window = new QMainWindow;
        window->setObjectName("MainWindow");
        return setLayoutWidget({ window }, { 160, 110 });
    }
    else if(name == "Menu")
    {
        QMenu* parentMenu = new QMenu;
        parentMenu->setObjectName("Menu");
        parentMenu->addMenu("Menu1");
        QMenu* menu1 = parentMenu->addMenu("Menu2");
        menu1->addMenu("Menu1");
        menu1->addMenu("Menu2");
        parentMenu->addSeparator();
        parentMenu->addMenu("Menu3");
        return setLayoutWidget({ parentMenu }, { 160, 110 });
    }
    else if(name == "MenuBar")
    {
        QMenuBar* bar = new QMenuBar;
        bar->setObjectName("QMenuBar");
        QMenu* menu1 = bar->addMenu("MenuBar1");
        menu1->addMenu("Menu1");
        menu1->addSeparator();
        menu1->addMenu("Menu2");
        QMenu* menu2 = bar->addMenu("MenuBar2");
        menu2->addMenu("Menu1");
        menu2->addSeparator();
        menu2->addMenu("Menu2");
        QMenu* menu3 = bar->addMenu("MenuBar3");
        menu3->addMenu("Menu1");
        menu3->addSeparator();
        menu3->addMenu("Menu2");
        return setLayoutWidget({ bar }, { 280, 60 });
    }
    else if(name == "ProgressBar")
    {
        QProgressBar* bar = new QProgressBar;
        bar->setObjectName("ProgressBar");
        bar->setRange(0, 100);
        bar->setValue(0);

        QTimer* timer = new QTimer(bar);
        this->connect(timer, &QTimer::timeout, this, [bar]()
        {
            if(bar->value() == 100)
                bar->setValue(0);
            else
                bar->setValue(bar->value() + 1);
        });
        timer->start(100);
        return setLayoutWidget({ bar }, { 110, 30 });
    }
    else if(name == "PushButton")
    {
        QPushButton* button = new QPushButton("PushButton");
        button->setObjectName("PushButton");
        return setLayoutWidget({ button }, { 125, 30 });
    }
    else if(name == "RadioButton")
    {
        QRadioButton* button = new QRadioButton("RadioButton");
        button->setObjectName("RadioButton");
        return setLayoutWidget({ button }, { 125, 30 });
    }
    else if(name == "ScrollBar")
    {
        QScrollBar* barH = new QScrollBar(Qt::Horizontal);
        QScrollBar* barV = new QScrollBar(Qt::Vertical);
        barH->setObjectName("ScrollBarH");
        barV->setObjectName("ScrollBarV");
        return setLayoutWidget({ barH, barV }, { 200, 100 });
    }
    else if(name == "Slider")
    {
        QSlider* sliderH = new QSlider(Qt::Horizontal);
        QSlider* sliderV = new QSlider(Qt::Vertical);
        sliderH->setObjectName("SliderH");
        sliderV->setObjectName("SliderV");
        return setLayoutWidget({ sliderH, sliderV }, { 200, 100 });
    }
    else if(name == "SpinBox")
    {
        QSpinBox* spinBox = new QSpinBox;
        spinBox->setObjectName("SpinBox");
        return setLayoutWidget({ spinBox }, { 60, 35 });
    }
    else if(name == "Splitter")
    {
        QSplitter* splitterV = new QSplitter(Qt::Vertical);
        QSplitter* splitterH = new QSplitter(Qt::Horizontal);
        splitterV->setObjectName("SplitterV");
        splitterH->setObjectName("SplitterH");
        splitterV->addWidget(new QPushButton("PushButton1"));
        splitterV->addWidget(new QPushButton("PushButton2"));
        splitterH->addWidget(splitterV);
        splitterH->addWidget(new QPushButton("PushButton3"));
        return setLayoutWidget({ splitterH }, { 250, 110 });
    }
    else if(name == "TabWidget")
    {
        QTabWidget* tab = new QTabWidget;
        tab->addTab(new QWidget, "Widget1");
        tab->addTab(new QWidget, "Widget2");
        tab->addTab(new QWidget, "Widget3");
        tab->setObjectName("TabWidget");
        return setLayoutWidget({ tab }, { 210, 110 });
    }
    else if(name == "TableView") //?
    {
        QTableView* view = new QTableView;
        view->setObjectName("TableView");
        view->resize(200, 100);
        return view;
    }
    else if(name == "TableWidget")
    {
        const int n = 100;
        QStringList list = { "one", "two", "three" };
        QTableWidget* table = new QTableWidget(n, n);
        table->setObjectName("TableWidget");
        table->setHorizontalHeaderLabels(list);
        table->setVerticalHeaderLabels(list);
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                table->setItem(i, j, new QTableWidgetItem(QString("%1, %2").arg(i).arg(j)));
        return setLayoutWidget({ table }, { 210, 110 });
    }
    else if(name == "TextEdit")
    {
        QTextEdit* text = new QTextEdit;
        text->setObjectName("TextEdit");
        return setLayoutWidget({ text }, { 80, 80 });
    }
    else if(name == "TimeEdit")
    {
        QTimeEdit* time = new QTimeEdit;
        time->setObjectName("TimeEdit");
        return setLayoutWidget({ time }, { 80, 80 });
    }
    else if(name == "ToolButton")
    {
        QToolButton* button = new QToolButton;
        button->setText("ToolButton");
        button->setObjectName("ToolButton");
        return setLayoutWidget({ button }, { 95, 25 });
    }
    else if(name == "ToolBox")
    {
        QToolBox* box = new QToolBox;
        box->addItem(new QWidget, "Widget1");
        box->addItem(new QWidget, "Widget2");
        box->addItem(new QWidget, "Widget3");
        box->setObjectName("ToolBox");
        return setLayoutWidget({ box }, { 110, 180 });
    }
    else if(name == "TreeView") //?
    {
        QTreeView* tree = new QTreeView;
        tree->setObjectName("TreeView");
        tree->resize(200, 100);
        return tree;
    }
    else if(name == "TreeWidget")
    {
        QTreeWidget* tree = new QTreeWidget;
        tree->setObjectName("TreeWidget");
        tree->setHeaderLabels({ "Folders", "Used Space" });
        QTreeWidgetItem* item = new QTreeWidgetItem(tree);
        item->setText(0, "Local Disk");
        for(int i = 1; i < 20; i++)
        {
            QTreeWidgetItem* dir = new QTreeWidgetItem(item);
            dir->setText(0, "Directory" + QString::number(i));
            dir->setText(1, QString::number(i) + "MB");
        }
        tree->setItemExpanded(item, true);
        return setLayoutWidget({ tree }, { 210, 110 });
    }
    else if(name == "Widget")
    {
        QWidget* widget = new QWidget;
        widget->setObjectName("Widget");
        return setLayoutWidget({ widget }, { 210, 110 });
    }
    return nullptr;
}
void ConfigScreen::CreateActiveMQConnectivityWidgets()
{
    QLineEdit* activemquri = new QLineEdit ( _activemqscreen );
    activemquri->setObjectName ( "kcfg_ActiveMQURI" );
    _lactivemqscreen->addRow ( "ActiveMQ URI:", activemquri );
    _confman->addWidget ( activemquri );
    QLineEdit* activemqusername = new QLineEdit ( _activemqscreen );
    activemqusername->setObjectName ( "kcfg_ActiveMQUsername" );
    _lactivemqscreen->addRow ( "ActiveMQ username:"******"kcfg_ActiveMQPassword" );
    _lactivemqscreen->addRow ( "ActiveMQ password:"******"kcfg_ActiveMQTopicName" );
    _lactivemqscreen->addRow ( "CSS Alarm Server topic name:", activemqtopicname );
    _confman->addWidget ( activemqtopicname );
    QSpinBox* laboratorynotificationtimeout = new QSpinBox ( _activemqscreen );
    laboratorynotificationtimeout->setMinimum ( 0 );
    laboratorynotificationtimeout->setMaximum ( 3600 );
    laboratorynotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
    laboratorynotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
    laboratorynotificationtimeout->setObjectName ( "kcfg_LaboratoryNotificationTimeout" );
    _lactivemqscreen->addRow ( "Laboratory notification timeout:", laboratorynotificationtimeout );
    _confman->addWidget ( laboratorynotificationtimeout );
    QSpinBox* desktopnotificationtimeout = new QSpinBox ( _activemqscreen );
    desktopnotificationtimeout->setMinimum ( 0 );
    desktopnotificationtimeout->setMaximum ( 3600 );
    desktopnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
    desktopnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
    desktopnotificationtimeout->setObjectName ( "kcfg_DesktopNotificationTimeout" );
    _lactivemqscreen->addRow ( "Desktop notification timeout:", desktopnotificationtimeout );
    _confman->addWidget ( desktopnotificationtimeout );
    QSpinBox* emailnotificationtimeout = new QSpinBox ( _activemqscreen );
    emailnotificationtimeout->setMinimum ( 0 );
    emailnotificationtimeout->setMaximum ( 3600 );
    emailnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
    emailnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
    emailnotificationtimeout->setObjectName ( "kcfg_EMailNotificationTimeout" );
    _lactivemqscreen->addRow ( "E-Mail notification timeout:", emailnotificationtimeout );
    _confman->addWidget ( emailnotificationtimeout );
    QLineEdit* emailnotificationfrom = new QLineEdit ( _activemqscreen );
    emailnotificationfrom->setObjectName ( "kcfg_EMailNotificationFrom" );
    _lactivemqscreen->addRow ( "E-Mail notification sender address:", emailnotificationfrom );
    _confman->addWidget ( emailnotificationfrom );
    QLineEdit* emailnotificationto = new QLineEdit ( _activemqscreen );
    emailnotificationto->setObjectName ( "kcfg_EMailNotificationTo" );
    _lactivemqscreen->addRow ( "E-Mail notification recipient address:", emailnotificationto );
    _confman->addWidget ( emailnotificationto );
    QLineEdit* emailnotificationservername = new QLineEdit ( _activemqscreen );
    emailnotificationservername->setObjectName ( "kcfg_EMailNotificationServerName" );
    _lactivemqscreen->addRow ( "SMTP server name:", emailnotificationservername );
    _confman->addWidget ( emailnotificationservername );
    QSpinBox* emailnotificationserverport = new QSpinBox ( _activemqscreen );
    emailnotificationserverport->setMinimum ( 0 ); // Minimum port number in TCP standard
    emailnotificationserverport->setMaximum ( 65535 ); // Maximum port number in TCP standard
    emailnotificationserverport->setObjectName ( "kcfg_EMailNotificationServerPort" );
    _lactivemqscreen->addRow ( "SMTP server port:", emailnotificationserverport );
    _confman->addWidget ( emailnotificationserverport );
    QLineEdit* flashlightrelaisdevicenode = new QLineEdit ( _activemqscreen );
    flashlightrelaisdevicenode->setObjectName ( QString::fromUtf8 ( "kcfg_FlashLightRelaisDeviceNode" ) );
    _lactivemqscreen->addRow ( QString::fromUtf8 ( "Device node of relais for red flash light:" ), flashlightrelaisdevicenode );
    _confman->addWidget ( flashlightrelaisdevicenode );
}
Example #13
0
void preferencedialog::setupDetTable(){

    ui->detTable->setRowCount(detectors.size());

    calList.clear();

    for(unsigned int i=0; i<detectors.size(); i++){
        calList.push_back("");
        calNum.push_back(0);
    }

    //Setup all items
    for (unsigned int j=0; j<detectors.size(); j++){
        for(int i=0; i<8; i++){
            ui->detTable->setItem(j,i, new QTableWidgetItem(""));
        }
    }

    for(unsigned int i=0; i<detectors.size(); i++){
        ui->detTable->item(i,0)->setText(detectors.at(i).getType());
        ui->detTable->item(i,1)->setText(detectors.at(i).getName());
        ui->detTable->item(i,2)->setText(detectors.at(i).getDgfmodule());
        ui->detTable->item(i,3)->setText(detectors.at(i).getCrate());
        ui->detTable->item(i,4)->setText(detectors.at(i).getSlot());
        ui->detTable->item(i,5)->setText(detectors.at(i).getAddress());
        calList.replace(i, detectors.at(i).getCalFilePath());

        for(int j=0; j<calNames.size(); j++){
	  if(detectors.size()>i){
            if(calNames.at(j)==detectors.at(i).getCalFilePath()){
                if((int)detectors.size()<=calNum.size()){
                    calNum.replace(i,j+1);
                }
            }
	  }
	  else{
	    qDebug() << "ERROR: detectors.at(i) does not exist! i="<<i<<" (preferencedialog::setupDetTable())";
	  }
        }
    }

    for(unsigned int i=0; i<detectors.size(); i++){
        QComboBox* calCombo = new QComboBox(this);
        calCombo->addItem("");
        for(int j=0; j<calNames.size(); j++){
            if(calNames.at(j).size()!=0) {calCombo->addItem("..."+calNames.at(j).right(20));}
        }
        calCombo->setCurrentIndex(calNum.at(i));
        calCombo->setObjectName(QString::number(i));
        connect(calCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(calStringChanged(QString)));

        ui->detTable->setCellWidget(i,6,calCombo);
    }

    for(unsigned int i=0; i<detectors.size(); i++){
        QComboBox* detCombo = new QComboBox(this);
        detCombo->addItem("");
        detCombo->addItem("Germanium");
        detCombo->addItem("Silicon");
        if(detectors.at(i).getDetType()=="Germanium")
            detCombo->setCurrentIndex(1);
        if(detectors.at(i).getDetType()=="Silicon")
            detCombo->setCurrentIndex(2);

        detCombo->setObjectName("detCombo"+QString::number(i));
        connect(detCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(detTypeChanged(QString)));

        ui->detTable->setCellWidget(i,7,detCombo);
    }

    for(unsigned int i=0; i<detectors.size(); i++){
        QSpinBox* ratesBox = new QSpinBox(this);
	ratesBox->setObjectName("ratesBox"+QString::number(i));
        connect(ratesBox, SIGNAL(valueChanged(QString)), this, SLOT(ratesLimitChanged(QString)));
        ratesBox->setRange(0,100000);
        ratesBox->setValue(detectors.at(i).getIratesLimit());
        ui->detTable->setCellWidget(i,8,ratesBox);
    }



    ui->detTable->resizeColumnsToContents();
    ui->detTable->setSelectionMode(QAbstractItemView::SingleSelection);
}
Example #14
0
    void setupUI(SAPenSetWidget*parent ,Qt::Orientation orient)
    {
        if (parent->objectName().isEmpty())
            parent->setObjectName(QStringLiteral("SAPenSetWidget"));
        if(Qt::Horizontal == orient)
        {
            parent->resize(247, 48);
            horizontalLayoutMain = new QHBoxLayout(parent);
            horizontalLayoutMain->setSpacing(0);
            horizontalLayoutMain->setObjectName(QStringLiteral("horizontalLayout_2"));
            horizontalLayoutMain->setContentsMargins(0, 0, 0, 0);
            verticalLayoutHorizontal = new QVBoxLayout();
            verticalLayoutHorizontal->setSpacing(0);
            verticalLayoutHorizontal->setObjectName(QStringLiteral("verticalLayout"));
            horizontalLayoutHorizontalColor = new QHBoxLayout();
            horizontalLayoutHorizontalColor->setObjectName(QStringLiteral("horizontalLayout"));
            labelColor = new QLabel(parent);
            labelColor->setObjectName(QStringLiteral("labelColor"));
            labelColor->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

            horizontalLayoutHorizontalColor->addWidget(labelColor);

            pushButtonColor = new SAColorPickerButton(parent);
            pushButtonColor->setObjectName(QStringLiteral("pushButtonColor"));
            QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
            sizePolicy.setHorizontalStretch(0);
            sizePolicy.setVerticalStretch(0);
            sizePolicy.setHeightForWidth(pushButtonColor->sizePolicy().hasHeightForWidth());
            pushButtonColor->setSizePolicy(sizePolicy);

            horizontalLayoutHorizontalColor->addWidget(pushButtonColor);


            verticalLayoutHorizontal->addLayout(horizontalLayoutHorizontalColor);

            horizontalSliderColorAlpha = new QSlider(parent);
            horizontalSliderColorAlpha->setObjectName(QStringLiteral("horizontalSliderColorAlpha"));
            QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Maximum);
            sizePolicy1.setHorizontalStretch(0);
            sizePolicy1.setVerticalStretch(0);
            sizePolicy1.setHeightForWidth(horizontalSliderColorAlpha->sizePolicy().hasHeightForWidth());
            horizontalSliderColorAlpha->setSizePolicy(sizePolicy1);
            horizontalSliderColorAlpha->setMinimumSize(QSize(8, 0));
            horizontalSliderColorAlpha->setOrientation(Qt::Horizontal);

            verticalLayoutHorizontal->addWidget(horizontalSliderColorAlpha);


            horizontalLayoutMain->addLayout(verticalLayoutHorizontal);

            labelWidth = new QLabel(parent);
            labelWidth->setObjectName(QStringLiteral("labelWidth"));
            labelWidth->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

            horizontalLayoutMain->addWidget(labelWidth);

            spinBoxPenWidth = new QSpinBox(parent);
            spinBoxPenWidth->setObjectName(QStringLiteral("spinBoxPenWidth"));
            spinBoxPenWidth->setMaximum(100);

            horizontalLayoutMain->addWidget(spinBoxPenWidth);

            labelStyle = new QLabel(parent);
            labelStyle->setObjectName(QStringLiteral("labelStyle"));
            labelStyle->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

            horizontalLayoutMain->addWidget(labelStyle);

            comboBoxPenStyle = new SAPenStyleComboBox(parent);
            comboBoxPenStyle->setObjectName(QStringLiteral("comboBoxPenStyle"));

            horizontalLayoutMain->addWidget(comboBoxPenStyle);
        }
        else
        {
            parent->resize(109, 79);
            verticalLayoutMain = new QVBoxLayout(parent);
            verticalLayoutMain->setSpacing(4);
            verticalLayoutMain->setObjectName(QStringLiteral("verticalLayout"));
            verticalLayoutMain->setContentsMargins(1, 1, 1, 1);
            horizontalLayoutVerticalColor = new QHBoxLayout();
            horizontalLayoutVerticalColor->setSpacing(4);
            horizontalLayoutVerticalColor->setObjectName(QStringLiteral("horizontalLayout"));
            labelColor = new QLabel(parent);
            labelColor->setObjectName(QStringLiteral("labelColor"));
            labelColor->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);

            horizontalLayoutVerticalColor->addWidget(labelColor);

            pushButtonColor = new SAColorPickerButton(parent);
            pushButtonColor->setObjectName(QStringLiteral("pushButtonColor"));
            QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
            sizePolicy.setHorizontalStretch(0);
            sizePolicy.setVerticalStretch(0);
            sizePolicy.setHeightForWidth(pushButtonColor->sizePolicy().hasHeightForWidth());
            pushButtonColor->setSizePolicy(sizePolicy);

            horizontalLayoutVerticalColor->addWidget(pushButtonColor);

            horizontalSliderColorAlpha = new QSlider(parent);
            horizontalSliderColorAlpha->setObjectName(QStringLiteral("horizontalSliderColorAlpha"));
            QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Maximum);
            sizePolicy1.setHorizontalStretch(0);
            sizePolicy1.setVerticalStretch(0);
            sizePolicy1.setHeightForWidth(horizontalSliderColorAlpha->sizePolicy().hasHeightForWidth());
            horizontalSliderColorAlpha->setSizePolicy(sizePolicy1);
            horizontalSliderColorAlpha->setMinimumSize(QSize(30, 0));
            horizontalSliderColorAlpha->setOrientation(Qt::Horizontal);


            horizontalLayoutVerticalColor->addWidget(horizontalSliderColorAlpha);


            verticalLayoutMain->addLayout(horizontalLayoutVerticalColor);

            horizontalLayoutVerticalWidth = new QHBoxLayout();
            horizontalLayoutVerticalWidth->setObjectName(QStringLiteral("horizontalLayout_2"));
            labelWidth = new QLabel(parent);
            labelWidth->setObjectName(QStringLiteral("labelWidth"));
            labelWidth->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);

            horizontalLayoutVerticalWidth->addWidget(labelWidth);

            spinBoxPenWidth = new QSpinBox(parent);
            spinBoxPenWidth->setObjectName(QStringLiteral("spinBoxPenWidth"));
            spinBoxPenWidth->setMaximum(100);

            horizontalLayoutVerticalWidth->addWidget(spinBoxPenWidth);


            verticalLayoutMain->addLayout(horizontalLayoutVerticalWidth);

            horizontalLayoutVerticalStyle = new QHBoxLayout();
            horizontalLayoutVerticalStyle->setObjectName(QStringLiteral("horizontalLayout_3"));
            labelStyle = new QLabel(parent);
            labelStyle->setObjectName(QStringLiteral("labelStyle"));
            labelStyle->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);

            horizontalLayoutVerticalStyle->addWidget(labelStyle);

            comboBoxPenStyle = new SAPenStyleComboBox(parent);
            comboBoxPenStyle->setObjectName(QStringLiteral("comboBoxPenStyle"));

            horizontalLayoutVerticalStyle->addWidget(comboBoxPenStyle);


            verticalLayoutMain->addLayout(horizontalLayoutVerticalStyle);


        }
        pushButtonColor->setStandardColors();
        horizontalSliderColorAlpha->setRange(0,255);
        retranslateUi(parent);
    }
void DkDisplayPreference::createLayout() {

	// zoom settings
	QCheckBox* invertZoom = new QCheckBox(tr("Invert zoom wheel behaviour"), this);
	invertZoom->setObjectName("invertZoom");
	invertZoom->setChecked(Settings::param().display().invertZoom);

	QLabel* interpolationLabel = new QLabel(tr("Show pixels if zoom level is above"), this);

	QSpinBox* sbInterpolation = new QSpinBox(this);
	sbInterpolation->setObjectName("interpolationBox");
	sbInterpolation->setToolTip(tr("nomacs will not interpolate images if the zoom level is larger."));
	sbInterpolation->setSuffix("%");
	sbInterpolation->setMinimum(0);
	sbInterpolation->setMaximum(10000);
	sbInterpolation->setValue(Settings::param().display().interpolateZoomLevel);

	DkGroupWidget* zoomGroup = new DkGroupWidget(tr("Zoom"), this);
	zoomGroup->addWidget(invertZoom);
	zoomGroup->addWidget(interpolationLabel);
	zoomGroup->addWidget(sbInterpolation);

	// keep zoom radio buttons
	QVector<QRadioButton*> keepZoomButtons;
	keepZoomButtons.resize(DkSettings::zoom_end);
	keepZoomButtons[DkSettings::zoom_always_keep] = new QRadioButton(tr("Always keep zoom"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size] = new QRadioButton(tr("Keep zoom if the size is the same"), this);
	keepZoomButtons[DkSettings::zoom_keep_same_size]->setToolTip(tr("If checked, the zoom level is only kept, if the image loaded has the same level as the previous."));
	keepZoomButtons[DkSettings::zoom_never_keep] = new QRadioButton(tr("Never keep zoom"), this);

	// check wrt the current settings
	keepZoomButtons[Settings::param().display().keepZoom]->setChecked(true);

	QButtonGroup* keepZoomButtonGroup = new QButtonGroup(this);
	keepZoomButtonGroup->setObjectName("keepZoom");
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_always_keep], DkSettings::zoom_always_keep);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_keep_same_size], DkSettings::zoom_keep_same_size);
	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_never_keep], DkSettings::zoom_never_keep);

	DkGroupWidget* keepZoomGroup = new DkGroupWidget(tr("When Displaying New Images"), this);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_always_keep]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_keep_same_size]);
	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_never_keep]);
	
	// icon size
	QSpinBox* sbIconSize = new QSpinBox(this);
	sbIconSize->setObjectName("iconSizeBox");
	sbIconSize->setToolTip(tr("Define the icon size in pixel."));
	sbIconSize->setSuffix(" px");
	sbIconSize->setMinimum(16);
	sbIconSize->setMaximum(1024);
	sbIconSize->setValue(Settings::param().display().iconSize);

	DkGroupWidget* iconGroup = new DkGroupWidget(tr("Icon Size"), this);
	iconGroup->addWidget(sbIconSize);

	// slideshow
	QLabel* fadeImageLabel = new QLabel(tr("Image Transition"), this);

	QDoubleSpinBox* fadeImageBox = new QDoubleSpinBox(this);
	fadeImageBox->setObjectName("fadeImageBox");
	fadeImageBox->setToolTip(tr("Define the image transition speed."));
	fadeImageBox->setSuffix(" sec");
	fadeImageBox->setMinimum(0.0);
	fadeImageBox->setMaximum(3);
	fadeImageBox->setSingleStep(.2);
	fadeImageBox->setValue(Settings::param().display().fadeSec);

	QLabel* displayTimeLabel = new QLabel(tr("Display Time"), this);

	QDoubleSpinBox* displayTimeBox = new QDoubleSpinBox(this);
	displayTimeBox->setObjectName("displayTimeBox");
	displayTimeBox->setToolTip(tr("Define the time an image is displayed."));
	displayTimeBox->setSuffix(" sec");
	displayTimeBox->setMinimum(0.0);
	displayTimeBox->setMaximum(30);
	displayTimeBox->setSingleStep(.2);
	displayTimeBox->setValue(Settings::param().slideShow().time);

	DkGroupWidget* slideshowGroup = new DkGroupWidget(tr("Slideshow"), this);
	slideshowGroup->addWidget(fadeImageLabel);
	slideshowGroup->addWidget(fadeImageBox);
	slideshowGroup->addWidget(displayTimeLabel);
	slideshowGroup->addWidget(displayTimeBox);

	// left column
	QWidget* leftWidget = new QWidget(this);
	QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
	leftLayout->setAlignment(Qt::AlignTop);
	leftLayout->addWidget(zoomGroup);
	leftLayout->addWidget(keepZoomGroup);
	leftLayout->addWidget(iconGroup);
	leftLayout->addWidget(slideshowGroup);

	// right column
	QWidget* rightWidget = new QWidget(this);
	QVBoxLayout* rightLayout = new QVBoxLayout(rightWidget);
	rightLayout->setAlignment(Qt::AlignTop);

	QHBoxLayout* layout = new QHBoxLayout(this);
	layout->setAlignment(Qt::AlignLeft);

	layout->addWidget(leftWidget);
	layout->addWidget(rightWidget);
}
Example #16
0
void RmShaderDialog::fillTabsWithPass(int index)
{
	clearTabs();
	if (index < 0 || eff_selected == NULL || index >= eff_selected->size())
		return;

	pass_selected = &(eff_selected->at(index));

	// Set the source code of vertex shader
	ui.textVertex->setText(pass_selected->getVertex());

	// Set the source code of fragment shader
	ui.textFragment->setText(pass_selected->getFragment());

	// General Info in the first tab
	QString info;
	if (pass_selected->hasRenderTarget())
		info += "Render Target: " + pass_selected->getRenderTarget().name + "\n";

	for (int i = 0; i < 2; i++)
		for (int j = 0;
		     j < (i == 0 ? pass_selected->vertexUniformVariableSize() : pass_selected->fragmentUniformVariableSize());
		     j++) {
			UniformVar v = pass_selected->getUniform(j, i == 0 ? RmPass::VERTEX : RmPass::FRAGMENT);

			if(v.representerTagName == "RmRenderTarget") {
				if (i == 0)
					info += "Vertex";
				else
					info += "Fragment";

				info += " render Input: " + v.name;

				for (int k = 0; k < eff_selected -> size(); k++)
					if (eff_selected->at(k).getRenderTarget().name == v.textureName) {
						info += " (from pass: "******")";
						break;
					}

				info += "\n";
			}
		}

	if (!info.isEmpty()) {
		QLabel *lblinfo = new QLabel(info);
		layoutUniform->addWidget(lblinfo, 0, 0, 1, 5);
		shown.append(lblinfo);
	}

	// any value change is sent to the state holder with this mapper
	// Signal are send from signaler in the form "varnameNM" where
	// NM is the index of row and column in case of matrix. (00 if
	// it is a simple variable).
	delete signaler;
	signaler = new QSignalMapper();
	connect(signaler, SIGNAL(mapped(const QString &)), this, SLOT(valuesChanged(const QString &)));


	// Uniform Variables in the first Tab
	QList<QString> usedVarables; // parser can give same variable twice in the vertex and fragment
	int row = 1;
	for (int ii = 0; ii < 2; ii++)
		for (int jj = 0;
		     jj < (ii == 0 ? pass_selected->vertexUniformVariableSize() : pass_selected->fragmentUniformVariableSize());
		     jj++) {
			UniformVar v = pass_selected->getUniform(jj, ii == 0 ? RmPass::VERTEX : RmPass::FRAGMENT);
			if (v.representerTagName == "RmRenderTarget" || usedVarables.contains(v.name))
				continue;
			usedVarables.append(v.name);

			QString varname = (ii == 0 ? "Vertex: " : "Fragment: ");
			varname += UniformVar::getStringFromUniformType(v.type) +
			           " " + v.name + (v.minSet || v.maxSet ? "\n" : "");

			switch (v.type) {
			case UniformVar::INT:
			case UniformVar::IVEC2:
			case UniformVar::IVEC3:
			case UniformVar::IVEC4: {
				int n = v.type == UniformVar::INT ? 1 : (v.type == UniformVar::IVEC2 ? 2 : (v.type == UniformVar::IVEC3 ? 3 : 4 ));
				for (int i = 0; i < n; i++) {
					QSpinBox *input = new QSpinBox();
					input->setObjectName(v.name + "0" + QString().setNum(i));
					if (v.minSet)
						input->setMinimum(v.fmin);
					else
						input -> setMinimum(-1000);

					if (v.maxSet)
						input->setMaximum(v.fmax);
					else
						input->setMaximum(1000);

					input->setSingleStep((v.minSet && v.maxSet )? std::max(( v.imax - v.imin )/10, 1) : 1 );
					input->setValue(v.ivec4[i]);
					layoutUniform->addWidget(input, row, 1 + i, 1,
					                         ((i + 1)==n ? 5-n : 1));
					shown.append(input);

					connect(input, SIGNAL(valueChanged(int)), signaler, SLOT(map()));
					signaler->setMapping(input, v.name + "0" + QString().setNum(i));
				}
				if (v.minSet) {
					varname += "min: " + QString().setNum(v.imin) + " ";
				}
				if (v.maxSet) {
					varname += " max: " + QString().setNum(v.imax);
				}
				break;
			}
			case UniformVar::BOOL:
			case UniformVar::BVEC2:
			case UniformVar::BVEC3:
			case UniformVar::BVEC4:
			{
				int n = v.type == UniformVar::BOOL ? 1 : (v.type == UniformVar::BVEC2 ? 2 : (v.type == UniformVar::BVEC3 ? 3 : 4 ));
				for( int i = 0; i < n; i++ ) {
					QCheckBox * input = new QCheckBox();
					input -> setObjectName( v.name + "0" + QString().setNum(i) );
					input -> setCheckState( v.bvec4[i] ? Qt::Checked : Qt::Unchecked );
					layoutUniform->addWidget(input, row, 1+i, 1, ((i+1)==n ? 5-n : 1));
					shown.append(input);

					connect(input, SIGNAL(stateChanged(int)), signaler, SLOT(map()));
					signaler->setMapping(input, v.name + "0" + QString().setNum(i) );
				}
				break;
			}
			case UniformVar::FLOAT:
			case UniformVar::VEC2:
			case UniformVar::VEC3:
			case UniformVar::VEC4:
			{
				int n = v.type == UniformVar::FLOAT ? 1 : (v.type == UniformVar::VEC2 ? 2 : (v.type == UniformVar::VEC3 ? 3 : 4 ));
				for( int i = 0; i < n; i++ )
				{
					QDoubleSpinBox * input = new QDoubleSpinBox();
					input -> setObjectName( v.name + "0" + QString().setNum(i) );
					input -> setDecimals(4);
					if( v.minSet ) input -> setMinimum( v.fmin ); else input -> setMinimum( -1000 );
					if( v.maxSet ) input -> setMaximum( v.fmax ); else input -> setMaximum( 1000 );
					input -> setSingleStep( (v.minSet && v.maxSet ) ? std::max(( v.fmax - v.fmin )/10., 0.0001) : 0.0001 );
					input -> setValue( v.vec4[i] );
					layoutUniform->addWidget( input, row, 1+i, 1, ((i+1)==n ? 5-n : 1) );
					shown.append(input);

					connect(input, SIGNAL(valueChanged(double)), signaler, SLOT(map()));
					signaler->setMapping(input, v.name + "0" + QString().setNum(i) );
				}
				if( v.minSet ) { varname += "min: " + QString().setNum(v.fmin) + " "; }
				if( v.maxSet ) { varname += " max: " + QString().setNum(v.fmax); }
				break;
			}
			case UniformVar::MAT2:
			case UniformVar::MAT3:
			case UniformVar::MAT4:
			{
				int n = v.type == UniformVar::MAT2 ? 2 : (v.type == UniformVar::MAT3 ? 3 : 4 );
				for( int i = 0; i < n; i++ ) {
					for( int j = 0; j < n; j++ ) {
						QDoubleSpinBox * input = new QDoubleSpinBox();
						input -> setObjectName( v.name + QString().setNum(i) + QString().setNum(j));
						input -> setDecimals(4);
						if( v.minSet ) input -> setMinimum( v.fmin ); else input -> setMinimum( -1000 );
						if( v.maxSet ) input -> setMaximum( v.fmax ); else input -> setMaximum( 1000 );
						input -> setSingleStep( (v.minSet && v.maxSet ) ? std::max(( v.fmax - v.fmin )/10., 0.0001) : 0.0001 );
						input -> setValue( v.vec4[(i*n)+j] );
						layoutUniform->addWidget(input, row, 1+j, 1, ((j+1)==n ? 5-n : 1));
						shown.append(input);

						connect(input, SIGNAL(valueChanged(double)), signaler, SLOT(map()));
						signaler->setMapping(input, v.name + QString().setNum(i) + QString().setNum(j));
					}
					if( (i+1) < n ) row += 1;
				}
				if( v.minSet ) { varname += "min: " + QString().setNum(v.fmin) + " "; }
				if( v.maxSet ) { varname += " max: " + QString().setNum(v.fmax); }
				break;
			}
			case UniformVar::SAMPLER1D:
			case UniformVar::SAMPLER2D:
			case UniformVar::SAMPLER3D:
			case UniformVar::SAMPLERCUBE:
			case UniformVar::SAMPLER1DSHADOW:
			case UniformVar::SAMPLER2DSHADOW:
			{
				QLabel * link = new QLabel( "<font color=\"blue\">See texture tab</font>" );
				layoutUniform->addWidget(link, row, 1, 1, 4);
				shown.append(link);
				break;
			}
			case UniformVar::OTHER:
			{
				QLabel * unimpl = new QLabel( "[Unimplemented mask]" );
				layoutUniform->addWidget( unimpl, row, 1, 1, 4);
				shown.append(unimpl);
			}
			}

			QLabel * lblvar = new QLabel(varname);
			layoutUniform->addWidget( lblvar, row, 0 );
			shown.append(lblvar);

			row += 1;
		}


	// Texture in the second tab
	for( int ii = 0, row = 0; ii < 2; ii++ )
		for( int jj = 0; jj < ( ii == 0 ? pass_selected -> vertexUniformVariableSize() : pass_selected -> fragmentUniformVariableSize()); jj++ )
		{
			UniformVar v = pass_selected -> getUniform( jj, ii == 0 ? RmPass::VERTEX : RmPass::FRAGMENT );
			if( v.textureFilename.isNull() ) continue;

			QFileInfo finfo(v.textureFilename);

			QDir textureDir = QDir(qApp->applicationDirPath());
#if defined(Q_OS_WIN)
			if (textureDir.dirName() == "debug" || textureDir.dirName() == "release" || textureDir.dirName() == "plugins"  ) textureDir.cdUp();
#elif defined(Q_OS_MAC)
			if (textureDir.dirName() == "MacOS") { for(int i=0;i<4;++i){ textureDir.cdUp(); if(textureDir.exists("textures")) break; } }
#endif
			textureDir.cd("textures");
			QFile f( textureDir.absoluteFilePath(finfo.fileName()));

			QString varname = ( ii == 0 ? "Vertex texture: " : "Fragment texture: ");
			varname += UniformVar::getStringFromUniformType(v.type) + " " + v.name + "<br>";
			varname += "Filename: " + finfo.fileName() + (f.exists() ? "" : " [<font color=\"red\">not found</font>]");

			for( int k = 0; k < v.textureGLStates.size(); k++ )
			{
				varname += "<br>OpenGL state: " + v.textureGLStates[k].getName() + ": " +
					parser->convertGlStateToString(v.textureGLStates[k]);
			}

			QLabel * lblvar = new QLabel(varname);
			lblvar -> setTextFormat( Qt::RichText );
			lblvar -> setObjectName( v.name + "00" );
			layoutTextures->addWidget( lblvar, row++, 0, 1, 2 );
			shown.append(lblvar);

			QLineEdit * txtChoose = new QLineEdit( textureDir.absoluteFilePath(finfo.fileName()) );
			txtChoose -> setObjectName( v.name + "11" );
			layoutTextures->addWidget( txtChoose, row, 0 );
			shown.append(txtChoose);

			connect(txtChoose, SIGNAL(editingFinished()), signaler, SLOT(map()));
			signaler->setMapping(txtChoose, v.name + "11");

			QPushButton * btnChoose = new QPushButton( "Browse" );
			btnChoose -> setObjectName( v.name + "22" );
			layoutTextures->addWidget( btnChoose, row, 1 );
			shown.append(btnChoose);

			connect(btnChoose, SIGNAL(clicked()), signaler, SLOT(map()));
			signaler->setMapping(btnChoose, v.name + "22");

			row++;
		}

	// OpenGL Status
	if( pass_selected -> openGLStatesSize() == 0 )
	{
		QLabel * lblgl = new QLabel( "No openGL states set" );
		layoutOpengl->addWidget( lblgl, row, 0 );
		shown.append(lblgl);
	}
	else
	{
		for( int i = 0, row = 0; i < pass_selected -> openGLStatesSize(); i++ )
		{
			QString str = "OpenGL state: " + pass_selected -> getOpenGLState(i).getName();
			str += " (" + QString().setNum(pass_selected -> getOpenGLState(i).getState()) + "): " +
				QString().setNum(pass_selected -> getOpenGLState(i).getValue());
			QLabel * lblgl = new QLabel(str);
			layoutOpengl->addWidget( lblgl, row++, 0 );
			shown.append(lblgl);
		}
	}
}