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

mcallegari / qlcplus / 14809507932

03 May 2025 09:13AM UTC coverage: 31.879% (+0.03%) from 31.845%
14809507932

push

github

web-flow
Merge pull request #1745 from mcallegari/qmluiqt6

Port QML UI to Qt6

2 of 9 new or added lines in 3 files covered. (22.22%)

3720 existing lines in 174 files now uncovered.

16422 of 51513 relevant lines covered (31.88%)

19079.9 hits per line

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

95.08
/engine/src/grandmaster.cpp
1
/*
2
  Q Light Controller Plus
3
  grandmaster.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 <climits>
21

22
#include "grandmaster.h"
23
#include "qlcmacros.h"
24

25
#define KXMLQLCGMValueModeLimit "Limit"
26
#define KXMLQLCGMValueModeReduce "Reduce"
27
#define KXMLQLCGMChannelModeAllChannels "All"
28
#define KXMLQLCGMChannelModeIntensity "Intensity"
29
#define KXMLQLCGMSliderModeNormal "Normal"
30
#define KXMLQLCGMSliderModeInverted "Inverted"
31

32
GrandMaster::GrandMaster(QObject *parent)
243✔
33
    : QObject(parent)
34
    , m_valueMode(Reduce)
243✔
35
    , m_channelMode(Intensity)
243✔
36
    , m_value(255)
243✔
37
    , m_fraction(1.0)
243✔
38
{
39
}
243✔
40

41
GrandMaster::~GrandMaster()
462✔
42
{
43
}
462✔
44

45
GrandMaster::ValueMode GrandMaster::stringToValueMode(const QString& str)
6✔
46
{
47
    if (str == KXMLQLCGMValueModeLimit)
6✔
48
        return GrandMaster::Limit;
3✔
49
    else
50
        return GrandMaster::Reduce;
3✔
51
}
52

53
QString GrandMaster::valueModeToString(GrandMaster::ValueMode mode)
4✔
54
{
55
    switch (mode)
4✔
56
    {
57
    case GrandMaster::Limit:
2✔
58
        return KXMLQLCGMValueModeLimit;
2✔
59
    default:
2✔
60
    case GrandMaster::Reduce:
61
        return KXMLQLCGMValueModeReduce;
2✔
62
    }
63
}
64

65
GrandMaster::ChannelMode GrandMaster::stringToChannelMode(const QString& str)
6✔
66
{
67
    if (str == KXMLQLCGMChannelModeAllChannels)
6✔
68
        return GrandMaster::AllChannels;
3✔
69
    else
70
        return GrandMaster::Intensity;
3✔
71
}
72

73
QString GrandMaster::channelModeToString(GrandMaster::ChannelMode mode)
4✔
74
{
75
    switch (mode)
4✔
76
    {
77
    case GrandMaster::AllChannels:
2✔
78
        return KXMLQLCGMChannelModeAllChannels;
2✔
79
    default:
2✔
80
    case GrandMaster::Intensity:
81
        return KXMLQLCGMChannelModeIntensity;
2✔
82
    }
83
}
84

85
GrandMaster::SliderMode GrandMaster::stringToSliderMode(const QString &str)
1✔
86
{
87
    if (str == KXMLQLCGMSliderModeInverted)
1✔
UNCOV
88
        return GrandMaster::Inverted;
×
89
    else
90
        return GrandMaster::Normal;
1✔
91
}
92

93
QString GrandMaster::sliderModeToString(GrandMaster::SliderMode mode)
1✔
94
{
95
    switch (mode)
1✔
96
    {
97
    case GrandMaster::Inverted:
×
98
        return KXMLQLCGMSliderModeInverted;
×
99
    default:
1✔
100
    case GrandMaster::Normal:
101
        return KXMLQLCGMSliderModeNormal;
1✔
102
    }
103
}
104

105
void GrandMaster::setValueMode(GrandMaster::ValueMode mode)
6✔
106
{
107
    if (m_valueMode != mode)
6✔
108
    {
109
        m_valueMode = mode;
6✔
110
        setValue(value());
6✔
111
    }
112
}
6✔
113

114
GrandMaster::ValueMode GrandMaster::valueMode() const
5,125,859✔
115
{
116
    return m_valueMode;
5,125,859✔
117
}
118

119
void GrandMaster::setChannelMode(GrandMaster::ChannelMode mode)
8✔
120
{
121
    if (m_channelMode != mode)
8✔
122
    {
123
        m_channelMode = mode;
8✔
124
        setValue(value());
8✔
125
    }
126
/*
127
    if (gMChannelMode() == GMIntensity)
128
    {
129
        QSetIterator <int> it(m_gMNonIntensityChannels);
130
        while (it.hasNext() == true)
131
        {
132
            int channel(it.next());
133
            char chValue(m_preGMValues->data()[channel]);
134
            write(channel, chValue, QLCChannel::NoGroup);
135
        }
136
    }
137
*/
138
}
8✔
139

140
GrandMaster::ChannelMode GrandMaster::channelMode() const
13,702,768✔
141
{
142
    return m_channelMode;
13,702,768✔
143
}
144

145
void GrandMaster::setValue(uchar value)
5,285✔
146
{
147
    m_value = value;
5,285✔
148
    m_fraction = CLAMP(double(value) / double(UCHAR_MAX), 0.0, 1.0);
5,285✔
149

150
    emit valueChanged(value);
5,285✔
151
}
5,285✔
152

153
uchar GrandMaster::value() const
1,463✔
154
{
155
    return m_value;
1,463✔
156
}
157

158
double GrandMaster::fraction() const
5,125,166✔
159
{
160
    return m_fraction;
5,125,166✔
161
}
162

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