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

mcallegari / qlcplus / 28807794184

06 Jul 2026 04:42PM UTC coverage: 35.285% (+1.1%) from 34.233%
28807794184

push

github

mcallegari
qmlui: VC Speed dial tap button can tap global BPM

18560 of 52600 relevant lines covered (35.29%)

40987.85 hits per line

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

39.86
/engine/src/monitorproperties.cpp
1
/*
2
  Q Light Controller Plus
3
  monitorproperties.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 <QQuaternion>
23
#include <QDebug>
24
#include <QFont>
25

26
#include "monitorproperties.h"
27
#include "qlcfixturedef.h"
28
#include "qlcconfig.h"
29
#include "qlcfile.h"
30
#include "fixture.h"
31
#include "doc.h"
32

33
#define KXMLQLCMonitorDisplay       QStringLiteral("DisplayMode")
34
#define KXMLQLCMonitorChannels      QStringLiteral("ChannelStyle")
35
#define KXMLQLCMonitorValues        QStringLiteral("ValueStyle")
36
#define KXMLQLCMonitorFont          QStringLiteral("Font")
37
#define KXMLQLCMonitorGrid          QStringLiteral("Grid")
38
#define KXMLQLCMonitorGridWidth     QStringLiteral("Width")
39
#define KXMLQLCMonitorGridHeight    QStringLiteral("Height")
40
#define KXMLQLCMonitorGridDepth     QStringLiteral("Depth")
41
#define KXMLQLCMonitorGridUnits     QStringLiteral("Units")
42
#define KXMLQLCMonitorPointOfView   QStringLiteral("POV")
43
#define KXMLQLCMonitorItemID        QStringLiteral("ID")
44
#define KXMLQLCMonitorShowLabels    QStringLiteral("ShowLabels")
45

46
#define KXMLQLCMonitorCommonBackground  QStringLiteral("Background")
47
#define KXMLQLCMonitorCustomBgItem      QStringLiteral("BackgroundItem")
48

49
#define KXMLQLCMonitorFixtureItem   QStringLiteral("FxItem")
50
#define KXMLQLCMonitorLightItem     QStringLiteral("LightItem")
51
#define KXMLQLCMonitorStageItem     QStringLiteral("StageItem")
52
#define KXMLQLCMonitorMeshItem      QStringLiteral("MeshItem")
53
#define KXMLQLCMonitorItemName      QStringLiteral("Name")
54
#define KXMLQLCMonitorItemRes       QStringLiteral("Res")
55

56
#define KXMLQLCMonitorItemXPosition     QStringLiteral("XPos")
57
#define KXMLQLCMonitorItemYPosition     QStringLiteral("YPos")
58
#define KXMLQLCMonitorItemZPosition     QStringLiteral("ZPos")
59
#define KXMLQLCMonitorItemXRotation     QStringLiteral("XRot")
60
#define KXMLQLCMonitorItemYRotation     QStringLiteral("YRot")
61
#define KXMLQLCMonitorItemZRotation     QStringLiteral("ZRot")
62
#define KXMLQLCMonitorFixtureRotation   QStringLiteral("Rotation") // LEGACY
63
#define KXMLQLCMonitorItemXScale        QStringLiteral("XScale")
64
#define KXMLQLCMonitorItemYScale        QStringLiteral("YScale")
65
#define KXMLQLCMonitorItemZScale        QStringLiteral("ZScale")
66

67
#define KXMLQLCMonitorFixtureHeadIndex      QStringLiteral("Head")
68
#define KXMLQLCMonitorFixtureLinkedIndex    QStringLiteral("Linked")
69

70
#define KXMLQLCMonitorFixtureGelColor   QStringLiteral("GelColor")
71
#define KXMLQLCMonitorFixtureFixedZoom  QStringLiteral("FixedZoom")
72

73
#define KXMLQLCMonitorFixtureHiddenFlag     QStringLiteral("Hidden")
74
#define KXMLQLCMonitorFixtureInvPanFlag     QStringLiteral("InvertedPan")
75
#define KXMLQLCMonitorFixtureInvTiltFlag    QStringLiteral("InvertedTilt")
76
#define KXMLQLCMonitorFixtureLockedFlag     QStringLiteral("Locked")
77

78
#define GRID_DEFAULT_WIDTH  5
79
#define GRID_DEFAULT_HEIGHT 3
80
#define GRID_DEFAULT_DEPTH  5
81

82
MonitorProperties::MonitorProperties()
9✔
83
    : m_font(QFont("Arial", 12))
9✔
84
    , m_displayMode(DMX)
9✔
85
    , m_channelStyle(DMXChannels)
9✔
86
    , m_valueStyle(DMXValues)
9✔
87
    , m_gridSize(QVector3D(GRID_DEFAULT_WIDTH, GRID_DEFAULT_HEIGHT, GRID_DEFAULT_DEPTH))
9✔
88
    , m_gridUnits(Meters)
9✔
89
    , m_pointOfView(Undefined)
9✔
90
    , m_stageType(StageSimple)
9✔
91
    , m_showLabels(false)
18✔
92
{
93
}
9✔
94

95
void MonitorProperties::reset()
16✔
96
{
97
    m_gridSize = QVector3D(GRID_DEFAULT_WIDTH, GRID_DEFAULT_HEIGHT, GRID_DEFAULT_DEPTH);
16✔
98
    m_gridUnits = Meters;
16✔
99
    m_pointOfView = Undefined;
16✔
100
    m_stageType = StageSimple;
16✔
101
    m_showLabels = false;
16✔
102
    m_fixtureItems.clear();
16✔
103
    m_lightItems.clear();
16✔
104
    m_genericItems.clear();
16✔
105
    m_commonBackgroundImage = QString();
16✔
106
}
16✔
107

108
/********************************************************************
109
 * Environment
110
 ********************************************************************/
111

