Skip to content

Commit

Permalink
ui: make use of shutter presets
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed May 4, 2018
1 parent 391d2f5 commit ef48ade
Showing 1 changed file with 38 additions and 25 deletions.
63 changes: 38 additions & 25 deletions ui/src/monitor/monitorfixtureitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,41 +170,54 @@ MonitorFixtureItem::MonitorFixtureItem(Doc *doc, quint32 fid)
continue;

bool containsShutter = false;
for (quint32 i = 0; i < 256; ++i)

switch (ch->preset())
{
QLCCapability *cap = ch->searchCapability(i);
if (cap != NULL)
case QLCChannel::ShutterStrobeFastSlow:
case QLCChannel::ShutterStrobeSlowFast:
{
// not "off" occurences are ok, but anything better would require manual classification
if (cap->name().contains("close", Qt::CaseInsensitive)
|| cap->name().contains("blackout", Qt::CaseInsensitive)
|| cap->name().contains("off", Qt::CaseInsensitive))
{
values << FixtureHead::Closed;
containsShutter = true;
}
else if (cap->name().contains("strob", Qt::CaseInsensitive)
|| cap->name().contains("pulse", Qt::CaseInsensitive))
{
// handle case when the channel has only one capability 0-255 strobe:
// make 0 Open to avoid blinking
values << FixtureHead::Open;
for (i = 1; i < 255; i++)
values << FixtureHead::Strobe;
containsShutter = true;
}
else
values << FixtureHead::Open;
containsShutter = true;
}
else
break;
case QLCChannel::Custom:
{
values << FixtureHead::Open;
foreach (QLCCapability *cap, ch->capabilities())
{
for (int i = cap->min(); i < cap->max(); i++)
{
switch (cap->preset())
{
case QLCCapability::Custom:
values << FixtureHead::Open;
break;
case QLCCapability::ShutterOpen:
values << FixtureHead::Open;
containsShutter = true;
break;
case QLCCapability::ShutterClose:
values << FixtureHead::Closed;
containsShutter = true;
break;
default:
values << FixtureHead::Strobe;
containsShutter = true;
break;
}
}
}
}
break;
default:
break;
}

if (containsShutter)
{
// handle case when the channel has only one capability 0-255 strobe:
// make 0 Open to avoid blinking
if (ch->capabilities().size() <= 1)
values[0] = FixtureHead::Open;

fxiItem->m_shutterValues[shutter] = values;
fxiItem->m_shutterChannels << shutter;
}
Expand Down

0 comments on commit ef48ade

Please sign in to comment.