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

mcallegari / qlcplus / 19144422256

06 Nov 2025 05:33PM UTC coverage: 34.256% (-0.1%) from 34.358%
19144422256

push

github

mcallegari
Back to 5.1.0 debug

17718 of 51723 relevant lines covered (34.26%)

19528.23 hits per line

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

81.01
/engine/src/chaser.cpp
1
/*
2
  Q Light Controller Plus
3
  chaser.cpp
4

5
  Copyright (c) Heikki Junnila
6
                Massimo Callegari
7

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

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

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

21
#include <QXmlStreamReader>
22
#include <QXmlStreamWriter>
23
#include <QCoreApplication>
24
#include <QDebug>
25
#include <QColor>
26
#include <QFile>
27

28
#include "chaserrunner.h"
29
#include "mastertimer.h"
30
#include "chaserstep.h"
31
#include "function.h"
32
#include "chaser.h"
33
#include "doc.h"
34
#include "bus.h"
35

36
#define KXMLQLCChaserSpeedModeCommon  QStringLiteral("Common")
37
#define KXMLQLCChaserSpeedModePerStep QStringLiteral("PerStep")
38
#define KXMLQLCChaserSpeedModeDefault QStringLiteral("Default")
39

40
#define KXMLQLCChaserLegacySequence QStringLiteral("Sequence")
41

42
/*****************************************************************************
43
 * Initialization
44
 *****************************************************************************/
45

46
Chaser::Chaser(Doc *doc)
79✔
47
    : Function(doc, Function::ChaserType)
48
    , m_legacyHoldBus(Bus::invalid())
158✔
49
    , m_fadeInMode(Default)
79✔
50
    , m_fadeOutMode(Default)
79✔
51
    , m_holdMode(Common)
79✔
52
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
53
    , m_runnerMutex(QMutex::Recursive)
54
#endif
55
    , m_runner(NULL)
79✔
56
{
57
    setName(tr("New Chaser"));
79✔
58

59
    // Listen to member Function removals
60
    connect(doc, SIGNAL(functionRemoved(quint32)),
79✔
61
            this, SLOT(slotFunctionRemoved(quint32)));
62

63
    m_startupAction.m_action = ChaserNoAction;
79✔
64
    m_startupAction.m_masterIntensity = 1.0;
79✔
65
    m_startupAction.m_stepIntensity = 1.0;
79✔
66
    m_startupAction.m_fadeMode = FromFunction;
79✔
67
    m_startupAction.m_stepIndex = -1;
79✔
68
}
79✔
69

70
Chaser::~Chaser()
131✔
71
{
72
}
131✔
73

74
QIcon Chaser::getIcon() const
×
75
{
76
    return QIcon(":/chaser.png");
×
77
}
78

79
/*****************************************************************************
80
 * Copying
81
 *****************************************************************************/
82

83
Function* Chaser::createCopy(Doc* doc, bool addToDoc)
1✔
84
{
85
    Q_ASSERT(doc != NULL);
1✔
86

87
    Function* copy = new Chaser(doc);
1✔
88
    if (copy->copyFrom(this) == false)
1✔
89
    {
90
        delete copy;
×
91
        copy = NULL;
×
92
    }
93
    if (addToDoc == true && doc->addFunction(copy) == false)
1✔
94
    {
95
        delete copy;
×
96
        copy = NULL;
×
97
    }
98

99
    return copy;
1✔
100
}
101

102
bool Chaser::copyFrom(const Function* function)
4✔
103
{
104
    const Chaser *chaser = qobject_cast<const Chaser*> (function);
4✔
105
    if (chaser == NULL)
4✔
106
        return false;
1✔
107

108
    // Copy chaser stuff
109
    m_steps = chaser->m_steps;
3✔
110
    m_fadeInMode = chaser->m_fadeInMode;
3✔
111
    m_fadeOutMode = chaser->m_fadeOutMode;
3✔
112
    m_holdMode = chaser->m_holdMode;
3✔
113

114
    // Copy common function stuff
115
    return Function::copyFrom(function);
3✔
116
}
117

118
/*****************************************************************************
119
 * Contents
120
 *****************************************************************************/
121

