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

mcallegari / qlcplus / 15805077468

22 Jun 2025 08:36AM UTC coverage: 31.876% (-0.01%) from 31.89%
15805077468

push

github

mcallegari
plugins/dmxusb: fix RDM discovery and commands while DMX is running

0 of 1 new or added line in 1 file covered. (0.0%)

3722 existing lines in 175 files now uncovered.

16438 of 51569 relevant lines covered (31.88%)

19266.08 hits per line

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

0.0
/ui/src/customfeedbackdialog.cpp
1
/*
2
  Q Light Controller Plus
3
  customfeedbackdialog.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 "customfeedbackdialog.h"
21
#include "qlcinputchannel.h"
22
#include "qlcinputsource.h"
23
#include "doc.h"
24

25
CustomFeedbackDialog::CustomFeedbackDialog(Doc *doc, const QSharedPointer<QLCInputSource> &source, QWidget *parent)
×
26
    : QDialog(parent)
27
    , m_doc(doc)
×
28
    , m_profile(NULL)
×
29
    , m_inputSource(source)
×
30
    , m_selectedFeedback(None)
×
31
{
32
    setupUi(this);
×
33

34
    bool enableControls = source.isNull() ? false : true;
×
35

UNCOV
36
    if (enableControls)
×
37
    {
38
        m_lowerSpin->setValue(m_inputSource->feedbackValue(QLCInputFeedback::LowerValue));
×
39
        m_upperSpin->setValue(m_inputSource->feedbackValue(QLCInputFeedback::UpperValue));
×
40
        m_monitorSpin->setValue(m_inputSource->feedbackValue(QLCInputFeedback::MonitorValue));
×
41
    }
42

43
    m_lowerSpin->setEnabled(enableControls);
×
44
    m_upperSpin->setEnabled(enableControls);
×
45

46
    m_monitorLabel->setVisible(false);
×
47
    m_monitorSpin->setVisible(false);
×
48
    m_monitorChannelCombo->setVisible(false);
×
49
    m_profileColorsTree->setVisible(false);
×
50
    m_midiChannelGroup->hide();
×
51

52
    if (enableControls)
×
53
    {
54
        InputPatch *ip = m_doc->inputOutputMap()->inputPatch(m_inputSource->universe());
×
55
        if (ip != NULL && ip->profile() != NULL)
×
56
        {
57
            m_profile = ip->profile();
×
58
            if (m_profile->hasColorTable())
×
59
            {
60
                m_lowerColor->setVisible(true);
×
61
                m_upperColor->setVisible(true);
×
62

63
                QMapIterator <uchar, QPair<QString, QColor>> it(m_profile->colorTable());
×
64
                while (it.hasNext() == true)
×
65
                {
UNCOV
66
                    it.next();
×
UNCOV
67
                    QPair<QString, QColor> lc = it.value();
×
68
                    QTreeWidgetItem *item = new QTreeWidgetItem(m_profileColorsTree);
×
69
                    item->setText(0, QString::number(it.key()));
×
70
                    item->setText(1, lc.first);
×
71

72
                    QLabel *colLabel = new QLabel();
×
73
                    colLabel->setStyleSheet(QString("background-color: %1").arg(lc.second.name()));
×
74

75
                    if (it.key() == m_inputSource->feedbackValue(QLCInputFeedback::LowerValue))
×
76
                        m_lowerColor->setStyleSheet(QString("background-color: %1").arg(lc.second.name()));
×
77

78
                    if (it.key() == m_inputSource->feedbackValue(QLCInputFeedback::UpperValue))
×
79
                        m_upperColor->setStyleSheet(QString("background-color: %1").arg(lc.second.name()));
×
80

81
                    if (it.key() == m_inputSource->feedbackValue(QLCInputFeedback::MonitorValue))
×
82
                        m_monitorColor->setStyleSheet(QString("background-color: %1").arg(lc.second.name()));
×
83

84
                    m_profileColorsTree->setItemWidget(item, 2, colLabel);
×
UNCOV
85
                }
×
UNCOV
86
            }
×
87
            if (m_profile->type() == QLCInputProfile::MIDI && m_profile->hasMidiChannelTable())
×
88
            {
89
                m_midiChannelGroup->show();
×
90
                m_lowerChannelCombo->addItem(tr("From plugin settings"));
×
91
                m_upperChannelCombo->addItem(tr("From plugin settings"));
×
92
                m_monitorChannelCombo->addItem(tr("From plugin settings"));
×
93

94
                QMapIterator <uchar, QString> it(m_profile->midiChannelTable());
×
95
                while (it.hasNext() == true)
×
96
                {
UNCOV
97
                    it.next();
×
98
                    m_lowerChannelCombo->addItem(it.value());
×
99
                    m_upperChannelCombo->addItem(it.value());
×
100
                    m_monitorChannelCombo->addItem(it.value());
×
101
                }
102

103
                QVariant extraParams = m_inputSource->feedbackExtraParams(QLCInputFeedback::LowerValue);
×
104
                if (extraParams.isValid())
×
105
                    m_lowerChannelCombo->setCurrentIndex(extraParams.toInt() + 1);
×
106

107
                extraParams = m_inputSource->feedbackExtraParams(QLCInputFeedback::UpperValue);
×
108
                if (extraParams.isValid())
×
109
                    m_upperChannelCombo->setCurrentIndex(extraParams.toInt() + 1);
×
110

111
                extraParams = m_inputSource->feedbackExtraParams(QLCInputFeedback::MonitorValue);
×
112
                if (extraParams.isValid())
×
113
                    m_monitorChannelCombo->setCurrentIndex(extraParams.toInt() + 1);
×
114
            }
×
115
        }
116
    }
117

118
    // connect signals
119
    connect(m_lowerColor, SIGNAL(clicked()),
×
120
            this, SLOT(slotLowerColorButtonClicked()));
121
    connect(m_upperColor, SIGNAL(clicked()),
×
122
            this, SLOT(slotUpperColorButtonClicked()));
123
    connect(m_monitorColor, SIGNAL(clicked()),
×
124
            this, SLOT(slotMonitorColorButtonClicked()));
125
    connect(m_profileColorsTree, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
×
126
            this, SLOT(slotColorSelected(QTreeWidgetItem *)));
127
}
×
128

129
CustomFeedbackDialog::~CustomFeedbackDialog()
×
130
{
131
}
×
132

133
void CustomFeedbackDialog::setMonitoringVisibility(bool visible)
×
134
{
135
    m_monitorLabel->setVisible(visible);
×
136
    m_monitorSpin->setVisible(visible);
×
137
    m_monitorColor->setVisible(visible);
×
138
    m_monitorChannelCombo->setVisible(visible);
×
139
}
×
140

141
void CustomFeedbackDialog::accept()
×
142
{
143
    if (m_inputSource.isNull())
×
UNCOV
144
        return;
×
145

146
    m_inputSource->setFeedbackValue(QLCInputFeedback::LowerValue, m_lowerSpin->value());
×
147
    m_inputSource->setFeedbackValue(QLCInputFeedback::UpperValue, m_upperSpin->value());
×
148
    if (m_monitorSpin->isVisible())
×
149
        m_inputSource->setFeedbackValue(QLCInputFeedback::MonitorValue, m_monitorSpin->value());
×
150

151
    if (m_midiChannelGroup->isVisible())
×
152
    {
153
        m_inputSource->setFeedbackExtraParams(QLCInputFeedback::LowerValue, m_lowerChannelCombo->currentIndex() - 1);
×
154
        m_inputSource->setFeedbackExtraParams(QLCInputFeedback::UpperValue, m_upperChannelCombo->currentIndex() - 1);
×
155
        if (m_monitorSpin->isVisible())
×
156
            m_inputSource->setFeedbackExtraParams(QLCInputFeedback::MonitorValue, m_monitorChannelCombo->currentIndex() - 1);
×
157
    }
158

159
    QDialog::accept();
×
160
}
161

162
void CustomFeedbackDialog::slotLowerColorButtonClicked()
×
163
{
164
    m_selectedFeedback = LowerValue;
×
165
    m_profileColorsTree->setVisible(true);
×
166
}
×
167

168
void CustomFeedbackDialog::slotUpperColorButtonClicked()
×
169
{
170
    m_selectedFeedback = UpperValue;
×
171
    m_profileColorsTree->setVisible(true);
×
172
}
×
173

174
void CustomFeedbackDialog::slotMonitorColorButtonClicked()
×
175
{
176
    m_selectedFeedback = MonitoringValue;
×
177
    m_profileColorsTree->setVisible(true);
×
178
}
×
179

180
void CustomFeedbackDialog::slotColorSelected(QTreeWidgetItem *item)
×
181
{
182
    QLabel *label = qobject_cast<QLabel *>(m_profileColorsTree->itemWidget(item, 2));
×
183

184
    if (m_selectedFeedback == LowerValue)
×
185
    {
186
        m_lowerSpin->setValue(item->text(0).toInt());
×
187
        m_lowerColor->setStyleSheet(label->styleSheet());
×
188
    }
189
    else if (m_selectedFeedback == UpperValue)
×
190
    {
191
        m_upperSpin->setValue(item->text(0).toInt());
×
192
        m_upperColor->setStyleSheet(label->styleSheet());
×
193
    }
194
    else if (m_selectedFeedback == MonitoringValue)
×
195
    {
196
        m_monitorSpin->setValue(item->text(0).toInt());
×
197
        m_monitorColor->setStyleSheet(label->styleSheet());
×
198
    }
199
    m_profileColorsTree->setVisible(false);
×
200
    m_selectedFeedback = None;
×
201
}
×
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