本文整理汇总了C++中EFXFixture类的典型用法代码示例。如果您正苦于以下问题:C++ EFXFixture类的具体用法?C++ EFXFixture怎么用?C++ EFXFixture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EFXFixture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q_ASSERT
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;
}
示例2: while
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);
}
示例3: while
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);
}
示例4: twit
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;
}
}
}
示例5: Q_UNUSED
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);
}
示例6: switch
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();
}
示例7: removeFixture
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;
}
示例8: slotFixtureItemChanged
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);
}
}
示例9: it
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);
}
示例10: Universe
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);
}
示例11: it
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);
}
示例12: Q_UNUSED
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();
}
示例13: array
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);
}
示例14: e
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);
}
示例15: qWarning
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;
}