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

mcallegari / qlcplus / 13633248611

03 Mar 2025 02:31PM UTC coverage: 31.871% (+0.4%) from 31.5%
13633248611

push

github

web-flow
actions: add chrpath to profile

14689 of 46089 relevant lines covered (31.87%)

26426.11 hits per line

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

0.0
/ui/src/virtualconsole/vcspeeddialproperties.cpp
1
/*
2
  Q Light Controller
3
  vcspeeddialproperties.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 <QDebug>
21

22
#include "vcspeeddialproperties.h"
23
#include "inputselectionwidget.h"
24
#include "vcspeeddialfunction.h"
25
#include "selectinputchannel.h"
26
#include "functionselection.h"
27
#include "vcspeeddial.h"
28
#include "vcspeeddialpreset.h"
29
#include "speeddial.h"
30
#include "apputil.h"
31
#include "doc.h"
32

33
#define PROP_ID  Qt::UserRole
34

35
#define COL_NAME     0
36
#define COL_FADEIN   1
37
#define COL_FADEOUT  2
38
#define COL_DURATION 3
39

40
VCSpeedDialProperties::VCSpeedDialProperties(VCSpeedDial* dial, Doc* doc)
×
41
    : QDialog(dial)
42
    , m_dial(dial)
×
43
    , m_doc(doc)
×
44
    , m_copyItem(NULL)
×
45
{
46
    Q_ASSERT(dial != NULL);
47
    Q_ASSERT(doc != NULL);
48

49
    setupUi(this);
×
50

51
    // IDs 0-15 are reserved for speed dial base controls
52
    m_lastAssignedID = 15;
×
53

54
    /* Name */
55
    m_nameEdit->setText(m_dial->caption());
×
56

57
    /* Functions */
58
    foreach (const VCSpeedDialFunction &speeddialfunction, m_dial->functions())
×
59
        createFunctionItem(speeddialfunction);
×
60

61
    /* Forbid editing the function name */
62
    m_tree->setItemDelegateForColumn(COL_NAME, new NoEditDelegate(this));
×
63
    /* Combobox for editing the multipliers */
64
    const QStringList &multiplierNames = VCSpeedDialFunction::speedMultiplierNames();
×
65
    m_tree->setItemDelegateForColumn(COL_FADEIN, new ComboBoxDelegate(multiplierNames, this));
×
66
    m_tree->setItemDelegateForColumn(COL_FADEOUT, new ComboBoxDelegate(multiplierNames, this));
×
67
    m_tree->setItemDelegateForColumn(COL_DURATION, new ComboBoxDelegate(multiplierNames, this));
×
68

69
    /* Absolute input */
70
    connect(m_absolutePrecisionCb, SIGNAL(toggled(bool)),
×
71
            this, SLOT(slotAbsolutePrecisionCbChecked(bool)));
72
    if (m_dial->absoluteValueMin() % (1000) || m_dial->absoluteValueMax() % (1000))
×
73
    {
74
        m_absolutePrecisionCb->setChecked(true);
×
75
        m_absoluteMinSpin->setValue(m_dial->absoluteValueMin());
×
76
        m_absoluteMaxSpin->setValue(m_dial->absoluteValueMax());
×
77
    }
78
    else
79
    {
80
        m_absolutePrecisionCb->setChecked(false);
×
81
        m_absoluteMinSpin->setValue(m_dial->absoluteValueMin() / 1000);
×
82
        m_absoluteMaxSpin->setValue(m_dial->absoluteValueMax() / 1000);
×
83
    }
84
    m_absoluteInputWidget = new InputSelectionWidget(m_doc, this);
×
85
    m_absoluteInputWidget->setInputSource(m_dial->inputSource(VCSpeedDial::absoluteInputSourceId));
×
86
    m_absoluteInputWidget->setWidgetPage(m_dial->page());
×
87
    m_absoluteInputWidget->setKeyInputVisibility(false);
×
88
    m_absoluteInputWidget->show();