112
void MonitorProperties::setPointOfView(MonitorProperties::PointOfView pov)
2✔
113
{
114
    if (pov == m_pointOfView)
2✔
115
        return;
1✔
116

117
    if (m_pointOfView == Undefined)
1✔
118
    {
119
        QVector3D gSize = gridSize();
1✔
120
        float units = gridUnits() == MonitorProperties::Meters ? 1000.0 : 304.8;
1✔
121

122
        if (gSize.z() == 0)
1✔
123
        {
124
            // convert the grid size first
125
            switch (pov)
×
126
            {
127
                case TopView:
×
128
                    setGridSize(QVector3D(gSize.x(), GRID_DEFAULT_HEIGHT, gSize.y()));
×
129
                break;
×
130
                case RightSideView:
×
131
                case LeftSideView:
132
                    setGridSize(QVector3D(GRID_DEFAULT_WIDTH, gSize.x(), gSize.x()));
×
133
                break;
×
134
                default:
×
135
                break;
×
136
            }
137
        }
138

139
        foreach (quint32 fid, fixtureItemsID())
2✔
140
        {
141
            foreach (quint32 subID, fixtureIDList(fid))
×
142
            {
143
                QVector3D pos = fixturePosition(fid, fixtureHeadIndex(subID), fixtureLinkedIndex(subID));
×
144
                QVector3D newPos;
×
145

146
                switch (pov)
×
147
                {
148
                    case TopView:
×
149
                    {
150
                        newPos = QVector3D(pos.x(), 1000, pos.y());
×
151
                    }
152
                    break;
×
153
                    case RightSideView:
×
154
                    {
155
                        newPos = QVector3D(0, pos.y(), (gridSize().z() * units) - pos.x());
×
156
                    }
157
                    break;
×
158
                    case LeftSideView:
×
159
                    {
160
                        newPos = QVector3D(0, pos.y(), pos.x());
×
161
                    }
162
                    break;
×
163
                    default:
×
164
                        newPos = QVector3D(pos.x(), (gridSize().y() * units) - pos.y(), 1000);
×
165
                    break;
×
166
                }
167
                setFixturePosition(fid, fixtureHeadIndex(subID), fixtureLinkedIndex(subID), newPos);
×
168
            }
×
169
        }
1✔
170
    }
171
    m_pointOfView = pov;
1✔
172
}
173

174
/********************************************************************
175
 * Fixture items
176
 ********************************************************************/
177

178
void MonitorProperties::removeFixture(quint32 fid)
2✔
179
{
180
    if (m_fixtureItems.contains(fid))
2✔
181
        m_fixtureItems.take(fid);
2✔
182
}
2✔
183

184
void MonitorProperties::removeFixture(quint32 fid, quint16 head, quint16 linked)
×
185
{
186
    if (m_fixtureItems.contains(fid) == false)
×
187
        return;
×
188

189
    // if no sub items are present,
190
    // the fixture can be removed completely
191
    if (m_fixtureItems[fid].m_subItems.count() == 0)
×
192
    {
193
        m_fixtureItems.take(fid);
×
194
        return;
×
195
    }
196

197
    quint32 subID = fixtureSubID(head, linked);
×
198
    m_fixtureItems[fid].m_subItems.remove(subID);
×
199
}
200

201
quint32 MonitorProperties::fixtureSubID(quint32 headIndex, quint32 linkedIndex) const
×
202
{
203
    return ((headIndex << 16) | linkedIndex);
×
204
}
205

206
quint16 MonitorProperties::fixtureHeadIndex(quint32 mapID) const
×
207
{
208
    return (quint16)(mapID >> 16);
×
209
}
210

211
quint16 MonitorProperties::fixtureLinkedIndex(quint32 mapID) const
×
212
{
213
    return (quint16)(mapID & 0x0000FFFF);
×
214
}
215

216
bool MonitorProperties::containsItem(quint32 fid, quint16 head, quint16 linked)
×
217
{
218
    if (m_fixtureItems.contains(fid) == false)
×
219
        return false;
×
220

221
    if (head == 0 && linked == 0)
×
222
        return true;
×
223

224
    quint32 subID = fixtureSubID(head, linked);
×
225
    return m_fixtureItems[fid].m_subItems.contains(subID);
×
226
}
227

228
void MonitorProperties::setFixturePosition(quint32 fid, quint16 head, quint16 linked, QVector3D pos)
5✔
229
{
230
    //qDebug() << Q_FUNC_INFO << "X:" << pos.x() << "Y:" << pos.y();
231
    if (head == 0 && linked == 0)
5✔
232
    {
233
        m_fixtureItems[fid].m_baseItem.m_position = pos;
5✔
234
    }
235
    else
236
    {
237
        quint32 subID = fixtureSubID(head, linked);
×
238
        m_fixtureItems[fid].m_subItems[subID].m_position = pos;
×
239
    }
240
}
5✔
241

242
QVector3D MonitorProperties::fixturePosition(quint32 fid, quint16 head, quint16 linked) const
1✔
243
{
244
    if (head == 0 && linked == 0)
1✔
245
    {
246
        return m_fixtureItems[fid].m_baseItem.m_position;
1✔
247
    }
248
    else
249
    {
250
        quint32 subID = fixtureSubID(head, linked);
×
251
        return m_fixtureItems[fid].m_subItems[subID].m_position;
×
252
    }
253
}
254

255
void MonitorProperties::setFixtureRotation(quint32 fid, quint16 head, quint16 linked, QVector3D degrees)
1✔
256
{
257
    if (head == 0 && linked == 0)
1✔
258
    {
259
        m_fixtureItems[fid].m_baseItem.m_rotation = degrees;
1✔
260
    }
261
    else
262
    {
263
        quint32 subID = fixtureSubID(head, linked);
×
264
        m_fixtureItems[fid].m_subItems[subID].m_rotation = degrees;
×
265
    }
266
}
1✔
267

268
QVector3D MonitorProperties::fixtureRotation(quint32 fid, quint16 head, quint16 linked) const
1✔
269
{
270
    if (head == 0 && linked == 0)
1✔
271
    {
272
        return m_fixtureItems[fid].m_baseItem.m_rotation;
1✔
273
    }
274
    else
275
    {
276
        quint32 subID = fixtureSubID(head, linked);
×
277
        return m_fixtureItems[fid].m_subItems[subID].m_rotation;
×
278
    }
279
}
280

