From b14855e6507aeb5e1b08b5af7a132b53cb818c0c Mon Sep 17 00:00:00 2001 From: Massimo Callegari Date: Mon, 30 Dec 2024 11:00:48 +0100 Subject: [PATCH] ui/simpledesk: fix some more usage via web API (fix #1651)(close #1652) --- ui/src/simpledesk.cpp | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/ui/src/simpledesk.cpp b/ui/src/simpledesk.cpp index adf3c298c..d34db0ac0 100644 --- a/ui/src/simpledesk.cpp +++ b/ui/src/simpledesk.cpp @@ -388,7 +388,9 @@ int SimpleDesk::getCurrentPage() uchar SimpleDesk::getAbsoluteChannelValue(uint address) { if (m_engine->hasChannel(address)) + { return m_engine->value(address); + } else { QList ua = m_doc->inputOutputMap()->claimUniverses(); @@ -404,6 +406,9 @@ uchar SimpleDesk::getAbsoluteChannelValue(uint address) void SimpleDesk::setAbsoluteChannelValue(uint address, uchar value) { + if (address >= ((uint)m_doc->inputOutputMap()->universesCount() * 512)) + return; + m_engine->setValue(address, value); } @@ -411,13 +416,18 @@ void SimpleDesk::resetChannel(quint32 address) { m_engine->resetChannel(address); - quint32 start = (m_universePageSpin->value() - 1) * m_channelsPerPage; + quint32 start = (m_currentUniverse * 512) + (m_universePageSpin->value() - 1) * m_channelsPerPage; - if (m_viewModeButton->isChecked() == false && - address >= start && address < start + m_channelsPerPage) + if (m_viewModeButton->isChecked() == false) { + if (address < start || address >= start + m_channelsPerPage) + return; + Fixture *fxi = m_doc->fixture(m_doc->fixtureForAddress(address)); - ConsoleChannel *cc = m_universeSliders[address - start]; + ConsoleChannel *cc = m_universeSliders.value(address - start, NULL); + if (cc == NULL) + return; + if (fxi == NULL) { cc->setChannelStyleSheet(ssNone); @@ -430,6 +440,23 @@ void SimpleDesk::resetChannel(quint32 address) cc->setChannelStyleSheet(ssOdd); } } + else + { + Fixture *fxi = m_doc->fixture(m_doc->fixtureForAddress(address)); + if (fxi == NULL) + return; + + FixtureConsole *fc = m_consoleList.value(fxi->id(), NULL); + if (fc == NULL) + return; + + quint32 ch = address - fxi->universeAddress(); + + if (fxi->id() % 2 == 0) + fc->setChannelStylesheet(ch, ssOdd); + else + fc->setChannelStylesheet(ch, ssEven); + } } void SimpleDesk::resetUniverse() @@ -780,7 +807,9 @@ void SimpleDesk::slotUniverseResetClicked() m_engine->resetUniverse(m_currentUniverse); m_universePageSpin->setValue(1); if (m_viewModeButton->isChecked() == false) + { slotUniversePageChanged(1); + } else { QHashIterator it(m_consoleList); @@ -997,7 +1026,11 @@ void SimpleDesk::slotUniverseWritten(quint32 idx, const QByteArray& universeData break; if (m_engine->hasChannel((startAddr + c) + (idx << 9)) == true) + { + fc->setValue(c, universeData.at(startAddr + c), false); + fc->setChannelStylesheet(c, ssOverride); continue; + } fc->blockSignals(true); fc->setValue(c, universeData.at(startAddr + c), false);