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

mcallegari / qlcplus / 12678124692

08 Jan 2025 08:03PM UTC coverage: 31.556% (+0.06%) from 31.5%
12678124692

push

github

web-flow
Merge pull request #1659 from mcallegari/crossuniverse

RGBPanel: implement cross universe and 16bit profiles

99 of 216 new or added lines in 10 files covered. (45.83%)

6 existing lines in 4 files now uncovered.

14147 of 44831 relevant lines covered (31.56%)

26765.29 hits per line

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

0.0
/ui/src/addrgbpanel.cpp
1
/*
2
  Q Light Controller Plus
3
  addrgbpanel.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 <QPushButton>
21
#include <QDebug>
22
#include <QSettings>
23

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

27
#define SETTINGS_GEOMETRY "addrgbpanel/geometry"
28

29
AddRGBPanel::AddRGBPanel(QWidget *parent, const Doc *doc)
×
30
    : QDialog(parent)
31
    , m_doc(doc)
×
32
{
33
    setupUi(this);
×
34

35
    /* Fill universe combo with available universes */
36
    m_uniCombo->addItems(m_doc->inputOutputMap()->universeNames());
×
37

38
    m_compCombo->addItem("RGB");
×
39
    m_compCombo->addItem("BGR");
×
40
    m_compCombo->addItem("BRG");
×
41
    m_compCombo->addItem("GBR");
×
42
    m_compCombo->addItem("GRB");
×
43
    m_compCombo->addItem("RBG");
×
44
    m_compCombo->addItem("RGBW");
×
45

46
    checkAddressAvailability();
×
47

48
    QSettings settings;
×
49
    QVariant geometrySettings = settings.value(SETTINGS_GEOMETRY);
×
50
    if (geometrySettings.isValid() == true)
×
51
        restoreGeometry(geometrySettings.toByteArray());
×
52

53
    connect(m_uniCombo, SIGNAL(currentIndexChanged(int)),
×
54
            this, SLOT(slotUniverseChanged()));
55
    connect(m_compCombo, SIGNAL(currentIndexChanged(int)),
×
56
            this, SLOT(slotComponentsChanged(int)));
57
    connect(m_addressSpin, SIGNAL(valueChanged(int)),
×
58
            this, SLOT(slotAddressChanged()));
59
    connect(m_columnSpin, SIGNAL(valueChanged(int)),
×
60
            this, SLOT(slotSizeChanged(int)));
61
    connect(m_rowSpin, SIGNAL(valueChanged(int)),
×
62
            this, SLOT(slotSizeChanged(int)));
63
}
×
64

65
AddRGBPanel::~AddRGBPanel()
×
66
{
67
    QSettings settings;
×
68
    settings.setValue(SETTINGS_GEOMETRY, saveGeometry());
×
69
}
×
70
bool AddRGBPanel::checkAddressAvailability()
×
71
{
72
    int uniAddr = m_doc->inputOutputMap()->getUniverseID(m_uniCombo->currentIndex());
×
73
    int startAddress = ((m_addressSpin->value() - 1) & 0x01FF) | (uniAddr << 9);
×
74
    int channels = m_columnSpin->value() * m_rowSpin->value() * 3;
×
75
    QPushButton *okBtn = buttonBox->button(QDialogButtonBox::Ok);
×
76

77
    qDebug() << "Check availability for address: " << startAddress;
78

79
    for (int i = 0; i < channels; i++)
×
80
    {
81
        quint32 fid = m_doc->fixtureForAddress(startAddress + i);
×
82
        if (fid != Fixture::invalidId())
×
83
        {
84
            m_addrErrorLabel->show();
×
85
            okBtn->setEnabled(false);
×
86
            return false;
×
87
        }
88
    }
89
    m_addrErrorLabel->hide();
×
90
    okBtn->setEnabled(true);
×
91
    return true;
92
}
93

94
void AddRGBPanel::slotUniverseChanged()
×
95
{
96
    checkAddressAvailability();
×
97
}
×
98

99
void AddRGBPanel::slotComponentsChanged(int index)
×
100
{
101
    if (index == 6) // RGBW
×
102
        m_columnSpin->setMaximum(128);
×
103
    else
104
        m_columnSpin->setMaximum(170);
×
105
}
×
106

107
void AddRGBPanel::slotAddressChanged()
×
108
{
109
    checkAddressAvailability();
×
110
}
×
111

112
QString AddRGBPanel::name()
×
113
{
114
    return m_nameEdit->text();
×
115
}
116

117
int AddRGBPanel::universeIndex()
×
118
{
119
    return m_uniCombo->currentIndex();
×
120
}
121

122
int AddRGBPanel::address()
×
123
{
124
    return m_addressSpin->value() - 1;
×
125
}
126

127
int AddRGBPanel::columns()
×
128
{
129
    return m_columnSpin->value();
×
130
}
131

132
int AddRGBPanel::rows()
×
133
{
134
    return m_rowSpin->value();
×
135
}
136

137
quint32 AddRGBPanel::physicalWidth()
×
138
{
139
    return m_phyWidthSpin->value();
×
140
}
141

142
quint32 AddRGBPanel::physicalHeight()
×
143
{
144
    return m_phyHeightSpin->value();
×
145
}
146

147
AddRGBPanel::Orientation AddRGBPanel::orientation()
×
148
{
149
    if (m_oriTopLeftRadio->isChecked())
×
150
        return TopLeft;
151
    else if (m_oriTopRightRadio->isChecked())
×
152
        return TopRight;
153
    else if (m_oriBottomLeftRadio->isChecked())
×
154
        return BottomLeft;
155
    else if (m_oriBottomRightRadio->isChecked())
×
156
        return BottomRight;
×
157

158
    return None;
159
}
160

161
AddRGBPanel::Type AddRGBPanel::type()
×
162
{
163
    if (m_snakeRadio->isChecked())
×
164
        return Snake;
165
    else if (m_zigzagRadio->isChecked())
×
166
        return ZigZag;
×
167

168
    return Unknown;
169
}
170

171
AddRGBPanel::Direction AddRGBPanel::direction()
×
172
{
173
        if (m_verticalRadio->isChecked())
×
174
                return Vertical;
175
        else if (m_horizontalRadio->isChecked())
×
176
                return Horizontal;
×
177

178
        return Undefined;
179
}
180

181
Fixture::Components AddRGBPanel::components()
×
182
{
183
    if (m_compCombo->currentIndex() == 1)
×
184
        return Fixture::BGR;
185
    else if (m_compCombo->currentIndex() == 2)
×
186
        return Fixture::BRG;
187
    else if (m_compCombo->currentIndex() == 3)
×
188
        return Fixture::GBR;
189
    else if (m_compCombo->currentIndex() == 4)
×
190
        return Fixture::GRB;
191
    else if (m_compCombo->currentIndex() == 5)
×
192
        return Fixture::RBG;
193
    else if (m_compCombo->currentIndex() == 6)
×
194
        return Fixture::RGBW;
×
195

196
    return Fixture::RGB;
197
}
198

NEW
199
bool AddRGBPanel::is16Bit()
×
200
{
NEW
201
    return m_16bitCheck->isChecked();
×
202
}
203

NEW
204
bool AddRGBPanel::crossUniverse()
×
205
{
NEW
206
    return m_crossUniverseCheck->isChecked();
×
207
}
208

UNCOV
209
void AddRGBPanel::slotSizeChanged(int)
×
210
{
211
    checkAddressAvailability();
×
212
    m_totalLabel->setText(QString::number(m_columnSpin->value() * m_rowSpin->value()));
×
213
}
×
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