×
89
    m_absoluteInputLayout->addWidget(m_absoluteInputWidget);
×
90

91
    /* Tap input */
92
    m_tapInputWidget = new InputSelectionWidget(m_doc, this);
×
93
    m_tapInputWidget->setInputSource(m_dial->inputSource(VCSpeedDial::tapInputSourceId));
×
94
    m_tapInputWidget->setWidgetPage(m_dial->page());
×
95
    m_tapInputWidget->setKeySequence(dial->tapKeySequence());
×
96
    m_tapInputWidget->show();
×
97
    m_tapInputLayout->addWidget(m_tapInputWidget);
×
98

99
    /* Apply input */
100
    m_applyInputWidget = new InputSelectionWidget(m_doc, this);
×
101
    m_applyInputWidget->setInputSource(m_dial->inputSource(VCSpeedDial::applyInputSourceId));
×
102
    m_applyInputWidget->setWidgetPage(m_dial->page());
×
103
    m_applyInputWidget->setKeySequence(dial->applyKeySequence());
×
104
    m_applyInputWidget->show();
×
105
    m_applyInputLayout->addWidget(m_applyInputWidget);
×
106

107
    // Mult/Div options
108
    m_resetFactorOnDialChangeCb->setChecked(m_dial->resetFactorOnDialChange());
×
109

110
    /* Mult input */
111
    m_multInputWidget = new InputSelectionWidget(m_doc, this);
×
112
    m_multInputWidget->setTitle(tr("Multiply by 2 Input"));
×
113
    m_multInputWidget->setInputSource(m_dial->inputSource(VCSpeedDial::multInputSourceId));
×
114
    m_multInputWidget->setWidgetPage(m_dial->page());
×
115
    m_multInputWidget->setKeySequence(dial->multKeySequence());
×
116
    m_multInputWidget->show();
×
117
    m_multInputLayout->addWidget(m_multInputWidget);
×
118

119
    /* Div input */
120
    m_divInputWidget = new InputSelectionWidget(m_doc, this);
×
121
    m_divInputWidget->setTitle(tr("Divide by 2 Input"));
×
122
    m_divInputWidget->setInputSource(m_dial->inputSource(VCSpeedDial::divInputSourceId));
×
123
    m_divInputWidget->setWidgetPage(m_dial->page());
×
124
    m_divInputWidget->setKeySequence(dial->divKeySequence());
×
125
    m_divInputWidget->show();
×
126
    m_divInputLayout->addWidget(m_divInputWidget);
×
127

128
    /* MultDiv Reset input */
129
    m_multDivResetInputWidget = new InputSelectionWidget(m_doc, this);
×
130
    m_multDivResetInputWidget->setTitle(tr("Factor Reset Input"));
×
131
    m_multDivResetInputWidget->setInputSource(m_dial->inputSource(VCSpeedDial::multDivResetInputSourceId));
×
132
    m_multDivResetInputWidget->setWidgetPage(m_dial->page());
×
133
    m_multDivResetInputWidget->setKeySequence(dial->multDivResetKeySequence());
×
134
    m_multDivResetInputWidget->show();
×
135
    m_multDivResetInputLayout->addWidget(m_multDivResetInputWidget);
×
136

137
    /* Visibility */
138
    quint32 dialMask = m_dial->visibilityMask();
×
139
    if (dialMask & SpeedDial::PlusMinus) m_pmCheck->setChecked(true);
×
140
    if (dialMask & SpeedDial::Dial) m_dialCheck->setChecked(true);
×
141
    if (dialMask & SpeedDial::Tap) m_tapCheck->setChecked(true);
×
142
    if (dialMask & SpeedDial::Hours) m_hoursCheck->setChecked(true);
×
143
    if (dialMask & SpeedDial::Minutes) m_minCheck->setChecked(true);
×
144
    if (dialMask & SpeedDial::Seconds) m_secCheck->setChecked(true);
×
145
    if (dialMask & SpeedDial::Milliseconds) m_msCheck->setChecked(true);
