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

mcallegari / qlcplus / 9022369978

09 May 2024 07:16PM UTC coverage: 31.498% (-0.6%) from 32.068%
9022369978

push

github

mcallegari
coverage: exclude enttecwing from coverage

15000 of 47622 relevant lines covered (31.5%)

16841.64 hits per line

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

80.36
/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 "Common"
37
#define KXMLQLCChaserSpeedModePerStep "PerStep"
38
#define KXMLQLCChaserSpeedModeDefault "Default"
39

40
#define KXMLQLCChaserLegacySequence QString("Sequence")
41

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

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

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

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

70
Chaser::~Chaser()
127✔
71
{
72
}
127✔
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)
175✔
123
{
124
    if (step.fid != this->id())
175✔
125
    {
126
        {
127
            QMutexLocker stepListLocker(&m_stepListMutex);
348✔
128
            if (index < 0)
174✔
129
                m_steps.append(step);
172✔
130
            else if (index <= m_steps.size())
2✔
131
                m_steps.insert(index, step);
2✔
132
        }
133

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

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

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

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

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

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

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

194
    emit changed(this->id());
1✔
195

196
    return true;
1✔
197
}
198

199
int Chaser::stepsCount() const
819✔
200
{
201
    return m_steps.count();
819✔
202
}
203

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

209
    return NULL;
1✔
210
}
211

212
QList <ChaserStep> Chaser::steps() const
244✔
213
{
214
    return m_steps;
244✔
215
}
216

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

245
quint32 Chaser::totalDuration()
×
246
{
247
    quint32 totalDuration = 0;
×
248

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

257
    return totalDuration;
×
258
}
259

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

268
    if (count > 0)
772✔
269
        emit changed(this->id());
141✔
270
}
772✔
271

272
/*****************************************************************************
273
 * Speed modes
274
 *****************************************************************************/
275

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

282
Chaser::SpeedMode Chaser::fadeInMode() const
177✔
283
{
284
    return m_fadeInMode;
177✔
285
}
286

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

293
Chaser::SpeedMode Chaser::fadeOutMode() const
210✔
294
{
295
    return m_fadeOutMode;
210✔
296
}
297

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

304
Chaser::SpeedMode Chaser::durationMode() const
187✔
305
{
306
    return m_holdMode;
187✔
307
}
308

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

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

329
/*****************************************************************************
330
 * Save & Load
331
 *****************************************************************************/
332

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

337
    /* Function tag */
338
    doc->writeStartElement(KXMLQLCFunction);
2✔
339

340
    /* Common attributes */
341
    saveXMLCommon(doc);
2✔
342

343
    /* Speed */
344
    saveXMLSpeed(doc);
2✔
345

346
    /* Direction */
347
    saveXMLDirection(doc);
2✔
348

349
    /* Run order */
350
    saveXMLRunOrder(doc);
2✔
351

352
    /* Speed modes */
353
    doc->writeStartElement(KXMLQLCChaserSpeedModes);
2✔
354
    doc->writeAttribute(KXMLQLCFunctionSpeedFadeIn, speedModeToString(fadeInMode()));
2✔
355
    doc->writeAttribute(KXMLQLCFunctionSpeedFadeOut, speedModeToString(fadeOutMode()));
2✔
356
    doc->writeAttribute(KXMLQLCFunctionSpeedDuration, speedModeToString(durationMode()));
2✔
357
    doc->writeEndElement();
2✔
358

359
    /* Steps */
360
    for (int i = 0; i < m_steps.count(); i++)
6✔
361
        m_steps.at(i).saveXML(doc, i, false);
4✔
362

363
    /* End the <Function> tag */
364
    doc->writeEndElement();
2✔
365

366
    return true;
2✔
367
}
368