122
bool Chaser::addStep(const ChaserStep& step, int index)
177✔
123
{
124
    if (step.fid != this->id())
177✔
125
    {
126
        {
127
            QMutexLocker stepListLocker(&m_stepListMutex);
176✔
128
            if (index < 0)
176✔
129
                m_steps.append(step);
174✔
130
            else if (index <= m_steps.size())
2✔
131
                m_steps.insert(index, step);
2✔
132
        }
176✔
133

134
        emit changed(this->id());
176✔
135
        emit stepsListChanged(this->id());
176✔
136
        return true;
176✔
137
    }
138
    else
139
    {
140
        return false;
1✔
141
    }
142
}
143

144
bool Chaser::removeStep(int index)
4✔
145
{
146
    if (index >= 0 && index < m_steps.size())
4✔
147
    {
148
        {
149
            QMutexLocker stepListLocker(&m_stepListMutex);
3✔
150
            m_steps.removeAt(index);
3✔
151
        }
3✔
152

153
        emit changed(this->id());
3✔
154
        emit stepsListChanged(this->id());
3✔
155
        return true;
3✔
156
    }
157
    else
158
    {
159
        return false;
1✔
160
    }
161
}
162

163
bool Chaser::replaceStep(const ChaserStep& step, int index)
14✔
164
{
165
    if (index >= 0 && index < m_steps.size())
14✔
166
    {
167
        {
168
            QMutexLocker stepListLocker(&m_stepListMutex);
13✔
169
            m_steps[index] = step;
13✔
170
        }
13✔
171

172
        emit changed(this->id());
13✔
173
        emit stepChanged(index);
13✔
174
        return true;
13✔
175
    }
176
    else
177
    {
178
        return false;
1✔
179
    }
180
}
181

182
bool Chaser::moveStep(int sourceIdx, int destIdx)
2✔
183
{
184
    if (sourceIdx < 0 || sourceIdx >= m_steps.size())
2✔
185
        return false;
1✔
186
    if (destIdx < 0 || destIdx >= m_steps.size() || destIdx == sourceIdx)
1✔
187
        return false;
×
188

189
    {
190
        QMutexLocker stepListLocker(&m_stepListMutex);
1✔
191
        ChaserStep cs = m_steps[sourceIdx];
1✔
192
        m_steps.removeAt(sourceIdx);
1✔
193
        m_steps.insert(destIdx, cs);
1✔
194
    }
1✔
195

196
    emit changed(this->id());
1✔
197

198
    return true;
1✔
199
}
200

201
int Chaser::stepsCount() const
860✔
202
{
203
    return m_steps.count();
860✔
204
}
205

206
ChaserStep *Chaser::stepAt(int idx)
29✔
207
{
208
    if (idx >= 0 && idx < m_steps.count())
29✔
209
        return &(m_steps[idx]);
28✔
210

211
    return NULL;
1✔
212
}
213

214
QList <ChaserStep> Chaser::steps() const
247✔
215
{
216
    return m_steps;
247✔
217
}
218

219
void Chaser::setTotalDuration(quint32 msec)
×
220
{
221
    if (durationMode() == Chaser::Common)
×
222
    {
223
        int stepsCount = m_steps.count();
×
224
        if (stepsCount == 0)
×
225
            stepsCount = 1;
×
226
        setDuration(msec / stepsCount);
×
227
    }
228
    else
229
    {
230
        // scale all the Chaser steps to resize
231
        // to the desired duration
232
        double dtDuration = (double)totalDuration();
×
233
        for (int i = 0; i < m_steps.count(); i++)
×
234
        {
235
            uint origDuration = m_steps[i].duration;
×
236
            m_steps[i].duration = ((double)m_steps[i].duration * msec) / dtDuration;
×
237
            if (m_steps[i].hold)
×
238
                m_steps[i].hold = ((double)m_steps[i].hold * (double)m_steps[i].duration) / (double)origDuration;
×
239
            m_steps[i].fadeIn = m_steps[i].duration - m_steps[i].hold;
×
240
            if (m_steps[i].fadeOut)
×
241
                m_steps[i].fadeOut = ((double)m_steps[i].fadeOut * (double)m_steps[i].duration) / (double)origDuration;
×
242
        }
243
    }
244
    emit changed(this->id());
×
245
}
×
246

247
quint32 Chaser::totalDuration()
×
248
{
249
    quint32 totalDuration = 0;
×
250

251
    if (durationMode() == Chaser::Common)
×
252
        totalDuration = duration() * m_steps.count();
×
253
    else
254
    {
255
        foreach (ChaserStep step, m_steps)
×
256
            totalDuration += step.duration;
×
257
    }
258

259
    return totalDuration;
×
260
}
261