281
void MonitorProperties::setFixtureGelColor(quint32 fid, quint16 head, quint16 linked, QColor col)
1✔
282
{
283
    //qDebug() << Q_FUNC_INFO << "Gel color:" << col;
284
    if (head == 0 && linked == 0)
1✔
285
    {
286
        m_fixtureItems[fid].m_baseItem.m_color = col;
1✔
287
    }
288
    else
289
    {
290
        quint32 subID = fixtureSubID(head, linked);
×
291
        m_fixtureItems[fid].m_subItems[subID].m_color = col;
×
292
    }
293
}
1✔
294

295
QColor MonitorProperties::fixtureGelColor(quint32 fid, quint16 head, quint16 linked) const
1✔
296
{
297
    if (head == 0 && linked == 0)
1✔
298
    {
299
        return m_fixtureItems[fid].m_baseItem.m_color;
1✔
300
    }
301
    else
302
    {
303
        quint32 subID = fixtureSubID(head, linked);
×
304
        return m_fixtureItems[fid].m_subItems[subID].m_color;
×
305
    }
306
}
307

308
void MonitorProperties::setFixtureFixedZoom(quint32 fid, quint16 head, quint16 linked, int degrees)
×
309
{
310
    if (head == 0 && linked == 0)
×
311
    {
312
        m_fixtureItems[fid].m_baseItem.m_zoom = degrees;
×
313
    }
314
    else
315
    {
316
        quint32 subID = fixtureSubID(head, linked);
×
317
        m_fixtureItems[fid].m_subItems[subID].m_zoom = degrees;
×
318
    }
319
}
×
320

321
int MonitorProperties::fixtureFixedZoom(quint32 fid, quint16 head, quint16 linked) const
×
322
{
323
    if (head == 0 && linked == 0)
×
324
    {
325
        return m_fixtureItems[fid].m_baseItem.m_zoom;
×
326
    }
327
    else
328
    {
329
        quint32 subID = fixtureSubID(head, linked);
×
330
        return m_fixtureItems[fid].m_subItems[subID].m_zoom;
×
331
    }
332
}
333

334
void MonitorProperties::setFixtureName(quint32 fid, quint16 head, quint16 linked, QString name)
1✔
335
{
336
    if (head == 0 && linked == 0)
1✔
337
    {
338
        m_fixtureItems[fid].m_baseItem.m_name = name;
1✔
339
    }
340
    else
341
    {
342
        quint32 subID = fixtureSubID(head, linked);
×
343
        m_fixtureItems[fid].m_subItems[subID].m_name = name;
×
344
    }
345
}
1✔
346

347
QString MonitorProperties::fixtureName(quint32 fid, quint16 head, quint16 linked) const
1✔
348
{
349
    if (head == 0 && linked == 0)
1✔
350
    {
351
        return m_fixtureItems[fid].m_baseItem.m_name;
1✔
352
    }
353
    else
354
    {
355
        quint32 subID = fixtureSubID(head, linked);
×
356
        return m_fixtureItems[fid].m_subItems[subID].m_name;
×
357
    }
358
}
359

360
void MonitorProperties::setFixtureFlags(quint32 fid, quint16 head, quint16 linked, quint32 flags)
1✔
361
{
362
    if (head == 0 && linked == 0)
1✔
363
    {
364
        m_fixtureItems[fid].m_baseItem.m_flags = flags;
1✔
365
    }
366
    else
367
    {
368
        quint32 subID = fixtureSubID(head, linked);
×
369
        m_fixtureItems[fid].m_subItems[subID].m_flags = flags;
×
370
    }
371
}
1✔
372

373
quint32 MonitorProperties::fixtureFlags(quint32 fid, quint16 head, quint16 linked) const
1✔
374
{
375
    if (head == 0 && linked == 0)
1✔
376
    {
377
        return m_fixtureItems[fid].m_baseItem.m_flags;
1✔
378
    }
379
    else
380
    {
381
        quint32 subID = fixtureSubID(head, linked);
×
382
        return m_fixtureItems[fid].m_subItems[subID].m_flags;
×
383
    }
384
}
385

386
PreviewItem MonitorProperties::fixtureItem(quint32 fid, quint16 head, quint16 linked) const
×
387
{
388
    if (head == 0 && linked == 0)
×
389
    {
390
        return m_fixtureItems[fid].m_baseItem;
×
391
    }
392
    else
393
    {
394
        quint32 subID = fixtureSubID(head, linked);
×
395
        return m_fixtureItems[fid].m_subItems[subID];
×
396
    }
397
}
398

399
void MonitorProperties::setFixtureItem(quint32 fid, quint16 head, quint16 linked, PreviewItem props)
×
400
{
401
    if (head == 0 && linked == 0)
×
402
    {
403
        m_fixtureItems[fid].m_baseItem = props;
×
404
    }
405
    else
406
    {
407
        quint32 subID = fixtureSubID(head, linked);
×
408
        m_fixtureItems[fid].m_subItems[subID] = props;
×
409
    }
410
}
×
411

412
QList<quint32> MonitorProperties::fixtureIDList(quint32 fid) const
×
413
{
414
    QList<quint32> list;
×
415

416
    // always add the basic fixture item ID
417
    list.append(0);
×
418

419
    if (m_fixtureItems.contains(fid) == false)
×
420
        return list;
×
421

422
    FixturePreviewItem fxItem = m_fixtureItems[fid];
×
423
    list.append(fxItem.m_subItems.keys());
×
424

425
    return list;
×
426
}
×
427

428
/********************************************************************
429
 * Fixture lights
430
 ********************************************************************/
431

432
void MonitorProperties::removeLight(QString resource)
1✔
433
{
434
    if (m_lightItems.contains(resource))
1✔
435
        m_lightItems.take(resource);
1✔
436
}
1✔
437

438
void MonitorProperties::removeLight(QString resource, quint16 head)
×
439
{
440
    if (m_lightItems.contains(resource) == false)
×
441
        return;
×
442

443
    m_lightItems[resource].remove(head);
×
444
    if (m_lightItems[resource].isEmpty())
×
445
    {
446
        m_lightItems.take(resource);
×
447
    }
448
}
449

