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()14Theme::Theme() 15 { 16 } 17 Theme(const Theme & copy)18Theme::Theme(const Theme ©) 19 { 20 m_data = copy.m_data; 21 } 22 Theme(ThemeData * data)23Theme::Theme(ThemeData *data) 24 : m_data(data) 25 { 26 } 27 ~Theme()28Theme::~Theme() 29 { 30 } 31 operator =(const Theme & other)32Theme &Theme::operator=(const Theme &other) 33 { 34 m_data = other.m_data; 35 return *this; 36 } 37 isValid() const38bool Theme::isValid() const 39 { 40 return m_data.data(); 41 } 42 name() const43QString Theme::name() const 44 { 45 return m_data ? m_data->name() : QString(); 46 } 47 translatedName() const48QString Theme::translatedName() const 49 { 50 return m_data ? QCoreApplication::instance()->translate("Theme", m_data->name().toUtf8().constData()) : QString(); 51 } 52 isReadOnly() const53bool Theme::isReadOnly() const 54 { 55 return m_data ? m_data->isReadOnly() : false; 56 } 57 filePath() const58QString Theme::filePath() const 59 { 60 return m_data ? m_data->filePath() : QString(); 61 } 62 textColor(TextStyle style) const63QRgb Theme::textColor(TextStyle style) const 64 { 65 return m_data ? m_data->textColor(style) : 0; 66 } 67 selectedTextColor(TextStyle style) const68QRgb Theme::selectedTextColor(TextStyle style) const 69 { 70 return m_data ? m_data->selectedTextColor(style) : 0; 71 } 72 backgroundColor(TextStyle style) const73QRgb Theme::backgroundColor(TextStyle style) const 74 { 75 return m_data ? m_data->backgroundColor(style) : 0; 76 } 77 selectedBackgroundColor(TextStyle style) const78QRgb Theme::selectedBackgroundColor(TextStyle style) const 79 { 80 return m_data ? m_data->selectedBackgroundColor(style) : 0; 81 } 82 isBold(TextStyle style) const83bool Theme::isBold(TextStyle style) const 84 { 85 return m_data ? m_data->isBold(style) : false; 86 } 87 isItalic(TextStyle style) const88bool Theme::isItalic(TextStyle style) const 89 { 90 return m_data ? m_data->isItalic(style) : false; 91 } 92 isUnderline(TextStyle style) const93bool Theme::isUnderline(TextStyle style) const 94 { 95 return m_data ? m_data->isUnderline(style) : false; 96 } 97 isStrikeThrough(TextStyle style) const98bool Theme::isStrikeThrough(TextStyle style) const 99 { 100 return m_data ? m_data->isStrikeThrough(style) : false; 101 } 102 editorColor(EditorColorRole role) const103QRgb Theme::editorColor(EditorColorRole role) const 104 { 105 return m_data ? m_data->editorColor(role) : 0; 106 } 107