示例#1
0
void ConfigureMIDIOut::slotEditClicked()
{
	QTreeWidgetItem* item;
	MIDIDevice* device;

	item = m_list->currentItem();
	if (item == NULL)
		return;

	device = m_plugin->device(item->text(KColumnNumber).toInt() - 1);
	if (device == NULL)
		return;

	ConfigureMIDIDevice cmd(this, device);
	if (cmd.exec() == QDialog::Accepted)
	{
		/* Update the tree item */
		item->setText(KColumnMIDIChannel,
			      QString("%1").arg(device->midiChannel() + 1));
		item->setText(KColumnMode,
			      MIDIDevice::modeToString(device->mode()));

		/* Save as global settings */
		device->saveSettings();
	}
}
示例#2
0
void ConfigureMIDIOut::refreshList()
{
	QTreeWidgetItem* item;
	MIDIDevice* dev;
	int i = 1;

	m_list->clear();

	QListIterator <MIDIDevice*> it(m_plugin->m_devices);
	while (it.hasNext() == true)
	{
		dev = it.next();

		item = new QTreeWidgetItem(m_list);
		item->setText(KColumnNumber, QString("%1").arg(i++));
		item->setText(KColumnName, dev->name());
		item->setText(KColumnMIDIChannel,
			      QString("%1").arg(dev->midiChannel() + 1));
		item->setText(KColumnMode,
			      MIDIDevice::modeToString(dev->mode()));
	}
}