450
bool MonitorProperties::containsLightItem(QString resource, quint16 head) const
3✔
451
{
452
    if (m_lightItems.contains(resource) == false)
3✔
453
        return false;
1✔
454

455
    return m_lightItems[resource].contains(head);
2✔
456
}
457

458
void MonitorProperties::setLightPosition(QString resource, quint16 head, QVector3D position)
2✔
459
{
460
    m_lightItems[resource][head].m_position = position;
2✔
461
}
2✔
462

463
QVector3D MonitorProperties::lightPosition(QString resource, quint16 head) const
2✔
464
{
465
    return m_lightItems[resource][head].m_position;
2✔
466
}
467

468
LightItem MonitorProperties::lightItem(QString resource, quint16 head) const
1✔
469
{
470
    return m_lightItems[resource][head];
1✔
471
}
472

473
void MonitorProperties::setLightItem(QString resource, quint16 head, LightItem props)
1✔
474
{
475
    m_lightItems[resource][head] = props;
1✔
476
}
1✔
477

478
QList<quint32> MonitorProperties::lightHeadList(QString resource) const
1✔
479
{
480
    return m_lightItems.value(resource).keys();
2✔
481
}
482

483
QMatrix4x4 MonitorProperties::fixtureRotationMatrix(QVector3D rot)
×
484
{
485
    // Matches Qt3DCore::QTransform::fromAxesAndAngles(X,-rx, Y,-ry, Z,-rz):
486
    // individual axis rotations composed as qZ * qY * qX (X applied first)
487
    QQuaternion qX = QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), -rot.x());
×
488
    QQuaternion qY = QQuaternion::fromAxisAndAngle(QVector3D(0, 1, 0), -rot.y());
×
489
    QQuaternion qZ = QQuaternion::fromAxisAndAngle(QVector3D(0, 0, 1), -rot.z());
×
490
    QMatrix4x4 m;
×
491
    m.rotate(qZ * qY * qX);
×
492
    return m;
×
493
}
494

495
bool MonitorProperties::fixtureBeamPosition(const MonitorProperties *monProps,
×
496
                                            const Fixture *fixture, int headIndex,
497
                                            QVector3D &beamPos, QMatrix4x4 &rotMatrix)
498
{
499
    if (monProps == nullptr || fixture == nullptr)
×
500
        return false;
×
501

502
    QString resource;
×
503
    if (fixture->type() == QLCFixtureDef::MovingHead)
×
504
        resource = QStringLiteral("moving_head.dae");
×
505

506
    int lightHead = headIndex;
×
507
    if (!resource.isEmpty())
×
508
    {
509
        if (!monProps->containsLightItem(resource, lightHead))
×
510
        {
511
            if (lightHead != 0 && monProps->containsLightItem(resource, 0))
×
512
                lightHead = 0;
×
513
            else
514
                resource.clear();
×
515
        }
516
    }
517

518
    QVector3D fixturePos = monProps->fixturePosition(fixture->id(), headIndex, 0);
×
519
    QVector3D fixtureRot = monProps->fixtureRotation(fixture->id(), headIndex, 0);
×
520

521
    float unitScale = monProps->gridUnits() == MonitorProperties::Meters ? 1.0f : 0.3048f;
×
522
    QVector3D gridMeters = monProps->gridSize() * unitScale;
×
523
    QVector3D rootPos((fixturePos.x() / 1000.0f) - (gridMeters.x() / 2.0f),
×
524
                       fixturePos.y() / 1000.0f,
×
525
                      (fixturePos.z() / 1000.0f) - (gridMeters.z() / 2.0f));
×
526

527
    rotMatrix = fixtureRotationMatrix(fixtureRot);
×
528

529
    if (!resource.isEmpty())
×
530
    {
531
        QVector3D localOffset = monProps->lightPosition(resource, lightHead);
×
532
        QVector4D worldOffset = rotMatrix * QVector4D(localOffset, 0.0f);
×
533
        beamPos = rootPos + QVector3D(worldOffset.x(), worldOffset.y(), worldOffset.z());
×
534
        return true;
×
535
    }
536

537
    beamPos = rootPos;
×
538
    return false;
×
539
}
×
540

541
/********************************************************************
542
 * Generic items
543
 ********************************************************************/
544

545
QList<quint32> MonitorProperties::genericItemsID() const
2✔
546
{
547
    return m_genericItems.keys();
2✔
548
}
549

550
QString MonitorProperties::itemName(quint32 itemID) const
1✔
551
{
552
    if (m_genericItems[itemID].m_name.isEmpty())
1✔
553
    {
554
        QFileInfo rName(m_genericItems[itemID].m_resource);
×
555
        return rName.baseName();
×
556
    }
×
557

558
    return m_genericItems[itemID].m_name;
1✔
559
}
560

561
void MonitorProperties::setItemName(quint32 itemID, QString name)
2✔
562
{
563
    m_genericItems[itemID].m_name = name;
2✔
564
}
2✔
565

566
QString MonitorProperties::itemResource(quint32 itemID) const
1✔
567
{
568
    return m_genericItems[itemID].m_resource;
1✔
569
}
570

571
void MonitorProperties::setItemResource(quint32 itemID, QString resource)
1✔
572
{
573
    m_genericItems[itemID].m_resource = resource;
1✔
574
}
1✔
575

576
QVector3D MonitorProperties::itemPosition(quint32 itemID) const
1✔
577
{
578
    return m_genericItems[itemID].m_position;
1✔
579
}
580

581
void MonitorProperties::setItemPosition(quint32 itemID, QVector3D pos)
1✔
582
{
583
    m_genericItems[itemID].m_position = pos;
1✔
584
}
1✔
585

586
QVector3D MonitorProperties::itemRotation(quint32 itemID) const
1✔
587
{
588
    return m_genericItems[itemID].m_rotation;
1✔
589
}
590

591
void MonitorProperties::setItemRotation(quint32 itemID, QVector3D rot)
1✔
592
{
593
    m_genericItems[itemID].m_rotation = rot;
1✔
594
}
1✔
595

596
QVector3D MonitorProperties::itemScale(quint32 itemID) const
1✔
597
{
598
    if (m_genericItems[itemID].m_scale.isNull())
1✔
599
        return QVector3D(1.0, 1.0, 1.0);
×
600

601
    return m_genericItems[itemID].m_scale;
1✔
602
}
603

