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

mcallegari / qlcplus / 13633248611

03 Mar 2025 02:31PM UTC coverage: 31.871% (+0.4%) from 31.5%
13633248611

push

github

web-flow
actions: add chrpath to profile

14689 of 46089 relevant lines covered (31.87%)

26426.11 hits per line

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

82.08
/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)
78✔
47
    : Function(doc, Function::ChaserType)
48
    , m_legacyHoldBus(Bus::invalid())
156✔
49
    , m_fadeInMode(Default)
78✔
50
    , m_fadeOutMode(Default)
78✔
51
    , m_holdMode(Common)
78✔
52
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
53
    , m_runnerMutex(QMutex::Recursive)
54
#endif
55
    , m_runner(NULL)
78✔
56
{
57
    setName(tr("New Chaser"));
78✔
58

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

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

70
Chaser::~Chaser()
129✔
71
{
72
}
129✔
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);
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);
105
    if (chaser == NULL)
4✔
106
        return false;
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
        }
133

134
        emit changed(this->id());
176✔
135
        emit stepsListChanged(this->id());
176✔
136
        return true;
176✔
137
    }
138
    else
139
    {
140
        return false;
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
        }
152

153
        emit changed(this->id());
3✔
154
        emit stepsListChanged(this->id());
3✔
155
        return true;
3✔
156
    }
157
    else
158
    {
159
        return false;
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
        }
171

172
        emit changed(this->id());
13✔
173
        emit stepChanged(index);
13✔
174
        return true;
13✔
175
    }
176
    else
177
    {
178
        return false;
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;
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
    }
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;
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)
773✔
263
{
264
    int count;
265
    {
266
        QMutexLocker stepListLocker(&m_stepListMutex);
773✔
267
        count = m_steps.removeAll(ChaserStep(fid));
1,546✔
268
    }
269

270
    if (count > 0)
773✔
271
        emit changed(this->id());
141✔
272
}
773✔
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;
325
    else if (str == KXMLQLCChaserSpeedModePerStep)
9✔
326
        return PerStep;
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);
338

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

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

345
    /* Speed */
346
    saveXMLSpeed(doc);
2✔
347

348
    /* Direction */
349
    saveXMLDirection(doc);
2✔
350

351
    /* Run order */
352
    saveXMLRunOrder(doc);
2✔
353

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

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

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

368
    return true;
2✔
369
}
370

371
bool Chaser::loadXMLSpeedModes(QXmlStreamReader &root)
3✔
372
{
373
    QXmlStreamAttributes attrs = root.attributes();
3✔
374
    QString str;
375

376
    str = attrs.value(KXMLQLCFunctionSpeedFadeIn).toString();
3✔
377
    setFadeInMode(stringToSpeedMode(str));
3✔
378

379
    str = attrs.value(KXMLQLCFunctionSpeedFadeOut).toString();
3✔
380
    setFadeOutMode(stringToSpeedMode(str));
3✔
381

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

386
    return true;
3✔
387
}
3✔
388

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

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

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

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

454
    return true;
455
}
456

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

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

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

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

481
/*****************************************************************************
482
 * Next/Previous
483
 * Protected ChaserRunner wrappers
484
 *****************************************************************************/
485

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

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

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

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

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

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

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

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

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

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

594
    return false;
5✔
595
}
596

597
QList<quint32> Chaser::components()
×
598
{
599
    QList<quint32> ids;
600

601
    foreach (ChaserStep step, m_steps)
×
602
        ids.append(step.fid);
×
603

604
    return ids;
×
605
}
×
606

607
/*****************************************************************************
608
 * Running
609
 *****************************************************************************/
610

611
void Chaser::createRunner(quint32 startTime)
11✔
612
{
613
    Q_ASSERT(m_runner == NULL);
614

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

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

633
    Function::preRun(timer);
11✔
634
}
11✔
635

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

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

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

661
    {
662
        QMutexLocker runnerLocker(&m_runnerMutex);
113✔
663
        QMutexLocker stepListLocker(&m_stepListMutex);
113✔
664
        Q_ASSERT(m_runner != NULL);
665

666
        if (m_runner->write(timer, universes) == false)
113✔
667
            stop(FunctionParent::master());
×
668
    }
669

670
    incrementElapsed();
113✔
671
}
672

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

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

682
        m_runner->postRun(timer, universes);
4✔
683

684
        delete m_runner;
4✔
685
        m_runner = NULL;
4✔
686
    }
687

688
    Function::postRun(timer, universes);
4✔
689
}
4✔
690

691
/*****************************************************************************
692
 * Intensity
693
 *****************************************************************************/
694

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

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

713
    return attrIndex;
9✔
714
}
715

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