• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mcallegari / qlcplus / 26064181639

18 May 2026 10:29PM UTC coverage: 35.004% (-0.03%) from 35.037%
26064181639

Pull #2025

github

web-flow
Merge 108f14ffe into 2aa9da5af
Pull Request #2025: Fix Show Manager edge cases around timing and previews

0 of 70 new or added lines in 6 files covered. (0.0%)

6 existing lines in 1 file now uncovered.

18293 of 52259 relevant lines covered (35.0%)

41120.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/ui/src/showmanager/efxitem.cpp
1
/*
2
  Q Light Controller Plus
3
  efxitem.cpp
4

5
  Copyright (C) Massimo Callegari
6

7
  Licensed under the Apache License, Version 2.0 (the "License");
8
  you may not use this file except in compliance with the License.
9
  You may obtain a copy of the License at
10

11
      http://www.apache.org/licenses/LICENSE-2.0.txt
12

13
  Unless required by applicable law or agreed to in writing, software
14
  distributed under the License is distributed on an "AS IS" BASIS,
15
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
  See the License for the specific language governing permissions and
17
  limitations under the License.
18
*/
19

20
#include <QApplication>
21
#include <QPainter>
22
#include <qmath.h>
23
#include <QDebug>
24
#include <QMenu>
25
#include <qmath.h>
26

27
#include "efxitem.h"
28
#include "trackitem.h"
29

30
EFXItem::EFXItem(EFX *efx, ShowFunction *func)
×
31
    : ShowItem(func)
32
    , m_efx(efx)
×
33
{
34
    Q_ASSERT(efx != NULL);
×
35

36
    if (func->color().isValid())
×
37
        setColor(func->color());
×
38
    else
39
        setColor(ShowFunction::defaultColor(Function::EFXType));
×
40

41
    calculateWidth();
×
42
    connect(m_efx, SIGNAL(changed(quint32)), this, SLOT(slotEFXChanged(quint32)));
×
43
}
×
44

45
void EFXItem::calculateWidth()
×
46
{
47
    int newWidth = 0;
×
48
    qint64 efxDuration = getDuration();
×
49
    float timeUnit = 50.0 / float(getTimeScale());
×
50

51
    if (efxDuration == 0)
×
52
    {
53
        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;
×
66

67
    setWidth(newWidth);
×
68
}
×
69

70
void EFXItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
×
71
{
72
    Q_UNUSED(option);
73
    Q_UNUSED(widget);
74

75
    float xpos = 0;
×
76
    float timeUnit = 50.0 / float(getTimeScale());
×
77

78
    ShowItem::paint(painter, option, widget);
×
79

80
    int loopCount = 0;
×
NEW
81
    quint32 loopDuration = m_efx->totalDuration();
×
NEW
82
    if (loopDuration > 0)
×
83
    {
NEW
84
        if (getDuration() == Function::infiniteSpeed())
×
NEW
85
            loopCount = 10000 / loopDuration;
×
NEW
86
        else if (getDuration() > 0)
×
NEW
87
            loopCount = qFloor(getDuration() / loopDuration);
×
88
    }
89

90
    for (int i = 0; i < loopCount; i++)
×
91
    {
NEW
92
        xpos += ((timeUnit * float(loopDuration)) / 1000);
×
93
        // draw loop vertical delimiter
94
        painter->setPen(QPen(Qt::white, 1));
×
95
        painter->drawLine(int(xpos), 1, int(xpos), TRACK_HEIGHT - 5);
×
96
    }
97

98
    ShowItem::postPaint(painter);
×
99
}
×
100

101
void EFXItem::setTimeScale(int val)
×
102
{
103
    ShowItem::setTimeScale(val);
×
104
    calculateWidth();
×
105
}
×
106

107
void EFXItem::setDuration(quint32 msec, bool stretch)
×
108
{
109
    if (stretch == true)
×
110
    {
111
        m_efx->setDuration(msec);
×
112
    }
113
    else
114
    {
115
        if (m_function)
×
116
            m_function->setDuration(msec);
×
117
        prepareGeometryChange();
×
118
        calculateWidth();
×
119
        updateTooltip();
×
120
    }
121
}
×
122

123
quint32 EFXItem::getDuration() const
×
124
{
125
    return m_function->duration() ? m_function->duration() : m_efx->duration();
×
126
}
127

128
QString EFXItem::functionName() const
×
129
{
130
    if (m_efx)
×
131
        return m_efx->name();
×
132
    return QString();
×
133
}
134

135
EFX *EFXItem::getEFX() const
×
136
{
137
    return m_efx;
×
138
}
139

140
void EFXItem::slotEFXChanged(quint32)
×
141
{
142
    prepareGeometryChange();
×
143
    calculateWidth();
×
144
    updateTooltip();
×
145
}
×
146

147
void EFXItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
×
148
{
149
    QMenu menu;
×
150
    QFont menuFont = qApp->font();
×
151
    menuFont.setPixelSize(14);
×
152
    menu.setFont(menuFont);
×
153

154
    foreach (QAction *action, getDefaultActions())
×
155
        menu.addAction(action);
×
156

157
    menu.exec(QCursor::pos());
×
158
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc