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

mcallegari / qlcplus / 8961243534

05 May 2024 09:23PM UTC coverage: 32.068% (+4.0%) from 28.094%
8961243534

push

github

mcallegari
Merge branch 'master' into qmltoqt6

902 of 2557 new or added lines in 140 files covered. (35.28%)

166 existing lines in 76 files now uncovered.

15395 of 48008 relevant lines covered (32.07%)

22949.67 hits per line

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

44.79
/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 "assignhotkey.h"
27
#include "inputpatch.h"
28
#include "doc.h"
29

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

40
    setupUi(this);
4✔
41

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

173
void InputSelectionWidget::slotChooseInputClicked()
×
174
{
175
    SelectInputChannel sic(this, m_doc->inputOutputMap());
×
176
    if (sic.exec() == QDialog::Accepted)
×
177
    {
178
        m_inputSource = QSharedPointer<QLCInputSource>(new QLCInputSource(sic.universe(), (m_widgetPage << 16) | sic.channel()));
×
179
        updateInputSource();
×
180
        emit inputValueChanged(sic.universe(), (m_widgetPage << 16) | sic.channel());
×
181
    }
182
}
×
183

NEW
184
void InputSelectionWidget::slotCustomFeedbackClicked()
×
185
{
NEW
186
    CustomFeedbackDialog cfDialog(m_doc, m_inputSource, this);
×
NEW
187
    cfDialog.setMonitoringVisibility(m_supportMonitoring);
×
NEW
188
    cfDialog.exec();
×
UNCOV
189
}
×
190

191
void InputSelectionWidget::updateInputSource()
3✔
192
{
193
    QString uniName;
6✔
194
    QString chName;
6✔
195

196
    if (!m_inputSource || m_doc->inputOutputMap()->inputSourceNames(m_inputSource, uniName, chName) == false)
3✔
197
    {
198
        uniName = KInputNone;
3✔
199
        chName = KInputNone;
3✔
200
    }
201

202
    m_inputUniverseEdit->setText(uniName);
3✔
203
    m_inputChannelEdit->setText(chName);
3✔
204
}
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

© 2025 Coveralls, Inc