262
void Chaser::slotFunctionRemoved(quint32 fid)
774✔
263
{
264
    int count;
265
    {
266
        QMutexLocker stepListLocker(&m_stepListMutex);
774✔
267
        count = m_steps.removeAll(ChaserStep(fid));
774✔
268
    }
774✔
269

270
    if (count > 0)
774✔
271
        emit changed(this->id());
141✔
272
}
774✔
273

274
/*****************************************************************************
275
 * Speed modes
276
 *****************************************************************************/
277

278
void Chaser::setFadeInMode(Chaser::SpeedMode mode)
17✔
279
{
280
    m_fadeInMode = mode;
17✔
281
    emit changed(this->id());
17✔
282
}
17✔
283

284
Chaser::SpeedMode Chaser::fadeInMode() const
180✔
285
{
286
    return m_fadeInMode;
180✔
287
}
288

289
void Chaser::setFadeOutMode(Chaser::SpeedMode mode)
17✔
290
{
291
    m_fadeOutMode = mode;
17✔
292
    emit changed(this->id());
17✔
293
}
17✔
294

295
Chaser::SpeedMode Chaser::fadeOutMode() const
214✔
296
{
297
    return m_fadeOutMode;
214✔
298
}
299

300
void Chaser::setDurationMode(Chaser::SpeedMode mode)
17✔
301
{
302
    m_holdMode = mode;
17✔
303
    emit changed(this->id());
17✔
304
}
17✔
305

306
Chaser::SpeedMode Chaser::durationMode() const
190✔
307
{
308
    return m_holdMode;
190✔
309
}
310

311
QString Chaser::speedModeToString(Chaser::SpeedMode mode)
13✔
312
{
313
    if (mode == Common)
13✔
314
        return KXMLQLCChaserSpeedModeCommon;
4✔
315
    else if (mode == PerStep)
9✔
316
        return KXMLQLCChaserSpeedModePerStep;
2✔
317
    else
318
        return KXMLQLCChaserSpeedModeDefault;
7✔
319
}
320

321
Chaser::SpeedMode Chaser::stringToSpeedMode(const QString& str)
13✔
322
{
323
    if (str == KXMLQLCChaserSpeedModeCommon)
13✔
324
        return Common;
4✔
325
    else if (str == KXMLQLCChaserSpeedModePerStep)
9✔
326
        return PerStep;
4✔
327
    else
328
        return Default;
5✔
329
}
330

331
/*****************************************************************************
332
 * Save & Load
333
 *****************************************************************************/
334

335
bool Chaser::saveXML(QXmlStreamWriter *doc)
2✔
336
{
337
    Q_ASSERT(doc != NULL);
2✔
338

339
    /* Function tag */
340
    doc->writeStartElement(KXMLQLCFunction);
4✔
341

342
    /* Common attributes */
343
    saveXMLCommon(doc);
2✔
344

345
    /* Save Tempo type */
346
    saveXMLTempoType(doc);
2✔
347

348
    /* Speed */
349
    saveXMLSpeed(doc);
2✔
350

351
    /* Direction */
352
    saveXMLDirection(doc);
2✔
353

354
    /* Run order */
355
    saveXMLRunOrder(doc);
2✔
356

357
    /* Speed modes */
358
    doc->writeStartElement(KXMLQLCChaserSpeedModes);
4✔
359
    doc->writeAttribute(KXMLQLCFunctionSpeedFadeIn, speedModeToString(fadeInMode()));
4✔
360
    doc->writeAttribute(KXMLQLCFunctionSpeedFadeOut, speedModeToString(fadeOutMode()));
4✔
361
    doc->writeAttribute(KXMLQLCFunctionSpeedDuration, speedModeToString(durationMode()));
4✔
362
    doc->writeEndElement();
2✔
363

364
    /* Steps */
365
    for (int i = 0; i < m_steps.count(); i++)
6✔
366
        m_steps.at(i).saveXML(doc, i, false);
4✔
367

368
    /* End the <Function> tag */
369
    doc->writeEndElement();
2✔
370

371
    return true;
2✔
372
}
373

