本文整理汇总了C++中QLCChannel::name方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCChannel::name方法的具体用法?C++ QLCChannel::name怎么用?C++ QLCChannel::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCChannel
的用法示例。
在下文中一共展示了QLCChannel::name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: name
void QLCChannel_Test::name()
{
/* Verify that a name can be set & get for the channel */
QLCChannel* channel = new QLCChannel();
QVERIFY(channel->name().isEmpty());
channel->setName("Channel");
QVERIFY(channel->name() == "Channel");
delete channel;
}
示例2: slotAddChannelClicked
void EditMode::slotAddChannelClicked()
{
QPtrListIterator<QLCChannel> it(*m_mode->fixtureDef()->channels());
QLCChannel* ch = NULL;
QStringList list;
bool ok = false;
QString name;
int index = 0;
/* Create a list of channels that have not been added to this mode yet */
while ( (ch = it.current()) != 0 )
{
++it;
if (m_mode->searchChannel(ch->name()) != NULL)
continue;
else
list.append(ch->name());
}
name = QInputDialog::getItem("Add channel to mode",
"Select a channel to add",
list, 0, false, &ok, this);
if (ok == true && name.isEmpty() == false)
{
QListViewItem* item = NULL;
int insertat = 0;
ch = m_mode->fixtureDef()->channel(name);
// Find out the current channel number
item = m_channelList->currentItem();
if (item != NULL)
insertat = item->text(KChannelsColumnNumber).toInt() - 1;
else
insertat = 0;
// Insert the item at current selection
m_mode->insertChannel(ch, insertat);
// Easier to refresh the whole list than to increment all
// channel numbers after the inserted item
refreshChannelList();
// Select the new channel
selectChannel(ch->name());
}
}
示例3: slotRemoveChannel
void QLCFixtureEditor::slotRemoveChannel()
{
QLCChannel* channel = currentChannel();
Q_ASSERT(channel != NULL);
if (QMessageBox::question(this, "Remove Channel",
tr("Are you sure you wish to remove channel: %1 ?")
.arg(channel->name()),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
QTreeWidgetItem* item;
QTreeWidgetItem* next;
item = m_channelList->currentItem();
if (m_channelList->itemBelow(item) != NULL)
next = m_channelList->itemBelow(item);
else if (m_channelList->itemAbove(item) != NULL)
next = m_channelList->itemAbove(item);
else
next = NULL;
// Remove the selected channel from the fixture (also deleted)
m_fixtureDef->removeChannel(currentChannel());
delete item;
m_channelList->setCurrentItem(next);
setModified();
}
}
示例4: refreshChannelList
void QLCFixtureEditor::refreshChannelList()
{
QLCChannel* ch = NULL;
QTreeWidgetItem* item = NULL;
QString str;
m_channelList->clear();
// Fill channels list
QListIterator <QLCChannel*> it(*m_fixtureDef->channels());
while (it.hasNext() == true)
{
ch = it.next();
item = new QTreeWidgetItem(m_channelList);
item->setText(KChannelsColumnName, ch->name());
item->setText(KChannelsColumnGroup, ch->group());
// Store the channel pointer to the listview as a string
str.sprintf("%lu", (unsigned long) ch);
item->setText(KChannelsColumnPointer, str);
}
slotChannelListSelectionChanged(m_channelList->currentItem());
}
示例5: slotPasteChannel
void QLCFixtureEditor::slotPasteChannel()
{
QLCChannel* ch = _app->copyChannel();
if (ch != NULL && m_fixtureDef != NULL)
{
/* Create new mode and an item for it */
QTreeWidgetItem* item;
QLCChannel* copy;
copy = new QLCChannel(ch);
item = new QTreeWidgetItem(m_channelList);
int cpIdx = 1;
QString copyName;
do
{
copyName = QString("%1 %2").arg(ch->name()).arg(cpIdx);
cpIdx++;
} while (m_fixtureDef->channel(copyName) != NULL);
copy->setName(copyName);
m_fixtureDef->addChannel(copy);
updateChannelItem(copy, item);
m_channelList->setCurrentItem(item);
m_channelList->resizeColumnToContents(CH_COL_NAME);
setModified();
}
}
示例6: updateModeItem
void QLCFixtureEditor::updateModeItem(const QLCFixtureMode* mode,
QTreeWidgetItem* item)
{
Q_ASSERT(mode != NULL);
Q_ASSERT(item != NULL);
item->setText(MODE_COL_NAME, mode->name());
item->setData(MODE_COL_NAME, PROP_PTR, (qulonglong) mode);
item->setText(MODE_COL_CHS, QString::number(mode->channels().size()));
if (mode->heads().size() > 0)
item->setText(MODE_COL_HEAD, QString::number(mode->heads().size()));
else
item->setText(MODE_COL_HEAD, QString());
/* Destroy the existing list of children */
QList <QTreeWidgetItem*> children(item->takeChildren());
foreach (QTreeWidgetItem* child, children)
delete child;
/* Put all mode channels as non-selectable sub items */
for (int i = 0; i < mode->channels().size(); i++)
{
QLCChannel* ch = mode->channel(i);
Q_ASSERT(ch != NULL);
QTreeWidgetItem* chitem = new QTreeWidgetItem(item);
chitem->setText(MODE_COL_NAME, ch->name());
chitem->setIcon(MODE_COL_NAME, ch->getIcon());
chitem->setText(MODE_COL_CHS, QString("%1").arg(i + 1));
chitem->setFlags(0); /* No selection etc. */
}
}
示例7: 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);
}
示例8: slotAddChannelClicked
void EditMode::slotAddChannelClicked()
{
QLCChannel* ch;
/* Create a list of channels that haven't been added to this mode yet */
QStringList chlist;
QListIterator <QLCChannel*> it(m_mode->fixtureDef()->channels());
while (it.hasNext() == true)
{
ch = it.next();
if (m_mode->channel(ch->name()) != NULL)
continue;
else
chlist << ch->name();
}
if (chlist.size() > 0)
{
bool ok = false;
QString name = QInputDialog::getItem(this,
tr("Add channel to mode"),
tr("Select a channel to add"),
chlist, 0, false, &ok);
if (ok == true && name.isEmpty() == false)
{
ch = m_mode->fixtureDef()->channel(name);
// Append the channel
m_mode->insertChannel(ch, m_mode->channels().size());
// Easier to refresh the whole list
refreshChannelList();
// Select the new channel
selectChannel(ch->name());
}
}
else
{
QMessageBox::information(this, tr("No more available channels"),
tr("All available channels are present in the mode."));
}
}
示例9: 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);
}
示例10: channel
QLCChannel* QLCFixtureMode::channel(const QString& name) const
{
QVectorIterator <QLCChannel*> it(m_channels);
while (it.hasNext() == true)
{
QLCChannel* ch = it.next();
Q_ASSERT(ch != NULL);
if (ch->name() == name)
return ch;
}
return NULL;
}
示例11: channel
QLCChannel* QLCFixtureDef::channel(const QString& name)
{
QListIterator <QLCChannel*> it(m_channels);
QLCChannel* ch = NULL;
while (it.hasNext() == true)
{
ch = it.next();
if (ch->name() == name)
return ch;
}
return NULL;
}
示例12: it
QLCFixtureMode& QLCFixtureMode::operator=(const QLCFixtureMode& mode)
{
if (this != &mode)
{
m_name = mode.m_name;
m_physical = mode.m_physical;
m_heads = mode.m_heads;
/* Clear the existing list of channels */
m_channels.clear();
Q_ASSERT(m_fixtureDef != NULL);
quint32 i = 0;
QVectorIterator <QLCChannel*> it(mode.m_channels);
while (it.hasNext() == true)
{
/* Since m_fixtureDef might not be the same as
mode.m_fixtureDef, we need to search for a
channel with the same name from m_fixtureDef and
not from mode.m_fixtureDef. If the channel in the
other mode is deleted, the one in this copied mode
will be invalid and we end up in a crash. */
QLCChannel* ch = it.next();
QLCChannel* actual = m_fixtureDef->channel(ch->name());
if (actual != NULL)
insertChannel(actual, i++);
else
qWarning() << Q_FUNC_INFO << "Unable to find channel"
<< ch->name() << "for mode"
<< m_name << "from its fixture definition";
}
}
return *this;
}
示例13: loadWrongRoot
void QLCChannel_Test::loadWrongRoot()
{
QBuffer buffer;
buffer.open(QIODevice::WriteOnly | QIODevice::Text);
QXmlStreamWriter xmlWriter(&buffer);
xmlWriter.writeStartElement("Chanel");
xmlWriter.writeAttribute("Name", "Channel1");
xmlWriter.writeStartElement("Group");
xmlWriter.writeAttribute("Byte", "1");
xmlWriter.writeCharacters("Tilt");
xmlWriter.writeEndElement();
xmlWriter.writeStartElement("Capability");
xmlWriter.writeAttribute("Min", "0");
xmlWriter.writeAttribute("Max", "10");
xmlWriter.writeCharacters("Cap1");
xmlWriter.writeEndElement();
/* Overlaps with cap1, shouldn't appear in the channel */
xmlWriter.writeStartElement("Capability");
xmlWriter.writeAttribute("Min", "5");
xmlWriter.writeAttribute("Max", "15");
xmlWriter.writeCharacters("Cap2");
xmlWriter.writeEndElement();
xmlWriter.writeStartElement("Capability");
xmlWriter.writeAttribute("Min", "11");
xmlWriter.writeAttribute("Max", "20");
xmlWriter.writeCharacters("Cap3");
xmlWriter.writeEndElement();
xmlWriter.writeEndDocument();
xmlWriter.setDevice(NULL);
buffer.close();
buffer.open(QIODevice::ReadOnly | QIODevice::Text);
QXmlStreamReader xmlReader(&buffer);
xmlReader.readNextStartElement();
QLCChannel ch;
QVERIFY(ch.loadXML(xmlReader) == false);
QVERIFY(ch.name().isEmpty());
QVERIFY(ch.group() == QLCChannel::Intensity);
QVERIFY(ch.controlByte() == QLCChannel::MSB);
QVERIFY(ch.capabilities().size() == 0);
}
示例14: 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
}
示例15: loadWrongRoot
void QLCChannel_Test::loadWrongRoot()
{
QDomDocument doc;
QDomElement root = doc.createElement("Chanel");
root.setAttribute("Name", "Channel1");
doc.appendChild(root);
QDomElement group = doc.createElement("Group");
root.appendChild(group);
group.setAttribute("Byte", 1);
QDomText groupName = doc.createTextNode("Tilt");
group.appendChild(groupName);
QDomElement cap1 = doc.createElement("Capability");
root.appendChild(cap1);
cap1.setAttribute("Min", 0);
cap1.setAttribute("Max", 10);
QDomText cap1name = doc.createTextNode("Cap1");
cap1.appendChild(cap1name);
/* Overlaps with cap1, shouldn't appear in the channel */
QDomElement cap2 = doc.createElement("Capability");
root.appendChild(cap2);
cap2.setAttribute("Min", 5);
cap2.setAttribute("Max", 15);
QDomText cap2name = doc.createTextNode("Cap2");
cap2.appendChild(cap2name);
QDomElement cap3 = doc.createElement("Capability");
root.appendChild(cap3);
cap3.setAttribute("Min", 11);
cap3.setAttribute("Max", 20);
QDomText cap3name = doc.createTextNode("Cap3");
cap3.appendChild(cap3name);
QLCChannel ch;
QVERIFY(ch.loadXML(&root) == false);
QVERIFY(ch.name().isEmpty());
QVERIFY(ch.group() == QLCChannel::Intensity);
QVERIFY(ch.controlByte() == QLCChannel::MSB);
QVERIFY(ch.capabilities().size() == 0);
}