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

mcallegari / qlcplus / 18357067171

08 Oct 2025 08:16PM UTC coverage: 34.26% (+2.2%) from 32.066%
18357067171

push

github

mcallegari
Merge branch 'master' into filedialog

1282 of 4424 new or added lines in 152 files covered. (28.98%)

1342 existing lines in 152 files now uncovered.

17704 of 51675 relevant lines covered (34.26%)

19430.31 hits per line

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

0.0
/ui/src/virtualconsole/vcspeeddialpreset.cpp
1
/*
2
  Q Light Controller Plus
3
  vcspeeddialpreset.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 <QXmlStreamReader>
21
#include <QXmlStreamWriter>
22
#include <QDebug>
23

24
#include "vcspeeddialpreset.h"
25
#include "vcwidget.h"
26

27
VCSpeedDialPreset::VCSpeedDialPreset(quint8 id)
×
UNCOV
28
    : m_id(id)
×
29
    , m_value(1000)
×
30
{
31
}
×
32

33
VCSpeedDialPreset::VCSpeedDialPreset(VCSpeedDialPreset const& other)
×
34
{
35
    *this = other;
×
36
}
×
37

38
VCSpeedDialPreset::~VCSpeedDialPreset()
×
39
{
40
}
×
41

42
VCSpeedDialPreset &VCSpeedDialPreset::operator=(const VCSpeedDialPreset &preset)
×
43
{
44
    if (this != &preset)
×
45
    {
46
        m_id = preset.m_id;
×
47
        m_name = preset.m_name;
×
48
        m_value = preset.m_value;
×
49
        m_keySequence = preset.m_keySequence;
×
50

51
        if (preset.m_inputSource != NULL)
×
52
        {
53
            m_inputSource = QSharedPointer<QLCInputSource>(new QLCInputSource(preset.m_inputSource->universe(),
×
54
                                                           preset.m_inputSource->channel()));
×
55

NEW
56
            m_inputSource->setFeedbackValue(QLCInputFeedback::LowerValue, preset.m_inputSource->feedbackValue(QLCInputFeedback::LowerValue));
×
NEW
57
            m_inputSource->setFeedbackValue(QLCInputFeedback::UpperValue, preset.m_inputSource->feedbackValue(QLCInputFeedback::UpperValue));
×
58
        }
59
    }
60
    return *this;
×
61
}
62

63
bool VCSpeedDialPreset::operator<(VCSpeedDialPreset const& right) const
×
64
{
65
    return m_id < right.m_id;
×
66
}
67

68
bool VCSpeedDialPreset::compare(VCSpeedDialPreset const* left, VCSpeedDialPreset const* right)
×
69
{
70
    return *left < *right;
×
71
}
72

73
bool VCSpeedDialPreset::loadXML(QXmlStreamReader &root)
×
74
{
75
    if (root.name() != KXMLQLCVCSpeedDialPreset)
×
76
    {
77
        qWarning() << Q_FUNC_INFO << "Speed Dial Preset node not found";
×
78
        return false;
×
79
    }
80

81
    if (root.attributes().hasAttribute(KXMLQLCVCSpeedDialPresetID) == false)
×
82
    {
83
        qWarning() << Q_FUNC_INFO << "Speed Dial Preset ID not found";
×
84
        return false;
×
85
    }
86

87
    m_id = root.attributes().value(KXMLQLCVCSpeedDialPresetID).toString().toUInt();
×
88

89
    /* Children */
90
    while (root.readNextStartElement())
×
91
    {
92
        if (root.name() == KXMLQLCVCSpeedDialPresetName)
×
93
        {
94
            m_name = root.readElementText();
×
95
        }
96
        else if (root.name() == KXMLQLCVCSpeedDialPresetValue)
×
97
        {
98
            m_value = root.readElementText().toInt();
×
99
        }
100
        else if (root.name() == KXMLQLCVCWidgetInput)
×
101
        {
102
            m_inputSource = VCWidget::getXMLInput(root);
×
103
            root.skipCurrentElement();
×
104
        }
105
        else if (root.name() == KXMLQLCVCWidgetKey)
×
106
        {
107
            m_keySequence = VCWidget::stripKeySequence(QKeySequence(root.readElementText()));
×
108
        }
109
        else
110
        {
111
            qWarning() << Q_FUNC_INFO << "Unknown VCSpeedDialPreset tag:" << root.name().toString();
×
112
            root.skipCurrentElement();
×
113
        }
114
    }
115

116
    return true;
×
117
}
118

119
bool VCSpeedDialPreset::saveXML(QXmlStreamWriter *doc)
×
120
{
121
    Q_ASSERT(doc != NULL);
×
122

123
    doc->writeStartElement(KXMLQLCVCSpeedDialPreset);
×
124
    doc->writeAttribute(KXMLQLCVCSpeedDialPresetID, QString::number(m_id));
×
125

126
    doc->writeTextElement(KXMLQLCVCSpeedDialPresetName, m_name);
×
127
    doc->writeTextElement(KXMLQLCVCSpeedDialPresetValue, QString::number(m_value));
×
128

129
    /* External input source */
130
    if (!m_inputSource.isNull() && m_inputSource->isValid())
×
131
        VCWidget::saveXMLInput(doc, m_inputSource);
×
132

133
    /* Key sequence */
134
    if (m_keySequence.isEmpty() == false)
×
135
        doc->writeTextElement(KXMLQLCVCWidgetKey, m_keySequence.toString());
×
136

137
    /* End the <Preset> tag */
138
    doc->writeEndElement();
×
139

140
    return true;
×
141
}
142

143

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