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

mcallegari / qlcplus / 8961243534

05 May 2024 09:23PM UTC coverage: 32.068% (+4.0%) from 28.094%
8961243534

push

github

mcallegari
Merge branch 'master' into qmltoqt6

902 of 2557 new or added lines in 140 files covered. (35.28%)

166 existing lines in 76 files now uncovered.

15395 of 48008 relevant lines covered (32.07%)

22949.67 hits per line

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

0.0
/ui/src/virtualconsole/vcframepageshortcut.cpp
1
/*
2
  Q Light Controller Plus
3
  vcframepageshortcut.cpp
4

5
  Copyright (c) Lukas Jähn
6
                Massimo Callegari
7

8
  Licensed under the Apache License, Version 2.0 (the "License");
9
  you may not use this file except in compliance with the License.
10
  You may obtain a copy of the License at
11

12
      http://www.apache.org/licenses/LICENSE-2.0.txt
13

14
  Unless required by applicable law or agreed to in writing, software
15
  distributed under the License is distributed on an "AS IS" BASIS,
16
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
  See the License for the specific language governing permissions and
18
  limitations under the License.
19
*/
20

21
#include <QXmlStreamReader>
22
#include <QXmlStreamWriter>
23
#include <QDebug>
24

25
#include "vcframepageshortcut.h"
26
#include "vcwidget.h"
27

UNCOV
28
VCFramePageShortcut::VCFramePageShortcut(int pageIndex, quint8 inputID)
×
29
    : m_id(inputID)
30
    , m_page(pageIndex)
31
    , m_inputSource(QSharedPointer<QLCInputSource>())
×
32
{
33
    setName();
×
34
}
×
35

36
VCFramePageShortcut::~VCFramePageShortcut()
×
37
{
38
}
×
39

40
QString VCFramePageShortcut::name() const
×
41
{
42
    return m_name;
×
43
}
44

45
void VCFramePageShortcut::setName(QString name)
×
46
{
47
    if (name.isEmpty())
×
48
        m_name = QObject::tr("Page: %1").arg(m_page + 1);
×
49
    else
50
        m_name = name;
×
51
}
×
52

53
bool VCFramePageShortcut::loadXML(QXmlStreamReader &root)
×
54
{
55
    if (root.name() != KXMLQLCVCFramePageShortcut)
×
56
    {
57
        qWarning() << Q_FUNC_INFO << "Frame page shortcut node not found";
×
58
        return false;
×
59
    }
60

61
    if (root.attributes().hasAttribute(KXMLQLCVCFramePageShortcutPage) == false)
×
62
    {
63
        qWarning() << Q_FUNC_INFO << "Frame page shortcut page not found";
×
64
        return false;
×
65
    }
66

67
    if (root.attributes().hasAttribute(KXMLQLCVCFramePageShortcutName) == false)
×
68
    {
69
        qWarning() << Q_FUNC_INFO << "Frame page shortcut name not found";
×
70
        return false;
×
71
    }
72

73
    m_page = root.attributes().value(KXMLQLCVCFramePageShortcutPage).toString().toInt();
×
74
    setName(root.attributes().value(KXMLQLCVCFramePageShortcutName).toString());
×
75

76
    /* Children */
77
    while (root.readNextStartElement())
×
78
    {
79
        if (root.name() == KXMLQLCVCWidgetInput)
×
80
        {
81
            m_inputSource = VCWidget::getXMLInput(root);
×
82
            root.skipCurrentElement();
×
83
        }
84
        else if (root.name() == KXMLQLCVCWidgetKey)
×
85
        {
86
            m_keySequence = VCWidget::stripKeySequence(QKeySequence(root.readElementText()));
×
87
        }
88
        else
89
        {
90
            qWarning() << Q_FUNC_INFO << "Unknown VCFramePageShortcut tag:" << root.name().toString();
×
91
            root.skipCurrentElement();
×
92
        }
93
    }
94

95
    return true;
×
96
}
97

98
bool VCFramePageShortcut::saveXML(QXmlStreamWriter *doc)
×
99
{
100
    Q_ASSERT(doc != NULL);
×
101

102
    doc->writeStartElement(KXMLQLCVCFramePageShortcut);
×
103
    doc->writeAttribute(KXMLQLCVCFramePageShortcutPage, QString::number(m_page));
×
104
    doc->writeAttribute(KXMLQLCVCFramePageShortcutName, m_name);
×
105

106
    /* External input source */
107
    if (!m_inputSource.isNull() && m_inputSource->isValid())
×
108
        VCWidget::saveXMLInput(doc, m_inputSource);
×
109

110
    /* Key sequence */
111
    if (m_keySequence.toString().isEmpty() == false)
×
112
        doc->writeTextElement(KXMLQLCVCWidgetKey, m_keySequence.toString());
×
113

114
    /* End the <Preset> tag */
115
    doc->writeEndElement();
×
116

117
    return true;
×
118
}
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