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

mcallegari / qlcplus / 15805077468

22 Jun 2025 08:36AM UTC coverage: 31.876% (-0.01%) from 31.89%
15805077468

push

github

mcallegari
plugins/dmxusb: fix RDM discovery and commands while DMX is running

0 of 1 new or added line in 1 file covered. (0.0%)

3722 existing lines in 175 files now uncovered.

16438 of 51569 relevant lines covered (31.88%)

19266.08 hits per line

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

0.0
/ui/src/fixtureselection.cpp
1
/*
2
  Q Light Controller
3
  fixtureselection.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 <QTreeWidgetItem>
21
#include <QTreeWidget>
22
#include <QHeaderView>
23
#include <QLabel>
24
#include <QAction>
25
#include <QSettings>
26

27
#include "fixturetreewidget.h"
28
#include "fixtureselection.h"
29
#include "doc.h"
30

31
#define SETTINGS_GEOMETRY "fixtureselection/geometry"
32

33
FixtureSelection::FixtureSelection(QWidget* parent, Doc* doc)
×
34
    : QDialog(parent)
35
    , m_doc(doc)
×
36
    , m_selectionMode(Fixtures)
×
37
{
UNCOV
38
    Q_ASSERT(doc != NULL);
×
39

40
    setupUi(this);
×
41

42
    QAction* action = new QAction(this);
×
43
    action->setShortcut(QKeySequence(QKeySequence::Close));
×
44
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
×
45
    addAction(action);
×
46

47
    m_treeFlags = FixtureTreeWidget::UniverseNumber |
×
48
                  FixtureTreeWidget::HeadsNumber |
49
                  FixtureTreeWidget::Manufacturer |
50
                  FixtureTreeWidget::Model |
51
                  FixtureTreeWidget::AddressRange |
52
                  FixtureTreeWidget::ShowGroups;
53

54
    m_tree = new FixtureTreeWidget(m_doc, m_treeFlags, this);
×
55
    m_mainLayout->addWidget(m_tree);
×
56

57
    QSettings settings;
×
58
    QVariant geometrySettings = settings.value(SETTINGS_GEOMETRY);
×
59
    if (geometrySettings.isValid() == true)
×
60
        restoreGeometry(geometrySettings.toByteArray());
×
61

62
    connect(m_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
×
63
            this, SLOT(slotItemDoubleClicked()));
64

65
    connect(m_tree, SIGNAL(itemSelectionChanged()),
×
66
            this, SLOT(slotSelectionChanged()));
67
}
×
68

69
FixtureSelection::~FixtureSelection()
×
70
{
71
    QSettings settings;
×
72
    settings.setValue(SETTINGS_GEOMETRY, saveGeometry());
×
73
}
×
74

75
int FixtureSelection::exec()
×
76
{
77
    //fillTree();
78
    m_tree->updateTree();
×
79
    if (m_tree->topLevelItemCount() == 0)
×
80
    {
81
        m_tree->setHeaderLabel(tr("No fixtures available"));
×
82
        QTreeWidgetItem* item = new QTreeWidgetItem(m_tree);
×
83
        item->setText(0, tr("Go to the Fixture Manager and add some fixtures first."));
×
84
        m_tree->resizeColumnToContents(0);
×
85
        m_tree->setEnabled(false);
×
86
        m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
×
87
    }
88
    return QDialog::exec();
×
89
}
90

91
/****************************************************************************
92
 * Selected fixtures
93
 ****************************************************************************/
94

95
QList <quint32> FixtureSelection::selection() const
×
96
{
97
    return m_selectedFixtures;
×
98
}
99

100
QList <GroupHead> FixtureSelection::selectedHeads() const
×
101
{
102
    return m_selectedHeads;
×
103
}
104

105
/****************************************************************************
106
 * Multi-selection
107
 ****************************************************************************/
108

109
void FixtureSelection::setMultiSelection(bool multi)
×
110
{
111
    if (multi == true)
×
112
        m_tree->setSelectionMode(QAbstractItemView::ExtendedSelection);
×
113
    else
114
        m_tree->setSelectionMode(QAbstractItemView::SingleSelection);
×
115
}
×
116

117
/****************************************************************************
118
 * Selection mode
119
 ****************************************************************************/
120

121
void FixtureSelection::setSelectionMode(SelectionMode mode)
×
122
{
123
    m_selectionMode = mode;
×
124
    if (mode == Fixtures)
×
125
    {
126
        m_tree->setRootIsDecorated(false);
×
127
        m_tree->setItemsExpandable(false);
×
128
        m_treeFlags = m_treeFlags & (~FixtureTreeWidget::ShowHeads);
×
129
    }
130
    else
131
    {
132
        m_tree->setRootIsDecorated(true);
×
133
        m_tree->setItemsExpandable(true);
×
134
        m_treeFlags = m_treeFlags | FixtureTreeWidget::ShowHeads;
×
135
    }
136
    m_tree->setFlags(m_treeFlags);
×
137
}
×
138

139
/****************************************************************************
140
 * Disabled items
141
 ****************************************************************************/
142

143
void FixtureSelection::setDisabledFixtures(const QList <quint32>& disabled)
×
144
{
145
    m_tree->setDisabledFixtures(disabled);
×
146
}
×
147

148
void FixtureSelection::setDisabledHeads(const QList <GroupHead>& disabled)
×
149
{
150
    m_tree->setDisabledHeads(disabled);
×
151
}
×
152

153
/****************************************************************************
154
 * Tree
155
 ****************************************************************************/
156

157
void FixtureSelection::slotItemDoubleClicked()
×
158
{
159
    if (m_tree->selectedItems().isEmpty() == false)
×
160
        accept();
×
161
}
×
162

163
void FixtureSelection::slotSelectionChanged()
×
164
{
165
    if (m_tree->selectedItems().size() > 0)
×
166
        m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
×
167
    else
168
        m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
×
169
}
×
170

171
void FixtureSelection::accept()
×
172
{
173
    m_selectedFixtures = m_tree->selectedFixtures();
×
174
    m_selectedHeads = m_tree->selectedHeads();
×
175

176
    QDialog::accept();
×
177
}
×
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