aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cerence/xt9/xt9common/xt9kdblayout.cpp
blob: 454b096e937eac49a17b0ea1d759d948c8614ef5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "xt9kdblayout.h"

QT_BEGIN_NAMESPACE
namespace QtVirtualKeyboard {

Xt9KdbLayout::Xt9KdbLayout() :
    primaryId(0),
    secondaryId(0),
    defaultLayoutWidth(0),
    defaultLayoutHeight(0),
    supportsExact(false),
    smartTouchActive(false)
{

}

void Xt9KdbLayout::serialize(QXmlStreamWriter &writer) const
{
    writer.writeStartElement(QStringLiteral("keyboard"));
    writer.writeAttribute(QStringLiteral("primaryId"), QString::number(primaryId));
    writer.writeAttribute(QStringLiteral("secondaryId"), QString::number(secondaryId));
    if (defaultLayoutWidth > 0 && defaultLayoutHeight > 0) {
        writer.writeAttribute(QStringLiteral("defaultLayoutWidth"), QString::number(defaultLayoutWidth));
        writer.writeAttribute(QStringLiteral("defaultLayoutHeight"), QString::number(defaultLayoutHeight + 1));
    }
    if (supportsExact)
        writer.writeAttribute(QStringLiteral("supportsExact"), QString(QStringLiteral("%1")).arg(supportsExact));
    if (smartTouchActive)
        writer.writeAttribute(QStringLiteral("smartTouchActive"), QString(QStringLiteral("%1")).arg(smartTouchActive));
    for (const Xt9KdbArea &area : areas) {
        area.serialize(writer);
    }
    writer.writeEndElement();
}

} // namespace QtVirtualKeyboard
QT_END_NAMESPACE