604
void MonitorProperties::setItemScale(quint32 itemID, QVector3D scale)
1✔
605
{
606
    m_genericItems[itemID].m_scale = scale;
1✔
607
}
1✔
608

609
quint32 MonitorProperties::itemFlags(quint32 itemID) const
1✔
610
{
611
    return m_genericItems[itemID].m_flags;
1✔
612
}
613

614
void MonitorProperties::setItemFlags(quint32 itemID, quint32 flags)
1✔
615
{
616
    m_genericItems[itemID].m_flags = flags;
1✔
617
}
1✔
618

619
/********************************************************************
620
 * 2D view background
621
 ********************************************************************/
622

623
QString MonitorProperties::customBackground(quint32 fid) const
×
624
{
625
    return m_customBackgroundImages.value(fid, QString());
×
626
}
627

628
/*********************************************************************
629
 * Load & Save
630
 *********************************************************************/
631

632
bool MonitorProperties::loadXML(QXmlStreamReader &root, const Doc *mainDocument)
1✔
633
{
634
    if (root.name() != KXMLQLCMonitorProperties)
1✔
635
    {
636
        qWarning() << Q_FUNC_INFO << "Monitor node not found";
×
637
        return false;
×
638
    }
639

640
    QXmlStreamAttributes attrs = root.attributes();
1✔
641

642
    if (attrs.hasAttribute(KXMLQLCMonitorDisplay) == false)
1✔
643
    {
644
        qWarning() << Q_FUNC_INFO << "Cannot determine Monitor display mode !";
×
645
        return false;
×
646
    }
647

648
    setDisplayMode(DisplayMode(attrs.value(KXMLQLCMonitorDisplay).toString().toInt()));
1✔
649
    if (attrs.hasAttribute(KXMLQLCMonitorShowLabels))
1✔
650
    {
651
        if (attrs.value(KXMLQLCMonitorShowLabels).toString() == "1")
2✔
652
            setLabelsVisible(true);
×
653
        else
654
            setLabelsVisible(false);
1✔
655
    }
656

657
    while (root.readNextStartElement())
6✔
658
    {
659
        QXmlStreamAttributes tAttrs = root.attributes();
5✔
660
        if (root.name() == KXMLQLCMonitorFont)
5✔
661
        {
662
            QFont fn;
1✔
663
            fn.fromString(root.readElementText());
1✔
664
            setFont(fn);
1✔
665
        }
1✔
666
        else if (root.name() == KXMLQLCMonitorChannels)
4✔
667
            setChannelStyle(ChannelStyle(root.readElementText().toInt()));
1✔
668
        else if (root.name() == KXMLQLCMonitorValues)
3✔
669
            setValueStyle(ValueStyle(root.readElementText().toInt()));
1✔
670
        else if (root.name() == KXMLQLCMonitorCommonBackground)
2✔
671
            setCommonBackgroundImage(mainDocument->denormalizeComponentPath(root.readElementText()));
×
672
        else if (root.name() == KXMLQLCMonitorCustomBgItem)
2✔
673
        {
674
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemID))
×
675
            {
676
                quint32 fid = tAttrs.value(KXMLQLCMonitorItemID).toString().toUInt();
×
677
                setCustomBackgroundItem(fid, mainDocument->denormalizeComponentPath(root.readElementText()));
×
678
            }
679
        }
680
        else if (root.name() == KXMLQLCMonitorGrid)
2✔
681
        {
682
            int w = 5, h = 3, d = 5;
1✔
683
            if (tAttrs.hasAttribute(KXMLQLCMonitorGridWidth))
1✔
684
                w = tAttrs.value(KXMLQLCMonitorGridWidth).toString().toInt();
1✔
685
            if (tAttrs.hasAttribute(KXMLQLCMonitorGridHeight))
1✔
686
                h = tAttrs.value(KXMLQLCMonitorGridHeight).toString().toInt();
1✔
687
            if (tAttrs.hasAttribute(KXMLQLCMonitorGridDepth))
1✔
688
                d = tAttrs.value(KXMLQLCMonitorGridDepth).toString().toInt();
1✔
689
            else
690
                d = h; // backward compatibility
×
691

692
            if (tAttrs.hasAttribute(KXMLQLCMonitorGridUnits))
1✔
693
                setGridUnits(GridUnits(tAttrs.value(KXMLQLCMonitorGridUnits).toString().toInt()));
1✔
694

695
            if (tAttrs.hasAttribute(KXMLQLCMonitorPointOfView))
1✔
696
                setPointOfView(PointOfView(tAttrs.value(KXMLQLCMonitorPointOfView).toString().toInt()));
×
697
            else
698
                setPointOfView(Undefined);
1✔
699

700
            setGridSize(QVector3D(w, h, d));
1✔
701
            root.skipCurrentElement();
1✔
702
        }
703
        else if (root.name() == KXMLQLCMonitorStageItem)
1✔
704
        {
705
            setStageType(StageType(root.readElementText().toInt()));
×
706
        }
707
        else if (root.name() == KXMLQLCMonitorFixtureItem)
1✔
708
        {
709
            // Fixture ID is mandatory. Skip the whole entry if not found.
710
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemID) == false)
×
711
            {
712
                root.skipCurrentElement();
×
713
                continue;
×
714
            }
715

716
            PreviewItem item;
×
717
            quint32 fid = tAttrs.value(KXMLQLCMonitorItemID).toString().toUInt();
×
718
            quint16 headIndex = 0;
×
719
            quint16 linkedIndex = 0;
×
720
            QVector3D pos(0, 0, 0);
×
721
            QVector3D rot(0, 0, 0);
×
722

723
            item.m_flags = 0;
×
724
            item.m_zoom = 0;
×
725

726
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureHeadIndex))
×
727
                headIndex = tAttrs.value(KXMLQLCMonitorFixtureHeadIndex).toString().toUInt();
×
728

729
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureLinkedIndex))
×
730
            {
731
                linkedIndex = tAttrs.value(KXMLQLCMonitorFixtureLinkedIndex).toString().toUInt();
×
732

733
                if (tAttrs.hasAttribute(KXMLQLCMonitorItemName))
×
734
                    item.m_name = tAttrs.value(KXMLQLCMonitorItemName).toString();
×
735
            }
