• 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

61.29
/engine/src/qlci18n.cpp
1
/*
2
  Q Light Controller
3
  qlci18n.cpp
4

5
  Copyright (C) Heikki Junnila
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 <QCoreApplication>
21
#include <QTranslator>
22
#include <QLocale>
23
#include <QString>
24
#include <QDebug>
25
#include <QDir>
26
#include <QLibraryInfo>
27

28
#include "qlcconfig.h"
29
#include "qlcfile.h"
30
#include "qlci18n.h"
31

32
QString QLCi18n::s_defaultLocale = QString();
33
QString QLCi18n::s_translationFilePath = QString();
34

35
void QLCi18n::init()
×
36
{
37
    // Set the default translation file path before parsing args
38
    QLCi18n::setTranslationFilePath(QLCFile::systemDirectory(TRANSLATIONDIR).absolutePath());
×
39
}
×
40

41
void QLCi18n::setDefaultLocale(const QString& locale)
3✔
42
{
43
    s_defaultLocale = locale;
3✔
44
}
3✔
45

46
QString QLCi18n::defaultLocale()
5✔
47
{
48
    return s_defaultLocale;
5✔
49
}
50

51
void QLCi18n::setTranslationFilePath(const QString& path)
2✔
52
{
53
    s_translationFilePath = path;
2✔
54
}
2✔
55

56
QString QLCi18n::translationFilePath()
5✔
57
{
58
    return s_translationFilePath;
5✔
59
}
60

61
bool QLCi18n::loadTranslation(const QString& component)
2✔
62
{
63
    const QString lc = defaultLocale().isEmpty() ? QLocale::system().name() : defaultLocale();
3✔
64
    const QString file(QString("%1_%2").arg(component).arg(lc));
2✔
65
    QTranslator* translator = new QTranslator(QCoreApplication::instance());
2✔
66
    if (translator->load(file, translationFilePath()) == true)
2✔
67
    {
68
        QCoreApplication::installTranslator(translator);
1✔
69
        return true;
1✔
70
    }
71
    else
72
    {
73
        return false;
1✔
74
    }
75
}
2✔
76

77
bool QLCi18n::loadQtTranslation(const QString& component)
×
78
{
79
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
80
    const QString qtTranslationsPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
81
#else
82
    const QString qtTranslationsPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
×
83
#endif
84

85
    const QString lc = defaultLocale().isEmpty() ? QLocale::system().name() : defaultLocale();
×
86
    const QString file(QString("%1_%2").arg(component).arg(lc));
×
87
    QTranslator* qtTranslator = new QTranslator(QCoreApplication::instance());
×
88
    if (qtTranslator->load(file, qtTranslationsPath))
×
89
        return QCoreApplication::installTranslator(qtTranslator);
×
90
    else
91
        return false;
×
92
}
×
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