Esempio n. 1
0
bool FloatLatch::initPopupMenu(QPopupMenu * popup)
{
	int i;
	
	Component::initPopupMenu(popup);
	
	popup->insertSeparator();
	i = popup->insertItem(i18n("&Add Channel"), this, SLOT(slotAddChannel()));
	if ((getInputPack()->getConnectorCount() >= MAX_CHANNELS)
	 || (getOutputPack()->getConnectorCount() >= MAX_CHANNELS))
	{
		popup->setItemEnabled(i, false);
	}
	
	
	i = popup->insertItem(i18n("&Delete Channel"), this, SLOT(slotDeleteChannel()));
	if ((getInputPack()->getConnectorCount() <= MIN_CHANNELS)
	 || (getInputPack()->getNumberOfDeletableConnectors() == 0)
	 || (getOutputPack()->getConnectorCount() <= MIN_CHANNELS)
	 || (getOutputPack()->getNumberOfDeletableConnectors() == 0))
	{
		popup->setItemEnabled(i, false);
	}
	
	return true;
}
Esempio n. 2
0
int QLCFixtureEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotManufacturerTextEdited((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: slotModelTextEdited((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 2: slotTypeActivated((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: slotChannelListSelectionChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
        case 4: slotAddChannel(); break;
        case 5: slotRemoveChannel(); break;
        case 6: slotEditChannel(); break;
        case 7: slotCopyChannel(); break;
        case 8: slotPasteChannel(); break;
        case 9: slotExpandChannels(); break;
        case 10: slotChannelListContextMenuRequested(); break;
        case 11: slotModeListSelectionChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break;
        case 12: slotAddMode(); break;
        case 13: slotRemoveMode(); break;
        case 14: slotEditMode(); break;
        case 15: slotCloneMode(); break;
        case 16: slotExpandModes(); break;
        case 17: slotModeListContextMenuRequested(); break;
        case 18: slotClipboardChanged(); break;
        default: ;
        }
        _id -= 19;
    }
    return _id;
}
Esempio n. 3
0
DesktopAccessDlg::DesktopAccessDlg(QWidget* parent)
: QDialog(parent, QT_DEFAULT_DIALOG_HINTS)
{
    ui.setupUi(this);
    setWindowIcon(QIcon(APPICON));

    connect(ui.delBtn, SIGNAL(clicked()),
            SLOT(slotDelEntry()));
    connect(ui.clearBtn, SIGNAL(clicked()),
            SLOT(slotClearEntry()));
    connect(ui.addBtn, SIGNAL(clicked()),
            SLOT(slotAddEntry()));

    connect(ui.addchanBtn, SIGNAL(clicked()),
            SLOT(slotAddChannel()));
    connect(ui.delchanBtn, SIGNAL(clicked()),
            SLOT(slotDelChannel()));
    connect(ui.adduserBtn, SIGNAL(clicked()),
            SLOT(slotAddUsername()));
    connect(ui.deluserBtn, SIGNAL(clicked()),
            SLOT(slotDelUsername()));

    connect(ui.listView, SIGNAL(clicked(const QModelIndex&)),
            SLOT(slotServerSelected(const QModelIndex&)));

    m_model = new DesktopAccessModel(this);

    QVector<DesktopAccessEntry> entries;
    getDesktopAccessList(entries);
    ui.listView->setModel(m_model);
    m_model->setEntries(entries);

    HostEntry host;
    if(getLatestHost(0, host))
    {
        int i;
        for(i=0;i<m_model->getEntries().size();i++)
        {
            if(m_model->getEntries()[i].ipaddr == host.ipaddr &&
               m_model->getEntries()[i].tcpport == host.tcpport)
            {
                QModelIndex index = m_model->index(i, 0);
                ui.listView->setCurrentIndex(index);
                slotServerSelected(index);
                break;
            }
        }
        if(i>=m_model->getEntries().size())
        {
            ui.hostaddrEdit->setText(host.ipaddr);
            ui.tcpportSpinBox->setValue(host.tcpport);
        }
    }
}
Esempio n. 4
0
AddChannelsDialog::AddChannelsDialog(QList<QLCChannel *> allList, QList<QLCChannel *> modeList, QWidget *parent) :
    QDialog(parent)
  , m_channelsList(allList)
{
    setupUi(this);

    m_allTree->setIconSize(QSize(32, 32));
    m_modeTree->setIconSize(QSize(32, 32));

    m_allTree->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_allTree->setDragEnabled(true);
    m_allTree->setDragDropMode(QAbstractItemView::InternalMove);
    m_modeTree->setAcceptDrops(true);
    m_modeTree->setDropIndicatorShown(true);
    m_modeTree->setSelectionMode(QAbstractItemView::ExtendedSelection);

    connect(m_addChannel, SIGNAL(clicked()),
            this, SLOT(slotAddChannel()));
    connect(m_removeChannel, SIGNAL(clicked()),
            this, SLOT(slotRemoveChannel()));

    fillChannelsTrees(m_channelsList, modeList);
}
Esempio n. 5
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. 6
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();
}