736

737
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemXPosition))
×
738
                pos.setX(tAttrs.value(KXMLQLCMonitorItemXPosition).toString().toDouble());
×
739
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemYPosition))
×
740
                pos.setY(tAttrs.value(KXMLQLCMonitorItemYPosition).toString().toDouble());
×
741
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemZPosition))
×
742
                pos.setZ(tAttrs.value(KXMLQLCMonitorItemZPosition).toString().toDouble());
×
743
            item.m_position = pos;
×
744

745
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureRotation)) // check legacy first
×
746
            {
747
                rot.setY(tAttrs.value(KXMLQLCMonitorFixtureRotation).toString().toDouble());
×
748
            }
749
            else
750
            {
751
                if (tAttrs.hasAttribute(KXMLQLCMonitorItemXRotation))
×
752
                    rot.setX(tAttrs.value(KXMLQLCMonitorItemXRotation).toString().toDouble());
×
753
                if (tAttrs.hasAttribute(KXMLQLCMonitorItemYRotation))
×
754
                    rot.setY(tAttrs.value(KXMLQLCMonitorItemYRotation).toString().toDouble());
×
755
                if (tAttrs.hasAttribute(KXMLQLCMonitorItemZRotation))
×
756
                    rot.setZ(tAttrs.value(KXMLQLCMonitorItemZRotation).toString().toDouble());
×
757
            }
758
            item.m_rotation = rot;
×
759

760
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureGelColor))
×
761
                item.m_color = QColor(tAttrs.value(KXMLQLCMonitorFixtureGelColor).toString());
×
762

763
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureFixedZoom))
×
764
                item.m_zoom = tAttrs.value(KXMLQLCMonitorFixtureFixedZoom).toString().toInt();
×
765

766
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureHiddenFlag))
×
767
                item.m_flags |= HiddenFlag;
×
768
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureInvPanFlag))
×
769
                item.m_flags |= InvertedPanFlag;
×
770
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureInvTiltFlag))
×
771
                item.m_flags |= InvertedTiltFlag;
×
772
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureLockedFlag))
×
773
                item.m_flags |= LockedFlag;
×
774

775
            setFixtureItem(fid, headIndex, linkedIndex, item);
×
776
            root.skipCurrentElement();
×
777

778
        }
×
779
        else if (root.name() == KXMLQLCMonitorLightItem)
1✔
780
        {
781
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemRes) == false)
1✔
782
            {
783
                root.skipCurrentElement();
×
784
                continue;
×
785
            }
786

787
            LightItem item;
1✔
788
            QString resource = tAttrs.value(KXMLQLCMonitorItemRes).toString();
1✔
789
            quint16 headIndex = 0;
1✔
790
            QVector3D position(0, 0, 0);
1✔
791

792
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureHeadIndex))
1✔
793
                headIndex = tAttrs.value(KXMLQLCMonitorFixtureHeadIndex).toString().toUInt();
×
794

795
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemXPosition))
1✔
796
                position.setX(tAttrs.value(KXMLQLCMonitorItemXPosition).toString().toDouble());
1✔
797
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemYPosition))
1✔
798
                position.setY(tAttrs.value(KXMLQLCMonitorItemYPosition).toString().toDouble());
1✔
799
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemZPosition))
1✔
800
                position.setZ(tAttrs.value(KXMLQLCMonitorItemZPosition).toString().toDouble());
1✔
801

802
            item.m_position = position;
1✔
803
            setLightItem(resource, headIndex, item);
1✔
804
            root.skipCurrentElement();
1✔
805
        }
1✔
806
        else if (root.name() == KXMLQLCMonitorMeshItem)
×
807
        {
808
            // Item ID is mandatory. Skip the whole entry if not found.
809
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemID) == false)
×
810
            {
811
                root.skipCurrentElement();
×
812
                continue;
×
813
            }
814

815
            PreviewItem item;
×
816
            quint32 itemID = tAttrs.value(KXMLQLCMonitorItemID).toString().toUInt();
×
817
            QVector3D pos(0, 0, 0);
×
818
            QVector3D rot(0, 0, 0);
×
819
            QVector3D scale(1.0, 1.0, 1.0);
×
820

821
            item.m_flags = 0;
×
822

823
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemXPosition))
×
824
                pos.setX(tAttrs.value(KXMLQLCMonitorItemXPosition).toString().toDouble());
×
825
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemYPosition))
×
826
                pos.setY(tAttrs.value(KXMLQLCMonitorItemYPosition).toString().toDouble());
×
827
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemZPosition))
×
828
                pos.setZ(tAttrs.value(KXMLQLCMonitorItemZPosition).toString().toDouble());
×
829
            item.m_position = pos;
×
830

831
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemXRotation))
×
832
                rot.setX(tAttrs.value(KXMLQLCMonitorItemXRotation).toString().toDouble());
×
833
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemYRotation))
×
834
                rot.setY(tAttrs.value(KXMLQLCMonitorItemYRotation).toString().toDouble());
×
835
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemZRotation))
×
836
                rot.setZ(tAttrs.value(KXMLQLCMonitorItemZRotation).toString().toDouble());
×
837
            item.m_rotation = rot;
×
838

839
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemXScale))
×
840
                scale.setX(tAttrs.value(KXMLQLCMonitorItemXScale).toString().toDouble());
×
841
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemYScale))
×
842
                scale.setY(tAttrs.value(KXMLQLCMonitorItemYScale).toString().toDouble());
×
843
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemZScale))
×
844
                scale.setZ(tAttrs.value(KXMLQLCMonitorItemZScale).toString().toDouble());
×
845
            item.m_scale = scale;
×
846

847
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureHiddenFlag))
×
848
                item.m_flags |= HiddenFlag;
×
849
            if (tAttrs.hasAttribute(KXMLQLCMonitorFixtureLockedFlag))
×
850
                item.m_flags |= LockedFlag;
×
851

852
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemRes))
×
853
                item.m_resource = tAttrs.value(KXMLQLCMonitorItemRes).toString();
