• 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/virtualconsole/vcpropertieseditor.cpp
1
/*
2
  Q Light Controller
3
  vcpropertieseditor.cpp
4

5
  Copyright (c) Heikki Junnila
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 <QRadioButton>
21
#include <QSettings>
22
#include <QCheckBox>
23
#include <QSpinBox>
24
#include <QAction>
25

26
#include "vcpropertieseditor.h"
27
#include "selectinputchannel.h"
28
#include "inputoutputmap.h"
29
#include "qlcinputsource.h"
30
#include "vcproperties.h"
31
#include "inputpatch.h"
32
#include "function.h"
33

34
/*****************************************************************************
35
 * Initialization
36
 *****************************************************************************/
37

38
VCPropertiesEditor::VCPropertiesEditor(QWidget* parent, const VCProperties& properties,
×
39
                                       InputOutputMap *ioMap)
×
40
    : QDialog(parent)
41
    , m_ioMap(ioMap)
×
42
{
43
    Q_ASSERT(ioMap != NULL);
×
44

45
    setupUi(this);
×
46

47
    QAction* action = new QAction(this);
×
48
    action->setShortcut(QKeySequence(QKeySequence::Close));
×
49
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
×
50
    addAction(action);
×
51

52
    m_properties = properties;
×
53

54
    /* General page */
55
    m_sizeXSpin->setValue(properties.size().width());
×
56
    m_sizeYSpin->setValue(properties.size().height());
×
57

58
    /* Widgets page */
59
    QSettings settings;
×
60
    // ********************* BUTTON ****************************
61
    QVariant var = settings.value(SETTINGS_BUTTON_SIZE);
×
62
    if (var.isValid() == true)
×
63
    {
64
        QSize size = var.toSize();
×
65
        m_buttonWspin->setValue(size.width());
×
66
        m_buttonHspin->setValue(size.height());
×
67
    }
68
    else
69
    {
70
        m_buttonWspin->setValue(50);
×
71
        m_buttonHspin->setValue(50);
×
72
    }
73
    // ********************* BUTTON STATUS *********************
74
    var = settings.value(SETTINGS_BUTTON_STATUSLED);
×
75
    if (var.isValid() == true && var.toBool() == true)
×
76
            m_buttonStatusLEDRadio->setChecked(true);
×
77
    // ********************* SLIDER ****************************
78
    var = settings.value(SETTINGS_SLIDER_SIZE);
×
79
    if (var.isValid() == true)
×
80
    {
81
        QSize size = var.toSize();
×
82
        m_sliderWspin->setValue(size.width());
×
83
        m_sliderHspin->setValue(size.height());
×
84
    }
85
    else
86
    {
87
        m_sliderWspin->setValue(60);
×
88
        m_sliderHspin->setValue(200);
×
89
    }
90
    // ********************* SPEED DIAL ************************
91
    var = settings.value(SETTINGS_SPEEDDIAL_SIZE);
×
92
    if (var.isValid() == true)
×
93
    {
94
        QSize size = var.toSize();
×
95
        m_speedWspin->setValue(size.width());
×
96
        m_speedHspin->setValue(size.height());
×
97
    }
98
    else
99
    {
100
        m_speedWspin->setValue(200);
×
101
        m_speedHspin->setValue(175);
×
102
    }
103
    // ********************* SPEED DIAL VALUE ******************
104
    var = settings.value(SETTINGS_SPEEDDIAL_VALUE);
×
105
    if (var.isValid() == true)
×
106
        m_speedValueEdit->setText(Function::speedToString(var.toUInt()));
×
107
    else
108
        m_speedValueEdit->setText(Function::speedToString(0));
×
109

110
    connect(m_speedValueEdit, SIGNAL(editingFinished()),
×
111
            this, SLOT(slotSpeedDialConfirmed()));
112

113
    // ********************* XY PAD ****************************
114
    var = settings.value(SETTINGS_XYPAD_SIZE);
×
115
    if (var.isValid() == true)
×
116
    {
117
        QSize size = var.toSize();
×
118
        m_xypadWspin->setValue(size.width());
×
119
        m_xypadHspin->setValue(size.height());
×
120
    }
121
    else
122
    {
123
        m_xypadWspin->setValue(230);
×
124
        m_xypadHspin->setValue(230);
×
125
    }
126
    // ********************* CUE LIST **************************
127
    var = settings.value(SETTINGS_CUELIST_SIZE);
×
128
    if (var.isValid() == true)
×
129
    {
130
        QSize size = var.toSize();
×
131
        m_cuelistWspin->setValue(size.width());
×
132
        m_cuelistHspin->setValue(size.height());
×
133
    }
134
    else
135
    {
136
        m_cuelistWspin->setValue(300);
×
137
        m_cuelistHspin->setValue(220);
×
138
    }
139
    // ************************ FRAME **************************
140
    var = settings.value(SETTINGS_FRAME_SIZE);
×
141
    if (var.isValid() == true)
×
142
    {
143
        QSize size = var.toSize();
×
144
        m_frameWspin->setValue(size.width());
×
145
        m_frameHspin->setValue(size.height());
×
146
    }
147
    else
148
    {
149
        m_frameWspin->setValue(200);
×
150
        m_frameHspin->setValue(200);
×
151
    }
152
    // ********************* SOLO FRAME ************************
153
    var = settings.value(SETTINGS_SOLOFRAME_SIZE);
×
154
    if (var.isValid() == true)
×
155
    {
156
        QSize size = var.toSize();
×
157
        m_soloWspin->setValue(size.width());
×
158
        m_soloHspin->setValue(size.height());
×
159
    }
160
    else
161
    {
162
        m_soloWspin->setValue(200);
×
163
        m_soloHspin->setValue(200);
×
164
    }
165
    // ***************** AUDIO TRIGGERS ************************
166
    var = settings.value(SETTINGS_AUDIOTRIGGERS_SIZE);
×
167
    if (var.isValid() == true)
×
168
    {
169
        QSize size = var.toSize();
×
170
        m_audioWspin->setValue(size.width());
×
171
        m_audioHspin->setValue(size.height());
×
172
    }
173
    else
174
    {
175
        m_audioWspin->setValue(200);
×
176
        m_audioHspin->setValue(200);
×
177
    }
178
    // ***************** RGB MATRIX ************************
179
    var = settings.value(SETTINGS_RGBMATRIX_SIZE);
×
180
    if (var.isValid() == true)
×
181
    {
182
        QSize size = var.toSize();
×
183
        m_matrixWspin->setValue(size.width());
×
184
        m_matrixHspin->setValue(size.height());
×
185
    }
186
    else
187
    {
188
        m_matrixWspin->setValue(160);
×
189
        m_matrixHspin->setValue(120);
×
190
    }
191

192
    /* Grand Master page */
193
    switch (properties.grandMasterChannelMode())
×
194
    {
195
    default:
×
196
    case GrandMaster::Intensity:
197
        m_gmIntensityRadio->setChecked(true);
×
198
        break;
×
199
    case GrandMaster::AllChannels:
×
200
        m_gmAllChannelsRadio->setChecked(true);
×
201
        break;
×
202
    }
203

204
    switch (properties.grandMasterValueMode())
×
205
    {
206
    default:
×
207
    case GrandMaster::Reduce:
208
        m_gmReduceRadio->setChecked(true);
×
209
        break;
×
210
    case GrandMaster::Limit:
×
211
        m_gmLimitRadio->setChecked(true);
×
212
        break;
×
213
    }
214

215
    switch (properties.grandMasterSlideMode())
×
216
    {
217
    default:
×
218
    case GrandMaster::Normal:
219
        m_gmSliderModeNormalRadio->setChecked(true);
×
220
        break;
×
221
    case GrandMaster::Inverted:
×
222
        m_gmSliderModeInvertedRadio->setChecked(true);
×
223
        break;
×
224
    }
225

226
    updateGrandMasterInputSource();
×
227
}
×
228

