Skip to content

Commit 0eeeede

Browse files
committed
ui/showmanager: fix hanging with an infinite duration EFX (fix mcallegari#1678)
1 parent 3f8bf32 commit 0eeeede

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

debian/changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
qlcplus (4.14.1) stable; urgency=low
22

3+
* Show Manager: fix hanging with an infinite duration EFX
34
* New fixture: beamZ MHL75 Hybrid Moving Head (thanks to Mikko Wuokko)
45
* New fixtures: Eurolite LED TSL-1000 Scan MK2, Varytec LED Theater Spot 100 (thanks to Christoph Wieser)
56

ui/src/showmanager/efxitem.cpp

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,24 @@ void EFXItem::calculateWidth()
4646
{
4747
int newWidth = 0;
4848
qint64 efxDuration = getDuration();
49+
float timeUnit = 50.0 / float(getTimeScale());
4950

50-
if (efxDuration != 0)
51-
newWidth = ((50.0 / float(getTimeScale())) * float(efxDuration)) / 1000.0;
52-
else
51+
if (efxDuration == 0)
52+
{
5353
newWidth = 100;
54+
}
55+
else if (efxDuration == Function::infiniteSpeed())
56+
{
57+
newWidth = timeUnit * 10000;
58+
}
59+
else
60+
{
61+
newWidth = (timeUnit * float(efxDuration)) / 1000.0;
62+
}
63+
64+
if (newWidth < timeUnit)
65+
newWidth = timeUnit;
5466

55-
if (newWidth < (50 / m_timeScale))
56-
newWidth = 50 / m_timeScale;
5767
setWidth(newWidth);
5868
}
5969

@@ -63,14 +73,19 @@ void EFXItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
6373
Q_UNUSED(widget);
6474

6575
float xpos = 0;
66-
float timeScale = 50 / float(m_timeScale);
76+
float timeUnit = 50.0 / float(getTimeScale());
6777

6878
ShowItem::paint(painter, option, widget);
6979

70-
int loopCount = m_function->duration() ? qFloor(m_function->duration() / m_efx->duration()) : 0;
80+
int loopCount = 0;
81+
if (getDuration() == Function::infiniteSpeed())
82+
loopCount = 10000 / m_efx->duration();
83+
else if (getDuration() > 0)
84+
loopCount = qFloor(getDuration() / m_efx->duration());
85+
7186
for (int i = 0; i < loopCount; i++)
7287
{
73-
xpos += ((timeScale * float(m_efx->duration())) / 1000);
88+
xpos += ((timeUnit * float(m_efx->duration())) / 1000);
7489
// draw loop vertical delimiter
7590
painter->setPen(QPen(Qt::white, 1));
7691
painter->drawLine(int(xpos), 1, int(xpos), TRACK_HEIGHT - 5);

0 commit comments

Comments
 (0)