×
146
    if (dialMask & VCSpeedDial::MultDiv) m_mdCheck->setChecked(true);
×
147
    if (dialMask & VCSpeedDial::Apply) m_applyCheck->setChecked(true);
×
148

149
    /* Presets */
150
    foreach (VCSpeedDialPreset const* preset, m_dial->presets())
×
151
    {
152
        m_presets.append(new VCSpeedDialPreset(*preset));
×
153
        if (preset->m_id > m_lastAssignedID)
×
154
            m_lastAssignedID = preset->m_id;
×
155
    }
156
    m_presetsTree->setSelectionMode(QAbstractItemView::SingleSelection);
×
157
    updateTree();
×
158

159
    m_presetInputWidget = new InputSelectionWidget(m_doc, this);
×
160
    m_presetInputWidget->setCustomFeedbackVisibility(true);
×
161
    m_presetInputWidget->setWidgetPage(m_dial->page());
×
162
    m_presetInputWidget->show();
×
163
    m_presetInputLayout->addWidget(m_presetInputWidget);
×
164

165
    connect(m_presetInputWidget, SIGNAL(inputValueChanged(quint32,quint32)),
×
166
            this, SLOT(slotInputValueChanged(quint32,quint32)));
167
    connect(m_presetInputWidget, SIGNAL(keySequenceChanged(QKeySequence)),
×
168
            this, SLOT(slotKeySequenceChanged(QKeySequence)));
169

170
    connect(m_presetsTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
×
171
            this, SLOT(slotTreeSelectionChanged()));
172

173
    connect(m_addPresetButton, SIGNAL(clicked()),
×
174
            this, SLOT(slotAddPresetClicked()));
175
    connect(m_removePresetButton, SIGNAL(clicked()),
×
176
            this, SLOT(slotRemovePresetClicked()));
177
    connect(m_presetNameEdit, SIGNAL(textEdited(QString const&)),
×
178
            this, SLOT(slotPresetNameEdited(QString const&)));
179

180
    connect(m_speedDialWidget, SIGNAL(valueChanged(int)),
×
181
            this, SLOT(slotSpeedDialWidgetValueChanged(int)));
182

183
    connect(m_addButton, SIGNAL(clicked()),
×
184
            this, SLOT(slotAddClicked()));
185
    connect(m_removeButton, SIGNAL(clicked()),
×
186
            this, SLOT(slotRemoveClicked()));
187

188
    connect(m_copyFactorsButton, SIGNAL(clicked()),
×
189
            this, SLOT(slotCopyFactorsClicked()));
190
    connect(m_pasteFactorsButton, SIGNAL(clicked()),
×
191
            this, SLOT(slotPasteFactorsClicked()));
192
}
×
193

194
VCSpeedDialProperties::~VCSpeedDialProperties()
×
195
{
196
    foreach (VCSpeedDialPreset* preset, m_presets)
×
197
    {
198
        delete preset;
×
199
    }
200
}
×
201