369
bool Chaser::loadXMLSpeedModes(QXmlStreamReader &root)
3✔
370
{
371
    QXmlStreamAttributes attrs = root.attributes();
6✔
372
    QString str;
×
373

374
    str = attrs.value(KXMLQLCFunctionSpeedFadeIn).toString();
3✔
375
    setFadeInMode(stringToSpeedMode(str));
3✔
376

377
    str = attrs.value(KXMLQLCFunctionSpeedFadeOut).toString();
3✔
378
    setFadeOutMode(stringToSpeedMode(str));
3✔
379

380
    str = attrs.value(KXMLQLCFunctionSpeedDuration).toString();
3✔
381
    setDurationMode(stringToSpeedMode(str));
3✔
382
    root.skipCurrentElement();
3✔
383

384
    return true;
6✔
385
}
386

387
bool Chaser::loadXML(QXmlStreamReader &root)
6✔
388
{
389
    if (root.name() != KXMLQLCFunction)
6✔
390
    {
391
        qWarning() << Q_FUNC_INFO << "Function node not found";
1✔
392
        return false;
1✔
393
    }
394

395
    if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::ChaserType))
5✔
396
    {
397
        qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString()
2✔
398
                   << "is not a Chaser";
1✔
399
        return false;
1✔
400
    }
401

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

431
            if (step.loadXML(root, stepNumber, doc()) == true)
18✔
432
            {
433
                if (stepNumber >= m_steps.size())
18✔
434
                    m_steps.append(step);
15✔
435
                else
436
                    m_steps.insert(stepNumber, step);
3✔
437
            }
438
        }
439
        else if (root.name() == KXMLQLCChaserLegacySequence)
3✔
440
        {
441
            doc()->appendToErrorLog(QString("<b>Unsupported sequences found</b>. Please convert your project "
×
442
                                            "at <a href=http://www.qlcplus.org/sequence_migration.php>http://www.qlcplus.org/sequence_migration.php</a>"));
443
            root.skipCurrentElement();
×
444
        }
445
        else
446
        {
447
            qWarning() << Q_FUNC_INFO << "Unknown chaser tag:" << root.name();
3✔
448
            root.skipCurrentElement();
3✔
449
        }
450
    }
451

452
    return true;
4✔
453
}
454

455
void Chaser::postLoad()
2✔
456
{
457
    if (m_legacyHoldBus != Bus::invalid())
2✔
458
    {
459
        quint32 value = Bus::instance()->value(m_legacyHoldBus);
2✔
460
        setDuration((value / MasterTimer::frequency()) * 1000);
2✔
461
    }
462

463
    Doc *doc = this->doc();
2✔
464
    Q_ASSERT(doc != NULL);
2✔
465

466
    QMutableListIterator <ChaserStep> it(m_steps);
2✔
467
    while (it.hasNext() == true)
14✔
468
    {
469
        ChaserStep step(it.next());
24✔
470
        Function *function = doc->function(step.fid);
12✔
471

472
        if (function == NULL)
12✔
473
            it.remove();
4✔
474
        else if (function->contains(id())) // forbid self-containment
8✔
475
            it.remove();
×
476
    }
477
}
2✔
478

479
/*****************************************************************************
480
 * Next/Previous
481
 * Protected ChaserRunner wrappers
482
 *****************************************************************************/
483

484
void Chaser::tap()
2✔
485
{
486
    QMutexLocker runnerLocker(&m_runnerMutex);
4✔
487
    if (m_runner != NULL && durationMode() == Common)
2✔
488
        m_runner->tap();
2✔
489
}
2✔
490

491
void Chaser::setAction(ChaserAction &action)
20✔
492
{
493
    QMutexLocker runnerLocker(&m_runnerMutex);
40✔
494
    if (m_runner != NULL)
20✔
495
    {
496
        m_runner->setAction(action);
16✔
497
    }
498
    else
499
    {
500
        m_startupAction.m_action = action.m_action;
4✔
501
        m_startupAction.m_stepIndex = action.m_stepIndex;
4✔
502
        m_startupAction.m_masterIntensity = action.m_masterIntensity;
4✔
503
        m_startupAction.m_stepIntensity = action.m_stepIntensity;
4✔
504
        m_startupAction.m_fadeMode = action.m_fadeMode;
4✔
505
    }
506
}
20✔
507

