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

mcallegari / qlcplus / 6683238402

29 Oct 2023 12:10PM UTC coverage: 28.07%. Remained the same
6683238402

push

github

mcallegari
engine: fix build

15385 of 54809 relevant lines covered (28.07%)

20267.63 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

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

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

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

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

44
    checkAddressAvailability();
×
45

46
    connect(m_uniCombo, SIGNAL(currentIndexChanged(int)),
×
47
            this, SLOT(slotUniverseChanged()));
48
    connect(m_addressSpin, SIGNAL(valueChanged(int)),
×
49
            this, SLOT(slotAddressChanged()));
50
    connect(m_columnSpin, SIGNAL(valueChanged(int)),
×
51
            this, SLOT(slotSizeChanged(int)));
52
    connect(m_rowSpin, SIGNAL(valueChanged(int)),
×
53
            this, SLOT(slotSizeChanged(int)));
54
}
×
55

56
AddRGBPanel::~AddRGBPanel()
×
57
{
58
}
×
59
bool AddRGBPanel::checkAddressAvailability()
×
60
{
61
    int uniAddr = m_doc->inputOutputMap()->getUniverseID(m_uniCombo->currentIndex());
×
62
    int startAddress = ((m_addressSpin->value() - 1) & 0x01FF) | (uniAddr << 9);
×
63
    int channels = m_columnSpin->value() * m_rowSpin->value() * 3;
×
64
    QPushButton *okBtn = buttonBox->button(QDialogButtonBox::Ok);
×
65

66
    qDebug() << "Check availability for address: " << startAddress;
×
67

68
    for (int i = 0; i < channels; i++)
×
69
    {
70
        quint32 fid = m_doc->fixtureForAddress(startAddress + i);
×
71
        if (fid != Fixture::invalidId())
×
72
        {
73
            m_addrErrorLabel->show();
×
74
            okBtn->setEnabled(false);
×
75
            return false;
×
76
        }
77
    }
78
    m_addrErrorLabel->hide();
×
79
    okBtn->setEnabled(true);
×
80
    return true;
×
81
}
82

83
void AddRGBPanel::slotUniverseChanged()
×
84
{
85
    checkAddressAvailability();
×
86
}
×
87

88
void AddRGBPanel::slotAddressChanged()
×
89
{
90
    checkAddressAvailability();
×
91
}
×
92

93
QString AddRGBPanel::name()
×
94
{
95
    return m_nameEdit->text();
×
96
}
97

98
int AddRGBPanel::universeIndex()
×
99
{
100
    return m_uniCombo->currentIndex();
×
101
}
102

103
int AddRGBPanel::address()
×
104
{
105
    return m_addressSpin->value() - 1;
×
106
}
107

108
int AddRGBPanel::columns()
×
109
{
110
    return m_columnSpin->value();
×
111
}
112

113
int AddRGBPanel::rows()
×
114
{
115
    return m_rowSpin->value();
×
116
}
117

118
quint32 AddRGBPanel::physicalWidth()
×
119
{
120
    return m_phyWidthSpin->value();
×
121
}
122

123
quint32 AddRGBPanel::physicalHeight()
×
124
{
125
    return m_phyHeightSpin->value();
×
126
}
127

128
AddRGBPanel::Orientation AddRGBPanel::orientation()
×
129
{
130
    if (m_oriTopLeftRadio->isChecked())
×
131
        return TopLeft;
×
132
    else if (m_oriTopRightRadio->isChecked())
×
133
        return TopRight;
×
134
    else if (m_oriBottomLeftRadio->isChecked())
×
135
        return BottomLeft;
×
136
    else if (m_oriBottomRightRadio->isChecked())
×
137
        return BottomRight;
×
138

139
    return None;
×
140
}
141

142
AddRGBPanel::Type AddRGBPanel::type()
×
143
{
144
    if (m_snakeRadio->isChecked())
×
145
        return Snake;
×
146
    else if (m_zigzagRadio->isChecked())
×
147
        return ZigZag;
×
148

149
    return Unknown;
×
150
}
151

152
AddRGBPanel::Direction AddRGBPanel::direction()
×
153
{
154
        if (m_verticalRadio->isChecked())
×
155
                return Vertical;
×
156
        else if (m_horizontalRadio->isChecked())
×
157
                return Horizontal;
×
158

159
        return Undefined;
×
160
}
161

162
Fixture::Components AddRGBPanel::components()
×
163
{
164
    if (m_compCombo->currentIndex() == 1)
×
165
        return Fixture::BGR;
×
166
    else if (m_compCombo->currentIndex() == 2)
×
167
        return Fixture::BRG;
×
168
    else if (m_compCombo->currentIndex() == 3)
×
169
        return Fixture::GBR;
×
170
    else if (m_compCombo->currentIndex() == 4)
×
171
        return Fixture::GRB;
×
172
    else if (m_compCombo->currentIndex() == 5)
×
173
        return Fixture::RBG;
×
174
    else if (m_compCombo->currentIndex() == 6)
×
175
        return Fixture::RGBW;
×
176

177
    return Fixture::RGB;
×
178
}
179

180
void AddRGBPanel::slotSizeChanged(int)
×
181
{
182
    checkAddressAvailability();
×
183
    m_totalLabel->setText(QString::number(m_columnSpin->value() * m_rowSpin->value()));
×
184
}
×
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