202
void VCSpeedDialProperties::accept()
×
203
{
204
    /* Name */
205
    m_dial->setCaption(m_nameEdit->text());
×
206

207
    /* Functions */
208
    m_dial->setFunctions(functions());
×
209

210
    /* Input sources */
211
    if (m_absolutePrecisionCb->isChecked())
×
212
        m_dial->setAbsoluteValueRange(m_absoluteMinSpin->value(),
×
213
                                      m_absoluteMaxSpin->value());
×
214
    else
215
        m_dial->setAbsoluteValueRange(m_absoluteMinSpin->value() * 1000,
×
216
                                      m_absoluteMaxSpin->value() * 1000);
×
217
    m_dial->setInputSource(m_absoluteInputWidget->inputSource(), VCSpeedDial::absoluteInputSourceId);
×
218

219
    m_dial->setInputSource(m_tapInputWidget->inputSource(), VCSpeedDial::tapInputSourceId);
×
220
    m_dial->setTapKeySequence(m_tapInputWidget->keySequence());
×
221

222
    m_dial->setInputSource(m_applyInputWidget->inputSource(), VCSpeedDial::applyInputSourceId);
×
223
    m_dial->setApplyKeySequence(m_applyInputWidget->keySequence());
×
224

225
    // Mult & Div
226
    m_dial->setResetFactorOnDialChange(m_resetFactorOnDialChangeCb->isChecked());
×
227
    m_dial->setInputSource(m_multInputWidget->inputSource(), VCSpeedDial::multInputSourceId);
×
228
    m_dial->setMultKeySequence(m_multInputWidget->keySequence());
×
229
    m_dial->setInputSource(m_divInputWidget->inputSource(), VCSpeedDial::divInputSourceId);
×
230
    m_dial->setDivKeySequence(m_divInputWidget->keySequence());
×
231
    m_dial->setInputSource(m_multDivResetInputWidget->inputSource(), VCSpeedDial::multDivResetInputSourceId);
×
232
    m_dial->setMultDivResetKeySequence(m_multDivResetInputWidget->keySequence());
×
233

234
    /* Visibility */
235
    quint32 dialMask = 0;
236
    if (m_pmCheck->isChecked()) dialMask |= SpeedDial::PlusMinus;
×
237
    if (m_dialCheck->isChecked()) dialMask |= SpeedDial::Dial;
×
238
    if (m_tapCheck->isChecked()) dialMask |= SpeedDial::Tap;
×
239
    if (m_hoursCheck->isChecked()) dialMask |= SpeedDial::Hours;
×
240
    if (m_minCheck->isChecked()) dialMask |= SpeedDial::Minutes;
×
241
    if (m_secCheck->isChecked()) dialMask |= SpeedDial::Seconds;
×
242
    if (m_msCheck->isChecked()) dialMask |= SpeedDial::Milliseconds;
×
243
    if (m_mdCheck->isChecked()) dialMask |= VCSpeedDial::MultDiv;
×
244
    if (m_applyCheck->isChecked()) dialMask |= VCSpeedDial::Apply;
×
245
    m_dial->setVisibilityMask(dialMask);
×
246

247
    /* Presets */
248
    m_dial->resetPresets();
×
249
    for (int i = 0; i < m_presets.count(); i++)
×
250
        m_dial->addPreset(*m_presets.at(i));
×
251

252
    QDialog::accept();
×
253
}
×
254

255
/****************************************************************************
256
 * Functions page
257
 ****************************************************************************/
258

259
void VCSpeedDialProperties::slotAddClicked()
×
260
{
261
    FunctionSelection fs(this, m_doc);
×
262
    fs.setMultiSelection(true);
×
263
    QList <quint32> ids;
264
    foreach (const VCSpeedDialFunction &speeddialfunction, functions())
×
265
        ids.append(speeddialfunction.functionId);
×
266
    fs.setDisabledFunctions(ids);
×
267
    if (fs.exec() == QDialog::Accepted)
×
268
    {
269
        foreach (quint32 id, fs.selection())
×
270
            createFunctionItem(id);
×
271
    }
272
}
×
273

274
void VCSpeedDialProperties::slotRemoveClicked()
×
275
{
276
    QListIterator <QTreeWidgetItem*> it(m_tree->selectedItems());
×
277
    while (it.hasNext() == true)
×
278
        delete it.next();
×
279
}
×
280

281
void VCSpeedDialProperties::slotCopyFactorsClicked()
×
282
{
283
    QList <QTreeWidgetItem*> allSelected = m_tree->selectedItems();
×
284
    if (allSelected.isEmpty())
×
285
        return;
286

287
    m_copyItem = allSelected.first();
×
288
    m_pasteFactorsButton->setEnabled(true);
×
289
}
×
290