508
int Chaser::currentStepIndex() const
2✔
509
{
510
    int ret = m_startupAction.m_stepIndex;
2✔
511
    {
512
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
513
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
514
#else
515
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
4✔
516
#endif
517
        if (m_runner != NULL)
2✔
518
            ret = m_runner->currentStepIndex();
2✔
519
    }
520
    return ret;
2✔
521
}
522

523
int Chaser::computeNextStep(int currentStepIndex) const
19✔
524
{
525
    int ret = m_startupAction.m_stepIndex;
19✔
526
    {
527
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
528
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
529
#else
530
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
38✔
531
#endif
532
        if (m_runner != NULL)
19✔
533
            ret = m_runner->computeNextStep(currentStepIndex);
19✔
534
    }
535
    return ret;
19✔
536
}
537

538
int Chaser::runningStepsNumber() const
×
539
{
540
    int ret = 0;
×
541
    {
542
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
543
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
544
#else
545
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
×
546
#endif
547
        if (m_runner != NULL)
×
548
            ret = m_runner->runningStepsNumber();
×
549
    }
550
    return ret;
×
551
}
552

553
ChaserRunnerStep Chaser::currentRunningStep() const
×
554
{
555
    ChaserRunnerStep ret;
556
    ret.m_function = NULL;
×
557

558
    {
559
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
560
        QMutexLocker runnerLocker(const_cast<QMutex*>(&m_runnerMutex));
561
#else
562
        QMutexLocker runnerLocker(const_cast<QRecursiveMutex*>(&m_runnerMutex));
×
563
#endif
564
        if (m_runner != NULL)
×
565
        {
566
            ChaserRunnerStep *step = m_runner->currentRunningStep();
×
567
            if (step != NULL)
×
568
                ret = *step;
×
569
        }
570
    }
571
    return ret;
×
572
}
573

574
bool Chaser::contains(quint32 functionId)
6✔
575
{
576
    Doc *doc = this->doc();
6✔
577
    Q_ASSERT(doc != NULL);
6✔
578

579
    foreach (ChaserStep step, m_steps)
7✔
580
    {
581
        Function *function = doc->function(step.fid);
2✔
582
        // contains() can be called during init, function may be NULL
583
        if (function == NULL)
2✔
584
            continue;
×
585

586
        if (function->id() == functionId)
2✔
587
            return true;
1✔
588
        if (function->contains(functionId))
1✔
589
            return true;
×
590
    }
591

592
    return false;
5✔
593
}
594

595
QList<quint32> Chaser::components()
×
596
{
597
    QList<quint32> ids;
×
598

599
    foreach (ChaserStep step, m_steps)
×
600
        ids.append(step.fid);
×
601

602
    return ids;
×
603
}
604

605
/*****************************************************************************
606
 * Running
607
 *****************************************************************************/
608

609
void Chaser::createRunner(quint32 startTime)
10✔
610
{
611
    Q_ASSERT(m_runner == NULL);
10✔
612

613
    {
614
        QMutexLocker stepListLocker(&m_stepListMutex);
10✔
615
        m_runner = new ChaserRunner(doc(), this, startTime);
10✔
616
    }
617
    m_runner->moveToThread(QCoreApplication::instance()->thread());
10✔
618
    m_runner->setParent(this);
10✔
619
    m_runner->setAction(m_startupAction);
10✔
620
    m_startupAction.m_action = ChaserNoAction;
10✔
621
}
10✔
622

