void VCSlider::writeDMX(MasterTimer* timer, UniverseArray* universes) { if (sliderMode() == Level) writeDMXLevel(timer, universes); else if (sliderMode() == Playback) writeDMXPlayback(timer, universes); }
void VCSlider::slotModeChanged(Doc::Mode mode) { if (mode == Doc::Operate) { m_topLabel->setEnabled(true); if (m_slider) m_slider->setEnabled(true); if (m_knob) m_knob->setEnabled(true); m_bottomLabel->setEnabled(true); m_tapButton->setEnabled(true); m_cngButton->setEnabled(true); if (sliderMode() == Playback) { /* Follow playback function running/stopped status in case the function is started from another control. */ Function* function = m_doc->function(playbackFunction()); if (function != NULL) { connect(function, SIGNAL(running(quint32)), this, SLOT(slotPlaybackFunctionRunning(quint32))); connect(function, SIGNAL(stopped(quint32)), this, SLOT(slotPlaybackFunctionStopped(quint32))); connect(function, SIGNAL(intensityChanged(qreal)), this, SLOT(slotPlaybackFunctionIntensityChanged(qreal))); } } } else { m_topLabel->setEnabled(false); if (m_slider) m_slider->setEnabled(false); if (m_knob) m_knob->setEnabled(false); m_bottomLabel->setEnabled(false); m_tapButton->setEnabled(false); m_cngButton->setEnabled(false); if (sliderMode() == Playback) { /* Stop following playback function running/stopped status in case the function is changed in Design mode to another. */ Function* function = m_doc->function(playbackFunction()); if (function != NULL) { disconnect(function, SIGNAL(running(quint32)), this, SLOT(slotPlaybackFunctionRunning(quint32))); disconnect(function, SIGNAL(stopped(quint32)), this, SLOT(slotPlaybackFunctionStopped(quint32))); disconnect(function, SIGNAL(intensityChanged(qreal)), this, SLOT(slotPlaybackFunctionIntensityChanged(qreal))); } } } VCWidget::slotModeChanged(mode); }
void VCSlider::emitSubmasterValue() { Q_ASSERT(sliderMode() == Submaster); emit submasterValueChanged(SCALE(float(m_levelValue), float(0), float(UCHAR_MAX), float(0), float(1)) * intensity()); }
void VCSlider::setValue(int value, bool setDMX, bool updateFeedback) { if (m_value == value) return; Tardis::instance()->enqueueAction(VCSliderSetValue, id(), m_value, value); m_value = value; switch(sliderMode()) { case Level: if (m_monitorEnabled == true && m_isOverriding == false && setDMX) { m_priority = DMXSource::Override; m_doc->masterTimer()->requestNewPriority(this); m_isOverriding = true; emit isOverridingChanged(); } if (clickAndGoType() == CnGPreset) updateClickAndGoResource(); break; case Submaster: emit submasterValueChanged(SCALE(qreal(m_value), qreal(0), qreal(UCHAR_MAX), qreal(0), qreal(1.0)) * intensity()); break; case GrandMaster: m_doc->inputOutputMap()->setGrandMasterValue(value); break; case Adjust: m_adjustChangeCounter++; break; } emit valueChanged(value); if (setDMX) m_levelValueChanged = true; Q_UNUSED(updateFeedback) /* TODO if (updateFeedback) { int fbv = 0; if (invertedAppearance() == true) fbv = levelHighLimit() - m_value; else fbv = m_value; fbv = (int)SCALE(float(fbv), float(levelLowLimit()), float(levelHighLimit()), float(0), float(UCHAR_MAX)); sendFeedback(fbv); } */ }
void VCSlider::slotSliderMoved(int value) { QString num; switch (sliderMode()) { case Level: { setLevelValue(value); /* Set text for the top label */ if (valueDisplayStyle() == ExactValue) { num.sprintf("%.3d", value); } else { float f = SCALE(float(value), float(m_slider->minimum()), float(m_slider->maximum()), float(0), float(100)); num.sprintf("%.3d%%", static_cast<int> (f)); } setTopLabelText(num); } break; case Playback: { setPlaybackValue(value); /* Set text for the top label */ if (valueDisplayStyle() == ExactValue) { num.sprintf("%.3d", value); } else { float f = SCALE(float(value), float(m_slider->minimum()), float(m_slider->maximum()), float(0), float(100)); num.sprintf("%.3d%%", static_cast<int> (f)); } setTopLabelText(num); } break; default: break; } if (m_slider->isSliderDown() == true) sendFeedBack(value); }
void VCSlider::slotModeChanged(Doc::Mode mode) { if (mode == Doc::Operate) { enableWidgetUI(true); if (sliderMode() == Playback) { /* Follow playback function running/stopped status in case the function is started from another control. */ Function* function = m_doc->function(playbackFunction()); if (function != NULL) { connect(function, SIGNAL(running(quint32)), this, SLOT(slotPlaybackFunctionRunning(quint32))); connect(function, SIGNAL(stopped(quint32)), this, SLOT(slotPlaybackFunctionStopped(quint32))); connect(function, SIGNAL(attributeChanged(int, qreal)), this, SLOT(slotPlaybackFunctionIntensityChanged(int, qreal))); }