291
void VCSpeedDialProperties::slotPasteFactorsClicked()
×
292
{
293
    if (m_copyItem == NULL)
×
294
        return;
295

296
    // is only called after the paste button has been enabled and copiedFactorValues is filled with data
297
    const QStringList &multiplierNames = VCSpeedDialFunction::speedMultiplierNames();
×
298

299
    VCSpeedDialFunction::SpeedMultiplier fadeInMultiplier = static_cast<VCSpeedDialFunction::SpeedMultiplier>(m_copyItem->data(COL_FADEIN, PROP_ID).toUInt());
×
300
    VCSpeedDialFunction::SpeedMultiplier fadeOutMultiplier = static_cast<VCSpeedDialFunction::SpeedMultiplier>(m_copyItem->data(COL_FADEOUT, PROP_ID).toUInt());
×
301
    VCSpeedDialFunction::SpeedMultiplier durationMultiplier = static_cast<VCSpeedDialFunction::SpeedMultiplier>(m_copyItem->data(COL_DURATION, PROP_ID).toUInt());
×
302

303
    foreach (QTreeWidgetItem* item, m_tree->selectedItems())
×
304
    {
305
        Q_ASSERT(item != NULL);
306

307
        QVariant id = item->data(COL_NAME, PROP_ID);
×
308
        if (id.isValid() == true)
×
309
        {
310
            item->setText(COL_FADEIN, multiplierNames[fadeInMultiplier]);
×
311
            item->setData(COL_FADEIN, PROP_ID, fadeInMultiplier);
×
312
            item->setText(COL_FADEOUT, multiplierNames[fadeOutMultiplier]);
×
313
            item->setData(COL_FADEOUT, PROP_ID, fadeOutMultiplier);
×
314
            item->setText(COL_DURATION, multiplierNames[durationMultiplier]);
×
315
            item->setData(COL_DURATION, PROP_ID, durationMultiplier);
×
316
        }
317
    }
×
318
}
319

320
QList <VCSpeedDialFunction> VCSpeedDialProperties::functions() const
×
321
{
322
    QList <VCSpeedDialFunction> list;
323
    for (int i = 0; i < m_tree->topLevelItemCount(); i++)
×
324
    {
325
        QTreeWidgetItem* item = m_tree->topLevelItem(i);
×
326
        Q_ASSERT(item != NULL);
327

328
        QVariant id = item->data(COL_NAME, PROP_ID);
×
329
        if (id.isValid() == true)
×
330
        {
331
            VCSpeedDialFunction speeddialfunction(id.toUInt());
×
332
            speeddialfunction.fadeInMultiplier = static_cast<VCSpeedDialFunction::SpeedMultiplier>(item->data(COL_FADEIN, PROP_ID).toUInt());
×
333
            speeddialfunction.fadeOutMultiplier = static_cast<VCSpeedDialFunction::SpeedMultiplier>(item->data(COL_FADEOUT, PROP_ID).toUInt());
×
334
            speeddialfunction.durationMultiplier = static_cast<VCSpeedDialFunction::SpeedMultiplier>(item->data(COL_DURATION, PROP_ID).toUInt());
×
335
            list.append(speeddialfunction);
×
336
        }
337
    }
×
338

339
    return list;
×
340
}
×
341

342
void VCSpeedDialProperties::createFunctionItem(const VCSpeedDialFunction &speeddialfunction)
×
343
{
344
    Function* function = m_doc->function(speeddialfunction.functionId);
×
345
    if (function != NULL)
×
346
    {
347
        QTreeWidgetItem* item = new QTreeWidgetItem(m_tree);
×
348
        item->setText(COL_NAME, function->name());
×
349
        item->setData(COL_NAME, PROP_ID, speeddialfunction.functionId);
×
350

351
        const QStringList &multiplierNames = VCSpeedDialFunction::speedMultiplierNames();
×
352

353
        item->setText(COL_FADEIN, multiplierNames[speeddialfunction.fadeInMultiplier]);
×
354
        item->setData(COL_FADEIN, PROP_ID, speeddialfunction.fadeInMultiplier);
×
355
        item->setText(COL_FADEOUT, multiplierNames[speeddialfunction.fadeOutMultiplier]);
×
356
        item->setData(COL_FADEOUT, PROP_ID, speeddialfunction.fadeOutMultiplier);
×
357
        item->setText(COL_DURATION, multiplierNames[speeddialfunction.durationMultiplier]);
×
358
        item->setData(COL_DURATION, PROP_ID, speeddialfunction.durationMultiplier);
×
359
        item->setFlags(item->flags() | Qt::ItemIsEditable);
×
360
    }
361
}
×
362