229
VCPropertiesEditor::~VCPropertiesEditor()
×
230
{
231
}
×
232

233
VCProperties VCPropertiesEditor::properties() const
×
234
{
235
    return m_properties;
×
236
}
237

238
QSize VCPropertiesEditor::buttonSize()
×
239
{
240
    return QSize(m_buttonWspin->value(), m_buttonHspin->value());
×
241
}
242

243
bool VCPropertiesEditor::buttonStatusLED()
×
244
{
245
    if (m_buttonStatusLEDRadio->isChecked())
×
246
        return true;
×
247
    else
248
        return false;
×
249
}
250

251
QSize VCPropertiesEditor::sliderSize()
×
252
{
253
    return QSize(m_sliderWspin->value(), m_sliderHspin->value());
×
254
}
255

256
QSize VCPropertiesEditor::speedDialSize()
×
257
{
258
    return QSize(m_speedWspin->value(), m_speedHspin->value());
×
259
}
260

261
uint VCPropertiesEditor::speedDialValue()
×
262
{
263
    return Function::stringToSpeed(m_speedValueEdit->text());
×
264
}
265

266
QSize VCPropertiesEditor::xypadSize()
×
267
{
268
    return QSize(m_xypadWspin->value(), m_xypadHspin->value());
×
269
}
270

271
QSize VCPropertiesEditor::cuelistSize()
×
272
{
273
    return QSize(m_cuelistWspin->value(), m_cuelistHspin->value());
×
274
}
275

276
QSize VCPropertiesEditor::frameSize()
×
277
{
278
    return QSize(m_frameWspin->value(), m_frameHspin->value());
×
279
}
280

