当前位置: 首页>>代码示例>>C++>>正文


C++ QLCChannel类代码示例

本文整理汇总了C++中QLCChannel的典型用法代码示例。如果您正苦于以下问题:C++ QLCChannel类的具体用法?C++ QLCChannel怎么用?C++ QLCChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QLCChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QLCChannel

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();
    }
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:30,代码来源:fixtureeditor.cpp

示例2: currentChannel

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();
    }
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:29,代码来源:fixtureeditor.cpp

示例3: it

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());
}
开发者ID:speakman,项目名称:qlc,代码行数:25,代码来源:fixtureeditor.cpp

示例4: Q_ASSERT

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. */
    }
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:32,代码来源:fixtureeditor.cpp

示例5: editAction

void QLCFixtureEditor::slotChannelListContextMenuRequested()
{
    QAction editAction(QIcon(":/edit.png"), tr("Edit"), this);
    QAction copyAction(QIcon(":/editcopy.png"), tr("Copy"), this);
    QAction pasteAction(QIcon(":/editpaste.png"), tr("Paste"), this);
    QAction removeAction(QIcon(":/editdelete.png"), tr("Remove"), this);

    /* Group menu */
    QMenu groupMenu;
    groupMenu.setTitle("Set group");
    QStringListIterator it(QLCChannel::groupList());
    while (it.hasNext() == true)
        groupMenu.addAction(it.next());

    /* Master edit menu */
    QMenu menu;
    menu.setTitle(tr("Channels"));
    menu.addAction(&editAction);
    menu.addAction(&copyAction);
    menu.addAction(&pasteAction);
    menu.addSeparator();
    menu.addAction(&removeAction);
    menu.addSeparator();
    menu.addMenu(&groupMenu);

    if (m_channelList->currentItem() == NULL)
    {
        copyAction.setEnabled(false);
        removeAction.setEnabled(false);
    }

    if (_app->copyChannel() == NULL)
        pasteAction.setEnabled(false);

    QAction* selectedAction = menu.exec(QCursor::pos());
    if (selectedAction == NULL)
        return;
    else if (selectedAction->text() == tr("Edit"))
        slotEditChannel();
    else if (selectedAction->text() == tr("Copy"))
        slotCopyChannel();
    else if (selectedAction->text() == tr("Paste"))
        slotPasteChannel();
    else if (selectedAction->text() == tr("Remove"))
        slotRemoveChannel();
    else
    {
        /* Group menu hook */
        QLCChannel* ch = NULL;
        QTreeWidgetItem* node = NULL;

        ch = currentChannel();
        if (ch != NULL)
            ch->setGroup(QLCChannel::stringToGroup(selectedAction->text()));
        node = m_channelList->currentItem();
        if (node != NULL)
            node->setText(CH_COL_GRP, selectedAction->text());
        setModified();
    }
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:60,代码来源:fixtureeditor.cpp

示例6: QLCChannel

void QLCChannel_Test::defaultValue()
{
    QLCChannel* channel = new QLCChannel();
    QVERIFY(channel->defaultValue() == 0);

    channel->setDefaultValue(137);
    QVERIFY(channel->defaultValue() == 137);
}
开发者ID:jeromelebleu,项目名称:qlcplus,代码行数:8,代码来源:qlcchannel_test.cpp

示例7: connect

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);
}
开发者ID:speakman,项目名称:qlc,代码行数:57,代码来源:fixturelist.cpp

示例8: QLCChannel

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;
}
开发者ID:alexpaulzor,项目名称:qlc,代码行数:11,代码来源:qlcchannel_test.cpp

示例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);
}
开发者ID:speakman,项目名称:qlc,代码行数:52,代码来源:fixturelist.cpp

示例10: it

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;
}
开发者ID:PML369,项目名称:qlcplus,代码行数:13,代码来源:qlcfixturemode.cpp

示例11: QCOMPARE

void QLCChannel_Test::controlByte()
{
    QCOMPARE(int(QLCChannel::MSB), 0);
    QCOMPARE(int(QLCChannel::LSB), 1);

    QLCChannel* channel = new QLCChannel();
    QVERIFY(channel->controlByte() == QLCChannel::MSB);

    channel->setControlByte(QLCChannel::LSB);
    QVERIFY(channel->controlByte() == QLCChannel::LSB);

    delete channel;
}
开发者ID:alexpaulzor,项目名称:qlc,代码行数:13,代码来源:qlcchannel_test.cpp

示例12: it

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;
}
开发者ID:PML369,项目名称:qlcplus,代码行数:14,代码来源:qlcfixturedef.cpp

示例13: it

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());
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:48,代码来源:editmode.cpp

示例14: Q_ASSERT

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
}
开发者ID:speakman,项目名称:qlc,代码行数:46,代码来源:fixturemanager.cpp

示例15: it

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."));
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:44,代码来源:editmode.cpp


注:本文中的QLCChannel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。