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; }
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; }
void QLCFixtureMode_Test::physical() { /* Verify that a QLCPhysical can be set & get for the mode */ QLCFixtureMode* mode = new QLCFixtureMode(m_fixtureDef); QVERIFY(mode->physical().bulbType().isEmpty()); QLCPhysical p; p.setBulbType("Foobar"); mode->setPhysical(p); QVERIFY(mode->physical().bulbType() == "Foobar"); delete mode; }