void MarControlGUI::updControl(MarControlPtr control) { //if this control is currently being edited by the user //do not update its widget if(editing_) return; //check control name and if it's the correct type if((control_->getType() != control->getType()) && (cname_ != control->getName())) return; //if no changes are needed, do nothing // if(!(*control != control_)) // return; //update internal MarControlPtr copy //control_ = control; //update corresponding widget string ctype = control_->getType(); if(ctype == "mrs_real") { realWidget_->setText(QString::number((double)control_->to<mrs_real>()));//does not trigger a signal! return; } if(ctype == "mrs_natural") { naturalWidget_->setText(QString::number((int)control_->to<mrs_natural>()));//does not trigger a signal! return; } if(ctype == "mrs_bool") { //we have to temporary disconnect the QCheckBox signal otherwise //we'll enter an infinite signal->slot loop... disconnect(boolWidget_, SIGNAL(toggled(bool)), this, SLOT(toMarControl(bool))); //[!] boolWidget_->setChecked(control_->to<mrs_bool>());//This does trigger a signal!! connect(boolWidget_, SIGNAL(toggled(bool)), this, SLOT(toMarControl(bool))); return; }
void MarLpcWindow::ctrlChanged(MarControlPtr cname) { string name = cname->getName(); if (cname.isEqual(posPtr_)) { mrs_real fval = cname->to<mrs_natural>() / (512.0 * 40.0); if (posSlider_->isSliderDown() == false) { posSlider_->blockSignals(true); posSlider_->setValue((int)fval); posSlider_->blockSignals(false); } posControl_->updControl(cname); } /*if (cname.isEqual(frequencyPolePtr_)) { frequencyPoleSlider_->blockSignals(true); mrs_real fval = cname->to<mrs_real>(); int val = (int)(fval * 50.0); frequencyPoleSlider_->setValue(val); frequencyPoleSlider_->blockSignals(false); frequencyPoleControl_->updControl(cname); } if (cname.isEqual(amplitudePolePtr_)) { amplitudePoleSlider_->blockSignals(true); mrs_real fval = cname->to<mrs_real>(); int val = (int)(fval * 50.0); amplitudePoleSlider_->setValue(val); amplitudePoleSlider_->blockSignals(false); amplitudePoleControl_->updControl(cname); }*/ }
void MarOscMultiGainWindow::ctrlChanged(MarControlPtr cname) { string name = cname->getName(); }