void MonitorGraphicsView::updateFixture(quint32 id) { Fixture *fxi = m_doc->fixture(id); if (fxi == NULL || m_fixtures.contains(id) == false) return; const QLCFixtureMode *mode = fxi->fixtureMode(); int width = 0; int height = 0; if (mode != 0) { width = mode->physical().width(); height = mode->physical().height(); } if (width == 0) width = 300; if (height == 0) height = 300; MonitorFixtureItem *item = m_fixtures[id]; item->setSize(QSize((width * m_cellPixels) / m_unitValue, (height * m_cellPixels) / m_unitValue)); item->setPos(realPositionToPixels(item->realPosition().x(), item->realPosition().y())); }
void MonitorGraphicsView::updateFixture(quint32 id) { Fixture *fxi = m_doc->fixture(id); if (fxi == NULL || m_fixtures.contains(id) == false) return; const QLCFixtureMode *mode = fxi->fixtureMode(); int width = 0; int height = 0; if (mode != 0) { width = mode->physical().width(); height = mode->physical().height(); } if (fxi->isDimmer()) { width = fxi->heads() * 200; height = 200; } else { if (width == 0) width = 300; if (height == 0) height = 300; } MonitorFixtureItem *item = m_fixtures[id]; item->setSize(QSize((width * m_cellPixels) / m_unitValue, (height * m_cellPixels) / m_unitValue)); qreal realX = m_xOffset + ((item->realPosition().x() * m_cellPixels) / m_unitValue); qreal realY = m_yOffset + ((item->realPosition().y() * m_cellPixels) / m_unitValue); item->setPos(realX, realY); }
quint32 MonitorGraphicsView::selectedFixtureID() { MonitorFixtureItem *item = getSelectedItem(); if (item != NULL) return item->fixtureID(); else return Fixture::invalidId(); }
QColor MonitorGraphicsView::fixtureGelColor(quint32 id) { MonitorFixtureItem *item = m_fixtures[id]; if (item == NULL) return QColor(); return item->getColor(); }
MonitorFixtureItem *MonitorGraphicsView::getSelectedItem() { QHashIterator <quint32, MonitorFixtureItem*> it(m_fixtures); while (it.hasNext() == true) { it.next(); MonitorFixtureItem *item = it.value(); if (item->isSelected() == true) return item; } return NULL; }
void MonitorGraphicsView::addFixture(quint32 id, QPointF pos) { if (id == Fixture::invalidId() || m_fixtures.contains(id) == true) return; MonitorFixtureItem *item = new MonitorFixtureItem(m_doc, id); item->setZValue(1); item->setRealPosition(pos); m_fixtures[id] = item; m_scene->addItem(item); updateFixture(id); connect(item, SIGNAL(itemDropped(MonitorFixtureItem*)), this, SLOT(slotFixtureMoved(MonitorFixtureItem*))); }
void MonitorGraphicsView::writeUniverse(int index, const QByteArray &ua) { QHashIterator <quint32, MonitorFixtureItem*> it(m_fixtures); while (it.hasNext() == true) { it.next(); quint32 fid = it.key(); Fixture *fxi = m_doc->fixture(fid); // preliminary validity checks if (fxi == NULL || fxi->universe() != (quint32)index || fxi->address() > (quint32)ua.size()) { continue; } MonitorFixtureItem *item = it.value(); item->updateValues(ua); } }
void MonitorGraphicsView::removeFixture(quint32 id) { MonitorFixtureItem *item = NULL; if (id == Fixture::invalidId()) { item = getSelectedItem(); if (item != NULL) id = item->fixtureID(); } else item = m_fixtures[id]; if (item == NULL) return; m_scene->removeItem(item); m_fixtures.take(id); delete item; }
bool MonitorGraphicsView::removeFixture(quint32 id) { MonitorFixtureItem *item = NULL; if (id == Fixture::invalidId()) { item = getSelectedItem(); if (item != NULL) id = item->fixtureID(); } else item = m_fixtures[id]; if (item == NULL) return false; m_scene->removeItem(item); m_fixtures.take(id); m_doc->monitorProperties()->removeFixture(id); delete item; return true; }
void MonitorGraphicsView::setFixtureRotation(quint32 id, ushort degrees) { MonitorFixtureItem *item = m_fixtures[id]; if (item != NULL) item->setRotation(degrees); }
void MonitorGraphicsView::setFixtureGelColor(quint32 id, QColor col) { MonitorFixtureItem *item = m_fixtures[id]; if (item != NULL) item->setGelColor(col); }