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

mcallegari / qlcplus / 6618760541

23 Oct 2023 08:37PM UTC coverage: 28.075% (+0.04%) from 28.038%
6618760541

Pull #1462

github

web-flow
Merge f29f91b17 into 646f68840
Pull Request #1462: Overriding flash functionality

56 of 56 new or added lines in 6 files covered. (100.0%)

15368 of 54740 relevant lines covered (28.07%)

20323.53 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 "qlcinputprofile.h"
27
#include "qlcinputchannel.h"
28
#include "qlcioplugin.h"
29
#include "qlcfile.h"
30

31
#include "vcpropertieseditor.h"
32
#include "selectinputchannel.h"
33
#include "virtualconsole.h"
34
#include "vcproperties.h"
35
#include "inputpatch.h"
36
#include "vcframe.h"
37

38
/*****************************************************************************
39
 * Initialization
40
 *****************************************************************************/
41

42
VCPropertiesEditor::VCPropertiesEditor(QWidget* parent, const VCProperties& properties,
×
43
                                       InputOutputMap *ioMap)
×
44
    : QDialog(parent)
45
    , m_ioMap(ioMap)
×
46
{
47
    Q_ASSERT(ioMap != NULL);
×
48

49
    setupUi(this);
×
50

51
    QAction* action = new QAction(this);
×
52
    action->setShortcut(QKeySequence(QKeySequence::Close));
×
53
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
×
54
    addAction(action);
×
55

56
    m_properties = properties;
×
57

58
    /* General page */
59
    m_sizeXSpin->setValue(properties.size().width());
×
60
    m_sizeYSpin->setValue(properties.size().height());
×
61

62
    m_flashOverrideBox->setChecked(properties.flashOverrides());
×
63
    m_forceLTPBox->setChecked(properties.flashForceLTP());
×
64

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

117
    connect(m_speedValueEdit, SIGNAL(editingFinished()),
×
118
            this, SLOT(slotSpeedDialConfirmed()));
119

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

199
    /* Grand Master page */
200
    switch (properties.grandMasterChannelMode())
×
201
    {
202
    default:
×
203
    case GrandMaster::Intensity:
204
        m_gmIntensityRadio->setChecked(true);
×
205
        break;
×
206
    case GrandMaster::AllChannels:
×
207
        m_gmAllChannelsRadio->setChecked(true);
×
208
        break;
×
209
    }
210

211
    switch (properties.grandMasterValueMode())
×
212
    {
213
    default:
×
214
    case GrandMaster::Reduce:
215
        m_gmReduceRadio->setChecked(true);
×
216
        break;
×
217
    case GrandMaster::Limit:
×
218
        m_gmLimitRadio->setChecked(true);
×
219
        break;
×
220
    }
221

222
    switch (properties.grandMasterSlideMode())
×
223
    {
224
    default:
×
225
    case GrandMaster::Normal:
226
        m_gmSliderModeNormalRadio->setChecked(true);
×
227
        break;
×
228
    case GrandMaster::Inverted:
×
229
        m_gmSliderModeInvertedRadio->setChecked(true);
×
230
        break;
×
231
    }
232

233
    updateGrandMasterInputSource();
×
234
}
×
235

236
VCPropertiesEditor::~VCPropertiesEditor()
×
237
{
238
}
×
239

240
VCProperties VCPropertiesEditor::properties() const
×
241
{
242
    return m_properties;
×
243
}
244

245
QSize VCPropertiesEditor::buttonSize()
×
246
{
247
    return QSize(m_buttonWspin->value(), m_buttonHspin->value());
×
248
}
249

250
bool VCPropertiesEditor::buttonStatusLED()
×
251
{
252
    if (m_buttonStatusLEDRadio->isChecked())
×
253
        return true;
×
254
    else
255
        return false;
×
256
}
257

258
QSize VCPropertiesEditor::sliderSize()
×
259
{
260
    return QSize(m_sliderWspin->value(), m_sliderHspin->value());
×
261
}
262

263
QSize VCPropertiesEditor::speedDialSize()
×
264
{
265
    return QSize(m_speedWspin->value(), m_speedHspin->value());
×
266
}
267

268
uint VCPropertiesEditor::speedDialValue()
×
269
{
270
    return Function::stringToSpeed(m_speedValueEdit->text());
×
271
}
272

273
QSize VCPropertiesEditor::xypadSize()
×
274
{
275
    return QSize(m_xypadWspin->value(), m_xypadHspin->value());
×
276
}
277

278
QSize VCPropertiesEditor::cuelistSize()
×
279
{
280
    return QSize(m_cuelistWspin->value(), m_cuelistHspin->value());
×
281
}
282

283
QSize VCPropertiesEditor::frameSize()
×
284
{
285
    return QSize(m_frameWspin->value(), m_frameHspin->value());
×
286
}
287