374
bool Chaser::loadXMLSpeedModes(QXmlStreamReader &root)
3✔
375
{
376
    QXmlStreamAttributes attrs = root.attributes();
3✔
377
    QString str;
3✔
378

379
    str = attrs.value(KXMLQLCFunctionSpeedFadeIn).toString();
3✔
380
    setFadeInMode(stringToSpeedMode(str));
3✔
381

382
    str = attrs.value(KXMLQLCFunctionSpeedFadeOut).toString();
3✔
383
    setFadeOutMode(stringToSpeedMode(str));
3✔
384

385
    str = attrs.value(KXMLQLCFunctionSpeedDuration).toString();
3✔
386
    setDurationMode(stringToSpeedMode(str));
3✔
387
    root.skipCurrentElement();
3✔
388

389
    return true;
3✔
390
}
3✔
391

392
bool Chaser::loadXML(QXmlStreamReader &root)
6✔
393
{
394
    if (root.name() != KXMLQLCFunction)
6✔
395
    {
396
        qWarning() << Q_FUNC_INFO << "Function node not found";
1✔
397
        return false;
1✔
398
    }
399

400
    if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::ChaserType))
10✔
401
    {
402
        qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString()
3✔
403
                   << "is not a Chaser";
1✔
404
        return false;
1✔
405
    }
406

407
    /* Load chaser contents */
408
    while (root.readNextStartElement())
38✔
409
    {
410
        if (root.name() == KXMLQLCBus)
34✔
411
        {
412
            m_legacyHoldBus = root.readElementText().toUInt();
3✔
413
        }
414
        else if (root.name() == KXMLQLCFunctionSpeed)
31✔
415
        {
416
            loadXMLSpeed(root);
1✔
417
        }
418
        else if (root.name() == KXMLQLCFunctionDirection)
30✔
419
        {
420
            loadXMLDirection(root);
4✔
421
        }
422
        else if (root.name() == KXMLQLCFunctionRunOrder)
26✔
423
        {
424
            loadXMLRunOrder(root);
4✔
425
        }
426
        else if (root.name() == KXMLQLCFunctionTempoType)
22✔
427
        {
428
            loadXMLTempoType(root);
×
429
        }
430
        else if (root.name() == KXMLQLCChaserSpeedModes)
22✔
431
        {
432
            loadXMLSpeedModes(root);
1✔
433
        }
434
        else if (root.name() == KXMLQLCFunctionStep)
21✔
435
        {
436
            //! @todo stepNumber is useless if the steps are in the wrong order
437
            ChaserStep step;
18✔
438
            int stepNumber = -1;
18✔
439

440
            if (step.loadXML(root, stepNumber, doc()) == true)
18✔
441
            {
442
                if (stepNumber >= m_steps.size())
18✔
443
                    m_steps.append(step);
15✔
444
                else
445
                    m_steps.insert(stepNumber, step);
3✔
446
            }
447
        }
18✔
448
        else if (root.name() == KXMLQLCChaserLegacySequence)
3✔
449
        {
450
            doc()->appendToErrorLog(QString("<b>Unsupported sequences found</b>. Please convert your project "
×
451
                                            "at <a href=http://www.qlcplus.org/sequence_migration.php>http://www.qlcplus.org/sequence_migration.php</a>"));
452
            root.skipCurrentElement();
×
453
        }
454
        else
455
        {
456
            qWarning() << Q_FUNC_INFO << "Unknown chaser tag:" << root.name();
3✔
457
            root.skipCurrentElement();
3✔
458
        }
459
    }
460

461
    return true;
4✔
462
}
463

464
void Chaser::postLoad()
2✔
465
{
466
    if (m_legacyHoldBus != Bus::invalid())
2✔
467
    {
468
        quint32 value = Bus::instance()->value(m_legacyHoldBus);
2✔
469
        setDuration((value / MasterTimer::frequency()) * 1000);
2✔
470
    }
471

472
    Doc *doc = this->doc();
2✔
473
    Q_ASSERT(doc != NULL);
2✔
474

475
    QMutableListIterator <ChaserStep> it(m_steps);
2✔
476
    while (it.hasNext() == true)
14✔
477
    {
478
        ChaserStep step(it.next());
12✔
479
        Function *function = doc->function(step.fid);
12✔
480

481
        if (function == NULL)
12✔
482
            it.remove();
4✔
483
        else if (function->contains(id())) // forbid self-containment
8✔
484
            it.remove();
×
485
    }
12✔
486
}
2✔
487