363
/****************************************************************************
364
 * Input page
365
 ****************************************************************************/
366

367
void VCSpeedDialProperties::slotAbsolutePrecisionCbChecked(bool checked)
×
368
{
369
    if (checked)
×
370
    {
371
        m_absoluteMinSpin->setSuffix("ms");
×
372
        m_absoluteMinSpin->setMaximum(600 * 1000);
×
373
        m_absoluteMinSpin->setValue(m_absoluteMinSpin->value() * 1000);
×
374
        m_absoluteMaxSpin->setSuffix("ms");
×
375
        m_absoluteMaxSpin->setMaximum(600 * 1000);
×
376
        m_absoluteMaxSpin->setValue(m_absoluteMaxSpin->value() * 1000);
×
377
    }
378
    else
379
    {
380
        m_absoluteMinSpin->setSuffix("s");
×
381
        m_absoluteMinSpin->setValue(m_absoluteMinSpin->value() / 1000);
×
382
        m_absoluteMinSpin->setMaximum(600);
×
383
        m_absoluteMaxSpin->setSuffix("s");
×
384
        m_absoluteMaxSpin->setValue(m_absoluteMaxSpin->value() / 1000);
×
385
        m_absoluteMaxSpin->setMaximum(600);
×
386
    }
387
}
×
388

389
/*********************************************************************
390
 * Presets
391
 *********************************************************************/
392

393
void VCSpeedDialProperties::updateTree()
×
394
{
395
    m_presetsTree->blockSignals(true);
×
396
    m_presetsTree->clear();
×
397
    foreach (VCSpeedDialPreset* preset, m_presets)
×
398
    {
399
        QTreeWidgetItem *item = new QTreeWidgetItem(m_presetsTree);
×
400
        item->setData(0, Qt::UserRole, preset->m_id);
×
401
        item->setText(0, preset->m_name);
×
402
        item->setText(1, Function::speedToString(preset->m_value));
×
403
    }
404
    m_presetsTree->resizeColumnToContents(0);
×
405
    m_presetsTree->blockSignals(false);
×
406
}
×
407

408
void VCSpeedDialProperties::updateTreeItem(VCSpeedDialPreset const& preset)
×
409
{
410
    m_presetsTree->blockSignals(true);
×
411
    m_presetsTree->resizeColumnToContents(0);
×
412
    for (int i = 0; i < m_presetsTree->topLevelItemCount(); ++i)
×
413
    {
414
        QTreeWidgetItem* treeItem = m_presetsTree->topLevelItem(i);
×
415
        if (treeItem->data(0, Qt::UserRole).toUInt() == preset.m_id)
×
416
        {
417
            treeItem->setText(0, preset.m_name);
×
418
            treeItem->setText(1, Function::speedToString(preset.m_value));
×
419
            m_presetsTree->blockSignals(false);
×
420
            return;
×
421
        }
422
    }
423
    Q_ASSERT(false);
424
}
425

426
VCSpeedDialPreset* VCSpeedDialProperties::getSelectedPreset()
×
427
{
428
    if (m_presetsTree->selectedItems().isEmpty())
×
429
        return NULL;
430

431
    QTreeWidgetItem* item = m_presetsTree->selectedItems().first();
×
432
    if (item != NULL)
×
433
    {
434
        quint8 presetID = item->data(0, Qt::UserRole).toUInt();
×
435
        foreach (VCSpeedDialPreset* preset, m_presets)
×
436
        {
437
            if (preset->m_id == presetID)
×
438
                return preset;
439
        }
440
    }
441

442
    Q_ASSERT(false);
443
    return NULL;
444
}
445

