本文整理汇总了C++中QLCFixtureHead::addChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCFixtureHead::addChannel方法的具体用法?C++ QLCFixtureHead::addChannel怎么用?C++ QLCFixtureHead::addChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCFixtureHead
的用法示例。
在下文中一共展示了QLCFixtureHead::addChannel方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cacheChannelsColor
void QLCFixtureHead_Test::cacheChannelsColor()
{
QLCFixtureMode mode(m_fixtureDef);
QCOMPARE(mode.channels().size(), 0);
m_ch1->setGroup(QLCChannel::Pan);
m_ch1->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch1, 0);
m_ch2->setGroup(QLCChannel::Colour);
m_ch2->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch2, 1);
m_ch3->setGroup(QLCChannel::Tilt);
m_ch3->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch3, 2);
m_ch4->setGroup(QLCChannel::Colour);
m_ch4->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch4, 3);
QLCFixtureHead head;
head.addChannel(0);
head.addChannel(1);
head.addChannel(2);
head.addChannel(3);
head.cacheChannels(&mode);
QCOMPARE(quint32(head.colorWheels().count()), quint32(2));
QCOMPARE(head.colorWheels().at(0), quint32(1));
QCOMPARE(head.colorWheels().at(1), quint32(3));
}
示例2: channels
void QLCFixtureHead_Test::channels()
{
QLCFixtureHead head;
QCOMPARE(head.channels().size(), 0);
head.addChannel(0);
QCOMPARE(head.channels().size(), 1);
QCOMPARE(head.channels().contains(0), true);
head.addChannel(0);
QCOMPARE(head.channels().size(), 1);
QCOMPARE(head.channels().contains(0), true);
head.addChannel(5000);
QCOMPARE(head.channels().size(), 2);
QCOMPARE(head.channels().contains(0), true);
QCOMPARE(head.channels().contains(5000), true);
head.removeChannel(1);
QCOMPARE(head.channels().size(), 2);
QCOMPARE(head.channels().contains(0), true);
QCOMPARE(head.channels().contains(5000), true);
head.removeChannel(0);
QCOMPARE(head.channels().size(), 1);
QCOMPARE(head.channels().contains(5000), true);
head.removeChannel(5000);
QCOMPARE(head.channels().size(), 0);
}
示例3: if
QLCFixtureMode *Fixture::genericRGBPanelMode(QLCFixtureDef *def, Components components, quint32 width, quint32 height)
{
Q_ASSERT(def != NULL);
QLCFixtureMode *mode = new QLCFixtureMode(def);
int compNum = 3;
if (components == BGR)
{
mode->setName("BGR");
}
else if (components == RGBW)
{
mode->setName("RGBW");
compNum = 4;
}
else if (components == RGBWW)
{
mode->setName("RGBWW");
compNum = 5;
}
else
mode->setName("RGB");
QList<QLCChannel *>channels = def->channels();
for (int i = 0; i < channels.count(); i++)
{
QLCChannel *ch = channels.at(i);
mode->insertChannel(ch, i);
if (i%compNum == 0)
{
QLCFixtureHead head;
head.addChannel(i);
head.addChannel(i+1);
head.addChannel(i+2);
if (components == RGBW)
head.addChannel(i+3);
else if (components == RGBWW)
{
head.addChannel(i+3);
head.addChannel(i+4);
}
mode->insertHead(-1, head);
}
}
QLCPhysical physical;
physical.setWidth(width);
physical.setHeight(height);
physical.setDepth(height);
mode->setPhysical(physical);
return mode;
}
示例4: QLCFixtureMode
QLCFixtureMode *Fixture::genericDimmerMode(QLCFixtureDef *def, int channels)
{
Q_ASSERT(def != NULL);
QLCFixtureMode *mode = new QLCFixtureMode(def);
mode->setName(QString("%1 Channel").arg(channels));
QList<QLCChannel *>chList = def->channels();
for (int i = 0; i < chList.count(); i++)
{
QLCChannel *ch = chList.at(i);
mode->insertChannel(ch, i);
QLCFixtureHead head;
head.addChannel(i);
mode->insertHead(-1, head);
}
QLCPhysical physical;
physical.setWidth(300 * channels);
physical.setHeight(300);
physical.setDepth(300);
mode->setPhysical(physical);
def->addMode(mode);
return mode;
}
示例5: cacheChannelsPanTilt
void QLCFixtureHead_Test::cacheChannelsPanTilt()
{
QLCFixtureMode mode(m_fixtureDef);
QCOMPARE(mode.channels().size(), 0);
m_ch1->setGroup(QLCChannel::Pan);
m_ch1->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch1, 0);
m_ch2->setGroup(QLCChannel::Pan);
m_ch2->setControlByte(QLCChannel::LSB);
mode.insertChannel(m_ch2, 1);
m_ch3->setGroup(QLCChannel::Tilt);
m_ch3->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch3, 2);
m_ch4->setGroup(QLCChannel::Tilt);
m_ch4->setControlByte(QLCChannel::LSB);
mode.insertChannel(m_ch4, 3);
QLCFixtureHead head;
head.addChannel(0);
head.addChannel(1);
head.addChannel(2);
head.addChannel(3);
head.cacheChannels(&mode);
QCOMPARE(head.panMsbChannel(), quint32(0));
QCOMPARE(head.panLsbChannel(), quint32(1));
QCOMPARE(head.tiltMsbChannel(), quint32(2));
QCOMPARE(head.tiltLsbChannel(), quint32(3));
QCOMPARE(head.rgbChannels(), QVector <quint32> ());
QCOMPARE(head.cmyChannels(), QVector <quint32> ());
QCOMPARE(head.masterIntensityChannel(), QLCChannel::invalid());
head.cacheChannels((QLCFixtureMode*) 0xDEADBEEF);
QCOMPARE(head.panMsbChannel(), quint32(0));
QCOMPARE(head.panLsbChannel(), quint32(1));
QCOMPARE(head.tiltMsbChannel(), quint32(2));
QCOMPARE(head.tiltLsbChannel(), quint32(3));
QCOMPARE(head.rgbChannels(), QVector <quint32> ());
QCOMPARE(head.cmyChannels(), QVector <quint32> ());
QCOMPARE(head.masterIntensityChannel(), QLCChannel::invalid());
}
示例6: save
void QLCFixtureHead_Test::save()
{
QLCFixtureHead head;
head.addChannel(0);
head.addChannel(1);
head.addChannel(2);
head.addChannel(3);
QBuffer buffer;
buffer.open(QIODevice::WriteOnly | QIODevice::Text);
QXmlStreamWriter xmlWriter(&buffer);
QVERIFY(head.saveXML(&xmlWriter));
xmlWriter.setDevice(NULL);
buffer.close();
buffer.open(QIODevice::ReadOnly | QIODevice::Text);
QXmlStreamReader xmlReader(&buffer);
xmlReader.readNextStartElement();
QCOMPARE(xmlReader.name().toString(), QString("Head"));
int ch = 0;
while (xmlReader.readNextStartElement())
{
if (xmlReader.name() == "Channel")
{
QString chNum = xmlReader.readElementText();
QVERIFY(chNum.toInt() == 0 || chNum.toInt() == 1 ||
chNum.toInt() == 2 || chNum.toInt() == 3);
ch++;
}
else
{
QFAIL(QString("Unexpected tag: %1").arg(xmlReader.name().toString()).toUtf8().constData());
xmlReader.skipCurrentElement();
}
}
QCOMPARE(ch, 4);
}
示例7: doublePanTilt
void QLCFixtureHead_Test::doublePanTilt()
{
// Test that the first found Pan/Tilt channel is used
// - for the case the user forgets to set the latter to LSB
// - in most cases the Pan MSB channel comes first
QLCFixtureMode mode(m_fixtureDef);
QCOMPARE(mode.channels().size(), 0);
m_ch1->setGroup(QLCChannel::Pan);
m_ch1->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch1, 0);
m_ch2->setGroup(QLCChannel::Pan);
m_ch2->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch2, 1);
m_ch3->setGroup(QLCChannel::Tilt);
m_ch3->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch3, 2);
m_ch4->setGroup(QLCChannel::Tilt);
m_ch4->setControlByte(QLCChannel::MSB);
mode.insertChannel(m_ch4, 3);
QLCFixtureHead head;
head.addChannel(0);
head.addChannel(1);
head.addChannel(2);
head.addChannel(3);
head.cacheChannels(&mode);
QCOMPARE(head.panMsbChannel(), quint32(0));
QCOMPARE(head.panLsbChannel(), QLCChannel::invalid());
QCOMPARE(head.tiltMsbChannel(), quint32(2));
QCOMPARE(head.tiltLsbChannel(), QLCChannel::invalid());
}
示例8: cacheChannelsCmyMaster
void QLCFixtureHead_Test::cacheChannelsCmyMaster()
{
QLCFixtureMode mode(m_fixtureDef);
QCOMPARE(mode.channels().size(), 0);
m_ch1->setGroup(QLCChannel::Intensity);
m_ch1->setColour(QLCChannel::Cyan);
mode.insertChannel(m_ch1, 0);
m_ch2->setGroup(QLCChannel::Intensity);
m_ch2->setColour(QLCChannel::Magenta);
mode.insertChannel(m_ch2, 1);
m_ch3->setGroup(QLCChannel::Intensity);
m_ch3->setColour(QLCChannel::NoColour);
mode.insertChannel(m_ch3, 2);
m_ch4->setGroup(QLCChannel::Intensity);
m_ch4->setColour(QLCChannel::Yellow);
mode.insertChannel(m_ch4, 3);
QLCFixtureHead head;
head.addChannel(0);
head.addChannel(1);
head.addChannel(2);
head.addChannel(3);
head.cacheChannels(&mode);
QCOMPARE(head.panMsbChannel(), QLCChannel::invalid());
QCOMPARE(head.panLsbChannel(), QLCChannel::invalid());
QCOMPARE(head.tiltMsbChannel(), QLCChannel::invalid());
QCOMPARE(head.tiltLsbChannel(), QLCChannel::invalid());
QCOMPARE(head.rgbChannels(), QVector <quint32> ());
QCOMPARE(head.cmyChannels(), QVector <quint32> () << 0 << 1 << 3);
QCOMPARE(head.masterIntensityChannel(), quint32(2));
}
示例9: setFixtureDefinition
void Fixture::setFixtureDefinition(QLCFixtureDef* fixtureDef,
QLCFixtureMode* fixtureMode)
{
if (fixtureDef != NULL && fixtureMode != NULL)
{
if (m_fixtureDef != NULL && m_fixtureDef != fixtureDef &&
m_fixtureDef->manufacturer() == KXMLFixtureGeneric &&
m_fixtureDef->model() == KXMLFixtureGeneric)
{
delete m_fixtureDef;
}
m_fixtureDef = fixtureDef;
m_fixtureMode = fixtureMode;
// If there are no head entries in the mode, create one that contains
// all channels. This const_cast is a bit heretic, but it's easier this
// way, than to change everything def & mode related non-const, which would
// be worse than one constness violation here.
if (fixtureMode->heads().size() == 0)
{
QLCFixtureHead head;
for (int i = 0; i < fixtureMode->channels().size(); i++)
head.addChannel(i);
fixtureMode->insertHead(-1, head);
}
m_values.resize(fixtureMode->channels().size());
m_values.fill(0);
// Cache all head channels
fixtureMode->cacheHeads();
}
else
{
m_fixtureDef = NULL;
m_fixtureMode = NULL;
}
emit changed(m_id);
}
示例10: setFixtureDefinition
void Fixture::setFixtureDefinition(const QLCFixtureDef* fixtureDef,
const QLCFixtureMode* fixtureMode)
{
if (fixtureDef != NULL && fixtureMode != NULL)
{
m_fixtureDef = fixtureDef;
m_fixtureMode = fixtureMode;
// If there are no head entries in the mode, create one that contains
// all channels. This const_cast is a bit heretic, but it's easier this
// way, than to change everything def & mode related non-const, which would
// be worse than one constness violation here.
QLCFixtureMode* mode = const_cast<QLCFixtureMode*> (fixtureMode);
if (mode->heads().size() == 0)
{
QLCFixtureHead head;
for (int i = 0; i < mode->channels().size(); i++)
head.addChannel(i);
mode->insertHead(-1, head);
}
// Cache all head channels
mode->cacheHeads();
if (m_genericChannel != NULL)
delete m_genericChannel;
m_genericChannel = NULL;
}
else
{
m_fixtureDef = NULL;
m_fixtureMode = NULL;
createGenericChannel();
}
emit changed(m_id);
}
示例11: copy
void QLCFixtureMode_Test::copy()
{
QLCFixtureMode* mode = new QLCFixtureMode(m_fixtureDef);
mode->setName("Test Mode");
mode->insertChannel(m_ch1, 0);
mode->insertChannel(m_ch2, 1);
mode->insertChannel(m_ch3, 2);
mode->insertChannel(m_ch4, 3);
QLCFixtureHead head;
head.addChannel(0);
head.addChannel(1);
head.addChannel(2);
mode->insertHead(-1, head);
/* Create a copy of the mode to the same fixtureDef as the original */
QLCFixtureMode* copy = new QLCFixtureMode(m_fixtureDef, mode);
QVERIFY(copy != NULL);
QVERIFY(copy->name() == "Test Mode");
QVERIFY(copy->channels().size() == 4);
QVERIFY(copy->channel(0) == m_ch1);
QVERIFY(copy->channel(1) == m_ch2);
QVERIFY(copy->channel(2) == m_ch3);
QVERIFY(copy->channel(3) == m_ch4);
QCOMPARE(copy->heads().size(), 1);
QVERIFY(copy->heads().at(0).channels().contains(0) == true);
QVERIFY(copy->heads().at(0).channels().contains(1) == true);
QVERIFY(copy->heads().at(0).channels().contains(2) == true);
delete copy;
copy = NULL;
/* Create another fixture def with some channels matching, some not */
QLCFixtureDef* anotherDef = new QLCFixtureDef();
QLCChannel* ch1 = new QLCChannel();
ch1->setName("Channel 1"); // Should match
anotherDef->addChannel(ch1);
QLCChannel* ch2 = new QLCChannel();
ch2->setName("Channel 2, not the same name"); // Shouldn't match
anotherDef->addChannel(ch2);
QLCChannel* ch3 = new QLCChannel();
ch3->setName("Channel 3, still not the same name"); // Shouldn't match
anotherDef->addChannel(ch3);
QLCChannel* ch4 = new QLCChannel();
ch4->setName("Channel 4"); // Should match
anotherDef->addChannel(ch4);
QLCChannel* ch5 = new QLCChannel();
ch5->setName("Channel 5"); // Shouldn't match since original has 4 chans
anotherDef->addChannel(ch5);
/* Create a copy of the mode to the other fixtureDef */
copy = new QLCFixtureMode(anotherDef, mode);
QVERIFY(copy->name() == "Test Mode");
QVERIFY(copy->channels().size() == 2);
QVERIFY(copy->channel(0)->name() == "Channel 1");
QVERIFY(copy->channel(0) == ch1);
QVERIFY(copy->channel(1)->name() == "Channel 4");
QVERIFY(copy->channel(1) == ch4);
delete copy;
delete anotherDef;
}
示例12: heads
void QLCFixtureMode_Test::heads()
{
QLCFixtureMode* mode = new QLCFixtureMode(m_fixtureDef);
QLCFixtureHead head;
head.addChannel(0);
head.addChannel(10);
head.addChannel(20);
mode->insertHead(-1, head);
QCOMPARE(mode->heads().size(), 1);
QVERIFY(mode->m_heads[0].m_channels.contains(0) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(10) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(20) == true);
QLCFixtureHead head2;
head2.addChannel(1);
head2.addChannel(2);
mode->insertHead(10, head2);
QCOMPARE(mode->heads().size(), 2);
QVERIFY(mode->m_heads[0].m_channels.contains(0) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(10) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(20) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(0) == false);
QVERIFY(mode->m_heads[1].m_channels.contains(1) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(2) == true);
QLCFixtureHead head3;
head3.addChannel(3);
head3.addChannel(4);
mode->insertHead(1, head3);
QCOMPARE(mode->heads().size(), 3);
QVERIFY(mode->m_heads[0].m_channels.contains(0) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(10) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(20) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(3) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(4) == true);
QVERIFY(mode->m_heads[2].m_channels.contains(1) == true);
QVERIFY(mode->m_heads[2].m_channels.contains(2) == true);
QLCFixtureHead head4;
head4.addChannel(15);
head4.addChannel(16);
mode->replaceHead(4, head4);
QCOMPARE(mode->heads().size(), 3);
QVERIFY(mode->m_heads[0].m_channels.contains(0) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(10) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(20) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(3) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(4) == true);
QVERIFY(mode->m_heads[2].m_channels.contains(1) == true);
QVERIFY(mode->m_heads[2].m_channels.contains(2) == true);
mode->replaceHead(2, head4);
QCOMPARE(mode->heads().size(), 3);
QVERIFY(mode->m_heads[0].m_channels.contains(0) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(10) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(20) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(3) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(4) == true);
QVERIFY(mode->m_heads[2].m_channels.contains(15) == true);
QVERIFY(mode->m_heads[2].m_channels.contains(16) == true);
mode->removeHead(15);
QCOMPARE(mode->heads().size(), 3);
mode->removeHead(1);
QCOMPARE(mode->heads().size(), 2);
QVERIFY(mode->m_heads[0].m_channels.contains(0) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(10) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(20) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(15) == true);
QVERIFY(mode->m_heads[1].m_channels.contains(16) == true);
mode->removeHead(0);
QCOMPARE(mode->heads().size(), 1);
QVERIFY(mode->m_heads[0].m_channels.contains(15) == true);
QVERIFY(mode->m_heads[0].m_channels.contains(16) == true);
mode->removeHead(0);
QCOMPARE(mode->heads().size(), 0);
delete mode;
}