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

mcallegari / qlcplus / 14499310713

16 Apr 2025 05:57PM UTC coverage: 31.873% (+0.02%) from 31.853%
14499310713

push

github

mcallegari
Restore VC properties default page and update changelog

14691 of 46092 relevant lines covered (31.87%)

26441.99 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
#define SETTINGS_GEOMETRY "vcpropertieseditor/geometry"
35

36
/*****************************************************************************
37
 * Initialization
38
 *****************************************************************************/
39

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

47
    setupUi(this);
×
48

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

54
    m_properties = properties;
×
55

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

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

112
    connect(m_speedValueEdit, SIGNAL(editingFinished()),
×
113
            this, SLOT(slotSpeedDialConfirmed()));
114

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

194
    QVariant geometrySettings = settings.value(SETTINGS_GEOMETRY);
×
195
    if (geometrySettings.isValid() == true)
×
196
        restoreGeometry(geometrySettings.toByteArray());
×
197

198
    /* Grand Master page */
199
    m_gmVisible->setChecked(properties.grandMasterVisible());
×
200

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

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

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

234
    updateGrandMasterInputSource();
×
235
}
×
236

237
VCPropertiesEditor::~VCPropertiesEditor()
×
238
{
239
    QSettings settings;
×
240
    settings.setValue(SETTINGS_GEOMETRY, saveGeometry());
×
241
}
×
242

243
VCProperties VCPropertiesEditor::properties() const
×
244
{
245
    return m_properties;
×
246
}
247

248
QSize VCPropertiesEditor::buttonSize()
×
249
{
250
    return QSize(m_buttonWspin->value(), m_buttonHspin->value());
×
251
}
252

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

261
QSize VCPropertiesEditor::sliderSize()
×
262
{
263
    return QSize(m_sliderWspin->value(), m_sliderHspin->value());
×
264
}
265

266
QSize VCPropertiesEditor::speedDialSize()
×
267
{
268
    return QSize(m_speedWspin->value(), m_speedHspin->value());
×
269
}
270

271
uint VCPropertiesEditor::speedDialValue()
×
272
{
273
    return Function::stringToSpeed(m_speedValueEdit->text());
×
274
}
275

276
QSize VCPropertiesEditor::xypadSize()
×
277
{
278
    return QSize(m_xypadWspin->value(), m_xypadHspin->value());
×
279
}
280

281
QSize VCPropertiesEditor::cuelistSize()
×
282
{
283
    return QSize(m_cuelistWspin->value(), m_cuelistHspin->value());
×
284
}
285

286
QSize VCPropertiesEditor::frameSize()
×
287
{
288
    return QSize(m_frameWspin->value(), m_frameHspin->value());
×
289
}
290

291
QSize VCPropertiesEditor::soloFrameSize()
×
292
{
293
    return QSize(m_soloWspin->value(), m_soloHspin->value());
×
294
}
295

296
QSize VCPropertiesEditor::audioTriggersSize()
×
297
{
298
    return QSize(m_audioWspin->value(), m_audioHspin->value());
×
299
}
300

301
QSize VCPropertiesEditor::rgbMatrixSize()
×
302
{
303
    return QSize(m_matrixWspin->value(), m_matrixHspin->value());
×
304
}
305

306
/*****************************************************************************
307
 * Layout page
308
 *****************************************************************************/
309

310
void VCPropertiesEditor::slotSizeXChanged(int value)
×
311
{
312
    QSize sz(m_properties.size());
×
313
    sz.setWidth(value);
314
    m_properties.setSize(sz);
×
315
}
×
316

317
void VCPropertiesEditor::slotSizeYChanged(int value)
×
318
{
319
    QSize sz(m_properties.size());
×
320
    sz.setHeight(value);
321
    m_properties.setSize(sz);
×
322
}
×
323

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

332

333

334
/*****************************************************************************
335
 * Grand Master page
336
 *****************************************************************************/
337

338
void VCPropertiesEditor::slotGrandMasterVisibleToggled(bool checked)
×
339
{
340
    m_properties.setGrandMasterVisible(checked);
×
341
}
×
342

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

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

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

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

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

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

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

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