446
void VCSpeedDialProperties::addPreset(VCSpeedDialPreset *preset)
×
447
{
448
    m_presets.append(preset);
×
449
}
×
450

451
void VCSpeedDialProperties::removePreset(quint8 id)
×
452
{
453
    for (int i = 0; i < m_presets.count(); i++)
×
454
    {
455
        if (m_presets.at(i)->m_id == id)
×
456
        {
457
            m_presets.removeAt(i);
×
458
            return;
×
459
        }
460
    }
461
}
462

463
void VCSpeedDialProperties::slotAddPresetClicked()
×
464
{
465
    VCSpeedDialPreset *newPreset = new VCSpeedDialPreset(++m_lastAssignedID);
×
466
    newPreset->m_value = 1000;
×
467
    newPreset->m_name = Function::speedToString(1000);
×
468
    addPreset(newPreset);
×
469
    updateTree();
×
470
}
×
471

472
void VCSpeedDialProperties::slotRemovePresetClicked()
×
473
{
474
    if (m_presetsTree->selectedItems().isEmpty())
×
475
        return;
476
    QTreeWidgetItem *selItem = m_presetsTree->selectedItems().first();
×
477
    quint8 ctlID = selItem->data(0, Qt::UserRole).toUInt();
×
478
    removePreset(ctlID);
×
479
    updateTree();
×
480
}
481

482
void VCSpeedDialProperties::slotTreeSelectionChanged()
×
483
{
484
    VCSpeedDialPreset* preset = getSelectedPreset();
×
485

486
    if (preset != NULL)
×
487
    {
488
        m_presetInputWidget->setInputSource(preset->m_inputSource);
×
489
        m_presetInputWidget->setKeySequence(preset->m_keySequence.toString(QKeySequence::NativeText));
×
490
        m_presetNameEdit->setText(preset->m_name);
×
491
        m_speedDialWidget->setValue(preset->m_value);
×
492
    }
493
}
×
494

495
void VCSpeedDialProperties::slotPresetNameEdited(QString const& newName)
×
496
{
497
    VCSpeedDialPreset* preset = getSelectedPreset();
×
498

499
    if (preset != NULL)
×
500
    {
501
        preset->m_name = newName;
×
502

503
        updateTreeItem(*preset);
×
504
    }
505
}
×
506

507
void VCSpeedDialProperties::slotSpeedDialWidgetValueChanged(int ms)
×
508
{
509
    VCSpeedDialPreset* preset = getSelectedPreset();
×
510

511
    if (preset != NULL)
×
512
    {
513
        if (Function::stringToSpeed(preset->m_name) == uint(preset->m_value))
×
514
        {
515
            preset->m_name = Function::speedToString(ms);
×
516
            m_presetNameEdit->blockSignals(true);
×
517
            m_presetNameEdit->setText(preset->m_name);
×
518
            m_presetNameEdit->blockSignals(false);
×
519
        }
520
        preset->m_value = ms;
×
521

522
        updateTreeItem(*preset);
×
523
    }
524
}
×
525

526
void VCSpeedDialProperties::slotInputValueChanged(quint32 universe, quint32 channel)
×
527
{
528
    Q_UNUSED(universe);
529
    Q_UNUSED(channel);
530

531
    VCSpeedDialPreset *preset = getSelectedPreset();
×
532

533
    if (preset != NULL)
×
534
        preset->m_inputSource = m_presetInputWidget->inputSource();
×
535
}
×
536

537
void VCSpeedDialProperties::slotKeySequenceChanged(QKeySequence key)
×
538
{
539
    VCSpeedDialPreset *preset = getSelectedPreset();
×
540

541
    if (preset != NULL)
×
542
        preset->m_keySequence = key;
×
543
}
×
544

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