int AddFixture::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: slotModeActivated((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 1: slotUniverseActivated((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: slotAddressChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: slotChannelsChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: slotSelectionChanged(); break; case 5: slotTreeDoubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; case 6: slotNameEdited((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 7: slotAmountSpinChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: slotGapSpinChanged((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 9; } return _id; }
AddFixture::AddFixture(QWidget* parent, const Doc* doc, const Fixture* fxi) : QDialog(parent) , m_doc(doc) { m_addressValue = 0; m_universeValue = 0; m_amountValue = 1; m_gapValue = 0; m_channelsValue = 1; m_fixtureDef = NULL; m_mode = NULL; m_fxiCount = 0; m_fixtureID = Fixture::invalidId(); m_invalidAddressFlag = false; setupUi(this); m_addrErrorLabel->hide(); QAction* action = new QAction(this); action->setShortcut(QKeySequence(QKeySequence::Close)); connect(action, SIGNAL(triggered(bool)), this, SLOT(reject())); addAction(action); connect(m_tree, SIGNAL(itemSelectionChanged()), this, SLOT(slotSelectionChanged())); connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slotTreeDoubleClicked(QTreeWidgetItem*))); connect(m_modeCombo, SIGNAL(activated(const QString&)), this, SLOT(slotModeActivated(const QString&))); connect(m_universeCombo, SIGNAL(activated(int)), this, SLOT(slotUniverseActivated(int))); connect(m_addressSpin, SIGNAL(valueChanged(int)), this, SLOT(slotAddressChanged(int))); connect(m_channelsSpin, SIGNAL(valueChanged(int)), this, SLOT(slotChannelsChanged(int))); connect(m_nameEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotNameEdited(const QString&))); connect(m_gapSpin, SIGNAL(valueChanged(int)), this, SLOT(slotGapSpinChanged(int))); connect(m_amountSpin, SIGNAL(valueChanged(int)), this, SLOT(slotAmountSpinChanged(int))); connect(m_searchEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSearchFilterChanged(QString))); connect(m_diptoolButton, SIGNAL(clicked()), this, SLOT(slotDiptoolButtonClicked())); /* Fill fixture definition tree (and select a fixture def) */ if (fxi != NULL) { fillTree(fxi->fixtureDef()->manufacturer(), fxi->fixtureDef()->model()); m_fixtureID = fxi->id(); } else fillTree(KXMLFixtureGeneric, KXMLFixtureGeneric); m_fixturesCount->setText(tr("Fixtures found: %1").arg(m_fxiCount)); /* Fill universe combo with available universes */ m_universeCombo->addItems(m_doc->inputOutputMap()->universeNames()); /* Simulate first selection and find the next free address */ slotSelectionChanged(); if (fxi != NULL) { // Universe m_universeCombo->setCurrentIndex(fxi->universe()); slotUniverseActivated(fxi->universe()); m_addressSpin->setValue(fxi->address() + 1); m_addressValue = fxi->address(); m_multipleGroup->setEnabled(false); // Name m_nameEdit->setText(fxi->name()); slotNameEdited(fxi->name()); m_nameEdit->setModified(true); // Prevent auto-naming // Mode int index = m_modeCombo->findText(fxi->fixtureMode()->name()); if (index != -1) { m_channelsSpin->setValue(fxi->channels()); m_modeCombo->setCurrentIndex(index); slotModeActivated(m_modeCombo->itemText(index)); } } else { slotUniverseActivated(0); findAddress(); m_channelsSpin->setValue(1); } QSettings settings; QVariant var = settings.value(SETTINGS_GEOMETRY); if (var.isValid() == true) restoreGeometry(var.toByteArray()); AppUtil::ensureWidgetIsVisible(this); }
AddFixture::AddFixture(QWidget* parent, const QLCFixtureDefCache& fixtureDefCache, const Doc& doc, const OutputMap& outputMap, const QString& selectManufacturer, const QString& selectModel, const QString& selectMode, const QString& selectName, int selectUniverse, int selectAddress, int selectChannels) : QDialog(parent), m_fixtureDefCache(fixtureDefCache), m_doc(doc), m_outputMap(outputMap) { m_addressValue = 0; m_universeValue = 0; m_amountValue = 1; m_gapValue = 0; m_channelsValue = 1; m_fixtureDef = NULL; m_mode = NULL; setupUi(this); m_tree->header()->setResizeMode(QHeaderView::ResizeToContents); connect(m_tree, SIGNAL(itemSelectionChanged()), this, SLOT(slotSelectionChanged())); connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slotTreeDoubleClicked(QTreeWidgetItem*))); connect(m_modeCombo, SIGNAL(activated(const QString&)), this, SLOT(slotModeActivated(const QString&))); connect(m_universeCombo, SIGNAL(activated(int)), this, SLOT(slotUniverseActivated(int))); connect(m_addressSpin, SIGNAL(valueChanged(int)), this, SLOT(slotAddressChanged(int))); connect(m_channelsSpin, SIGNAL(valueChanged(int)), this, SLOT(slotChannelsChanged(int))); connect(m_nameEdit, SIGNAL(textEdited(const QString&)), this, SLOT(slotNameEdited(const QString&))); connect(m_gapSpin, SIGNAL(valueChanged(int)), this, SLOT(slotGapSpinChanged(int))); connect(m_amountSpin, SIGNAL(valueChanged(int)), this, SLOT(slotAmountSpinChanged(int))); /* Fill fixture definition tree */ fillTree(selectManufacturer, selectModel); /* Fill universe combo with available universes */ m_universeCombo->addItems(m_outputMap.universeNames()); /* Simulate first selection and find the next free address */ slotSelectionChanged(); if (selectAddress == -1 && selectUniverse == -1) { slotUniverseActivated(0); findAddress(); } else { m_universeCombo->setCurrentIndex(selectUniverse); slotUniverseActivated(selectUniverse); if (m_outputMap.isDMXZeroBased(m_universeValue) == true) m_addressSpin->setValue(selectAddress); else m_addressSpin->setValue(selectAddress + 1); m_addressValue = selectAddress; m_multipleGroup->setEnabled(false); } if (selectName.isEmpty() == false) { m_nameEdit->setText(selectName); slotNameEdited(selectName); } if (selectMode.isEmpty() == false) { int index = m_modeCombo->findText(selectMode); if (index != -1) { m_modeCombo->setCurrentIndex(index); slotModeActivated(m_modeCombo->itemText(index)); } } else { m_channelsSpin->setValue(selectChannels); } QSettings settings; QVariant var = settings.value(SETTINGS_GEOMETRY); if (var.isValid() == true) restoreGeometry(var.toByteArray()); }