本文整理汇总了C++中Fixture::channels方法的典型用法代码示例。如果您正苦于以下问题:C++ Fixture::channels方法的具体用法?C++ Fixture::channels怎么用?C++ Fixture::channels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fixture
的用法示例。
在下文中一共展示了Fixture::channels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFixture
void MonitorFixture::setFixture(quint32 fxi_id)
{
Fixture* fxi;
/* Get rid of old stuff first, if such exists */
if (m_fixtureLabel != NULL)
delete m_fixtureLabel;
while (m_channelLabels.isEmpty() == false)
delete m_channelLabels.takeFirst();
while (m_valueLabels.isEmpty() == false)
delete m_valueLabels.takeFirst();
m_fixture = fxi_id;
fxi = m_doc->fixture(m_fixture);
if (fxi != NULL)
{
/* The grid layout uses columns and rows. The first row is for
the fixture name, second row for channel numbers and the
third row for channel values. Each channel is in its own
column. */
QGridLayout* lay = qobject_cast<QGridLayout*> (layout());
/* Create a new fixture label and set the fixture name there */
m_fixtureLabel = new QLabel(this);
m_fixtureLabel->setText(QString("<B>%1</B>").arg(fxi->name()));
/* Set the fixture name to span all channels horizontally */
lay->addWidget(m_fixtureLabel, 0, 0, 1, fxi->channels(),
Qt::AlignLeft);
/* Create channel numbers and value labels */
for (quint32 i = 0; i < fxi->channels(); i++)
{
QLabel* label;
QString str;
/* Create a label for channel number */
label = new QLabel(this);
lay->addWidget(label, 1, i, Qt::AlignHCenter);
m_channelLabels.append(label);
/* Create a label for value */
label = new QLabel(this);
lay->addWidget(label, 2, i, Qt::AlignHCenter);
m_valueLabels.append(label);
}
}
}
示例2: moveFixture
bool Doc::moveFixture(quint32 id, quint32 newAddress)
{
if (m_fixtures.contains(id) == true)
{
Fixture* fixture = m_fixtures[id];
// remove it
QMutableHashIterator <uint,uint> it(m_addresses);
while (it.hasNext() == true)
{
it.next();
if (it.value() == id)
it.remove();
}
// add it to new address
for (uint i = newAddress; i < newAddress + fixture->channels(); i++)
{
m_addresses[i] = id;
}
setModified();
return true;
}
else
{
qWarning() << Q_FUNC_INFO << "No fixture with id" << id;
return false;
}
}
示例3: setFixture
bool Scene::setFixture(t_fixture_id id)
{
Fixture* fxi = NULL;
fxi = _app->doc()->fixture(id);
if (fxi == NULL)
{
return false;
}
t_channel newChannels = fxi->channels();
if (m_channels == 0)
{
m_channels = newChannels;
m_values = new SceneValue[m_channels];
for (t_channel i = 0; i < m_channels; i++)
{
m_values[i].value = 0;
m_values[i].type = Fade;
}
}
else
{
Q_ASSERT(m_channels == newChannels);
}
m_fixture = id;
_app->doc()->emitFunctionChanged(m_id);
return true;
}
示例4: paintFixtureLabelAll
//
// Paint all visible fixture labels
//
void Monitor::paintFixtureLabelAll(QRegion region, int x_offset, int y_offset,
int unitW, int unitH, int unitsX)
{
int x = 0;
int y = 0;
int w = 0;
int wcur = 0;
int h = 0;
t_fixture_id id = KNoID;
Fixture* fxi = NULL;
// Draw fixture names and their channel spaces
for (id = 0; id < KFixtureArraySize; id++)
{
fxi = _app->doc()->fixture(id);
if (fxi == NULL) continue;
if (fxi->universe() != m_universe) continue;
// Calculate x and y positions for this fixture label
x = ((fxi->address() % unitsX) * unitW);
x += x_offset;
y = static_cast<int>
(floor((fxi->address() / unitsX)) * (unitH * 3));
y += y_offset;
// Get width and height for this fixture label
w = (fxi->channels() * unitW) - X_OFFSET;
h = unitH;
// Check if this label needs to be painted at all
if (region.contains(QRect(x, y, w, h)) == false)
continue;
if ((x + w + X_OFFSET) <= width())
{
// The label fits to one line, just draw it
paintFixtureLabel(x, y, w, h, fxi->name());
}
else
{
// The label needs to be drawn on at least two lines
while (w > 0)
{
wcur = MIN(w, (unitsX * unitW) - (x));
// Draw the label
paintFixtureLabel(x, y, wcur, h, fxi->name());
// Calculate remaining width
w = w - wcur - X_OFFSET;
// Next line
y += (unitH * 3);
x = x_offset;
}
}
}
}
示例5: initTestCase
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);
}
示例6: setFixture
void FixtureConsole::setFixture(t_fixture_id id)
{
ConsoleChannel* cc = NULL;
Fixture* fxi = NULL;
/* Get rid of any previous channels */
while (m_channels.isEmpty() == false)
delete m_channels.takeFirst();
m_fixture = id;
fxi = _app->doc()->fixture(m_fixture);
Q_ASSERT(fxi != NULL);
/* Create channel units */
for (unsigned int i = 0; i < fxi->channels(); i++)
{
const QLCChannel* ch = fxi->channel(i);
Q_ASSERT(ch != NULL);
if (ch->group() == QLCChannel::NoGroup)
continue;
cc = new ConsoleChannel(this, m_fixture, i);
cc->setCheckable(m_channelsCheckable);
layout()->addWidget(cc);
connect(cc, SIGNAL(valueChanged(quint32,uchar,bool)),
this, SLOT(slotValueChanged(quint32,uchar,bool)));
m_channels.append(cc);
}
/* Make a spacer item eat excess space to justify channels left */
layout()->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
}
示例7: slotAutoFunction
void FixtureManager::slotAutoFunction()
{
#if 0
QTreeWidgetItem* item;
t_fixture_id fxi_id;
Fixture* fxi;
item = m_tree->currentItem();
if (item == NULL)
return;
fxi_id = item->text(KColumnID).toInt();
fxi = _app->doc()->fixture(fxi_id);
Q_ASSERT(fxi != NULL);
// Loop over all channels
for (int i = 0; i < fxi->channels(); i++)
{
QLCChannel* channel = fxi->channel(i);
Q_ASSERT(channel != NULL);
QListIterator <QLCCapability*>
cap_it(*channel->capabilities());
// Loop over all capabilities
while (cap_it.hasNext() == true)
{
QLCCapability* cap = cap_it.next();
Q_ASSERT(cap != NULL);
Scene* sc = static_cast<Scene*>
(_app->doc()->newFunction(Function::Scene,
fxi_id));
sc->setName(channel->name() + " - " + cap->name());
// Set the unused channels to NoSet and zero.
for (int j = 0; j < fxi->channels(); j++)
sc->set(j, 0, Scene::NoSet);
// Set only the capability
sc->set(i, (t_value) ((cap->min() + cap->max()) / 2),
Scene::Set);
}
}
#endif
}
示例8: init
void FixtureList::init()
{
QTreeWidgetItem* item;
m_listView->clear();
connect(m_listView, SIGNAL(itemSelectionChanged()),
this, SLOT(slotSelectionChanged()));
connect(m_listView, SIGNAL(itemDoubleClicked(QTreeWidgetItem*)),
this, SLOT(slotItemDoubleClicked()));
for (t_fixture_id fxi_id = 0; fxi_id < KFixtureArraySize; fxi_id++)
{
Fixture* fxi = _app->doc()->fixture(fxi_id);
if (fxi == NULL)
continue;
for (unsigned int n = 0; n < fxi->channels(); n++)
{
QLCChannel* channel;
QString s;
// Create a new item for a channel
item = new QTreeWidgetItem(m_listView);
// Fixture name
item->setText(KColumnFixtureName, fxi->name());
// Channel name
channel = fxi->channel(n);
if (channel != NULL)
{
s.sprintf("%.3d: ", n + 1);
s += channel->name();
item->setText(KColumnChannelName, s);
}
else
{
delete item;
break;
}
// Relative channel number (not shown)
s.sprintf("%.3d", n);
item->setText(KColumnChannelNum, s);
// Fixture ID (not shown)
item->setText(KColumnFixtureID,
QString("%1").arg(fxi_id));
}
}
/* Select the first item */
item = m_listView->topLevelItem(0);
if (item != NULL)
item->setSelected(true);
}
示例9: replaceFixtures
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;
}
示例10: init
void ChaserRunner_Test::init()
{
QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
QVERIFY(def != NULL);
QLCFixtureMode* mode = def->mode("Mode 1");
QVERIFY(mode != NULL);
Fixture* fxi = new Fixture(m_doc);
QVERIFY(fxi != NULL);
fxi->setFixtureDefinition(def, mode);
fxi->setName("Test Fixture");
fxi->setAddress(0);
fxi->setUniverse(0);
m_doc->addFixture(fxi);
m_scene1 = new Scene(m_doc);
m_scene1->setName("S1");
QVERIFY(m_scene1 != NULL);
for (quint32 i = 0; i < fxi->channels(); i++)
m_scene1->setValue(fxi->id(), i, 255 - i);
m_doc->addFunction(m_scene1);
m_scene2 = new Scene(m_doc);
m_scene2->setName("S2");
QVERIFY(m_scene2 != NULL);
for (quint32 i = 0; i < fxi->channels(); i++)
m_scene2->setValue(fxi->id(), i, 127 - i);
m_doc->addFunction(m_scene2);
m_scene3 = new Scene(m_doc);
m_scene3->setName("S3");
QVERIFY(m_scene3 != NULL);
for (quint32 i = 0; i < fxi->channels(); i++)
m_scene3->setValue(fxi->id(), i, 0 + i);
m_doc->addFunction(m_scene3);
m_chaser = new Chaser(m_doc);
m_chaser->addStep(ChaserStep(m_scene1->id()));
m_chaser->addStep(ChaserStep(m_scene2->id()));
m_chaser->addStep(ChaserStep(m_scene3->id()));
}
示例11: slotFixtureChanged
void Doc::slotFixtureChanged(quint32 id)
{
/* Keep track of fixture addresses */
Fixture* fxi = fixture(id);
for (uint i = fxi->universeAddress(); i < fxi->universeAddress() + fxi->channels(); i++)
{
m_addresses[i] = id;
}
setModified();
emit fixtureChanged(id);
}
示例12: init
void FixtureList::init()
{
QListViewItem* item = NULL;
QLCChannel* channel = NULL;
Fixture* fxi = NULL;
unsigned int n = 0;
QString fxi_id;
QString s;
m_listView->clear();
for (t_fixture_id i = 0; i < KFixtureArraySize; i++)
{
fxi = _app->doc()->fixture(i);
if (fxi == NULL)
continue;
fxi_id.setNum(fxi->id());
for (n = 0; n < fxi->channels(); n++)
{
// Create a new item for a channel
item = new QListViewItem(m_listView);
// Fixture name
item->setText(KColumnFixtureName, fxi->name());
// Channel name
channel = fxi->channel(n);
if (channel != NULL)
{
s.sprintf("%.3d: ", n + 1);
s += channel->name();
item->setText(KColumnChannelName, s);
}
else
{
delete item;
break;
}
// Relative channel number (not shown)
s.sprintf("%.3d", n);
item->setText(KColumnChannelNum, s);
// Fixture ID (not shown)
item->setText(KColumnFixtureID, fxi_id);
}
}
m_listView->setSelected(m_listView->firstChild(), true);
}
示例13: saveXML
// Save this function to an XML document
bool Scene::saveXML(QDomDocument* doc, QDomElement* wksp_root)
{
Fixture* fxi = NULL;
QDomElement root;
QDomElement tag;
QDomText text;
QString str;
Q_ASSERT(doc != NULL);
Q_ASSERT(wksp_root != NULL);
fxi = _app->doc()->fixture(m_fixture);
Q_ASSERT(fxi != NULL);
/* Function tag */
root = doc->createElement(KXMLQLCFunction);
wksp_root->appendChild(root);
root.setAttribute(KXMLQLCFunctionID, id());
root.setAttribute(KXMLQLCFunctionType, Function::typeToString(m_type));
root.setAttribute(KXMLQLCFunctionName, name());
root.setAttribute(KXMLQLCFunctionFixture, fixture());
/* Speed bus */
tag = doc->createElement(KXMLQLCBus);
root.appendChild(tag);
tag.setAttribute(KXMLQLCBusRole, KXMLQLCBusFade);
str.setNum(busID());
text = doc->createTextNode(str);
tag.appendChild(text);
/* Scene contents */
for (t_channel i = 0; i < fxi->channels(); i++)
{
/* Value tag */
tag = doc->createElement(KXMLQLCFunctionValue);
/* Value type & channel */
tag.setAttribute(KXMLQLCFunctionChannel, i);
tag.setAttribute(KXMLQLCFunctionValueType, valueTypeString(i));
root.appendChild(tag);
/* Value contents */
str.setNum(m_values[i].value);
text = doc->createTextNode(str);
tag.appendChild(text);
}
}
示例14: createFixtureItem
void MainView2D::createFixtureItems(quint32 fxID, QVector3D pos, bool mmCoords)
{
Fixture *fixture = m_doc->fixture(fxID);
if (fixture == NULL)
return;
if (fixture->type() == QLCFixtureDef::Dimmer)
{
for (quint32 i = 0; i < fixture->channels(); i++)
createFixtureItem(fixture->id(), i, 0, pos, mmCoords);
}
else
{
createFixtureItem(fixture->id(), 0, 0, pos, mmCoords);
}
}
示例15: loader
void Fixture_Test::loader()
{
QBuffer buffer;
buffer.open(QIODevice::WriteOnly | QIODevice::Text);
QXmlStreamWriter xmlWriter(&buffer);
xmlWriter.writeStartElement("Fixture");
xmlWriter.writeTextElement("Channels", "18");
xmlWriter.writeTextElement("Name", "Foobar");
xmlWriter.writeTextElement("Universe", "3");
xmlWriter.writeTextElement("Model", "Foobar");
xmlWriter.writeTextElement("Mode", "Foobar");
xmlWriter.writeTextElement("Manufacturer", "Foobar");
xmlWriter.writeTextElement("ID", "42");
xmlWriter.writeTextElement("Address", "21");
xmlWriter.writeEndDocument();
xmlWriter.setDevice(NULL);
buffer.close();
buffer.open(QIODevice::ReadOnly | QIODevice::Text);
QXmlStreamReader xmlReader(&buffer);
xmlReader.readNextStartElement();
QVERIFY(m_doc != NULL);
QVERIFY(m_doc->fixtures().size() == 0);
QVERIFY(Fixture::loader(xmlReader, m_doc) == true);
QVERIFY(m_doc->fixtures().size() == 1);
QVERIFY(m_doc->fixture(0) == NULL); // No ID auto-assignment
Fixture* fxi = m_doc->fixture(42);
QVERIFY(fxi != NULL);
QVERIFY(fxi->name() == "Foobar");
QVERIFY(fxi->channels() == 18);
QVERIFY(fxi->address() == 21);
QVERIFY(fxi->universe() == 3);
QVERIFY(fxi->fixtureDef() != NULL);
QVERIFY(fxi->fixtureMode() != NULL);
}