488
/*****************************************************************************
489
 * Next/Previous
490
 * Protected ChaserRunner wrappers
491
 *****************************************************************************/
492

493
void Chaser::tap()
2✔
494
{
495
    QMutexLocker runnerLocker(&m_runnerMutex);
2✔
496
    if (m_runner != NULL && durationMode() == Common)
2✔
497
        m_runner->tap();
2✔
498
}
2✔
499

500
void Chaser::setAction(ChaserAction &action)
20✔
501
{
502
    QMutexLocker runnerLocker(&m_runnerMutex);
20✔
503
    if (m_runner != NULL)
20✔
504
    {
505
        m_runner->setAction(action);
16✔
506
    }
507
    else
508
    {
509
        m_startupAction.m_action = action.m_action;
4✔
510
        m_startupAction.m_stepIndex = action.m_stepIndex;
4✔
511
        m_startupAction.m_masterIntensity = action.m_masterIntensity;
4✔
512
        m_startupAction.m_stepIntensity = action.m_stepIntensity;
4✔
513
        m_startupAction.m_fadeMode = action.m_fadeMode;
4✔
514
    }
515
}
20✔
516

517
int Chaser::currentStepIndex() const
2✔
518
{
519
    int ret = m_startupAction.m_stepIndex;
2✔
520
    {
521
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
522
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
523
#else
524
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
2✔
525
#endif
526
        if (m_runner != NULL)
2✔
527
            ret = m_runner->currentStepIndex();
2✔
528
    }
2✔
529
    return ret;
2✔
530
}
531

532
int Chaser::computeNextStep(int currentStepIndex) const
19✔
533
{
534
    int ret = m_startupAction.m_stepIndex;
19✔
535
    {
536
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
537
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
538
#else
539
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
19✔
540
#endif
541
        if (m_runner != NULL)
19✔
542
            ret = m_runner->computeNextStep(currentStepIndex);
19✔
543
    }
19✔
544
    return ret;
19✔
545
}
546

547
int Chaser::runningStepsNumber() const
×
548
{
549
    int ret = 0;
×
550
    {
551
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
552
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
553
#else
554
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
×
555
#endif
556
        if (m_runner != NULL)
×
557
            ret = m_runner->runningStepsNumber();
×
558
    }
×
559
    return ret;
×
560
}
561

562
ChaserRunnerStep Chaser::currentRunningStep() const
×
563
{
564
    ChaserRunnerStep ret;
565
    ret.m_function = NULL;
×
566

567
    {
568
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
569
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
570
#else
571
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
×
572
#endif
573
        if (m_runner != NULL)
×
574
        {
575
            ChaserRunnerStep *step = m_runner->currentRunningStep();
×
576
            if (step != NULL)
×
577
                ret = *step;
×
578
        }
579
    }
×
580
    return ret;
×
581
}
582

583
bool Chaser::contains(quint32 functionId)
6✔
584
{
585
    Doc *doc = this->doc();
6✔
586
    Q_ASSERT(doc != NULL);
6✔
587

588
    foreach (ChaserStep step, m_steps)
7✔
589
    {
590
        Function *function = doc->function(step.fid);
2✔
591
        // contains() can be called during init, function may be NULL
592
        if (function == NULL)
2✔
593
            continue;
×
594

595
        if (function->id() == functionId)
2✔
596
            return true;
1✔
597
        if (function->contains(functionId))
1✔
598
            return true;
×
599
    }
8✔
600

601
    return false;
5✔
602
}
603

604
QList<quint32> Chaser::components()
×
605
{
606
    QList<quint32> ids;
×
607

608
    foreach (ChaserStep step, m_steps)
×
609
        ids.append(step.fid);
×
610

611
    return ids;
×
612
}
×
613

614
/*****************************************************************************
615
 * Running
616
 *****************************************************************************/
617

618
void Chaser::createRunner(quint32 startTime)
11✔
619
{
620
    Q_ASSERT(m_runner == NULL);
11✔
621

622
    {
623
        QMutexLocker stepListLocker(&m_stepListMutex);
11✔
624
        m_runner = new ChaserRunner(doc(), this, startTime);
11✔
625
    }
11✔
626
    m_runner->moveToThread(QCoreApplication::instance()->thread());
11✔
627
    m_runner->setParent(this);
11✔
628
    m_runner->setAction(m_startupAction);
11✔
629
    m_startupAction.m_action = ChaserNoAction;
11✔
630
}
11✔
631