288
QSize VCPropertiesEditor::soloFrameSize()
×
289
{
290
    return QSize(m_soloWspin->value(), m_soloHspin->value());
×
291
}
292

293
QSize VCPropertiesEditor::audioTriggersSize()
×
294
{
295
    return QSize(m_audioWspin->value(), m_audioHspin->value());
×
296
}
297

298
QSize VCPropertiesEditor::rgbMatrixSize()
×
299
{
300
    return QSize(m_matrixWspin->value(), m_matrixHspin->value());
×
301
}
302

303
/*****************************************************************************
304
 * Layout page
305
 *****************************************************************************/
306

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

314
void VCPropertiesEditor::slotSizeYChanged(int value)
×
315
{
316
    QSize sz(m_properties.size());
×
317
    sz.setHeight(value);
×
318
    m_properties.setSize(sz);
×
319
}
×
320

321
void VCPropertiesEditor::slotSpeedDialConfirmed()
×
322
{
323
    if (m_speedValueEdit->text().contains(".") == false)
×
324
    {
325
        m_speedValueEdit->setText(Function::speedToString(m_speedValueEdit->text().toUInt()));
×
326
    }
327
}
×
328

329
void VCPropertiesEditor::slotFlashOverrideToggled(bool value)
×
330
{
331
    m_properties.setFlashOverride(value);
×
332
}
×
333

334
void VCPropertiesEditor::slotForceLTPToggled(bool value)
×
335
{
336
    m_properties.setFlashForceLTP(value);
×
337
}
×
338

339

340
/*****************************************************************************
341
 * Grand Master page
342
 *****************************************************************************/
343

344
void VCPropertiesEditor::slotGrandMasterIntensityToggled(bool checked)
×
345
{
346
    if (checked == true)
×
347
        m_properties.setGrandMasterChannelMode(GrandMaster::Intensity);
×
348
    else
349
        m_properties.setGrandMasterChannelMode(GrandMaster::AllChannels);
×
350
}
×
351

352
void VCPropertiesEditor::slotGrandMasterReduceToggled(bool checked)
×
353
{
354
    if (checked == true)
×
355
        m_properties.setGrandMasterValueMode(GrandMaster::Reduce);
×
356
    else
357
        m_properties.setGrandMasterValueMode(GrandMaster::Limit);
×
358
}
×
359

360
void VCPropertiesEditor::slotGrandMasterSliderNormalToggled(bool checked)
×
361
{
362
    if (checked == true)
×
363
        m_properties.setGrandMasterSliderMode(GrandMaster::Normal);
×
364
    else
365
        m_properties.setGrandMasterSliderMode(GrandMaster::Inverted);
×
366
}
×
367

368
void VCPropertiesEditor::slotAutoDetectGrandMasterInputToggled(bool checked)
×
369
{
370
    if (checked == true)
×
371
    {
372
        connect(m_ioMap, SIGNAL(inputValueChanged(quint32,quint32,uchar)),
×
373
                this, SLOT(slotGrandMasterInputValueChanged(quint32,quint32)));
374
    }
375
    else
376
    {
377
        disconnect(m_ioMap, SIGNAL(inputValueChanged(quint32,quint32,uchar)),
×
378
                   this, SLOT(slotGrandMasterInputValueChanged(quint32,quint32)));
379
    }
380
}
×
381

382
void VCPropertiesEditor::slotGrandMasterInputValueChanged(quint32 universe,
×
383
                                                          quint32 channel)
384
{
385
    m_properties.setGrandMasterInputSource(universe, channel);
×
386
    updateGrandMasterInputSource();
×
387
}
×
388

389
void VCPropertiesEditor::slotChooseGrandMasterInputClicked()
×
390
{
391
    SelectInputChannel sic(this, m_ioMap);
×
392
    if (sic.exec() == QDialog::Accepted)
×
393
    {
394
        m_properties.setGrandMasterInputSource(sic.universe(), sic.channel());
×
395
        updateGrandMasterInputSource();
×
396
    }
397
}
×
398

399
void VCPropertiesEditor::updateGrandMasterInputSource()
×
400
{
401
    QString uniName;
×
402
    QString chName;
×
403

404
    if (m_ioMap->inputSourceNames(
×
405
                QSharedPointer<QLCInputSource>(
×
406
                    new QLCInputSource(
407
                        m_properties.grandMasterInputUniverse(),
×
408
                        m_properties.grandMasterInputChannel())),
×
409
                uniName, chName) == true)
×
410
    {
411
        /* Display the gathered information */
412
        m_gmInputUniverseEdit->setText(uniName);
×
413
        m_gmInputChannelEdit->setText(chName);
×
414
    }
415
    else
416
    {
417
        m_gmInputUniverseEdit->setText(KInputNone);
×
418
        m_gmInputChannelEdit->setText(KInputNone);
×
419
    }
420
}
×
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