×
854

855
            if (tAttrs.hasAttribute(KXMLQLCMonitorItemName))
×
856
                item.m_name = tAttrs.value(KXMLQLCMonitorItemName).toString();
×
857

858
            m_genericItems[itemID] = item;
×
859
            root.skipCurrentElement();
×
860
        }
×
861
        else
862
        {
863
            qWarning() << Q_FUNC_INFO << "Unknown MonitorProperties tag:" << root.name();
×
864
            root.skipCurrentElement();
×
865
        }
866
    }
5✔
867
    return true;
1✔
868
}
1✔
869

870
bool MonitorProperties::saveXML(QXmlStreamWriter *doc, const Doc *mainDocument) const
2✔
871
{
872
    Q_ASSERT(doc != NULL);
2✔
873

874
    /* Create the master Monitor node */
875
    doc->writeStartElement(KXMLQLCMonitorProperties);
4✔
876
    doc->writeAttribute(KXMLQLCMonitorDisplay, QString::number(displayMode()));
4✔
877
    doc->writeAttribute(KXMLQLCMonitorShowLabels, QString::number(labelsVisible()));
4✔
878

879
    /* Font */
880
    doc->writeTextElement(KXMLQLCMonitorFont, font().toString());
4✔
881
    /* Channels style */
882
    doc->writeTextElement(KXMLQLCMonitorChannels, QString::number(channelStyle()));
4✔
883
    /* Values style */
884
    doc->writeTextElement(KXMLQLCMonitorValues, QString::number(valueStyle()));
4✔
885

886
    /* Background */
887
    if (commonBackgroundImage().isEmpty() == false)
2✔
888
    {
889
        doc->writeTextElement(KXMLQLCMonitorCommonBackground,
×
890
                              mainDocument->normalizeComponentPath(commonBackgroundImage()));
×
891
    }
892
    else if (customBackgroundList().isEmpty() == false)
2✔
893
    {
894
        QMapIterator <quint32, QString> it(customBackgroundList());
×
895
        while (it.hasNext() == true)
×
896
        {
897
            it.next();
×
898
            doc->writeStartElement(KXMLQLCMonitorCustomBgItem);
×
899
            quint32 fid = it.key();
×
900
            doc->writeAttribute(KXMLQLCMonitorItemID, QString::number(fid));
×
901
            doc->writeCharacters(mainDocument->normalizeComponentPath(it.value()));
×
902
            doc->writeEndElement();
×
903
        }
904
    }
×
905

906
    doc->writeStartElement(KXMLQLCMonitorGrid);
4✔
907
    doc->writeAttribute(KXMLQLCMonitorGridWidth, QString::number(gridSize().x()));
4✔
908
    doc->writeAttribute(KXMLQLCMonitorGridHeight, QString::number(gridSize().y()));
4✔
909
    doc->writeAttribute(KXMLQLCMonitorGridDepth, QString::number(gridSize().z()));
4✔
910
    doc->writeAttribute(KXMLQLCMonitorGridUnits, QString::number(gridUnits()));
4✔
911
    if (m_pointOfView != Undefined)
2✔
912
        doc->writeAttribute(KXMLQLCMonitorPointOfView, QString::number(pointOfView()));
×
913

914
    doc->writeEndElement();
2✔
915

916
#ifdef QMLUI
917
    doc->writeTextElement(KXMLQLCMonitorStageItem, QString::number(stageType()));
918
#endif
919

920
    // ***********************************************************
921
    // *                write fixtures information               *
922
    // ***********************************************************
923

924
    foreach (quint32 fid, fixtureItemsID())
4✔
925
    {
926
        foreach (quint32 subID, fixtureIDList(fid))
×
927
        {
928
            quint16 headIndex = fixtureHeadIndex(subID);
×
929
            quint16 linkedIndex = fixtureLinkedIndex(subID);
×
930
            PreviewItem item = fixtureItem(fid, headIndex, linkedIndex);
×
931

932
            doc->writeStartElement(KXMLQLCMonitorFixtureItem);
×
933
            doc->writeAttribute(KXMLQLCMonitorItemID, QString::number(fid));
×
934

935
            if (headIndex)
×
936
                doc->writeAttribute(KXMLQLCMonitorFixtureHeadIndex, QString::number(headIndex));
×
937

938
            if (linkedIndex)
×
939
            {
940
                doc->writeAttribute(KXMLQLCMonitorFixtureLinkedIndex, QString::number(linkedIndex));
×
941
                if (item.m_name.isEmpty() == false)
×
942
                    doc->writeAttribute(KXMLQLCMonitorItemName, item.m_name);
×
943
            }
944

945
            // write flags, if present
946
            if (item.m_flags & HiddenFlag)
×
947
                doc->writeAttribute(KXMLQLCMonitorFixtureHiddenFlag, KXMLQLCTrue);
×
948
            if (item.m_flags & InvertedPanFlag)
×
949
                doc->writeAttribute(KXMLQLCMonitorFixtureInvPanFlag, KXMLQLCTrue);
×
950
            if (item.m_flags & InvertedTiltFlag)
×
951
                doc->writeAttribute(KXMLQLCMonitorFixtureInvTiltFlag, KXMLQLCTrue);
×
952
            if (item.m_flags & LockedFlag)
×
953
                doc->writeAttribute(KXMLQLCMonitorFixtureLockedFlag, KXMLQLCTrue);
×
954

955
            // always write position
956
            doc->writeAttribute(KXMLQLCMonitorItemXPosition, QString::number(item.m_position.x()));
×
957
            doc->writeAttribute(KXMLQLCMonitorItemYPosition, QString::number(item.m_position.y()));
×
958

959
#ifdef QMLUI
960
            doc->writeAttribute(KXMLQLCMonitorItemZPosition, QString::number(item.m_position.z()));
961

962
            // write rotation, if set
963
            if (item.m_rotation.x() != 0)
964
                doc->writeAttribute(KXMLQLCMonitorItemXRotation, QString::number(item.m_rotation.x()));
965
            if (item.m_rotation.y() != 0)
966
                doc->writeAttribute(KXMLQLCMonitorItemYRotation, QString::number(item.m_rotation.y()));
967
            if (item.m_rotation.z() != 0)
968
                doc->writeAttribute(KXMLQLCMonitorItemZRotation, QString::number(item.m_rotation.z()));
969
#else
970
            if (item.m_rotation != QVector3D(0, 0, 0))
×
971
                doc->writeAttribute(KXMLQLCMonitorFixtureRotation, QString::number(item.m_rotation.y()));
×
972
#endif
973
            if (item.m_color.isValid())
×
974
                doc->writeAttribute(KXMLQLCMonitorFixtureGelColor, item.m_color.name());
×
975

976
            if (item.m_zoom > 0)
×
977
                doc->writeAttribute(KXMLQLCMonitorFixtureFixedZoom, QString::number(item.m_zoom));
×
978

979
            doc->writeEndElement();
×
980
        }
×
981
    }
2✔
982

983
    foreach (QString resource, lightResources())
5✔
984
    {
985
        foreach (quint32 headIndex, lightHeadList(resource))
3✔
986
        {
987
            if (containsLightItem(resource, headIndex) == false)
1✔
988
                continue;
×
989

990
            LightItem item = lightItem(resource, headIndex);
1✔
991

992
            if (resource.isEmpty())
1✔
993
                continue;
×
994

995
            doc->writeStartElement(KXMLQLCMonitorLightItem);
2✔
996
            doc->writeAttribute(KXMLQLCMonitorItemRes, resource);
2✔
997

998
            if (headIndex)
1✔
999
                doc->writeAttribute(KXMLQLCMonitorFixtureHeadIndex, QString::number(headIndex));
×
1000

1001
            doc->writeAttribute(KXMLQLCMonitorItemXPosition, QString::number(item.m_position.x()));
2✔
1002
            doc->writeAttribute(KXMLQLCMonitorItemYPosition, QString::number(item.m_position.y()));
2✔
1003
            doc->writeAttribute(KXMLQLCMonitorItemZPosition, QString::number(item.m_position.z()));
2✔
1004

1005
            doc->writeEndElement();
1✔
1006
        }
1✔
1007
    }
3✔
1008
#ifdef QMLUI
1009
    QDir dir = QDir::cleanPath(QLCFile::systemDirectory(MESHESDIR).path());
1010
    QString meshDirAbsPath = dir.absolutePath() + QDir::separator();
1011
#endif
1012

1013
    // ***********************************************************
1014
    // *             write generic items information             *
1015
    // ***********************************************************
1016
    QMapIterator<quint32, PreviewItem> it(m_genericItems);
2✔
1017
    while (it.hasNext())
2✔
1018
    {
1019
        it.next();
×
1020
        quint32 itemID = it.key();
×
1021
        PreviewItem item = it.value();
×
1022

1023
        doc->writeStartElement(KXMLQLCMonitorMeshItem);
×
1024
        doc->writeAttribute(KXMLQLCMonitorItemID, QString::number(itemID));
×
1025

1026
        // write flags, if present
1027
        if (item.m_flags & HiddenFlag)
×
1028
            doc->writeAttribute(KXMLQLCMonitorFixtureHiddenFlag, KXMLQLCTrue);
×
1029
        if (item.m_flags & LockedFlag)
×
1030
            doc->writeAttribute(KXMLQLCMonitorFixtureLockedFlag, KXMLQLCTrue);
×
1031

1032
        // always write position
1033
        doc->writeAttribute(KXMLQLCMonitorItemXPosition, QString::number(item.m_position.x()));
×
1034
        doc->writeAttribute(KXMLQLCMonitorItemYPosition, QString::number(item.m_position.y()));
×
1035
        doc->writeAttribute(KXMLQLCMonitorItemZPosition, QString::number(item.m_position.z()));
×
1036

1037
        // write rotation, if set
1038
        if (item.m_rotation.x() != 0)
×
1039
            doc->writeAttribute(KXMLQLCMonitorItemXRotation, QString::number(item.m_rotation.x()));
×
1040
        if (item.m_rotation.y() != 0)
×
1041
            doc->writeAttribute(KXMLQLCMonitorItemYRotation, QString::number(item.m_rotation.y()));
×
1042
        if (item.m_rotation.z() != 0)
×
1043
            doc->writeAttribute(KXMLQLCMonitorItemZRotation, QString::number(item.m_rotation.z()));
×
1044

1045
        // write scale, if set
1046
        if (item.m_scale.x() != 1.0)
×
1047
            doc->writeAttribute(KXMLQLCMonitorItemXScale, QString::number(item.m_scale.x()));
×
1048
        if (item.m_scale.y() != 1.0)
×
1049
            doc->writeAttribute(KXMLQLCMonitorItemYScale, QString::number(item.m_scale.y()));
×
1050
        if (item.m_scale.z() != 1.0)
×
1051
            doc->writeAttribute(KXMLQLCMonitorItemZScale, QString::number(item.m_scale.z()));
×
1052

1053
        if (item.m_resource.isEmpty() == false)
×
1054
        {
1055
            // perform normalization depending on the mesh location
1056
            // (mesh folder, project path, absolute path)
1057
            QFileInfo res(item.m_resource);
×
1058

1059
            if (res.isRelative())
×
1060
            {
1061
                doc->writeAttribute(KXMLQLCMonitorItemRes, item.m_resource);
×
1062
            }
1063
#ifdef QMLUI
1064
            else if (item.m_resource.startsWith(meshDirAbsPath))
1065
            {
1066
                item.m_resource.remove(meshDirAbsPath);
1067
                doc->writeAttribute(KXMLQLCMonitorItemRes, item.m_resource);
1068
            }
1069
#endif
1070
            else
1071
            {
1072
                doc->writeAttribute(KXMLQLCMonitorItemRes, mainDocument->normalizeComponentPath(item.m_resource));
×
1073
            }
1074
        }
×
1075

1076
        if (item.m_name.isEmpty() == false)
×
1077
            doc->writeAttribute(KXMLQLCMonitorItemName, item.m_name);
×
1078

1079
        doc->writeEndElement();
×
1080
    }
×
1081

1082
    doc->writeEndElement();
2✔
1083

1084
    return true;
2✔
1085
}
2✔
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