281
QSize VCPropertiesEditor::soloFrameSize()
×
282
{
283
    return QSize(m_soloWspin->value(), m_soloHspin->value());
×
284
}
285

286
QSize VCPropertiesEditor::audioTriggersSize()
×
287
{
288
    return QSize(m_audioWspin->value(), m_audioHspin->value());
×
289
}
290

291
QSize VCPropertiesEditor::rgbMatrixSize()
×
292
{
293
    return QSize(m_matrixWspin->value(), m_matrixHspin->value());
×
294
}
295

296
/*****************************************************************************
297
 * Layout page
298
 *****************************************************************************/
299

300
void VCPropertiesEditor::slotSizeXChanged(int value)
×
301
{
302
    QSize sz(m_properties.size());
×
303
    sz.setWidth(value);
×
304
    m_properties.setSize(sz);
×
305
}
×
306

307
void VCPropertiesEditor::slotSizeYChanged(int value)
×
308
{
309
    QSize sz(m_properties.size());
×
310
    sz.setHeight(value);
×
311
    m_properties.setSize(sz);
×
312
}
×
313

314
void VCPropertiesEditor::slotSpeedDialConfirmed()
×
315
{
316
    if (m_speedValueEdit->text().contains(".") == false)
×
317
    {
318
        m_speedValueEdit->setText(Function::speedToString(m_speedValueEdit->text().toUInt()));
×
319
    }
320
}
×
321

322
/*****************************************************************************
323
 * Grand Master page
324
 *****************************************************************************/
325

326
void VCPropertiesEditor::slotGrandMasterIntensityToggled(bool checked)
×
327
{
328
    if (checked == true)
×
329
        m_properties.setGrandMasterChannelMode(GrandMaster::Intensity);
×
330
    else
331
        m_properties.setGrandMasterChannelMode(GrandMaster::AllChannels);
×
332
}
×
333

334
void VCPropertiesEditor::slotGrandMasterReduceToggled(bool checked)
×
335
{
336
    if (checked == true)
×
337
        m_properties.setGrandMasterValueMode(GrandMaster::Reduce);
×
338
    else
339
        m_properties.setGrandMasterValueMode(GrandMaster::Limit);
×
340
}
×
341

342
void VCPropertiesEditor::slotGrandMasterSliderNormalToggled(bool checked)
×
343
{
344
    if (checked == true)
×
345
        m_properties.setGrandMasterSliderMode(GrandMaster::Normal);
×
346
    else
347
        m_properties.setGrandMasterSliderMode(GrandMaster::Inverted);
×
348
}
×
349

350
void VCPropertiesEditor::slotAutoDetectGrandMasterInputToggled(bool checked)
×
351
{
352
    if (checked == true)
×
353
    {
354
        connect(m_ioMap, SIGNAL(inputValueChanged(quint32,quint32,uchar)),
×
355
                this, SLOT(slotGrandMasterInputValueChanged(quint32,quint32)));
356
    }
357
    else
358
    {
359
        disconnect(m_ioMap, SIGNAL(inputValueChanged(quint32,quint32,uchar)),
×
360
                   this, SLOT(slotGrandMasterInputValueChanged(quint32,quint32)));
361
    }
362
}
×
363

364
void VCPropertiesEditor::slotGrandMasterInputValueChanged(quint32 universe,
×
365
                                                          quint32 channel)
366
{
367
    m_properties.setGrandMasterInputSource(universe, channel);
×
368
    updateGrandMasterInputSource();
×
369
}
×
370

371
void VCPropertiesEditor::slotChooseGrandMasterInputClicked()
×
372
{
373
    SelectInputChannel sic(this, m_ioMap);
×
374
    if (sic.exec() == QDialog::Accepted)
×
375
    {
376
        m_properties.setGrandMasterInputSource(sic.universe(), sic.channel());
×
377
        updateGrandMasterInputSource();
×
378
    }
379
}
×
380

381
void VCPropertiesEditor::updateGrandMasterInputSource()
×
382
{
383
    QString uniName;
×
384
    QString chName;
×
385

386
    if (m_ioMap->inputSourceNames(
×
387
                QSharedPointer<QLCInputSource>(
×
388
                    new QLCInputSource(
389
                        m_properties.grandMasterInputUniverse(),
×
390
                        m_properties.grandMasterInputChannel())),
×
391
                uniName, chName) == true)
×
392
    {
393
        /* Display the gathered information */
394
        m_gmInputUniverseEdit->setText(uniName);
×
395
        m_gmInputChannelEdit->setText(chName);
×
396
    }
397
    else
398
    {
399
        m_gmInputUniverseEdit->setText(KInputNone);
×
400
        m_gmInputChannelEdit->setText(KInputNone);
×
401
    }
402
}
×
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