void AMExtendedControlEditor::setControl(AMControl *newControl) { if (control_ != newControl) { if (control_) { // Disconnect from control. disconnect( control_, 0, this, 0 ); disconnect( dialog_, 0, control_, 0 ); control_ = 0; // Clear the frame title. if (!titleSetManually_) setTitleText(""); } control_ = newControl; if (control_) { // Set the frame title. if (!titleSetManually_) { if (control_->description().isEmpty()) setTitleText(control_->name()); else setTitleText(control_->description()); } // Set control values precision_ = control_->displayPrecision(); maxValue_ = control_->maximumValue(); minValue_ = control_->minimumValue(); // Make connections. connect(control_, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double))); connect(control_, SIGNAL(unitsChanged(QString)), this, SLOT(onUnitsChanged(QString))); connect(control_, SIGNAL(connected(bool)), this, SLOT(onConnectedChanged()) ); connect(control_, SIGNAL(movingChanged(bool)), this, SLOT(onMotion(bool))); connect(control_, SIGNAL(enumChanged()), this, SLOT(onControlEnumChanged())); connect(control_, SIGNAL(moveStarted()), this, SLOT(onControlMoveStarted())); if(!configureOnly_) connect(dialog_, SIGNAL(doubleValueSelected(double)), control_, SLOT(move(double))); else connect(dialog_, SIGNAL(doubleValueSelected(double)), this, SLOT(onNewSetpoint(double))); } onConnectedChanged(); emit controlChanged(control_); } }
bool AMDetectorSet::addDetector(AMDetector *detector){ if(!detector) return false; if( append(detector, detector->name()) ){ connect(detector, SIGNAL(connected(bool)), this, SLOT(onConnectedChanged(bool))); connect(detector, SIGNAL(timedOut()), this, SLOT(onTimedOut())); onConnectedChanged(detector->isConnected()); emit detectorAdded(count() - 1); return true; }