1 /***********************************************************************
2  *
3  * Copyright (C) 2015-2018 wereturtle
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  ***********************************************************************/
19 
20 #include <QDebug>
21 
22 #include "Theme.h"
23 
Theme()24 Theme::Theme()
25     : builtInFlag(false)
26 {
27 
28 }
29 
Theme(const QString & name,bool builtIn)30 Theme::Theme(const QString& name, bool builtIn)
31     : name(name), builtInFlag(builtIn)
32 {
33 
34 }
35 
~Theme()36 Theme::~Theme()
37 {
38 
39 }
40 
getName() const41 QString Theme::getName() const
42 {
43     return name;
44 }
45 
setName(const QString & value)46 void Theme::setName(const QString& value)
47 {
48     name = value;
49 }
50 
isBuiltIn() const51 bool Theme::isBuiltIn() const
52 {
53     return builtInFlag;
54 }
55 
setBuiltIn(const bool builtIn)56 void Theme::setBuiltIn(const bool builtIn)
57 {
58     builtInFlag = builtIn;
59 }
60 
getDefaultTextColor() const61 QColor Theme::getDefaultTextColor() const
62 {
63     return defaultTextColor;
64 }
65 
setDefaultTextColor(const QColor & value)66 void Theme::setDefaultTextColor(const QColor& value)
67 {
68     defaultTextColor = value;
69 }
70 
getMarkupColor() const71 QColor Theme::getMarkupColor() const
72 {
73     return markupColor;
74 }
75 
setMarkupColor(const QColor & value)76 void Theme::setMarkupColor(const QColor& value)
77 {
78     markupColor = value;
79 }
80 
getLinkColor() const81 QColor Theme::getLinkColor() const
82 {
83     return linkColor;
84 }
85 
setLinkColor(const QColor & value)86 void Theme::setLinkColor(const QColor& value)
87 {
88     linkColor = value;
89 }
90 
getHeadingColor() const91 QColor Theme::getHeadingColor() const
92 {
93     return headingColor;
94 }
95 
setHeadingColor(const QColor & value)96 void Theme::setHeadingColor(const QColor& value)
97 {
98     headingColor = value;
99 }
100 
getEmphasisColor() const101 QColor Theme::getEmphasisColor() const
102 {
103     return emphasisColor;
104 }
105 
setEmphasisColor(const QColor & value)106 void Theme::setEmphasisColor(const QColor& value)
107 {
108     emphasisColor = value;
109 }
110 
getBlockquoteColor() const111 QColor Theme::getBlockquoteColor() const
112 {
113     return blockquoteColor;
114 }
115 
setBlockquoteColor(const QColor & value)116 void Theme::setBlockquoteColor(const QColor& value)
117 {
118     blockquoteColor = value;
119 }
120 
getCodeColor() const121 QColor Theme::getCodeColor() const
122 {
123     return codeColor;
124 }
125 
setCodeColor(const QColor & value)126 void Theme::setCodeColor(const QColor& value)
127 {
128     codeColor = value;
129 }
130 
getSpellingErrorColor() const131 QColor Theme::getSpellingErrorColor() const
132 {
133     return spellingErrorColor;
134 }
135 
setSpellingErrorColor(const QColor & value)136 void Theme::setSpellingErrorColor(const QColor& value)
137 {
138     spellingErrorColor = value;
139 }
140 
getEditorAspect() const141 EditorAspect Theme::getEditorAspect() const
142 {
143     return editorAspect;
144 }
145 
setEditorAspect(const EditorAspect value)146 void Theme::setEditorAspect(const EditorAspect value)
147 {
148     if ((value < EditorAspectFirst) || (value > EditorAspectLast))
149     {
150         editorAspect = EditorAspectFirst;
151         qCritical() << "Theme editor aspect value of " << value
152                     << " is out of range. Defaulting to value of "
153                     << editorAspect;
154     }
155     else
156     {
157         editorAspect = value;
158     }
159 }
160 
getBackgroundImageAspect() const161 PictureAspect Theme::getBackgroundImageAspect() const
162 {
163     return backgroundImageAspect;
164 }
165 
setBackgroundImageAspect(const PictureAspect value)166 void Theme::setBackgroundImageAspect(const PictureAspect value)
167 {
168     if ((value < PictureAspectFirst) || (value > PictureAspectLast))
169     {
170         backgroundImageAspect = PictureAspectFirst;
171         qCritical() << "Theme background image aspect value of " << value
172                     << " is out of range. Defaulting to value of "
173                     << backgroundImageAspect;
174     }
175     else
176     {
177         backgroundImageAspect = value;
178     }
179 }
180 
getBackgroundImageUrl() const181 QString Theme::getBackgroundImageUrl() const
182 {
183     return backgroundImageUrl;
184 }
185 
setBackgroundImageUrl(const QString & value)186 void Theme::setBackgroundImageUrl(const QString& value)
187 {
188     backgroundImageUrl = value;
189 }
190 
getBackgroundColor() const191 QColor Theme::getBackgroundColor() const
192 {
193     return backgroundColor;
194 }
195 
setBackgroundColor(const QColor & value)196 void Theme::setBackgroundColor(const QColor& value)
197 {
198     backgroundColor = value;
199 }
200 
getEditorBackgroundColor() const201 QColor Theme::getEditorBackgroundColor() const
202 {
203     return editorBackgroundColor;
204 }
205 
setEditorBackgroundColor(const QColor & value)206 void Theme::setEditorBackgroundColor(const QColor& value)
207 {
208     editorBackgroundColor = value;
209 }
210 
getHudForegroundColor() const211 QColor Theme::getHudForegroundColor() const
212 {
213     return hudForegroundColor;
214 }
215 
setHudForegroundColor(const QColor & value)216 void Theme::setHudForegroundColor(const QColor& value)
217 {
218     hudForegroundColor = value;
219 }
220 
getHudBackgroundColor() const221 QColor Theme::getHudBackgroundColor() const
222 {
223     return hudBackgroundColor;
224 }
225 
setHudBackgroundColor(const QColor & value)226 void Theme::setHudBackgroundColor(const QColor& value)
227 {
228     hudBackgroundColor = value;
229 }
230 
231