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(); } }
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(©Action); 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(); } }
void EditMode::slotRemoveChannelClicked() { QLCChannel* ch = currentChannel(); if (ch != NULL) { QListViewItem* item = NULL; QString select; // Pick the item above or below to be selected next item = m_channelList->currentItem()->itemAbove(); if (item == NULL) item = m_channelList->currentItem()->itemBelow(); if (item != NULL) select = item->text(KChannelsColumnName); // Remove the channel and the listview item m_mode->removeChannel(ch); delete m_channelList->currentItem(); // Easier to refresh the whole list than to decrement all // channel numbers after the inserted item refreshChannelList(); // Select another channel selectChannel(select); } }
unsigned int DocInfo::currentChannelColumn_pos() const { unsigned int c = currentChannelColumn(); for (unsigned int i = 0; i < currentChannel(); i++) { c += patternColumns(i); } return c; }
float SSTimeSeriesView::currentValue() { if (!d->m_data) return 0; int ch0=currentChannel(); if (ch0>=0) { return d->m_data->value(ch0,(int)currentX()); } else return 0; }
void EditMode::slotLowerChannelClicked() { QLCChannel* ch = currentChannel(); int index = 0; if (ch == NULL) return; index = m_mode->channelNumber(ch) + 1; // Don't move beyond the end of the list if (index >= m_mode->channels()) return; m_mode->removeChannel(ch); m_mode->insertChannel(ch, index); refreshChannelList(); selectChannel(ch->name()); }
void QLCFixtureEditor::slotEditChannel() { QLCChannel* real = NULL; QTreeWidgetItem* item = NULL; // Initialize the dialog with the selected logical channel or // bail out if there is no current selection real = currentChannel(); if (real == NULL) return; EditChannel ec(this, real); if (ec.exec() == QDialog::Accepted) { if (m_fixtureDef->channel(ec.channel()->name()) != NULL && ec.channel()->name() != real->name()) { QMessageBox::warning(this, tr("Channel already exists"), tr("A channel by the name \"%1\" already exists!") .arg(ec.channel()->name())); } else if (ec.channel()->name().length() == 0) { QMessageBox::warning(this, tr("Channel has no name"), tr("You must give the channel a descriptive name!")); } else { // Copy the channel's contents to the real channel *real = *(ec.channel()); item = m_channelList->currentItem(); updateChannelItem(real, item); m_channelList->resizeColumnToContents(CH_COL_NAME); setModified(); } } }
void QLCFixtureEditor::slotEditChannel() { QLCChannel* real = NULL; QTreeWidgetItem* item = NULL; // Initialize the dialog with the selected logical channel or // bail out if there is no current selection real = currentChannel(); if (real == NULL) return; EditChannel ec(this, real); if (ec.exec() == QDialog::Accepted) { // Copy the channel's contents to the real channel *real = *(ec.channel()); item = m_channelList->currentItem(); item->setText(KChannelsColumnName, real->name()); item->setText(KChannelsColumnGroup, real->group()); setModified(); } }
void QLCFixtureEditor::slotCopyChannel() { _app->setCopyChannel(currentChannel()); }