bool EFX::write(QByteArray* universes) { int ready = 0; Q_ASSERT(universes != NULL); /* Check that a valid point function is present and there's at least one fixture to control. */ if (pointFunc == NULL || m_fixtures.isEmpty() == true) return false; QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); if (ef->isReady() == false) ef->nextStep(universes); else ready++; } /* Check for stop condition */ if (ready == m_fixtures.count()) return false; else return true; }
bool EFX::copyFrom(const Function* function) { const EFX* efx = qobject_cast<const EFX*> (function); if (efx == NULL) return false; while (m_fixtures.isEmpty() == false) delete m_fixtures.takeFirst(); QListIterator <EFXFixture*> it(efx->m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(this); ef->copyFrom(it.next()); m_fixtures.append(ef); } m_propagationMode = efx->m_propagationMode; for (int i = 0; i < efx->attributes().count(); i++) adjustAttribute(efx->attributes().at(i).m_value, i); m_isRelative = efx->m_isRelative; updateRotationCache(); m_xFrequency = efx->m_xFrequency; m_yFrequency = efx->m_yFrequency; m_xPhase = efx->m_xPhase; m_yPhase = efx->m_yPhase; m_algorithm = efx->m_algorithm; return Function::copyFrom(function); }
bool EFX::copyFrom(const Function* function) { const EFX* efx = qobject_cast<const EFX*> (function); if (efx == NULL) return false; while (m_fixtures.isEmpty() == false) delete m_fixtures.takeFirst(); QListIterator <EFXFixture*> it(efx->m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(this); ef->copyFrom(it.next()); m_fixtures.append(ef); } m_propagationMode = efx->m_propagationMode; m_width = efx->m_width; m_height = efx->m_height; m_xOffset = efx->m_xOffset; m_yOffset = efx->m_yOffset; m_rotation = efx->m_rotation; m_xFrequency = efx->m_xFrequency; m_yFrequency = efx->m_yFrequency; m_xPhase = efx->m_xPhase; m_yPhase = efx->m_yPhase; m_algorithm = efx->m_algorithm; return Function::copyFrom(function); }
void EFXEditor::slotAddFixtureClicked() { /* Put all fixtures already present into a list of fixtures that will be disabled in the fixture selection dialog */ QList <t_fixture_id> disabled; QTreeWidgetItemIterator twit(m_tree); while (*twit != NULL) { EFXFixture* ef = reinterpret_cast <EFXFixture*> ((*twit)->data(0, Qt::UserRole).toULongLong()); Q_ASSERT(ef != NULL); /* TODO: Disable all fixtures that don't have pan&tilt chans */ disabled.append(ef->fixture()); twit++; } /* Get a list of new fixtures to add to the scene */ FixtureSelection fs(this, _app->doc(), true, disabled); if (fs.exec() == QDialog::Accepted) { QListIterator <t_fixture_id> it(fs.selection); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(m_efx); ef->setFixture(it.next()); if (m_efx->addFixture(ef) == true) addFixtureItem(ef); else delete ef; } } }
void EFX::write(MasterTimer* timer, QList<Universe*> universes) { Q_UNUSED(timer); int ready = 0; if (isPaused()) return; QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); if (ef->isReady() == false) ef->nextStep(timer, universes); else ready++; } incrementElapsed(); /* Check for stop condition */ if (ready == m_fixtures.count()) stop(FunctionParent::master()); m_fader->write(universes); }
void EFX::adjustAttribute(qreal fraction, int attributeIndex) { switch (attributeIndex) { case Intensity: { if (m_fader != NULL) m_fader->adjustIntensity(fraction); QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); ef->adjustIntensity(fraction); } } break; case Height: case Width: case XOffset: case YOffset: case Rotation: break; } Function::adjustAttribute(fraction, attributeIndex); if (attributeIndex == Rotation) updateRotationCache(); }
void EFXEditor::slotAddFixtureClicked() { /* Put all fixtures already present into a list of fixtures that will be disabled in the fixture selection dialog */ QList <t_fixture_id> disabled; QTreeWidgetItemIterator twit(m_tree); while (*twit != NULL) { EFXFixture* ef = reinterpret_cast <EFXFixture*> ((*twit)->data(0, Qt::UserRole).toULongLong()); Q_ASSERT(ef != NULL); disabled.append(ef->fixture()); twit++; } /* Disable all fixtures that don't have pan OR tilt channels */ for (t_fixture_id fxi_id = 0; fxi_id < KFixtureArraySize; fxi_id++) { Fixture* fixture = _app->doc()->fixture(fxi_id); if (fixture == NULL) continue; // If a channel with pan group exists, don't disable this fixture if (fixture->channel("", Qt::CaseSensitive, KQLCChannelGroupPan) != Fixture::invalidChannel()) { continue; } // If a channel with tilt group exists, don't disable this fixture if (fixture->channel("", Qt::CaseSensitive, KQLCChannelGroupTilt) != Fixture::invalidChannel()) { continue; } // Disable all fixtures without pan or tilt channels disabled << fxi_id; } /* Get a list of new fixtures to add to the scene */ FixtureSelection fs(this, _app->doc(), true, disabled); if (fs.exec() == QDialog::Accepted) { QListIterator <t_fixture_id> it(fs.selection); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(m_efx); ef->setFixture(it.next()); if (m_efx->addFixture(ef) == true) addFixtureItem(ef); else delete ef; } } }
bool EFX::removeFixture(quint32 fxi, int head) { for (int i = 0; i < m_fixtures.count(); i++) { EFXFixture *ef = m_fixtures.at(i); if (ef->head().fxi == fxi && ef->head().head == head) { m_fixtures.removeAt(i); return true; } } return false; }
void EFXEditor::slotFixtureItemChanged(QTreeWidgetItem* item, int column) { if (column == KColumnReverse) { EFXFixture* ef = reinterpret_cast <EFXFixture*> (item->data(0, Qt::UserRole).toULongLong()); Q_ASSERT(ef != NULL); if (item->checkState(column) == Qt::Checked) ef->setDirection(Function::Backward); else ef->setDirection(Function::Forward); } }
void EFX::adjustIntensity(qreal fraction) { if (m_fader != NULL) m_fader->adjustIntensity(fraction); QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); ef->adjustIntensity(fraction); } Function::adjustIntensity(fraction); }
void EFX::preRun(MasterTimer* timer) { int serialNumber = 0; QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); Q_ASSERT(ef != NULL); ef->setSerialNumber(serialNumber++); } Q_ASSERT(m_fader == NULL); m_fader = new GenericFader(doc()); Function::preRun(timer); }
void EFXFixture_Test::stop() { QList<Universe*> ua; ua.append(new Universe(0, new GrandMaster())); MasterTimerStub mts(m_doc, ua); EFX e(m_doc); e.setFadeInSpeed(1000); e.setFadeOutSpeed(2000); EFXFixture* ef = new EFXFixture(&e); ef->setHead(GroupHead(0,0)); e.addFixture(ef); Fixture* fxi = m_doc->fixture(0); QVERIFY(fxi != NULL); e.preRun(&mts); // Not started yet ef->stop(&mts, ua); QCOMPARE(e.m_fader->m_channels.size(), 0); QCOMPARE(mts.fader()->m_channels.size(), 0); // Start ef->start(&mts, ua); QCOMPARE(e.m_fader->m_channels.size(), 1); FadeChannel fc; fc.setFixture(m_doc, fxi->id()); fc.setChannel(fxi->masterIntensityChannel()); QVERIFY(e.m_fader->m_channels.contains(fc) == true); // Then stop ef->stop(&mts, ua); QCOMPARE(e.m_fader->m_channels.size(), 0); // FadeChannels are handed over to MasterTimer's GenericFader QCOMPARE(mts.fader()->m_channels.size(), 1); QVERIFY(e.m_fader->m_channels.contains(fc) == false); QVERIFY(mts.m_fader->m_channels.contains(fc) == true); QCOMPARE(mts.m_fader->m_channels[fc].fadeTime(), uint(2000)); e.postRun(&mts, ua); }
bool EFX::copyFrom(const Function* function) { const EFX* efx = qobject_cast<const EFX*> (function); if (efx == NULL) return false; m_fixtures.clear(); QListIterator <EFXFixture*> it(efx->m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(this); ef->copyFrom(it.next()); m_fixtures.append(ef); } m_propagationMode = efx->m_propagationMode; m_width = efx->width(); m_height = efx->height(); m_xOffset = efx->xOffset(); m_yOffset = efx->yOffset(); m_rotation = efx->rotation(); m_xFrequency = efx->xFrequency(); m_yFrequency = efx->yFrequency(); m_xPhase = efx->xPhase(); m_yPhase = efx->yPhase(); m_runOrder = efx->runOrder(); m_direction = efx->direction(); m_startSceneID = efx->startScene(); m_startSceneEnabled = efx->startSceneEnabled(); m_stopSceneID = efx->stopScene(); m_stopSceneEnabled = efx->stopSceneEnabled(); m_algorithm = QString(efx->algorithm()); return Function::copyFrom(function); }
void EFXFixture_Test::nextStepSingleShot() { QList<Universe*> ua; ua.append(new Universe(0, new GrandMaster())); MasterTimerStub mts(m_doc, ua); EFX e(m_doc); e.setDuration(1000); // 1s e.setRunOrder(EFX::SingleShot); EFXFixture* ef = new EFXFixture(&e); ef->setHead(GroupHead(0,0)); e.addFixture(ef); /* Initialize the EFXFixture so that it can do math */ ef->setSerialNumber(0); QVERIFY(ef->isValid() == true); QVERIFY(ef->isReady() == false); QVERIFY(ef->m_elapsed == 0); e.preRun(&mts); ef->reset(); /* Run one cycle (50 steps) */ uint max = MasterTimer::tick() * MasterTimer::frequency(); for (uint i = MasterTimer::tick(); i < max; i += MasterTimer::tick()) { ef->nextStep(&mts, ua); QVERIFY(ef->isReady() == false); QCOMPARE(ef->m_elapsed, i); } ef->nextStep(&mts, ua); /* Single-shot EFX should now be ready */ QVERIFY(ef->isReady() == true); e.postRun(&mts, ua); }
void EFX::write(MasterTimer* timer, QByteArray* universes) { int ready = 0; Q_UNUSED(timer); QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); if (ef->isReady() == false) ef->nextStep(universes); else ready++; } incrementElapsed(); /* Check for stop condition */ if (ready == m_fixtures.count()) stop(); }
void EFXFixture_Test::nextStepLoopZeroDuration() { QList<Universe*> ua; ua.append(new Universe(0, new GrandMaster())); MasterTimerStub mts(m_doc, ua); EFX e(m_doc); e.setDuration(0); // 0s EFXFixture* ef = new EFXFixture(&e); ef->setHead(GroupHead(0,0)); e.addFixture(ef); /* Initialize the EFXFixture so that it can do math */ ef->setSerialNumber(0); QVERIFY(ef->isValid() == true); QVERIFY(ef->isReady() == false); QVERIFY(ef->m_elapsed == 0); e.preRun(&mts); /* Run two cycles (2 * tickms * freq) to see that Loop never quits */ uint max = MasterTimer::tick() * MasterTimer::frequency(); uint i = MasterTimer::tick(); for (uint times = 0; times < 2; times++) { for (; i < max; i += MasterTimer::tick()) { ef->nextStep(&mts, ua); QVERIFY(ef->isReady() == false); // Loop is never ready QCOMPARE(ef->m_elapsed, i); } // m_elapsed is NOT zeroed since there are no "rounds" when duration == 0 } e.postRun(&mts, ua); }
void EFXFixture_Test::nextStepLoop() { UniverseArray array(512 * 4); MasterTimerStub mts(m_doc, array); EFX e(m_doc); e.setDuration(1000); // 1s EFXFixture* ef = new EFXFixture(&e); ef->setFixture(0); e.addFixture(ef); /* Initialize the EFXFixture so that it can do math */ ef->setSerialNumber(0); QVERIFY(ef->isValid() == true); QVERIFY(ef->isReady() == false); QVERIFY(ef->m_elapsed == 0); e.preRun(&mts); /* Run two cycles (2 * tickms * freq) to see that Loop never quits */ uint max = MasterTimer::tick() * MasterTimer::frequency(); uint i = MasterTimer::tick(); for (uint times = 0; times < 2; times++) { for (; i < max; i += MasterTimer::tick()) { ef->nextStep(&mts, &array); QVERIFY(ef->isReady() == false); // Loop is never ready QCOMPARE(ef->m_elapsed, i); } i = 0; // m_elapsed is zeroed after a full pass } e.postRun(&mts, &array); }
void EFXFixture_Test::start() { QList<Universe*> ua; ua.append(new Universe(0, new GrandMaster())); MasterTimerStub mts(m_doc, ua); EFX e(m_doc); e.setFadeInSpeed(1000); e.setFadeOutSpeed(2000); EFXFixture* ef = new EFXFixture(&e); ef->setHead(GroupHead(0,0)); e.addFixture(ef); Fixture* fxi = m_doc->fixture(0); QVERIFY(fxi != NULL); e.preRun(&mts); // Fade intensity == 0, no need to do fade-in ef->setFadeIntensity(0); ef->start(&mts, ua); QCOMPARE(e.m_fader->m_channels.size(), 0); ef->m_started = false; // Fade intensity > 0, need to do fade-in ef->setFadeIntensity(1); ef->start(&mts, ua); QCOMPARE(e.m_fader->m_channels.size(), 1); FadeChannel fc; fc.setFixture(m_doc, fxi->id()); fc.setChannel(fxi->masterIntensityChannel()); QVERIFY(e.m_fader->m_channels.contains(fc) == true); QCOMPARE(e.m_fader->m_channels[fc].fadeTime(), uint(1000)); e.postRun(&mts, ua); }
void EFXFixture_Test::start() { UniverseArray array(512 * 4); MasterTimerStub mts(m_doc, array); EFX e(m_doc); e.setFadeInSpeed(1000); e.setFadeOutSpeed(2000); EFXFixture* ef = new EFXFixture(&e); ef->setFixture(0); e.addFixture(ef); Fixture* fxi = m_doc->fixture(0); QVERIFY(fxi != NULL); e.preRun(&mts); // Fade intensity == 0, no need to do fade-in ef->setFadeIntensity(0); ef->start(&mts, &array); QCOMPARE(e.m_fader->m_channels.size(), 0); ef->m_started = false; // Fade intensity > 0, need to do fade-in ef->setFadeIntensity(1); ef->start(&mts, &array); QCOMPARE(e.m_fader->m_channels.size(), 1); FadeChannel fc; fc.setFixture(fxi->id()); fc.setChannel(fxi->masterIntensityChannel()); QVERIFY(e.m_fader->m_channels.contains(fc) == true); QCOMPARE(e.m_fader->m_channels[fc].fadeTime(), uint(1000)); e.postRun(&mts, &array); }
bool EFX::loadXML(const QDomElement* root) { QString str; QDomNode node; QDomElement tag; Q_ASSERT(root != NULL); if (root->tagName() != KXMLQLCFunction) { qWarning() << "Function node not found!"; return false; } /* Load EFX contents */ node = root->firstChild(); while (node.isNull() == false) { tag = node.toElement(); if (tag.tagName() == KXMLQLCBus) { /* Bus */ str = tag.attribute(KXMLQLCBusRole); setBus(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXFixture) { EFXFixture* ef = new EFXFixture(this); ef->loadXML(&tag); if (ef->fixture() != KNoID) { if (addFixture(ef) == false) delete ef; } } else if (tag.tagName() == KXMLQLCEFXPropagationMode) { /* Propagation mode */ setPropagationMode(stringToPropagationMode(tag.text())); } else if (tag.tagName() == KXMLQLCEFXAlgorithm) { /* Algorithm */ setAlgorithm(tag.text()); } else if (tag.tagName() == KXMLQLCFunctionDirection) { /* Direction */ setDirection(Function::stringToDirection(tag.text())); } else if (tag.tagName() == KXMLQLCFunctionRunOrder) { /* Run Order */ setRunOrder(Function::stringToRunOrder(tag.text())); } else if (tag.tagName() == KXMLQLCEFXWidth) { /* Width */ setWidth(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXHeight) { /* Height */ setHeight(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXRotation) { /* Rotation */ setRotation(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXStartScene) { /* Start scene */ setStartScene(tag.text().toInt()); if (tag.attribute(KXMLQLCFunctionEnabled) == KXMLQLCTrue) setStartSceneEnabled(true); else setStartSceneEnabled(false); } else if (tag.tagName() == KXMLQLCEFXStopScene) { /* Stop scene */ setStopScene(tag.text().toInt()); if (tag.attribute(KXMLQLCFunctionEnabled) == KXMLQLCTrue) setStopSceneEnabled(true); else setStopSceneEnabled(false); } else if (tag.tagName() == KXMLQLCEFXAxis) { /* Axes */ loadXMLAxis(&tag); } else { qWarning() << "Unknown EFX tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }
void EFX::arm() { class Scene* startScene = NULL; class Scene* stopScene = NULL; QLCFixtureMode* mode = NULL; QLCChannel* ch = NULL; int serialNumber = 0; Fixture* fxi = NULL; /* Initialization scene */ if (m_startSceneID != KNoID && m_startSceneEnabled == true) startScene = static_cast <class Scene*> (_app->doc()->function(m_startSceneID)); /* De-initialization scene */ if (m_stopSceneID != KNoID && m_stopSceneEnabled == true) stopScene = static_cast <class Scene*> (_app->doc()->function(m_stopSceneID)); QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); Q_ASSERT(ef != NULL); ef->setSerialNumber(serialNumber++); ef->setStartScene(startScene); ef->setStopScene(stopScene); /* If fxi == NULL, the fixture has been destroyed */ fxi = _app->doc()->fixture(ef->fixture()); if (fxi == NULL) continue; /* If this fixture has no mode, it's a generic dimmer that can't do pan&tilt anyway. */ mode = fxi->fixtureMode(); if (mode == NULL) continue; /* Find exact channel numbers for MSB/LSB pan and tilt */ for (t_channel i = 0; i < mode->channels(); i++) { ch = mode->channel(i); Q_ASSERT(ch != NULL); if (ch->group() == KQLCChannelGroupPan) { if (ch->controlByte() == 0) { ef->setMsbPanChannel( fxi->universeAddress() + i); } else if (ch->controlByte() == 1) { ef->setLsbPanChannel( fxi->universeAddress() + i); } } else if (ch->group() == KQLCChannelGroupTilt) { if (ch->controlByte() == 0) { ef->setMsbTiltChannel( fxi->universeAddress() + i); } else if (ch->controlByte() == 1) { ef->setLsbTiltChannel( fxi->universeAddress() + i); } } } } /* Choose a point calculation function depending on the algorithm */ if (m_algorithm == KCircleAlgorithmName) pointFunc = circlePoint; else if (m_algorithm == KEightAlgorithmName) pointFunc = eightPoint; else if (m_algorithm == KLineAlgorithmName) pointFunc = linePoint; else if (m_algorithm == KTriangleAlgorithmName) pointFunc = trianglePoint; else if (m_algorithm == KDiamondAlgorithmName) pointFunc = diamondPoint; else if (m_algorithm == KLissajousAlgorithmName) pointFunc = lissajousPoint; else pointFunc = NULL; }
void EFXFixture_Test::nextStepSingleShot() { QByteArray array; EFX e(m_doc); e.slotBusValueChanged(e.busID(), 50); /* 50 steps */ e.pointFunc = e.circlePoint; e.setRunOrder(EFX::SingleShot); EFXFixture* ef = new EFXFixture(&e); ef->setFixture(0); e.addFixture(ef); /* Nothing should happen since isValid() == false */ ef->nextStep(&array); QVERIFY(array.size() == 0); /* Initialize the EFXFixture so that it can do math */ ef->setSerialNumber(0); ef->setMsbPanChannel(0); ef->setMsbTiltChannel(1); ef->setLsbPanChannel(2); ef->setLsbTiltChannel(3); QVERIFY(ef->isValid() == true); QVERIFY(ef->m_initialized == false); QVERIFY(ef->m_iterator == 0); ef->reset(); /* Run one cycle (50 steps) and reset the checking iterator in the middle to expect correct iterator values. */ qreal checkIter = 0; for (int i = 0; i < 50; i++) { ef->nextStep(&array); checkIter += e.m_stepSize; QVERIFY(ef->m_initialized == true); QVERIFY(ef->m_iterator == checkIter); QVERIFY(ef->isReady() == false); } ef->nextStep(&array); /* Single-shot EFX should now be ready */ QVERIFY(ef->isReady() == true); }
void EFXFixture_Test::nextStepLoop() { QByteArray array; EFX e(m_doc); e.slotBusValueChanged(e.busID(), 50); /* 50 steps */ e.pointFunc = e.circlePoint; EFXFixture* ef = new EFXFixture(&e); ef->setFixture(0); e.addFixture(ef); /* Nothing should happen since isValid() == false */ ef->nextStep(&array); QVERIFY(array.size() == 0); /* Initialize the EFXFixture so that it can do math */ ef->setSerialNumber(0); ef->setMsbPanChannel(0); ef->setMsbTiltChannel(1); ef->setLsbPanChannel(2); ef->setLsbTiltChannel(3); QVERIFY(ef->isValid() == true); QVERIFY(ef->m_initialized == false); QVERIFY(ef->m_iterator == 0); /* Run two cycles (2 * 50 = 100) and reset the checking iterator in the middle to expect correct iterator values. */ qreal checkIter = 0; for (int i = 0; i < 100; i++) { ef->nextStep(&array); checkIter += e.m_stepSize; if (i == 50) checkIter = 0; QVERIFY(ef->m_iterator == checkIter); QVERIFY(ef->m_initialized == true); QVERIFY(ef->isReady() == false); // Loop is never ready } }
void EFX::arm() { int serialNumber = 0; Doc* doc = qobject_cast <Doc*> (parent()); Q_ASSERT(doc != NULL); QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); Q_ASSERT(ef != NULL); ef->setSerialNumber(serialNumber++); /* If fxi == NULL, the fixture has been destroyed */ Fixture* fxi = doc->fixture(ef->fixture()); if (fxi == NULL) continue; /* If this fixture has no mode, it's a generic dimmer that can't do pan&tilt anyway. */ const QLCFixtureMode* mode = fxi->fixtureMode(); if (mode == NULL) continue; QList <quint32> intensityChannels; /* Find exact channel numbers for MSB/LSB pan and tilt */ for (quint32 i = 0; i < quint32(mode->channels().size()); i++) { QLCChannel* ch = mode->channel(i); Q_ASSERT(ch != NULL); if (ch->group() == QLCChannel::Pan) { if (ch->controlByte() == QLCChannel::MSB) ef->setMsbPanChannel(fxi->universeAddress() + i); else if (ch->controlByte() == QLCChannel::LSB) ef->setLsbPanChannel(fxi->universeAddress() + i); } else if (ch->group() == QLCChannel::Tilt) { if (ch->controlByte() == QLCChannel::MSB) ef->setMsbTiltChannel(fxi->universeAddress() + i); else if (ch->controlByte() == QLCChannel::LSB) ef->setLsbTiltChannel(fxi->universeAddress() + i); } else if (ch->group() == QLCChannel::Intensity && ch->colour() == QLCChannel::NoColour) // Don't touch RGB/CMY channels { if (ch->searchCapability(/*D*/"immer", false) != NULL || ch->searchCapability(/*I*/"ntensity", false) != NULL) { intensityChannels << (fxi->universeAddress() + i); } } } ef->setIntensityChannels(intensityChannels); ef->setFadeBus(fadeBusID()); } Q_ASSERT(m_fader == NULL); m_fader = new GenericFader; resetElapsed(); }
bool EFX::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCFunction) { qWarning() << "Function node not found!"; return false; } if (root.attribute(KXMLQLCFunctionType) != typeToString(Function::EFX)) { qWarning("Function is not an EFX!"); return false; } /* Load EFX contents */ QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCBus) { /* Bus */ QString str = tag.attribute(KXMLQLCBusRole); if (str == KXMLQLCBusFade) m_legacyFadeBus = tag.text().toUInt(); else if (str == KXMLQLCBusHold) m_legacyHoldBus = tag.text().toUInt(); } else if (tag.tagName() == KXMLQLCFunctionSpeed) { loadXMLSpeed(tag); } else if (tag.tagName() == KXMLQLCEFXFixture) { EFXFixture* ef = new EFXFixture(this); ef->loadXML(tag); if (ef->fixture() != Fixture::invalidId()) { if (addFixture(ef) == false) delete ef; } } else if (tag.tagName() == KXMLQLCEFXPropagationMode) { /* Propagation mode */ setPropagationMode(stringToPropagationMode(tag.text())); } else if (tag.tagName() == KXMLQLCEFXAlgorithm) { /* Algorithm */ setAlgorithm(stringToAlgorithm(tag.text())); } else if (tag.tagName() == KXMLQLCFunctionDirection) { loadXMLDirection(tag); } else if (tag.tagName() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(tag); } else if (tag.tagName() == KXMLQLCEFXWidth) { /* Width */ setWidth(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXHeight) { /* Height */ setHeight(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXRotation) { /* Rotation */ setRotation(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXStartOffset) { /* StartOffset */ setStartOffset(tag.text().toInt()); } else if (tag.tagName() == KXMLQLCEFXAxis) { /* Axes */ loadXMLAxis(tag); } else { qWarning() << "Unknown EFX tag:" << tag.tagName(); } node = node.nextSibling(); } return true; }
bool EFX::loadXML(QXmlStreamReader &root) { if (root.name() != KXMLQLCFunction) { qWarning() << "Function node not found!"; return false; } if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::EFX)) { qWarning("Function is not an EFX!"); return false; } /* Load EFX contents */ while (root.readNextStartElement()) { if (root.name() == KXMLQLCBus) { /* Bus */ QString str = root.attributes().value(KXMLQLCBusRole).toString(); if (str == KXMLQLCBusFade) m_legacyFadeBus = root.readElementText().toUInt(); else if (str == KXMLQLCBusHold) m_legacyHoldBus = root.readElementText().toUInt(); } else if (root.name() == KXMLQLCFunctionSpeed) { loadXMLSpeed(root); } else if (root.name() == KXMLQLCEFXFixture) { EFXFixture* ef = new EFXFixture(this); ef->loadXML(root); if (ef->head().isValid()) { if (addFixture(ef) == false) delete ef; } } else if (root.name() == KXMLQLCEFXPropagationMode) { /* Propagation mode */ setPropagationMode(stringToPropagationMode(root.readElementText())); } else if (root.name() == KXMLQLCEFXAlgorithm) { /* Algorithm */ setAlgorithm(stringToAlgorithm(root.readElementText())); } else if (root.name() == KXMLQLCFunctionDirection) { loadXMLDirection(root); } else if (root.name() == KXMLQLCFunctionRunOrder) { loadXMLRunOrder(root); } else if (root.name() == KXMLQLCEFXWidth) { /* Width */ setWidth(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXHeight) { /* Height */ setHeight(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXRotation) { /* Rotation */ setRotation(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXStartOffset) { /* StartOffset */ setStartOffset(root.readElementText().toInt()); } else if (root.name() == KXMLQLCEFXIsRelative) { /* IsRelative */ setIsRelative(root.readElementText().toInt() != 0); } else if (root.name() == KXMLQLCEFXAxis) { /* Axes */ loadXMLAxis(root); } else { qWarning() << "Unknown EFX tag:" << root.name(); root.skipCurrentElement(); } } return true; }