632
void Chaser::preRun(MasterTimer* timer)
11✔
633
{
634
    {
635
        QMutexLocker runnerLocker(&m_runnerMutex);
11✔
636
        createRunner(elapsed());
11✔
637
        connect(m_runner, SIGNAL(currentStepChanged(int)), this, SIGNAL(currentStepChanged(int)));
11✔
638
    }
11✔
639

640
    Function::preRun(timer);
11✔
641
}
11✔
642

643
void Chaser::setPause(bool enable)
2✔
644
{
645
    QMutexLocker runnerLocker(&m_runnerMutex);
2✔
646
    if (m_runner != NULL)
2✔
647
    {
648
        // request a change of pause state at the next write call
649
        m_startupAction.m_action = ChaserPauseRequest;
2✔
650
        // use fade mode to pass through enable/disable flag
651
        m_startupAction.m_fadeMode = enable ? 1 : 0;
2✔
652
    }
653
    Function::setPause(enable);
2✔
654
}
2✔
655

656
void Chaser::write(MasterTimer* timer, QList<Universe *> universes)
114✔
657
{
658
    if (isPaused() && m_startupAction.m_action != ChaserPauseRequest)
114✔
659
        return;
1✔
660

661
    if (m_startupAction.m_action == ChaserPauseRequest)
113✔
662
    {
663
        qDebug() << "[Chaser] Request PAUSE" << m_startupAction.m_fadeMode;
2✔
664
        m_runner->setAction(m_startupAction);
2✔
665
        m_startupAction.m_action = ChaserNoAction;
2✔
666
    }
667

668
    {
669
        QMutexLocker runnerLocker(&m_runnerMutex);
113✔
670
        QMutexLocker stepListLocker(&m_stepListMutex);
113✔
671
        Q_ASSERT(m_runner != NULL);
113✔
672

673
        if (m_runner->write(timer, universes) == false)
113✔
674
            stop(FunctionParent::master());
×
675
    }
113✔
676

677
    incrementElapsed();
113✔
678
}
679

680
void Chaser::postRun(MasterTimer* timer, QList<Universe *> universes)
4✔
681
{
682
    {
683
        QMutexLocker runnerLocker(&m_runnerMutex);
4✔
684
        Q_ASSERT(m_runner != NULL);
4✔
685

686
        if (isPaused())
4✔
687
            m_runner->setPause(false, universes);
×
688

689
        m_runner->postRun(timer, universes);
4✔
690

691
        delete m_runner;
4✔
692
        m_runner = NULL;
4✔
693
    }
4✔
694

695
    Function::postRun(timer, universes);
4✔
696
}
4✔
697

698
/*****************************************************************************
699
 * Intensity
700
 *****************************************************************************/
701

702
int Chaser::adjustAttribute(qreal fraction, int attributeId)
9✔
703
{
704
    int attrIndex = Function::adjustAttribute(fraction, attributeId);
9✔
705

706
    if (attrIndex == Intensity)
9✔
707
    {
708
        QMutexLocker runnerLocker(&m_runnerMutex);
9✔
709
        QMutexLocker stepListLocker(&m_stepListMutex);
9✔
710
        if (m_runner != NULL)
9✔
711
        {
712
            m_runner->adjustStepIntensity(getAttributeValue(Function::Intensity));
4✔
713
        }
714
        else
715
        {
716
            m_startupAction.m_masterIntensity = getAttributeValue(Function::Intensity);
5✔
717
        }
718
    }
9✔
719

720
    return attrIndex;
9✔
721
}
722

723
void Chaser::adjustStepIntensity(qreal fraction, int stepIndex, FadeControlMode fadeControl)
×
724
{
725
    QMutexLocker runnerLocker(&m_runnerMutex);
×
726
    if (m_runner != NULL)
×
727
    {
728
        m_runner->adjustStepIntensity(fraction, stepIndex, fadeControl);
×
729
    }
730
    else
731
    {
732
        m_startupAction.m_masterIntensity = getAttributeValue(Function::Intensity);
×
733
        m_startupAction.m_stepIntensity = fraction;
×
734
    }
735
}
×
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