本文整理汇总了C++中QLCFixtureDef类的典型用法代码示例。如果您正苦于以下问题:C++ QLCFixtureDef类的具体用法?C++ QLCFixtureDef怎么用?C++ QLCFixtureDef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QLCFixtureDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Doc
void VCXYPadFixtureEditor_Test::initTestCase()
{
m_doc = new Doc(this);
QDir dir(INTERNAL_FIXTUREDIR);
dir.setFilter(QDir::Files);
dir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
QVERIFY(m_doc->fixtureDefCache()->loadMap(dir) == true);
QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
QVERIFY(def != NULL);
QLCFixtureMode* mode = def->modes()[0];
QVERIFY(mode != NULL);
Fixture* fxi = new Fixture(m_doc);
fxi->setName("Fixture 1");
fxi->setFixtureDefinition(def, mode);
fxi->setAddress(0);
fxi = new Fixture(m_doc);
fxi->setName("Fixture 2");
fxi->setFixtureDefinition(def, mode);
fxi->setAddress(10);
fxi = new Fixture(m_doc);
fxi->setName("Fixture 3");
fxi->setFixtureDefinition(def, mode);
fxi->setAddress(20);
}
示例2: fxi
void Fixture_Test::channels()
{
Fixture fxi(this);
QLCFixtureDef* fixtureDef = m_doc->fixtureDefCache()->fixtureDef("i-Pix", "BB4");
QVERIFY(fixtureDef != NULL);
QLCFixtureMode* fixtureMode = fixtureDef->modes().last();
QVERIFY(fixtureMode != NULL);
fxi.setFixtureDefinition(fixtureDef, fixtureMode);
QCOMPARE(fxi.channel("red", Qt::CaseInsensitive), quint32(3));
QCOMPARE(fxi.channel("red", Qt::CaseInsensitive, QLCChannel::Intensity), quint32(3));
QCOMPARE(fxi.channel("brown", Qt::CaseInsensitive), QLCChannel::invalid());
QSet <quint32> chs;
chs << 3 << 4 << 21 << 22 << 12 << 13 << 30 << 31;
QCOMPARE(chs, fxi.channels("red", Qt::CaseInsensitive));
QCOMPARE(chs, fxi.channels("red", Qt::CaseInsensitive, QLCChannel::Intensity));
chs.clear();
chs << 5 << 6 << 23 << 24 << 14 << 15 << 32 << 33;
QCOMPARE(chs, fxi.channels("green", Qt::CaseInsensitive));
chs.clear();
QCOMPARE(chs, fxi.channels("green"));
chs.clear();
chs << 7 << 8 << 16 << 17 << 25 << 26 << 34 << 35;
QCOMPARE(chs, fxi.channels("blue", Qt::CaseInsensitive));
chs.clear();
QCOMPARE(chs, fxi.channels("green", Qt::CaseInsensitive, QLCChannel::Colour));
chs.clear();
QCOMPARE(fxi.channels("brown", Qt::CaseInsensitive, QLCChannel::Intensity), chs);
}
示例3: qDebug
bool FixtureManager::addFixture(QString manuf, QString model, QString mode, QString name,
int uniIdx, int address, int channels, int quantity, quint32 gap,
qreal xPos, qreal yPos)
{
qDebug() << Q_FUNC_INFO << manuf << model << quantity;
QLCFixtureDef *fxiDef = m_doc->fixtureDefCache()->fixtureDef(manuf, model);
Q_ASSERT(fxiDef != NULL);
QLCFixtureMode *fxiMode = fxiDef->mode(mode);
Q_ASSERT(fxiMode != NULL);
for (int i = 0; i < quantity; i++)
{
Fixture *fxi = new Fixture(m_doc);
/* If we're adding more than one fixture,
append a number to the end of the name */
if (quantity > 1)
fxi->setName(QString("%1 #%2").arg(name).arg(i + 1));
else
fxi->setName(name);
fxi->setAddress(address + (i * channels) + (i * gap));
fxi->setUniverse(uniIdx);
fxi->setFixtureDefinition(fxiDef, fxiMode);
m_doc->addFixture(fxi);
emit newFixtureCreated(fxi->id(), xPos, yPos);
}
m_fixtureList.clear();
m_fixtureList = m_doc->fixtures();
emit fixturesCountChanged();
return true;
}
示例4: fxi
void Fixture_Test::status()
{
// This test is mostly just a stability check since checking lots of
// detailed HTML formatting is not that useful.
QString info;
Fixture fxi(this);
info = fxi.status();
fxi.setID(1337);
info = fxi.status();
fxi.setName("Test Fixture");
info = fxi.status();
fxi.setUniverse(2);
info = fxi.status();
fxi.setAddress(438);
info = fxi.status();
fxi.setChannels(12);
info = fxi.status();
QLCFixtureDef* fixtureDef;
fixtureDef = m_doc->fixtureDefCache()->fixtureDef("Martin", "MAC250+");
Q_ASSERT(fixtureDef != NULL);
QLCFixtureMode* fixtureMode;
fixtureMode = fixtureDef->modes().at(0);
Q_ASSERT(fixtureMode != NULL);
fxi.setFixtureDefinition(fixtureDef, fixtureMode);
info = fxi.status();
}
示例5: QLCFixtureDef
void QLCFixtureDef_Test::type()
{
QLCFixtureDef* fd = new QLCFixtureDef();
fd->setType("Scanner");
QVERIFY(fd->type() == "Scanner");
delete fd;
}
示例6: Doc
void RGBMatrix_Test::initTestCase()
{
m_doc = new Doc(this);
QDir fxiDir(INTERNAL_FIXTUREDIR);
fxiDir.setFilter(QDir::Files);
fxiDir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
QVERIFY(m_doc->fixtureDefCache()->loadMap(fxiDir) == true);
QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Stairville", "LED PAR56");
QVERIFY(def != NULL);
QLCFixtureMode* mode = def->modes().first();
QVERIFY(mode != NULL);
FixtureGroup* grp = new FixtureGroup(m_doc);
grp->setName("Test Group");
grp->setSize(QSize(5, 5));
m_doc->addFixtureGroup(grp);
for (int i = 0; i < 25; i++)
{
Fixture* fxi = new Fixture(m_doc);
fxi->setFixtureDefinition(def, mode);
fxi->setAddress(i * fxi->channels());
m_doc->addFixture(fxi);
grp->assignFixture(fxi->id());
}
QVERIFY(m_doc->rgbScriptsCache()->load(QDir(INTERNAL_SCRIPTDIR)));
QVERIFY(m_doc->rgbScriptsCache()->names().size() != 0);
}
示例7: it
void AddFixture::fillTree()
{
QPtrListIterator <QLCFixtureDef> it(*_app->fixtureDefList());
QLCFixtureDef* fixtureDef = NULL;
QListViewItem* parent = NULL;
QListViewItem* node = NULL;
QString str;
/* Clear the tree of any previous data */
m_tree->clear();
/* Add all known fixture definitions. */
while ( (fixtureDef = *it) != NULL )
{
parent = NULL;
/* Search for an existing manufacturer parent node from
the tree. If such is found, it will be used as the
parent for the current fixture. If not, the manufacturer
will be added as a new parent and then used for the
current fixture. */
for (node = m_tree->firstChild(); node != NULL;
node = node->nextSibling())
{
if (node->text(KColumnName) == fixtureDef->manufacturer())
{
parent = node;
break;
}
}
/* If an existing manufacturer parent node was not found,
we must create one. Otherwise we use the found node
as the parent for the new item. */
if (parent == NULL)
parent = new QListViewItem(m_tree,
fixtureDef->manufacturer());
/* Create a new fixture node, under the parent node */
node = new QListViewItem(parent);
node->setText(KColumnName, fixtureDef->model());
node->setText(KColumnType, fixtureDef->type());
/* Store the fixture pointer into the tree */
str.sprintf("%d", (unsigned long) fixtureDef);
node->setText(KColumnPointer, str);
++it;
}
/* Create a node & parent for generic dimmers */
parent = new QListViewItem(m_tree);
parent->setText(KColumnName, KXMLFixtureGeneric);
node = new QListViewItem(parent);
node->setText(KColumnName, KXMLFixtureGeneric);
node->setText(KColumnType, KXMLFixtureDimmer);
node->setText(KColumnPointer, "0");
}
示例8: fxit
bool Doc::replaceFixtures(QList<Fixture*> newFixturesList)
{
// Delete all fixture instances
QListIterator <quint32> fxit(m_fixtures.keys());
while (fxit.hasNext() == true)
{
Fixture* fxi = m_fixtures.take(fxit.next());
delete fxi;
m_fixturesListCacheUpToDate = false;
}
m_latestFixtureId = 0;
m_addresses.clear();
foreach(Fixture *fixture, newFixturesList)
{
quint32 id = fixture->id();
// create a copy of the original cause remapping will
// destroy it later
Fixture *newFixture = new Fixture(this);
newFixture->setID(id);
newFixture->setName(fixture->name());
newFixture->setAddress(fixture->address());
newFixture->setUniverse(fixture->universe());
if (fixture->fixtureDef() == NULL ||
(fixture->fixtureDef()->manufacturer() == KXMLFixtureGeneric &&
fixture->fixtureDef()->model() == KXMLFixtureGeneric))
{
newFixture->setChannels(fixture->channels());
}
else
{
QLCFixtureDef *def = fixtureDefCache()->fixtureDef(fixture->fixtureDef()->manufacturer(),
fixture->fixtureDef()->model());
QLCFixtureMode *mode = NULL;
if (def != NULL)
mode = def->mode(fixture->fixtureMode()->name());
newFixture->setFixtureDefinition(def, mode);
}
newFixture->setExcludeFadeChannels(fixture->excludeFadeChannels());
m_fixtures.insert(id, newFixture);
m_fixturesListCacheUpToDate = false;
/* Patch fixture change signals thru Doc */
connect(newFixture, SIGNAL(changed(quint32)),
this, SLOT(slotFixtureChanged(quint32)));
/* Keep track of fixture addresses */
for (uint i = newFixture->universeAddress();
i < newFixture->universeAddress() + newFixture->channels(); i++)
{
m_addresses[i] = id;
}
m_latestFixtureId = id;
}
示例9: while
int QLCFixtureDefCache::loadMapManufacturer(QXmlStreamReader *doc, QString manufacturer)
{
int count = 0;
QString spacedManufacturer = manufacturer;
spacedManufacturer.replace("_", " ");
while (doc->readNextStartElement())
{
if (doc->name() == "F")
{
QString defFile = "";
QString model = "";
if (doc->attributes().hasAttribute("n"))
{
defFile = QString("%1%2%3%4")
.arg(manufacturer).arg(QDir::separator())
.arg(doc->attributes().value("n").toString()).arg(KExtFixture);
//qDebug() << "Manufacturer" << spacedManufacturer << "file" << defFile;
}
if (doc->attributes().hasAttribute("m"))
model = doc->attributes().value("m").toString();
if (defFile.isEmpty() == false &&
spacedManufacturer.isEmpty() == false &&
model.isEmpty() == false)
{
QLCFixtureDef *fxi = new QLCFixtureDef();
Q_ASSERT(fxi != NULL);
fxi->setDefinitionSourceFile(defFile);
fxi->setManufacturer(spacedManufacturer);
fxi->setModel(model);
/* Delete the def if it's a duplicate. */
if (addFixtureDef(fxi) == false)
delete fxi;
fxi = NULL;
count++;
}
}
else
{
qWarning() << Q_FUNC_INFO << "Unknown manufacturer tag: " << doc->name();
}
doc->skipCurrentElement();
}
return count;
}
示例10: Universe
void CueStack_Test::insertStartValue()
{
QList<Universe*> ua;
ua.append(new Universe(0, new GrandMaster()));
ua.at(0)->setChannelCapability(0, QLCChannel::Pan);
CueStack cs(m_doc);
cs.preRun();
FadeChannel fc;
fc.setChannel(0);
fc.setStart(0);
fc.setTarget(255);
fc.setCurrent(127);
cs.m_fader->add(fc);
fc.setTarget(64);
cs.insertStartValue(fc, ua);
QCOMPARE(fc.start(), uchar(127));
QCOMPARE(fc.current(), uchar(127));
cs.m_fader->remove(fc);
// HTP channel in universes
ua[0]->write(0, 192);
cs.insertStartValue(fc, ua);
QCOMPARE(fc.start(), uchar(0));
QCOMPARE(fc.current(), uchar(0));
QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
QVERIFY(def != NULL);
QLCFixtureMode* mode = def->modes().first();
QVERIFY(mode != NULL);
Fixture* fxi = new Fixture(m_doc);
fxi->setFixtureDefinition(def, mode);
fxi->setName("Test Scanner");
fxi->setAddress(0);
fxi->setUniverse(0);
m_doc->addFixture(fxi);
// LTP channel (Pan) in universes
ua[0]->write(0, 192);
cs.insertStartValue(fc, ua);
QCOMPARE(fc.start(), uchar(192));
QCOMPARE(fc.current(), uchar(192));
MasterTimer mt(m_doc);
cs.postRun(&mt);
}
示例11: doc
void FadeChannel_Test::group()
{
Doc doc(this);
FadeChannel fc;
// Only a channel given, no fixture at the address -> intensity
fc.setChannel(2);
QCOMPARE(fc.group(&doc), QLCChannel::Intensity);
Fixture* fxi = new Fixture(&doc);
fxi->setAddress(10);
fxi->setChannels(5);
doc.addFixture(fxi);
// Fixture and channel given, fixture is a dimmer -> intensity
fc.setFixture(&doc, fxi->id());
QCOMPARE(fc.group(&doc), QLCChannel::Intensity);
QDir dir(INTERNAL_FIXTUREDIR);
dir.setFilter(QDir::Files);
dir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
QVERIFY(doc.fixtureDefCache()->load(dir) == true);
QLCFixtureDef* def = doc.fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
QVERIFY(def != NULL);
QLCFixtureMode* mode = def->modes().first();
QVERIFY(mode != NULL);
fxi = new Fixture(&doc);
fxi->setAddress(0);
fxi->setFixtureDefinition(def, mode);
doc.addFixture(fxi);
// Fixture and channel given, but channel is beyond fixture's channels -> intensity
fc.setFixture(&doc, fxi->id());
fc.setChannel(50);
QCOMPARE(fc.group(&doc), QLCChannel::Intensity);
// Only a channel given, no fixture given but a fixture occupies the address.
// Check that reverse address -> fixture lookup works.
fc.setFixture(&doc, Fixture::invalidId());
fc.setChannel(2);
QCOMPARE(fc.group(&doc), QLCChannel::Colour);
// Fixture and channel given, but fixture doesn't exist -> intensity
fc.setFixture(&doc, 12345);
fc.setChannel(2);
QCOMPARE(fc.group(&doc), QLCChannel::Intensity);
}
示例12: loadQXF
QLCFixtureDef* App::loadQXF(const QString& path, QString& errorMsg) const
{
QLCFixtureDef* fixtureDef = new QLCFixtureDef;
Q_ASSERT(fixtureDef != NULL);
QFile::FileError error = fixtureDef->loadXML(path);
if (error != QFile::NoError)
{
delete fixtureDef;
fixtureDef = NULL;
errorMsg = QLCFile::errorString(error);
}
return fixtureDef;
}
示例13: it
QLCFixtureDef* QLCFixtureDefCache::fixtureDef(
const QString& manufacturer, const QString& model) const
{
QListIterator <QLCFixtureDef*> it(m_defs);
while (it.hasNext() == true)
{
QLCFixtureDef* def = it.next();
if (def->manufacturer() == manufacturer && def->model() == model)
{
def->checkLoaded(m_mapAbsolutePath);
return def;
}
}
return NULL;
}
示例14: Fixture
void VCXYPad_Test::modeChange()
{
//UniverseArray ua(512);
QWidget w;
Fixture* fxi = new Fixture(m_doc);
QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
QVERIFY(def != NULL);
QLCFixtureMode* mode = def->modes().first();
QVERIFY(mode != NULL);
fxi->setFixtureDefinition(def, mode);
m_doc->addFixture(fxi);
VCXYPad pad(&w, m_doc);
pad.show();
w.show();
pad.resize(QSize(200, 200));
VCXYPadFixture xy(m_doc);
xy.setHead(GroupHead(fxi->id(), 0));
pad.appendFixture(xy);
QCOMPARE(pad.fixtures().size(), 1);
QCOMPARE(pad.fixtures()[0].m_xMSB, QLCChannel::invalid());
QCOMPARE(pad.fixtures()[0].m_xLSB, QLCChannel::invalid());
m_doc->setMode(Doc::Operate);
QVERIFY(pad.fixtures()[0].m_xMSB != QLCChannel::invalid());
QVERIFY(pad.fixtures()[0].m_yMSB != QLCChannel::invalid());
QCOMPARE(m_doc->masterTimer()->m_dmxSourceList.size(), 1);
QCOMPARE(m_doc->masterTimer()->m_dmxSourceList[0], &pad);
/*
// FIXME !!
pad.m_area->setPosition(QPoint(pad.m_area->width(), pad.m_area->height()));
pad.writeDMX(m_doc->masterTimer(), &ua);
QCOMPARE(ua.preGMValues()[0], char(255));
QCOMPARE(ua.preGMValues()[1], char(255));
pad.m_area->setPosition(QPoint(pad.m_area->width() / 2, pad.m_area->height() / 4));
pad.writeDMX(m_doc->masterTimer(), &ua);
QCOMPARE(ua.preGMValues()[0], char(128));
QCOMPARE(ua.preGMValues()[1], char(64));
*/
m_doc->setMode(Doc::Design);
QCOMPARE(pad.fixtures()[0].m_xMSB, QLCChannel::invalid());
QCOMPARE(pad.fixtures()[0].m_yMSB, QLCChannel::invalid());
QCOMPARE(m_doc->masterTimer()->m_dmxSourceList.size(), 0);
}
示例15: QString
void QLCFixtureDefCache_Test::fixtureDef()
{
// check the content of a cached fixture relative path
QString firstManufacturer = cache.m_defs.first()->manufacturer();
QString firstModel = cache.m_defs.first()->model();
QString relPath = QString("%1/%1-%2.qxf").arg(firstManufacturer).arg(firstModel);
relPath.replace(" ", "-");
QVERIFY(cache.m_defs.first()->definitionSourceFile() == relPath);
// request a fixture cached but not yet loaded
QLCFixtureDef *def = cache.fixtureDef("Futurelight", "CY-200");
// check that once loaded, the relative path is reset
QVERIFY(def->definitionSourceFile().isEmpty());
cache.clear();
QLCFixtureDef *def1 = new QLCFixtureDef();
def1->setManufacturer("Martin");
def1->setModel("MAC250");
cache.addFixtureDef(def1);
QLCFixtureDef *def2 = new QLCFixtureDef();
def2->setManufacturer("Martin");
def2->setModel("MAC500");
cache.addFixtureDef(def2);
QLCFixtureDef *def3 = new QLCFixtureDef();
def3->setManufacturer("Robe");
def3->setModel("WL250");
cache.addFixtureDef(def3);
QLCFixtureDef *def4 = new QLCFixtureDef();
def4->setManufacturer("Futurelight");
def4->setModel("DJ Scan 250");
cache.addFixtureDef(def4);
QVERIFY(cache.fixtureDef("Martin", "MAC250") == def1);
QVERIFY(cache.fixtureDef("Martin", "MAC500") == def2);
QVERIFY(cache.fixtureDef("Robe", "WL250") == def3);
QVERIFY(cache.fixtureDef("Futurelight", "DJ Scan 250") == def4);
QVERIFY(cache.fixtureDef("Martin", "MAC 250") == NULL);
QVERIFY(cache.fixtureDef("Mar tin", "MAC250") == NULL);
QVERIFY(cache.fixtureDef("Foobar", "Foobar") == NULL);
QVERIFY(cache.fixtureDef("", "") == NULL);
}