Skip to content

Commit

Permalink
showmanager: don't freeze on infinite duration chasers/sequences (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed May 26, 2024
1 parent ff16fdc commit c18e9e5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
2 changes: 2 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ qlcplus (4.13.1) stable; urgency=low
* engine: include relative EFX in blackout
* engine: fix RGB Matrix clone control mode
* Show Manager: improve resume after pause
* Show Manager: don't freeze on infinite duration Chasers/Sequences
* Virtual Console: fix OSC feedback regression
* Virtual Console/Slider: add an optional button to flash in playback mode
* Virtual Console/XY Pad: copy presets when cloning (thanks to Hans-Jürgen Tappe)
* Plugins/DMX USB: restore Vince DMX512 output (thanks to Jérôme Lebleu)
* Plugins/HID: add merger mode for DMX devices (thanks to qfulmina)
* Plugins/HID: improve devices naming (thanks to qfulmina)
* Web Access: added getWidgetSubIdList API and Animation widget sub-control example (API test page updated)
* New fixtures: beamZ BAC500 and BAC506 (thanks to Olivier Michel)
* New fixtures: American DJ Par Z4, beamZ SB400, OXO ColorBeam 7 FCW IR, Pro-Lights Pixie Spot (thanks to Dmitry Kolesnikov)
Expand Down
30 changes: 21 additions & 9 deletions ui/src/showmanager/sequenceitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,28 @@ SequenceItem::SequenceItem(Chaser *seq, ShowFunction *func)
void SequenceItem::calculateWidth()
{
int newWidth = 0;
unsigned long seq_duration = m_chaser->totalDuration();
quint32 seq_duration = m_chaser->totalDuration();
float timeUnit = 50.0 / float(getTimeScale());

if (seq_duration != 0)
newWidth = ((50/(float)getTimeScale()) * (float)seq_duration) / 1000;
if (seq_duration == Function::infiniteSpeed())
{
newWidth = timeUnit * 10000;
}
else
{
if (seq_duration != 0)
newWidth = (timeUnit * float(seq_duration)) / 1000.0;

if (newWidth < (50 / m_timeScale))
newWidth = 50 / m_timeScale;
if (newWidth < timeUnit)
newWidth = timeUnit;
}
setWidth(newWidth);
}

void SequenceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
float xpos = 0;
float timeScale = 50/(float)m_timeScale;
float timeUnit = 50.0 / float(m_timeScale);
int stepIdx = 0;

ShowItem::paint(painter, option, widget);
Expand All @@ -82,18 +90,22 @@ void SequenceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
if (m_chaser->durationMode() == Chaser::Common)
stepDuration = m_chaser->duration();

// avoid hanging on infinite duration
if (stepDuration == Function::infiniteSpeed())
stepDuration = 10 * 1000 * 1000;

// draw fade in line
if (stepFadeIn > 0)
{
int fadeXpos = xpos + ((timeScale * (float)stepFadeIn) / 1000);
int fadeXpos = xpos + ((timeUnit * (float)stepFadeIn) / 1000);
// doesn't even draw it if too small
if (fadeXpos - xpos > 5)
{
painter->setPen(QPen(Qt::gray, 1));
painter->drawLine(xpos, TRACK_HEIGHT - 4, fadeXpos, 1);
}
}
float stepWidth = ((timeScale * (float)stepDuration) / 1000);
float stepWidth = ((timeUnit * (float)stepDuration) / 1000);
// draw selected step
if (stepIdx == m_selectedStep)
{
Expand All @@ -110,7 +122,7 @@ void SequenceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
// draw fade out line
if (stepFadeOut > 0)
{
int fadeXpos = xpos + ((timeScale * (float)stepFadeOut) / 1000);
int fadeXpos = xpos + ((timeUnit * (float)stepFadeOut) / 1000);
// doesn't even draw it if too small
if (fadeXpos - xpos > 5)
{
Expand Down

0 comments on commit c18e9e5

Please sign in to comment.