//! Update parameters void onUpdateParameters(void) { if (paramChanged(m_args.max_angle)) m_args.max_angle = Angles::radians(m_args.max_angle); if (paramChanged(m_args.max_rate)) m_args.max_rate = Angles::radians(m_args.max_rate); }
void KisColorSelector::setConfiguration(Configuration conf) { m_configuration = conf; if(m_mainComponent!=0) { Q_ASSERT(m_subComponent!=0); m_mainComponent->setGeometry(0, 0, 0, 0); m_subComponent->setGeometry(0, 0, 0, 0); m_mainComponent->disconnect(); m_subComponent->disconnect(); } switch (m_configuration.mainType) { case Square: m_mainComponent=m_square; break; case Wheel: m_mainComponent=m_wheel; break; case Triangle: m_mainComponent=m_triangle; break; default: Q_ASSERT(false); } switch (m_configuration.subType) { case Ring: m_subComponent=m_ring; break; case Slider: m_subComponent=m_slider; break; default: Q_ASSERT(false); } connect(m_mainComponent, SIGNAL(paramChanged(qreal,qreal,qreal,qreal,qreal)), m_subComponent, SLOT(setParam(qreal,qreal,qreal,qreal,qreal)), Qt::UniqueConnection); connect(m_subComponent, SIGNAL(paramChanged(qreal,qreal,qreal,qreal,qreal)), m_mainComponent, SLOT(setParam(qreal,qreal,qreal,qreal, qreal)), Qt::UniqueConnection); connect(m_mainComponent, SIGNAL(update()), m_signalCompressor, SLOT(start()), Qt::UniqueConnection); connect(m_subComponent, SIGNAL(update()), m_signalCompressor, SLOT(start()), Qt::UniqueConnection); m_mainComponent->setConfiguration(m_configuration.mainTypeParameter, m_configuration.mainType); m_subComponent->setConfiguration(m_configuration.subTypeParameter, m_configuration.subType); QResizeEvent event(QSize(width(), height()), QSize()); resizeEvent(&event); }
//! Parse arguments. void onUpdateParameters(void) { if (paramChanged(m_args.message_name)) { Memory::clear(m_msg); m_msg = IMC::Factory::produce(m_args.message_name); } if (paramChanged(m_args.peak_lat)) m_args.peak_lat = Angles::radians(m_args.peak_lat); if (paramChanged(m_args.peak_lon)) m_args.peak_lon = Angles::radians(m_args.peak_lon); }
void KisAutoBrushWidget::spinBoxAngleChanged(int a) { inputAngle->blockSignals(true); inputAngle->setValue(a); inputAngle->blockSignals(false); paramChanged(); }
void KisAutoBrushWidget::spinBoxDensityChanged(qreal a) { density->blockSignals(true); density->setValue(a); density->blockSignals(false); paramChanged(); }
void GameCFGWidget::schemeChanged(int index) { QStringList sl; int size = GameSchemes->model()->columnCount(); for(int i = 0; i < size; ++i) sl << schemeData(i).toString(); if (sl.size()!=1) emit paramChanged("SCHEME", sl); // this is a stupid hack for the fact that SCHEME is being sent once, empty. Still need to find out why. if (isEnabled() && bindEntries->isEnabled() && bindEntries->isChecked()) { QString schemeName = GameSchemes->itemText(index); for (int i = 0; i < WeaponsName->count(); i++) { QString weapName = WeaponsName->itemText(i); int res = QString::compare(weapName, schemeName, Qt::CaseSensitive); if (0 == res) { WeaponsName->setCurrentIndex(i); emit ammoChanged(i); break; } } } }
void GameCFGWidget::schemeChanged(int index) { QStringList sl; int size = GameSchemes->model()->columnCount(); for(int i = 0; i < size; ++i) sl << schemeData(i).toString(); if (sl.size() >= 42) { sl[sl.size()-1].prepend('!'); emit paramChanged("SCHEME", sl); // this is a stupid hack for the fact that SCHEME is being sent once, empty. Still need to find out why. } if (isEnabled() && bindEntries->isEnabled() && bindEntries->isChecked()) { QString schemeName = GameSchemes->itemText(index); for (int i = 0; i < WeaponsName->count(); i++) { QString weapName = WeaponsName->itemText(i); int res = QString::compare(weapName, schemeName, Qt::CaseSensitive); if (0 == res) { WeaponsName->setCurrentIndex(i); emit ammoChanged(i); break; } } } pMapContainer->setScript(Scripts->itemData(Scripts->currentIndex(), GameStyleModel::ScriptRole).toString().toUtf8(), schemeData(43).toString()); }
void ParameterGroupWidget::reload(bool resetToDefaults) { // attempt to create a new BRDF based on this one BRDFBase* newBRDF = brdf->cloneBRDF(resetToDefaults); if( !newBRDF ) return; // remove all the items from the layout QLayoutItem *child; while ((child = containerLayout->takeAt(1)) != 0) { child->widget()->deleteLater(); delete child; } brdfParamWidgets.clear(); // switch out the old BRDF for the new one delete brdf; brdf = newBRDF; // now add parameter widgets based on the new BRDF addParameterWidgets(); // now redraw paramChanged(); }
void KisAutoBrushWidget::spinBoxRadiusChanged(qreal a) { inputRadius->blockSignals(true); inputRadius->setValue(a); inputRadius->blockSignals(false); paramChanged(); }
void KisAutoBrushWidget::spinBoxSpacingChanged(qreal a) { inputSpacing->blockSignals(true); inputSpacing->setValue(a); inputSpacing->blockSignals(false); paramChanged(); }
void GameCFGWidget::ammoChanged(int index) { if (index >= 0) { emit paramChanged( "AMMO", QStringList() << WeaponsName->itemText(index) << WeaponsName->itemData(index).toString() ); } }
void GameCFGWidget::scriptChanged(int index) { const QString & name = Scripts->itemText(index); m_curScript = name; if(isEnabled() && index > 0) { QString scheme = Scripts->itemData(index, GameStyleModel::SchemeRole).toString(); QString weapons = Scripts->itemData(index, GameStyleModel::WeaponsRole).toString(); if (scheme == "locked") { GameSchemes->setEnabled(false); GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); } else if (m_master) { GameSchemes->setEnabled(true); int num = GameSchemes->findText(scheme); if (num != -1) GameSchemes->setCurrentIndex(num); else GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); } if (weapons == "locked") { WeaponsName->setEnabled(false); WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); } else if (m_master) { WeaponsName->setEnabled(true); int num = WeaponsName->findText(weapons); if (num != -1) WeaponsName->setCurrentIndex(num); else WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); } if (scheme != "locked" && weapons != "locked") bindEntries->setEnabled(true); else bindEntries->setEnabled(false); } else { GameSchemes->setEnabled(true); WeaponsName->setEnabled(true); bindEntries->setEnabled(true); } emit paramChanged("SCRIPT", QStringList(name)); }
KoColor KisColorSelectorRing::selectColor(int x, int y) { QPoint ringMiddle(width()/2, height()/2); QPoint ringCoord = QPoint(x, y)-ringMiddle; qreal hue = std::atan2(qreal(ringCoord.y()), qreal(ringCoord.x()))+(M_PI); hue/=2.*M_PI; emit paramChanged(hue, -1, -1, -1, -1, -1, -1, -1, -1); m_lastHue=hue; emit update(); return KoColor(); }
void KisAutoBrushWidget::spinBoxVerticalChanged(qreal a) { if (m_linkFade) { inputHFade->blockSignals(true); inputHFade->setValue(a); inputHFade->blockSignals(false); } inputVFade->blockSignals(true); inputVFade->setValue(a); inputVFade->blockSignals(false); paramChanged(); }
void GameCFGWidget::mapChanged(const QString & value) { if(isEnabled() && pMapContainer->getCurrentIsMission()) { Scripts->setEnabled(false); Scripts->setCurrentIndex(0); if (pMapContainer->getCurrentScheme() == "locked") { GameSchemes->setEnabled(false); GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); } else { GameSchemes->setEnabled(true); int num = GameSchemes->findText(pMapContainer->getCurrentScheme()); if (num != -1) GameSchemes->setCurrentIndex(num); //else // GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); } if (pMapContainer->getCurrentWeapons() == "locked") { WeaponsName->setEnabled(false); WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); } else { WeaponsName->setEnabled(true); int num = WeaponsName->findText(pMapContainer->getCurrentWeapons()); if (num != -1) WeaponsName->setCurrentIndex(num); //else // WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); } if (pMapContainer->getCurrentScheme() != "locked" && pMapContainer->getCurrentWeapons() != "locked") bindEntries->setEnabled(true); else bindEntries->setEnabled(false); } else { Scripts->setEnabled(true); GameSchemes->setEnabled(true); WeaponsName->setEnabled(true); bindEntries->setEnabled(true); } emit paramChanged("MAP", QStringList(value)); }
void KisColorSelectorRing::setColor(const KoColor &color) { qreal h, s, v; m_parent->converter()->getHsvF(color, &h, &s, &v); emit paramChanged(h, -1, -1, -1, -1, -1, -1, -1, -1); // selector keeps the position on the ring if hue is undefined (when saturation is 0) if (!qFuzzyCompare(s, 0.0)) { m_lastHue=h; } emit update(); }
void ParameterGroupWidget::addParameterWidgets() { // no BRDF? No parameters to load. if( !brdf ) return; // loop through and add all the parameters to the list int float_index = 0, bool_index = 0, color_index = 0; for( int i = 0; i < brdf->getParameterCount(); i++ ) { switch (brdf->getParameterType(i)) { case BRDF_VAR_FLOAT: { const brdfFloatParam* p = brdf->getFloatParameter( float_index++ ); FloatVarWidget* fv = new FloatVarWidget(QString(p->name.c_str()), p->minVal, p->maxVal, p->defaultVal); fv->setValue( p->currentVal ); connect(fv, SIGNAL(valueChanged(float)), this, SLOT(paramChanged())); brdfParamWidgets.push_back( BRDFParamWidget(BRDF_VAR_FLOAT, fv) ); containerLayout->addWidget( fv ); } break; case BRDF_VAR_BOOL: { const brdfBoolParam* p = brdf->getBoolParameter( bool_index++ ); QCheckBox* bv = new QCheckBox(QString(p->name.c_str())); bv->setChecked( bool(p->currentVal > 0.0001) ); connect(bv, SIGNAL(stateChanged(int)), this, SLOT(paramChanged())); brdfParamWidgets.push_back( BRDFParamWidget(BRDF_VAR_BOOL, bv) ); containerLayout->addWidget( bv ); } break; case BRDF_VAR_COLOR: { const brdfColorParam* p = brdf->getColorParameter( color_index++ ); ColorVarWidget* cv = new ColorVarWidget(QString(p->name.c_str()), p->currentVal[0], p->currentVal[1], p->currentVal[2]); connect(cv, SIGNAL(valueChanged()), this, SLOT(paramChanged())); brdfParamWidgets.push_back( BRDFParamWidget(BRDF_VAR_COLOR, cv) ); containerLayout->addWidget( cv ); } break; } } }
void KisColorSelectorTriangle::setColor(const KoColor &color) { qreal h, s, v; m_parent->converter()->getHsvF(color, &h, &s, &v); qreal y = v * triangleHeight(); qreal horizontalLineLength = y * (2. / sqrt(3.)); qreal horizontalLineStart = 0.5 * (triangleWidth() - horizontalLineLength); qreal x=s * horizontalLineLength + horizontalLineStart; QPoint tmp = triangleToWidgetCoordinates(QPoint(x, y)); m_lastClickPos.setX(tmp.x()/qreal(width())); m_lastClickPos.setY(tmp.y()/qreal(height())); // Workaround for Bug 287001 setLastMousePosition(tmp.x(), tmp.y()); emit paramChanged(-1, s, v, -1, -1); emit update(); }
void GameCFGWidget::seedChanged(const QString & value) { emit paramChanged("SEED", QStringList(value)); }
void GameCFGWidget::slMapFeatureSizeChanged(int s) { emit paramChanged("FEATURE_SIZE", QStringList(QString::number(s))); }
void GameCFGWidget::onDrawnMapChanged(const QByteArray & data) { emit paramChanged("DRAWNMAP", QStringList(qCompress(data, 9).toBase64())); }
void GameCFGWidget::mapgenChanged(MapGenerator m) { emit paramChanged("MAPGEN", QStringList(QString::number(m))); }
void GameCFGWidget::maze_sizeChanged(int s) { emit paramChanged("MAZE_SIZE", QStringList(QString::number(s))); }
void GameCFGWidget::themeChanged(const QString & value) { emit paramChanged("THEME", QStringList(value)); }
void YigSynthGraphic::setParam2(float value) { emit paramChanged(mMapKey, Param2, param2); param2 = value; }
void KisAutoBrushWidget::activate() { paramChanged(); }
void GameCFGWidget::templateFilterChanged(int value) { emit paramChanged("TEMPLATE", QStringList(QString::number(value))); }
//! Update internal parameters. void onUpdateParameters(void) { if (paramChanged(m_args.ir_prob)) m_args.ir_prob *= 0.01; }
void YigSynthGraphic::broadcastParams() { emit paramChanged(mMapKey, Param1, param1); emit paramChanged(mMapKey, Param2, param2); }
KisAutoBrushWidget::KisAutoBrushWidget(QWidget *parent, const char* name) : KisWdgAutobrush(parent, name) , m_autoBrush(0) , m_linkFade(false) { connect(aspectButton, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(linkFadeToggled(bool))); aspectButton->setKeepAspectRatio(m_linkFade); connect((QObject*)comboBoxShape, SIGNAL(activated(int)), this, SLOT(paramChanged())); inputRadius->setRange(0.0, 10.0, 2); inputRadius->addMultiplier(10.0); inputRadius->addMultiplier(100.0); inputRadius->setExponentRatio(3.0); inputRadius->setValue(5.0); connect(inputRadius, SIGNAL(valueChanged(qreal)), this, SLOT(spinBoxRadiusChanged(qreal))); inputRatio->setRange(0.0, 1.0, 2); inputRatio->setSingleStep(0.1); inputRatio->setValue(1.0); connect(inputRatio, SIGNAL(valueChanged(qreal)), this, SLOT(spinBoxRatioChanged(qreal))); inputHFade->setRange(0.0, 1.0, 2); inputHFade->setSingleStep(0.1); inputHFade->setValue(0.5); connect(inputHFade, SIGNAL(valueChanged(qreal)), this, SLOT(spinBoxHorizontalChanged(qreal))); inputVFade->setRange(0.0, 1.0, 2); inputVFade->setSingleStep(0.1); inputVFade->setValue(0.5); connect(inputVFade, SIGNAL(valueChanged(qreal)), this, SLOT(spinBoxVerticalChanged(qreal))); inputSpikes->setRange(2, 20); inputSpikes->setValue(2); connect(inputSpikes, SIGNAL(valueChanged(int)), this, SLOT(spinBoxSpikesChanged(int))); inputRandomness->setRange(0, 100); inputRandomness->setValue(0); connect(inputRandomness, SIGNAL(valueChanged(qreal)), this, SLOT(spinBoxRandomnessChanged(qreal))); inputAngle->setRange(0, 360); inputAngle->setSuffix(QChar(Qt::Key_degree)); inputAngle->setValue(0); connect(inputAngle, SIGNAL(valueChanged(int)), this, SLOT(spinBoxAngleChanged(int))); inputSpacing->setRange(0.0, 10.0, 2); inputSpacing->setSingleStep(0.1); inputSpacing->setValue(0.1); connect(inputSpacing, SIGNAL(valueChanged(qreal)), this, SLOT(spinBoxSpacingChanged(qreal))); density->setRange(0, 100, 0); density->setSingleStep(1); density->setValue(100); density->setSuffix("%"); connect(density, SIGNAL(valueChanged(qreal)), this, SLOT(spinBoxDensityChanged(qreal))); KisCubicCurve topLeftBottomRightLinearCurve; topLeftBottomRightLinearCurve.setPoint(0, QPointF(0.0, 1.0)); topLeftBottomRightLinearCurve.setPoint(1, QPointF(1.0, 0.0)); softnessCurve->setCurve(topLeftBottomRightLinearCurve); connect(softnessCurve, SIGNAL(modified()), this, SLOT(paramChanged())); m_brush = QImage(1, 1, QImage::Format_RGB32); connect(brushPreview, SIGNAL(clicked()), SLOT(paramChanged())); QList<KoID> ids = KisMaskGenerator::maskGeneratorIds(); for (int i = 0; i < ids.size(); i++) { comboBoxMaskType->insertItem(i, ids[i].name()); } connect(comboBoxMaskType, SIGNAL(activated(int)), SLOT(paramChanged())); connect(comboBoxMaskType, SIGNAL(currentIndexChanged(int)), SLOT(setStackedWidget(int))); brushPreview->setIconSize(QSize(100, 100)); paramChanged(); }