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

mcallegari / qlcplus / 14809507932

03 May 2025 09:13AM UTC coverage: 31.879% (+0.03%) from 31.845%
14809507932

push

github

web-flow
Merge pull request #1745 from mcallegari/qmluiqt6

Port QML UI to Qt6

2 of 9 new or added lines in 3 files covered. (22.22%)

3720 existing lines in 174 files now uncovered.

16422 of 51513 relevant lines covered (31.88%)

19079.9 hits per line

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

11.11
/engine/src/qlcmodifierscache.cpp
1
/*
2
  Q Light Controller Plus
3
  qlcmodifierscache.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 <QDebug>
21

22
#include "qlcmodifierscache.h"
23
#include "channelmodifier.h"
24
#include "qlcconfig.h"
25
#include "qlcfile.h"
26

27
QLCModifiersCache::QLCModifiersCache()
177✔
28
{
29
}
177✔
30

31
QLCModifiersCache::~QLCModifiersCache()
177✔
32
{
33
    qDeleteAll(m_modifiers);
177✔
34
}
177✔
35

36
bool QLCModifiersCache::addModifier(ChannelModifier *modifier)
×
37
{
38
    if (m_modifiers.contains(modifier->name()))
×
UNCOV
39
        return false;
×
40

41
    //qDebug() << "[QLCModifiersCache] added modifier" << modifier->name();
42
    m_modifiers[modifier->name()] = modifier;
×
43
    return true;
×
44
}
45

46
QList<QString> QLCModifiersCache::templateNames()
×
47
{
48
    return m_modifiers.keys();
×
49
}
50

51
ChannelModifier *QLCModifiersCache::modifier(QString name)
×
52
{
53
    return m_modifiers.value(name, NULL);
×
54
}
55

56
QDir QLCModifiersCache::systemTemplateDirectory()
×
57
{
58
    return QLCFile::systemDirectory(QString(MODIFIERSTEMPLATEDIR), QString(KExtModifierTemplate));
×
59
}
60

61
QDir QLCModifiersCache::userTemplateDirectory()
×
62
{
63
    return QLCFile::userDirectory(QString(USERMODIFIERSTEMPLATEDIR), QString(MODIFIERSTEMPLATEDIR),
×
64
                                  QStringList() << QString("*%1").arg(KExtModifierTemplate));
×
65
}
66

67
bool QLCModifiersCache::load(const QDir& dir, bool systemTemplates)
×
68
{
UNCOV
69
    qDebug() << Q_FUNC_INFO << dir.path();
×
70

71
    if (dir.exists() == false || dir.isReadable() == false)
×
72
        return false;
×
73

74
    ChannelModifier::Type type;
75
    if (systemTemplates ==true)
×
UNCOV
76
        type = ChannelModifier::SystemTemplate;
×
77
    else
UNCOV
78
        type = ChannelModifier::UserTemplate;
×
79

80
    /* Attempt to read all specified files from the given directory */
81
    QStringListIterator it(dir.entryList());
×
82
    while (it.hasNext() == true)
×
83
    {
84
        QString path(dir.absoluteFilePath(it.next()));
×
85

86
        if (path.toLower().endsWith(KExtModifierTemplate) == true)
×
87
        {
88
            ChannelModifier* chMod = new ChannelModifier();
×
UNCOV
89
            Q_ASSERT(chMod != NULL);
×
90

91
            QFile::FileError error = chMod->loadXML(path, type);
×
92
            if (error == QFile::NoError)
×
93
            {
94
                /* Delete the modifier if it's a duplicate. */
95
                if (addModifier(chMod) == false)
×
96
                {
97
                    delete chMod;
×
UNCOV
98
                    chMod = NULL;
×
99
                }
100
            }
101
            else
102
            {
103
                qWarning() << Q_FUNC_INFO << "Channel modifier template loading from"
×
104
                           << path << "failed:" << QLCFile::errorString(error);
×
105
                delete chMod;
×
UNCOV
106
                chMod = NULL;
×
107
            }
108
        }
109
        else
110
            qWarning() << Q_FUNC_INFO << "Unrecognized template extension:" << path;
×
111
    }
×
112

UNCOV
113
    return true;
×
UNCOV
114
}
×
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