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

5
  Copyright (C) Massimo Callegari
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 <QColorDialog>
21

22
#include "monitorfixturepropertieseditor.h"
23
#include "monitorgraphicsview.h"
24
#include "monitorfixtureitem.h"
25
#include "monitorproperties.h"
26

27
MonitorFixturePropertiesEditor::MonitorFixturePropertiesEditor(
×
28
        MonitorFixtureItem *fxItem, MonitorGraphicsView *gfxView,
29
        MonitorProperties *props, QWidget *parent) :
×
30
    QWidget(parent)
31
  , m_fxItem(fxItem)
×
32
  , m_gfxView(gfxView)
×
33
  , m_props(props)
×
34
{
35
    Q_ASSERT(fxItem != NULL);
36
    Q_ASSERT(gfxView != NULL);
37
    Q_ASSERT(props != NULL);
38

39
    setupUi(this);
×
40

41
    m_xPosSpin->setMaximum(m_gfxView->gridSize().width());
×
42
    m_yPosSpin->setMaximum(m_gfxView->gridSize().height());
×
43

44
    if (m_props->gridUnits() == MonitorProperties::Feet)
×
45
    {
46
        m_xPosSpin->setSuffix("ft");
×
47
        m_yPosSpin->setSuffix("ft");
×
48
    }
49
    else
50
    {
51
        m_xPosSpin->setSuffix("m");
×
52
        m_yPosSpin->setSuffix("m");
×
53
    }
54

55
    m_fxName->setText(m_fxItem->name());
×
56
    m_xPosSpin->setValue(m_fxItem->realPosition().x() / 1000);
×
57
    m_yPosSpin->setValue(m_fxItem->realPosition().y() / 1000);
×
58
    m_rotationSpin->setValue(m_fxItem->rotation());
×
59

60
    QPixmap pm(28, 28);
×
61
    if (m_fxItem->getColor().isValid())
×
62
    {
63
        pm.fill(m_fxItem->getColor());
×
64
        m_gelColorButton->setIcon(QIcon(pm));
×
65
    }
66

67
    connect(m_xPosSpin, SIGNAL(valueChanged(double)),
×
68
            this, SLOT(slotSetPosition()));
69
    connect(m_yPosSpin, SIGNAL(valueChanged(double)),
×
70
            this, SLOT(slotSetPosition()));
71
    connect(m_rotationSpin, SIGNAL(valueChanged(int)),
×
72
            this, SLOT(slotRotationChanged(int)));
73
    connect(m_gelColorButton, SIGNAL(clicked()),
×
74
            this, SLOT(slotGelColorClicked()));
75
    connect(m_gelResetButton, SIGNAL(clicked()),
×
76
            this, SLOT(slotGelResetClicked()));
77
}
×
78

79
MonitorFixturePropertiesEditor::~MonitorFixturePropertiesEditor()
×
80
{
81

82
}
×
83

84
void MonitorFixturePropertiesEditor::slotSetPosition()
×
85
{
86
    QPointF itemPos(m_xPosSpin->value() * 1000, m_yPosSpin->value() * 1000);
×
87
    m_fxItem->setPos(m_gfxView->realPositionToPixels(itemPos.x(), itemPos.y()));
×
88
    m_fxItem->setRealPosition(itemPos);
×
89
    m_props->setFixturePosition(m_fxItem->fixtureID(), 0, 0,QVector3D(itemPos.x(), itemPos.y(), 0));
×
90
}
×
91

92
void MonitorFixturePropertiesEditor::slotRotationChanged(int value)
×
93
{
94
    m_fxItem->setRotation(value);
×
95
    m_props->setFixtureRotation(m_fxItem->fixtureID(), 0, 0, QVector3D(0, value, 0));
×
96
}
×
97

98
void MonitorFixturePropertiesEditor::slotGelColorClicked()
×
99
{
100
    QColor color = m_fxItem->getColor();
×
101
    QColor newColor = QColorDialog::getColor(color);
×
102

103
    if (newColor.isValid())
×
104
    {
105
        m_fxItem->setGelColor(newColor);
×
106
        m_props->setFixtureGelColor(m_fxItem->fixtureID(), 0, 0, newColor);
×
107
        QPixmap pm(28, 28);
×
108
        pm.fill(newColor);
×
109
        m_gelColorButton->setIcon(QIcon(pm));
×
110
    }
×
111
}
×
112

113
void MonitorFixturePropertiesEditor::slotGelResetClicked()
×
114
{
115
    m_gelColorButton->setIcon(QIcon());
×
116
    m_fxItem->setGelColor(QColor());
×
117
    m_props->setFixtureGelColor(m_fxItem->fixtureID(), 0, 0, QColor());
×
118
}
×
119

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