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

mcallegari / qlcplus / 18357067171

08 Oct 2025 08:16PM UTC coverage: 34.26% (+2.2%) from 32.066%
18357067171

push

github

mcallegari
Merge branch 'master' into filedialog

1282 of 4424 new or added lines in 152 files covered. (28.98%)

1342 existing lines in 152 files now uncovered.

17704 of 51675 relevant lines covered (34.26%)

19430.31 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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