Coverage Report

Created: 2026-03-12 07:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/syntax-highlighting/src/lib/theme.cpp
Line
Count
Source
1
/*
2
    SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
3
    SPDX-FileCopyrightText: 2022 Jonathan Poelen <jonathan.poelen@gmail.com>
4
5
    SPDX-License-Identifier: MIT
6
*/
7
8
#include "theme.h"
9
#include "themedata_p.h"
10
11
#include <QCoreApplication>
12
13
using namespace KSyntaxHighlighting;
14
15
static QExplicitlySharedDataPointer<ThemeData> &sharedDefaultThemeData()
16
17.4k
{
17
17.4k
    static QExplicitlySharedDataPointer<ThemeData> data(new ThemeData);
18
17.4k
    return data;
19
17.4k
}
20
21
Theme::Theme()
22
17.4k
    : m_data(sharedDefaultThemeData())
23
17.4k
{
24
17.4k
}
25
26
1.04M
Theme::Theme(const Theme &copy) = default;
27
28
Theme::Theme(ThemeData *data)
29
524k
    : m_data(data)
30
524k
{
31
524k
}
32
33
1.59M
Theme::~Theme() = default;
34
35
17.4k
Theme &Theme::operator=(const Theme &other) = default;
36
37
bool Theme::isValid() const
38
0
{
39
0
    return m_data.data() != sharedDefaultThemeData().data();
40
0
}
41
42
QString Theme::name() const
43
3.07M
{
44
3.07M
    return m_data->name();
45
3.07M
}
46
47
QString Theme::translatedName() const
48
0
{
49
0
    return isValid() ? QCoreApplication::instance()->translate("Theme", m_data->name().toUtf8().constData()) : QString();
50
0
}
51
52
bool Theme::isReadOnly() const
53
0
{
54
0
    return m_data->isReadOnly();
55
0
}
56
57
QString Theme::filePath() const
58
0
{
59
0
    return m_data->filePath();
60
0
}
61
62
QRgb Theme::textColor(TextStyle style) const
63
227k
{
64
227k
    return m_data->textColor(style);
65
227k
}
66
67
QRgb Theme::selectedTextColor(TextStyle style) const
68
0
{
69
0
    return m_data->selectedTextColor(style);
70
0
}
71
72
QRgb Theme::backgroundColor(TextStyle style) const
73
454k
{
74
454k
    return m_data->backgroundColor(style);
75
454k
}
76
77
QRgb Theme::selectedBackgroundColor(TextStyle style) const
78
0
{
79
0
    return m_data->selectedBackgroundColor(style);
80
0
}
81
82
bool Theme::isBold(TextStyle style) const
83
227k
{
84
227k
    return m_data->isBold(style);
85
227k
}
86
87
bool Theme::isItalic(TextStyle style) const
88
227k
{
89
227k
    return m_data->isItalic(style);
90
227k
}
91
92
bool Theme::isUnderline(TextStyle style) const
93
227k
{
94
227k
    return m_data->isUnderline(style);
95
227k
}
96
97
bool Theme::isStrikeThrough(TextStyle style) const
98
227k
{
99
227k
    return m_data->isStrikeThrough(style);
100
227k
}
101
102
QRgb Theme::editorColor(EditorColorRole role) const
103
0
{
104
0
    return m_data->editorColor(role);
105
0
}
106
107
#include "moc_theme.cpp"