Esempio n. 1
0
void QLCFixtureEditor::slotCloneMode()
{
	QLCFixtureMode* mode = NULL;
	QLCFixtureMode* clone = NULL;
	bool ok = false;
	QString text;
	
	mode = currentMode();
	if (mode == NULL)
		return;
	
	while (1)
	{
		text = QInputDialog::getText(this, tr("Rename new mode"),
					     tr("Give a unique name for the mode"),
					     QLineEdit::Normal,
					     "Copy of " + mode->name(),
					     &ok);

		if (ok == true && text.isEmpty() == false)
		{
			/* User entered a name that is already found from
			   the fixture definition -> again */
			if (mode->fixtureDef()->mode(text) != NULL)
			{
				QMessageBox::information(
					this,
					tr("Invalid name"),
					tr("Another mode by that name already exists."));
				ok = false;
				continue;
			}

			clone = new QLCFixtureMode(mode);
			clone->setName(text);
			mode->fixtureDef()->addMode(clone);
			refreshModeList();
			break;
		}
		else
		{
			// User pressed cancel
			break;
		}
	}
}
Esempio n. 2
0
void QLCFixtureEditor::slotAddMode()
{
	EditMode em(_app, m_fixtureDef);
	bool ok = false;
	while (ok == false)
	{
		if (em.exec() == QDialog::Accepted)
		{
			if (m_fixtureDef->mode(em.mode()->name()) != NULL)
			{
				QMessageBox::warning(
					this, 
					tr("Unable to add mode"),
					tr("Another mode by that name already exists"));
				
				// User must rename the mode to continue
				ok = false;
			}
			else if (em.mode()->name().length() == 0)
			{
				QMessageBox::warning(
					this, 
					tr("Unable to add mode"),
					tr("You must give a name to the mode"));
				
				ok = false;
			}
			else
			{
				ok = true;
				m_fixtureDef->addMode(
					new QLCFixtureMode(em.mode()));
				refreshModeList();
				setModified();
			}
		}
		else
		{
			ok = true;
		}
	}
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
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();
}