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); } }
void QLCFixtureEditor::slotPasteChannel() { QLCChannel* ch = _app->copyChannel(); if (ch != NULL && m_fixtureDef != NULL) { m_fixtureDef->addChannel(new QLCChannel(ch)); refreshChannelList(); setModified(); } }
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()); } }
void EditMode::init() { /* Channels page */ connect(m_addChannelButton, SIGNAL(clicked()), this, SLOT(slotAddChannelClicked())); connect(m_removeChannelButton, SIGNAL(clicked()), this, SLOT(slotRemoveChannelClicked())); connect(m_raiseChannelButton, SIGNAL(clicked()), this, SLOT(slotRaiseChannelClicked())); connect(m_lowerChannelButton, SIGNAL(clicked()), this, SLOT(slotLowerChannelClicked())); m_modeNameEdit->setText(m_mode->name()); m_modeNameEdit->setValidator(CAPS_VALIDATOR(this)); refreshChannelList(); /* Heads page */ connect(m_addHeadButton, SIGNAL(clicked()), this, SLOT(slotAddHeadClicked())); connect(m_removeHeadButton, SIGNAL(clicked()), this, SLOT(slotRemoveHeadClicked())); connect(m_editHeadButton, SIGNAL(clicked()), this, SLOT(slotEditHeadClicked())); connect(m_raiseHeadButton, SIGNAL(clicked()), this, SLOT(slotRaiseHeadClicked())); connect(m_lowerHeadButton, SIGNAL(clicked()), this, SLOT(slotLowerHeadClicked())); refreshHeadList(); /* Physical page */ m_phyEdit = new EditPhysical(m_mode->physical(), this); m_phyEdit->show(); physicalLayout->addWidget(m_phyEdit); if (m_mode->useGlobalPhysical() == false) m_overridePhyCheck->setChecked(true); slotPhysicalModeChanged(); connect(m_globalPhyCheck, SIGNAL(clicked(bool)), this, SLOT(slotPhysicalModeChanged())); connect(m_overridePhyCheck, SIGNAL(clicked(bool)), this, SLOT(slotPhysicalModeChanged())); /* Forward copy/paste requests up to reach the main FixtureEditor clipboard */ connect(m_phyEdit, SIGNAL(copyToClipboard(QLCPhysical)), this, SIGNAL(copyToClipboard(QLCPhysical))); connect(m_phyEdit, SIGNAL(requestPasteFromClipboard()), this, SIGNAL(requestPasteFromClipboard())); // Close shortcut QAction* action = new QAction(this); action->setShortcut(QKeySequence(QKeySequence::Close)); connect(action, SIGNAL(triggered(bool)), this, SLOT(reject())); addAction(action); // Geometry QSettings settings; QVariant var = settings.value(KSettingsGeometry); if (var.isValid() == true) restoreGeometry(var.toByteArray()); }
void EditMode::slotAddChannelClicked() { AddChannelsDialog ach(m_mode->fixtureDef()->channels(), m_mode->channels()); if (ach.exec() != QDialog::Accepted) return; QList <QLCChannel *> newChannelList = ach.getModeChannelsList(); // clear the previous list m_mode->removeAllChannels(); // Append the channels foreach(QLCChannel *ch, newChannelList) m_mode->insertChannel(ch, m_mode->channels().size()); // Easier to refresh the whole list refreshChannelList(); }
void QLCFixtureEditor::slotAddChannel() { EditChannel ec(this); bool ok = false; while (ok == false) { if (ec.exec() == QDialog::Accepted) { if (m_fixtureDef->channel(ec.channel()->name()) != NULL) { QMessageBox::warning(this, QString("Channel already exists"), QString("A channel by the name \"") + ec.channel()->name() + QString("\" already exists!")); ok = false; } else if (ec.channel()->name().length() == 0) { QMessageBox::warning(this, QString("Channel has no name"), QString("You must give the channel a descriptive name!")); ok = false; } else { /* Create a new channel to the fixture */ m_fixtureDef->addChannel( new QLCChannel(ec.channel())); refreshChannelList(); setModified(); ok = true; } } else { ok = true; } } }
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.")); } }
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 EditMode::init() { QString str; QLCPhysical physical = m_mode->physical(); /* Channel buttons */ m_addChannelButton->setIconSet(QPixmap(QString(PIXMAPS) + QString("/edit_add.png"))); m_removeChannelButton->setIconSet(QPixmap(QString(PIXMAPS) + QString("/edit_remove.png"))); m_raiseChannelButton->setIconSet(QPixmap(QString(PIXMAPS) + QString("/up.png"))); m_lowerChannelButton->setIconSet(QPixmap(QString(PIXMAPS) + QString("/down.png"))); /* Mode name */ m_modeNameEdit->setText(m_mode->name()); /* Channels */ refreshChannelList(); /* Physical properties */ m_bulbTypeCombo->setCurrentText(physical.bulbType()); m_bulbLumensSpin->setValue(physical.bulbLumens()); str.sprintf("%d", physical.bulbColourTemperature()); m_bulbTempCombo->setCurrentText(str); m_weightSpin->setValue(physical.weight()); m_widthSpin->setValue(physical.width()); m_heightSpin->setValue(physical.height()); m_depthSpin->setValue(physical.depth()); m_lensNameCombo->setCurrentText(physical.lensName()); m_lensMinDegreesSpin->setValue(physical.lensDegreesMin()); m_lensMaxDegreesSpin->setValue(physical.lensDegreesMax()); m_focusTypeCombo->setCurrentText(physical.focusType()); m_panMaxSpin->setValue(physical.focusPanMax()); m_tiltMaxSpin->setValue(physical.focusTiltMax()); }
void EditMode::init() { QString str; QLCPhysical physical = m_mode->physical(); /* Channels page */ connect(m_addChannelButton, SIGNAL(clicked()), this, SLOT(slotAddChannelClicked())); connect(m_removeChannelButton, SIGNAL(clicked()), this, SLOT(slotRemoveChannelClicked())); connect(m_raiseChannelButton, SIGNAL(clicked()), this, SLOT(slotRaiseChannelClicked())); connect(m_lowerChannelButton, SIGNAL(clicked()), this, SLOT(slotLowerChannelClicked())); m_modeNameEdit->setText(m_mode->name()); m_channelList->header()->setResizeMode(QHeaderView::ResizeToContents); refreshChannelList(); /* Physical page */ m_bulbTypeCombo->setEditText(physical.bulbType()); m_bulbLumensSpin->setValue(physical.bulbLumens()); m_bulbTempCombo->setEditText(str.setNum(physical.bulbColourTemperature())); m_weightSpin->setValue(physical.weight()); m_widthSpin->setValue(physical.width()); m_heightSpin->setValue(physical.height()); m_depthSpin->setValue(physical.depth()); m_lensNameCombo->setEditText(physical.lensName()); m_lensDegreesMinSpin->setValue(physical.lensDegreesMin()); m_lensDegreesMaxSpin->setValue(physical.lensDegreesMax()); m_focusTypeCombo->setEditText(physical.focusType()); m_panMaxSpin->setValue(physical.focusPanMax()); m_tiltMaxSpin->setValue(physical.focusTiltMax()); m_powerConsumptionSpin->setValue(physical.powerConsumption()); m_dmxConnectorCombo->setEditText(physical.dmxConnector()); }
void QLCFixtureEditor::init() { /* General page */ m_manufacturerEdit->setText(m_fixtureDef->manufacturer()); m_manufacturerEdit->setValidator(CAPS_VALIDATOR(this)); connect(m_manufacturerEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotManufacturerTextEdited(const QString&))); m_modelEdit->setText(m_fixtureDef->model()); m_modelEdit->setValidator(CAPS_VALIDATOR(this)); connect(m_modelEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotModelTextEdited(const QString&))); m_typeCombo->setCurrentIndex(m_typeCombo->findText(m_fixtureDef->type())); connect(m_typeCombo, SIGNAL(activated(const QString&)), this, SLOT(slotTypeActivated(const QString&))); // Display author name or suggest current user name if there isn't one. // When the def already has an author, disable the field to prevent modification. m_authorEdit->setText(m_fixtureDef->author()); if (m_authorEdit->text().length() > 0) { // Temporarily allow editing author name since most definitions contain wrong name: // m_authorEdit->setEnabled(false); } else { m_authorEdit->setText(QLCFile::currentUserName()); } connect(m_authorEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotAuthorTextEdited(const QString&))); /* Channel page */ connect(m_addChannelButton, SIGNAL(clicked()), this, SLOT(slotAddChannel())); connect(m_removeChannelButton, SIGNAL(clicked()), this, SLOT(slotRemoveChannel())); connect(m_editChannelButton, SIGNAL(clicked()), this, SLOT(slotEditChannel())); connect(m_copyChannelButton, SIGNAL(clicked()), this, SLOT(slotCopyChannel())); connect(m_pasteChannelButton, SIGNAL(clicked()), this, SLOT(slotPasteChannel())); connect(m_expandChannelsButton, SIGNAL(clicked()), this, SLOT(slotExpandChannels())); connect(m_channelList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(slotChannelListSelectionChanged(QTreeWidgetItem*))); connect(m_channelList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotChannelListContextMenuRequested())); connect(m_channelList, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotEditChannel())); connect(m_channelList, SIGNAL(expanded(QModelIndex)), this, SLOT(slotChannelItemExpanded())); m_channelList->setContextMenuPolicy(Qt::CustomContextMenu); m_channelList->setIconSize(QSize(24, 24)); refreshChannelList(); /* Mode page */ connect(m_addModeButton, SIGNAL(clicked()), this, SLOT(slotAddMode())); connect(m_removeModeButton, SIGNAL(clicked()), this, SLOT(slotRemoveMode())); connect(m_editModeButton, SIGNAL(clicked()), this, SLOT(slotEditMode())); connect(m_cloneModeButton, SIGNAL(clicked()), this, SLOT(slotCloneMode())); connect(m_expandModesButton, SIGNAL(clicked()), this, SLOT(slotExpandModes())); connect(m_modeList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(slotModeListSelectionChanged(QTreeWidgetItem*))); connect(m_modeList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotModeListContextMenuRequested())); connect(m_modeList, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotEditMode())); connect(m_modeList, SIGNAL(expanded(QModelIndex)), this, SLOT(slotModeItemExpanded())); m_modeList->setContextMenuPolicy(Qt::CustomContextMenu); refreshModeList(); }
void QLCFixtureEditor::init() { /* General page */ m_manufacturerEdit->setText(m_fixtureDef->manufacturer()); connect(m_manufacturerEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotManufacturerTextEdited(const QString&))); m_modelEdit->setText(m_fixtureDef->model()); connect(m_modelEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotModelTextEdited(const QString&))); m_typeCombo->setCurrentIndex( m_typeCombo->findText(m_fixtureDef->type())); connect(m_typeCombo, SIGNAL(activated(const QString&)), this, SLOT(slotTypeActivated(const QString&))); /* Channel page */ m_addChannelButton->setIcon(QIcon(":/edit_add.png")); connect(m_addChannelButton, SIGNAL(clicked()), this, SLOT(slotAddChannel())); m_removeChannelButton->setIcon(QIcon(":/edit_remove.png")); connect(m_removeChannelButton, SIGNAL(clicked()), this, SLOT(slotRemoveChannel())); m_editChannelButton->setIcon(QIcon(":/edit.png")); connect(m_editChannelButton, SIGNAL(clicked()), this, SLOT(slotEditChannel())); connect(m_channelList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(slotChannelListSelectionChanged(QTreeWidgetItem*))); connect(m_channelList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotChannelListContextMenuRequested(const QPoint&))); connect(m_channelList, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotEditChannel())); m_channelList->header()->setResizeMode(QHeaderView::ResizeToContents); refreshChannelList(); /* Mode page */ m_addModeButton->setIcon(QIcon(":/edit_add.png")); connect(m_addModeButton, SIGNAL(clicked()), this, SLOT(slotAddMode())); m_removeModeButton->setIcon(QIcon(":/edit_remove.png")); connect(m_removeModeButton, SIGNAL(clicked()), this, SLOT(slotRemoveMode())); m_editModeButton->setIcon(QIcon(":/edit.png")); connect(m_editModeButton, SIGNAL(clicked()), this, SLOT(slotEditMode())); connect(m_modeList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(slotModeListSelectionChanged(QTreeWidgetItem*))); connect(m_modeList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotModeListContextMenuRequested(const QPoint&))); connect(m_modeList, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotEditMode())); m_modeList->header()->setResizeMode(QHeaderView::ResizeToContents); refreshModeList(); }