1 /*
2     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
3 
4     SPDX-License-Identifier: MIT
5 */
6 
7 #include "theme.h"
8 #include "themedata_p.h"
9 
10 #include <QCoreApplication>
11 
12 using namespace KSyntaxHighlighting;
13 
Theme()14 Theme::Theme()
15 {
16 }
17 
Theme(const Theme & copy)18 Theme::Theme(const Theme &copy)
19 {
20     m_data = copy.m_data;
21 }
22 
Theme(ThemeData * data)23 Theme::Theme(ThemeData *data)
24     : m_data(data)
25 {
26 }
27 
~Theme()28 Theme::~Theme()
29 {
30 }
31 
operator =(const Theme & other)32 Theme &Theme::operator=(const Theme &other)
33 {
34     m_data = other.m_data;
35     return *this;
36 }
37 
isValid() const38 bool Theme::isValid() const
39 {
40     return m_data.data();
41 }
42 
name() const43 QString Theme::name() const
44 {
45     return m_data ? m_data->name() : QString();
46 }
47 
translatedName() const48 QString Theme::translatedName() const
49 {
50     return m_data ? QCoreApplication::instance()->translate("Theme", m_data->name().toUtf8().constData()) : QString();
51 }
52 
isReadOnly() const53 bool Theme::isReadOnly() const
54 {
55     return m_data ? m_data->isReadOnly() : false;
56 }
57 
filePath() const58 QString Theme::filePath() const
59 {
60     return m_data ? m_data->filePath() : QString();
61 }
62 
textColor(TextStyle style) const63 QRgb Theme::textColor(TextStyle style) const
64 {
65     return m_data ? m_data->textColor(style) : 0;
66 }
67 
selectedTextColor(TextStyle style) const68 QRgb Theme::selectedTextColor(TextStyle style) const
69 {
70     return m_data ? m_data->selectedTextColor(style) : 0;
71 }
72 
backgroundColor(TextStyle style) const73 QRgb Theme::backgroundColor(TextStyle style) const
74 {
75     return m_data ? m_data->backgroundColor(style) : 0;
76 }
77 
selectedBackgroundColor(TextStyle style) const78 QRgb Theme::selectedBackgroundColor(TextStyle style) const
79 {
80     return m_data ? m_data->selectedBackgroundColor(style) : 0;
81 }
82 
isBold(TextStyle style) const83 bool Theme::isBold(TextStyle style) const
84 {
85     return m_data ? m_data->isBold(style) : false;
86 }
87 
isItalic(TextStyle style) const88 bool Theme::isItalic(TextStyle style) const
89 {
90     return m_data ? m_data->isItalic(style) : false;
91 }
92 
isUnderline(TextStyle style) const93 bool Theme::isUnderline(TextStyle style) const
94 {
95     return m_data ? m_data->isUnderline(style) : false;
96 }
97 
isStrikeThrough(TextStyle style) const98 bool Theme::isStrikeThrough(TextStyle style) const
99 {
100     return m_data ? m_data->isStrikeThrough(style) : false;
101 }
102 
editorColor(EditorColorRole role) const103 QRgb Theme::editorColor(EditorColorRole role) const
104 {
105     return m_data ? m_data->editorColor(role) : 0;
106 }
107