Skip to content

Commit

Permalink
ui/simpledesk: fix some more usage via web API (fix #1651)(close #1652)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed Dec 30, 2024
1 parent 370437d commit b14855e
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions ui/src/simpledesk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ int SimpleDesk::getCurrentPage()
uchar SimpleDesk::getAbsoluteChannelValue(uint address)
{
if (m_engine->hasChannel(address))
{
return m_engine->value(address);
}
else
{
QList<Universe*> ua = m_doc->inputOutputMap()->claimUniverses();
Expand All @@ -404,20 +406,28 @@ 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);
}

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);
Expand All @@ -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()
Expand Down Expand Up @@ -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 <quint32,FixtureConsole*> it(m_consoleList);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b14855e

Please sign in to comment.