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

mcallegari / qlcplus / 9226455509

24 May 2024 03:34PM UTC coverage: 31.637% (-0.4%) from 32.007%
9226455509

Pull #1422

github

web-flow
Merge 9870df2c8 into b9e7b67e6
Pull Request #1422: RgbScript make stage colors available to scripts

60 of 910 new or added lines in 11 files covered. (6.59%)

9 existing lines in 4 files now uncovered.

15421 of 48743 relevant lines covered (31.64%)

22674.46 hits per line

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

14.89
/engine/src/rgbplain.cpp
1
/*
2
  Q Light Controller Plus
3
  rgbplain.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 <QXmlStreamReader>
21
#include <QXmlStreamWriter>
22
#include <QDebug>
23

24
#include "rgbplain.h"
25
#include "doc.h"
26

27
RGBPlain::RGBPlain(Doc * doc)
7✔
28
    : RGBAlgorithm(doc)
7✔
29
{
30
}
7✔
31

32
RGBPlain::RGBPlain(const RGBPlain& a, QObject *parent)
×
33
    : QObject(parent)
34
    , RGBAlgorithm(a.doc())
×
35
{
36
}
×
37

38
RGBPlain::~RGBPlain()
7✔
39
{
40
}
7✔
41

42
RGBAlgorithm* RGBPlain::clone() const
×
43
{
44
    RGBPlain* plain = new RGBPlain(*this);
×
45
    return static_cast<RGBAlgorithm*> (plain);
×
46
}
47

48
/****************************************************************************
49
 * RGBAlgorithm
50
 ****************************************************************************/
51

52
int RGBPlain::rgbMapStepCount(const QSize& size)
×
53
{
54
    Q_UNUSED(size);
55
    return 1;
×
56
}
57

NEW
58
void RGBPlain::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map, uint (&rawColors)[RGBAlgorithmRawColorCount])
×
59
{
60
    Q_UNUSED(step);
61
    Q_UNUSED(rawColors);
62
    map.resize(size.height());
×
63
    for (int y = 0; y < size.height(); y++)
×
64
    {
65
        map[y].resize(size.width());
×
66
        map[y].fill(rgb);
×
67
    }
68
}
×
69

70
QString RGBPlain::name() const
6✔
71
{
72
    return QString("Plain Color");
6✔
73
}
74

75
QString RGBPlain::author() const
×
76
{
77
    return QString("Massimo Callegari");
×
78
}
79

80
int RGBPlain::apiVersion() const
×
81
{
82
    return 1;
×
83
}
84

NEW
85
void RGBPlain::setColors(QColor colors[RGBAlgorithmRawColorCount])
×
86
{
NEW
87
    RGBAlgorithm::setColors(colors);
×
88
}
×
89

90
RGBAlgorithm::Type RGBPlain::type() const
×
91
{
92
    return RGBAlgorithm::Plain;
×
93
}
94

95
int RGBPlain::acceptColors() const
×
96
{
97
    return 1; // only start color is accepted
×
98
}
99

100
bool RGBPlain::loadXML(QXmlStreamReader &root)
×
101
{
102
    if (root.name() != KXMLQLCRGBAlgorithm)
×
103
    {
104
        qWarning() << Q_FUNC_INFO << "RGB Algorithm node not found";
×
105
        return false;
×
106
    }
107

108
    if (root.attributes().value(KXMLQLCRGBAlgorithmType).toString() != KXMLQLCRGBPlain)
×
109
    {
110
        qWarning() << Q_FUNC_INFO << "RGB Algorithm is not Plain";
×
111
        return false;
×
112
    }
113

114
    root.skipCurrentElement();
×
115

116
    return true;
×
117
}
118

119
bool RGBPlain::saveXML(QXmlStreamWriter *doc) const
×
120
{
121
    Q_ASSERT(doc != NULL);
×
122

123
    doc->writeStartElement(KXMLQLCRGBAlgorithm);
×
124
    doc->writeAttribute(KXMLQLCRGBAlgorithmType, KXMLQLCRGBPlain);
×
125
    doc->writeEndElement();
×
126

127
    return true;
×
128
}
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