623
void Chaser::preRun(MasterTimer* timer)
10✔
624
{
625
    {
626
        QMutexLocker runnerLocker(&m_runnerMutex);
10✔
627
        createRunner(elapsed());
10✔
628
        connect(m_runner, SIGNAL(currentStepChanged(int)), this, SIGNAL(currentStepChanged(int)));
10✔
629
    }
630

631
    Function::preRun(timer);
10✔
632
}
10✔
633

634
void Chaser::setPause(bool enable)
2✔
635
{
636
    QMutexLocker runnerLocker(&m_runnerMutex);
4✔
637
    if (m_runner != NULL)
2✔
638
    {
639
        // request a change of pause state at the next write call
640
        m_startupAction.m_action = ChaserPauseRequest;
2✔
641
        // use fade mode to pass through enable/disable flag
642
        m_startupAction.m_fadeMode = enable ? 1 : 0;
2✔
643
    }
644
    Function::setPause(enable);
2✔
645
}
2✔
646

647
void Chaser::write(MasterTimer* timer, QList<Universe *> universes)
84✔
648
{
649
    if (isPaused() && m_startupAction.m_action != ChaserPauseRequest)
84✔
650
        return;
1✔
651

652
    if (m_startupAction.m_action == ChaserPauseRequest)
83✔
653
    {
654
        qDebug() << "[Chaser] Request PAUSE" << m_startupAction.m_fadeMode;
2✔
655
        m_runner->setAction(m_startupAction);
2✔
656
        m_startupAction.m_action = ChaserNoAction;
2✔
657
    }
658

659
    {
660
        QMutexLocker runnerLocker(&m_runnerMutex);
166✔
661
        QMutexLocker stepListLocker(&m_stepListMutex);
166✔
662
        Q_ASSERT(m_runner != NULL);
83✔
663

664
        if (m_runner->write(timer, universes) == false)
83✔
665
            stop(FunctionParent::master());
×
666
    }
667

668
    incrementElapsed();
83✔
669
}
670

671
void Chaser::postRun(MasterTimer* timer, QList<Universe *> universes)
4✔
672
{
673
    {
674
        QMutexLocker runnerLocker(&m_runnerMutex);
4✔
675
        Q_ASSERT(m_runner != NULL);
4✔
676

677
        if (isPaused())
4✔
678
            m_runner->setPause(false, universes);
×
679

680
        m_runner->postRun(timer, universes);
4✔
681

682
        delete m_runner;
4✔
683
        m_runner = NULL;
4✔
684
    }
685

686
    Function::postRun(timer, universes);
4✔
687
}
4✔
688

689
/*****************************************************************************
690
 * Intensity
691
 *****************************************************************************/
692

693
int Chaser::adjustAttribute(qreal fraction, int attributeId)
9✔
694
{
695
    int attrIndex = Function::adjustAttribute(fraction, attributeId);
9✔
696

697
    if (attrIndex == Intensity)
9✔
698
    {
699
        QMutexLocker runnerLocker(&m_runnerMutex);
18✔
700
        QMutexLocker stepListLocker(&m_stepListMutex);
18✔
701
        if (m_runner != NULL)
9✔
702
        {
703
            m_runner->adjustStepIntensity(getAttributeValue(Function::Intensity));
4✔
704
        }
705
        else
706
        {
707
            m_startupAction.m_masterIntensity = getAttributeValue(Function::Intensity);
5✔
708
        }
709
    }
710

711
    return attrIndex;
9✔
712
}
713

714
void Chaser::adjustStepIntensity(qreal fraction, int stepIndex, FadeControlMode fadeControl)
×
715
{
716
    QMutexLocker runnerLocker(&m_runnerMutex);
×
717
    if (m_runner != NULL)
×
718
    {
719
        m_runner->adjustStepIntensity(fraction, stepIndex, fadeControl);
×
720
    }
721
    else
722
    {
723
        m_startupAction.m_masterIntensity = getAttributeValue(Function::Intensity);
×
724
        m_startupAction.m_stepIntensity = fraction;
×
725
    }
726
}
×
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

© 2025 Coveralls, Inc