• 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

37.01
/ui/src/inputselectionwidget.cpp
1
/*
2
  Q Light Controller Plus
3
  inputselectionwidget.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 <QDebug>
21

22
#include "customfeedbackdialog.h"
23
#include "inputselectionwidget.h"
24
#include "selectinputchannel.h"
25
#include "qlcinputchannel.h"
26
#include "qlcinputsource.h"
27
#include "assignhotkey.h"
28
#include "inputpatch.h"
29
#include "doc.h"
30

31
InputSelectionWidget::InputSelectionWidget(Doc *doc, QWidget *parent)
4✔
32
    : QWidget(parent)
33
    , m_doc(doc)
4✔
34
    , m_widgetPage(0)
4✔
35
    , m_emitOdd(false)
4✔
36
    , m_supportMonitoring(false)
4✔
37
    , m_signalsReceived(0)
4✔
38
{
39
    Q_ASSERT(doc != NULL);
4✔
40

41
    setupUi(this);
4✔
42

43
    m_customFbButton->setVisible(false);
4✔
44

45
    connect(m_attachKey, SIGNAL(clicked()), this, SLOT(slotAttachKey()));
4✔
46
    connect(m_detachKey, SIGNAL(clicked()), this, SLOT(slotDetachKey()));
4✔
47

48
    connect(m_autoDetectInputButton, SIGNAL(toggled(bool)),
4✔
49
            this, SLOT(slotAutoDetectInputToggled(bool)));
50
    connect(m_chooseInputButton, SIGNAL(clicked()),
4✔
51
            this, SLOT(slotChooseInputClicked()));
52

53
    connect(m_customFbButton, SIGNAL(clicked(bool)),
4✔
54
            this, SLOT(slotCustomFeedbackClicked()));
55
}
4✔
56

57
InputSelectionWidget::~InputSelectionWidget()
8✔
58
{
59
}
8✔
60

61
void InputSelectionWidget::setKeyInputVisibility(bool visible)
×
62
{
63
    m_keyInputGroup->setVisible(visible);
×
64
}
×
65

66
void InputSelectionWidget::setCustomFeedbackVisibility(bool visible)
4✔
67
{
68
    m_customFbButton->setVisible(visible);
4✔
69
}
4✔
70

NEW
71
void InputSelectionWidget::setMonitoringSupport(bool enable)
×
72
{
NEW
73
    m_supportMonitoring = enable;
×
NEW
74
}
×
75

76
void InputSelectionWidget::setTitle(QString title)
3✔
77
{
78
    m_extInputGroup->setTitle(title);
3✔
79
}
3✔
80

81
void InputSelectionWidget::setWidgetPage(int page)
4✔
82
{
83
    m_widgetPage = page;
4✔
84
}
4✔
85

86
bool InputSelectionWidget::isAutoDetecting()
×
87
{
88
   return m_autoDetectInputButton->isChecked();
×
89
}
90

91
void InputSelectionWidget::stopAutoDetection()
×
92
{
93
    if (m_autoDetectInputButton->isChecked())
×
94
        m_autoDetectInputButton->toggle();
×
95
}
×
96

97
void InputSelectionWidget::emitOddValues(bool enable)
×
98
{
99
    m_emitOdd = enable;
×
100
}
×
101

102
void InputSelectionWidget::setKeySequence(const QKeySequence &keySequence)
3✔
103
{
104
    m_keySequence = QKeySequence(keySequence);
3✔
105
    m_keyEdit->setText(m_keySequence.toString(QKeySequence::NativeText));
3✔
106
}
3✔
107

108
QKeySequence InputSelectionWidget::keySequence() const
3✔
109
{
110
    return m_keySequence;
3✔
111
}
112

113
void InputSelectionWidget::setInputSource(const QSharedPointer<QLCInputSource> &source)
3✔
114
{
115
    m_inputSource = source;
3✔
116
    updateInputSource();
3✔
117
}
3✔
118

119
QSharedPointer<QLCInputSource> InputSelectionWidget::inputSource() const
3✔
120
{
121
    return m_inputSource;
3✔
122
}
123

124
void InputSelectionWidget::slotAttachKey()
×
125
{
126
    AssignHotKey ahk(this, m_keySequence);
×
127
    if (ahk.exec() == QDialog::Accepted)
×
128
    {
129
        setKeySequence(QKeySequence(ahk.keySequence()));
×
130
        emit keySequenceChanged(m_keySequence);
×
131
    }
132
}
×
133

134
void InputSelectionWidget::slotDetachKey()
×
135
{
136
    setKeySequence(QKeySequence());
×
137
    emit keySequenceChanged(m_keySequence);
×
138
}
×
139

140
void InputSelectionWidget::slotAutoDetectInputToggled(bool checked)
×
141
{
142
    if (checked == true)
×
143
    {
144
        connect(m_doc->inputOutputMap(),
×
145
                SIGNAL(inputValueChanged(quint32,quint32,uchar)),
146
                this, SLOT(slotInputValueChanged(quint32,quint32)));
147
    }
148
    else
149
    {
150
        disconnect(m_doc->inputOutputMap(),
×
151
                   SIGNAL(inputValueChanged(quint32,quint32,uchar)),
152
                   this, SLOT(slotInputValueChanged(quint32,quint32)));
153
    }
154
    emit autoDetectToggled(checked);
×
155
}
×
156

157
void InputSelectionWidget::slotInputValueChanged(quint32 universe, quint32 channel)
×
158
{
159
    if (m_emitOdd == true && m_signalsReceived % 2)
×
160
    {
161
        emit inputValueChanged(universe, (m_widgetPage << 16) | channel);
×
162
        m_signalsReceived++;
×
163
        return;
×
164
    }
165

166
    m_inputSource = QSharedPointer<QLCInputSource>(new QLCInputSource(universe, (m_widgetPage << 16) | channel));
×
167
    updateInputSource();
×
168
    m_signalsReceived++;
×
169

170
    if (m_emitOdd == false)
×
171
        emit inputValueChanged(universe, (m_widgetPage << 16) | channel);
×
172
}
173

174
void InputSelectionWidget::slotChooseInputClicked()
×
175
{
176
    SelectInputChannel sic(this, m_doc->inputOutputMap());
×
177
    if (sic.exec() == QDialog::Accepted)
×
178
    {
NEW
179
        uchar lowerValue = 0;
×
NEW
180
        uchar upperValue = 0;
×
NEW
181
        uchar monitorValue = 0;
×
NEW
182
        QVariant extraLowerParams;
×
NEW
183
        QVariant extraUpperParams;
×
NEW
184
        QVariant extraMonitorParams;
×
NEW
185
        if (!m_inputSource.isNull())
×
186
        {
NEW
187
            lowerValue = m_inputSource->feedbackValue(QLCInputFeedback::LowerValue);
×
NEW
188
            upperValue = m_inputSource->feedbackValue(QLCInputFeedback::UpperValue);
×
NEW
189
            monitorValue = m_inputSource->feedbackValue(QLCInputFeedback::MonitorValue);
×
NEW
190
            extraLowerParams = m_inputSource->feedbackExtraParams(QLCInputFeedback::LowerValue);
×
NEW
191
            extraUpperParams = m_inputSource->feedbackExtraParams(QLCInputFeedback::UpperValue);
×
NEW
192
            extraMonitorParams = m_inputSource->feedbackExtraParams(QLCInputFeedback::MonitorValue);
×
193
        }
194
        m_inputSource = QSharedPointer<QLCInputSource>(new QLCInputSource(sic.universe(), (m_widgetPage << 16) | sic.channel()));
×
NEW
195
        if (!m_inputSource.isNull())
×
196
        {
NEW
197
            if (lowerValue != m_inputSource->feedbackValue(QLCInputFeedback::LowerValue))
×
NEW
198
                m_inputSource->setFeedbackValue(QLCInputFeedback::LowerValue, lowerValue);
×
NEW
199
            if (upperValue != m_inputSource->feedbackValue(QLCInputFeedback::UpperValue))
×
NEW
200
                m_inputSource->setFeedbackValue(QLCInputFeedback::UpperValue, upperValue);
×
NEW
201
            if (monitorValue != m_inputSource->feedbackValue(QLCInputFeedback::MonitorValue))
×
NEW
202
                m_inputSource->setFeedbackValue(QLCInputFeedback::MonitorValue, monitorValue);
×
NEW
203
            if (extraLowerParams.isValid())
×
NEW
204
                m_inputSource->setFeedbackExtraParams(QLCInputFeedback::LowerValue, extraLowerParams);
×
NEW
205
            if (extraUpperParams.isValid())
×
NEW
206
                m_inputSource->setFeedbackExtraParams(QLCInputFeedback::UpperValue, extraUpperParams);
×
NEW
207
            if (extraMonitorParams.isValid())
×
NEW
208
                m_inputSource->setFeedbackExtraParams(QLCInputFeedback::MonitorValue, extraMonitorParams);
×
209
        }
210
        updateInputSource();
×
211
        emit inputValueChanged(sic.universe(), (m_widgetPage << 16) | sic.channel());
×
UNCOV
212
    }
×
213
}
×
214

NEW
215
void InputSelectionWidget::slotCustomFeedbackClicked()
×
216
{
NEW
217
    CustomFeedbackDialog cfDialog(m_doc, m_inputSource, this);
×
NEW
218
    cfDialog.setMonitoringVisibility(m_supportMonitoring);
×
NEW
219
    cfDialog.exec();
×
UNCOV
220
}
×
221

222
void InputSelectionWidget::updateInputSource()
3✔
223
{
224
    QString uniName;
3✔
225
    QString chName;
3✔
226

227
    if (!m_inputSource || m_doc->inputOutputMap()->inputSourceNames(m_inputSource, uniName, chName) == false)
3✔
228
    {
229
        uniName = KInputNone;
3✔
230
        chName = KInputNone;
3✔
231
    }
232

233
    m_inputUniverseEdit->setText(uniName);
3✔
234
    m_inputChannelEdit->setText(chName);
3✔
235
}
3✔
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