hydrogen 1.2.3
Theme.cpp
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see https://www.gnu.org/licenses
19 *
20 */
21#include <fstream>
22
23#include "Theme.h"
24
26#include "../Version.h"
27
28namespace H2Core
29{
30
32 : m_songEditor_backgroundColor( QColor( 128, 134, 152 ) )
33 , m_songEditor_alternateRowColor( QColor( 106, 111, 126 ) )
34 , m_songEditor_virtualRowColor( QColor( 120, 112, 97 ) )
35 , m_songEditor_selectedRowColor( QColor( 149, 157, 178 ) )
36 , m_songEditor_selectedRowTextColor( QColor( 0, 0, 0 ) )
37 , m_songEditor_lineColor( QColor( 54, 57, 67 ) )
38 , m_songEditor_textColor( QColor( 206, 211, 224 ) )
39 , m_songEditor_automationBackgroundColor( QColor( 83, 89, 103 ) )
40 , m_songEditor_automationLineColor( QColor( 45, 66, 89 ) )
41 , m_songEditor_automationNodeColor( QColor( 255, 255, 255 ) )
42 , m_songEditor_stackedModeOnColor( QColor( 127, 159, 127 ) )
43 , m_songEditor_stackedModeOnNextColor( QColor( 240, 223, 175 ) )
44 , m_songEditor_stackedModeOffNextColor( QColor( 247, 100, 100 ) )
45 , m_patternEditor_backgroundColor( QColor( 165, 166, 160 ) )
46 , m_patternEditor_alternateRowColor( QColor( 133, 134, 129 ) )
47 , m_patternEditor_selectedRowColor( QColor( 194, 195, 187 ) )
48 , m_patternEditor_selectedRowTextColor( QColor( 0, 0, 0 ) )
49 , m_patternEditor_octaveRowColor( QColor( 193, 194, 186 ) )
50 , m_patternEditor_textColor( QColor( 240, 240, 240 ) )
51 , m_patternEditor_noteVelocityFullColor( QColor( 247, 100, 100 ) )
52 , m_patternEditor_noteVelocityDefaultColor( QColor( 40, 40, 40 ) )
53 , m_patternEditor_noteVelocityHalfColor( QColor( 89, 131, 175 ) )
54 , m_patternEditor_noteVelocityZeroColor( QColor( 255, 255, 255 ) )
55 , m_patternEditor_noteOffColor( QColor( 71, 79, 191 ) )
56 , m_patternEditor_lineColor( QColor(45, 45, 45) )
57 , m_patternEditor_line1Color( QColor(55, 55, 55) )
58 , m_patternEditor_line2Color( QColor(75, 75, 75) )
59 , m_patternEditor_line3Color( QColor(95, 95, 95) )
60 , m_patternEditor_line4Color( QColor(105, 105, 105) )
61 , m_patternEditor_line5Color( QColor(115, 115, 115) )
62 , m_selectionHighlightColor( QColor( 255, 255, 255 ) )
63 , m_selectionInactiveColor( QColor( 199, 199, 199 ) )
64 , m_windowColor( QColor( 58, 62, 72 ) )
65 , m_windowTextColor( QColor( 255, 255, 255 ) )
66 , m_baseColor( QColor( 88, 94, 112 ) )
67 , m_alternateBaseColor( QColor( 138, 144, 162 ) )
68 , m_textColor( QColor( 255, 255, 255 ) )
69 , m_buttonColor( QColor( 88, 94, 112 ) )
70 , m_buttonTextColor( QColor( 255, 255, 255 ) )
71 , m_lightColor( QColor( 138, 144, 162 ) )
72 , m_midLightColor( QColor( 128, 134, 152 ) )
73 , m_midColor( QColor( 58, 62, 72 ) )
74 , m_darkColor( QColor( 81, 86, 99 ) )
75 , m_shadowTextColor( QColor( 255, 255, 255 ) )
76 , m_highlightColor( QColor( 206, 150, 30 ) )
77 , m_highlightedTextColor( QColor( 255, 255, 255 ) )
78 , m_toolTipBaseColor( QColor( 227, 243, 252 ) )
79 , m_toolTipTextColor( QColor( 64, 64, 66 ) )
80 , m_widgetColor( QColor( 164, 170, 190 ) )
81 , m_widgetTextColor( QColor( 10, 10, 10 ) )
82 , m_buttonRedColor( QColor( 247, 100, 100 ) )
83 , m_buttonRedTextColor( QColor( 10, 10, 10 ) )
84 , m_spinBoxColor( QColor( 51, 74 , 100 ) )
85 , m_spinBoxTextColor( QColor( 240, 240, 240 ) )
86 , m_accentColor( QColor( 67, 96, 131 ) )
87 , m_accentTextColor( QColor( 255, 255, 255 ) )
88 , m_playheadColor( QColor( 0, 0, 0 ) )
89 , m_cursorColor( QColor( 38, 39, 44 ) )
90{
91}
92
93ColorTheme::ColorTheme( const std::shared_ptr<ColorTheme> pOther )
94 : m_songEditor_backgroundColor( pOther->m_songEditor_backgroundColor )
95 , m_songEditor_alternateRowColor( pOther->m_songEditor_alternateRowColor )
96 , m_songEditor_virtualRowColor( pOther->m_songEditor_virtualRowColor )
97 , m_songEditor_selectedRowColor( pOther->m_songEditor_selectedRowColor )
98 , m_songEditor_selectedRowTextColor( pOther->m_songEditor_selectedRowTextColor )
99 , m_songEditor_lineColor( pOther->m_songEditor_lineColor )
100 , m_songEditor_textColor( pOther->m_songEditor_textColor )
101 , m_songEditor_automationBackgroundColor( pOther->m_songEditor_automationBackgroundColor )
102 , m_songEditor_automationLineColor( pOther->m_songEditor_automationLineColor )
103 , m_songEditor_automationNodeColor( pOther->m_songEditor_automationNodeColor )
104 , m_songEditor_stackedModeOnColor( pOther->m_songEditor_stackedModeOnColor )
105 , m_songEditor_stackedModeOnNextColor( pOther->m_songEditor_stackedModeOnNextColor )
106 , m_songEditor_stackedModeOffNextColor( pOther->m_songEditor_stackedModeOffNextColor )
107 , m_patternEditor_backgroundColor( pOther->m_patternEditor_backgroundColor )
108 , m_patternEditor_alternateRowColor( pOther->m_patternEditor_alternateRowColor )
109 , m_patternEditor_selectedRowColor( pOther->m_patternEditor_selectedRowColor )
110 , m_patternEditor_selectedRowTextColor( pOther->m_patternEditor_selectedRowTextColor )
111 , m_patternEditor_octaveRowColor( pOther->m_patternEditor_octaveRowColor )
112 , m_patternEditor_textColor( pOther->m_patternEditor_textColor )
113 , m_patternEditor_noteVelocityFullColor( pOther->m_patternEditor_noteVelocityFullColor )
114 , m_patternEditor_noteVelocityDefaultColor( pOther->m_patternEditor_noteVelocityDefaultColor )
115 , m_patternEditor_noteVelocityHalfColor( pOther->m_patternEditor_noteVelocityHalfColor )
116 , m_patternEditor_noteVelocityZeroColor( pOther->m_patternEditor_noteVelocityZeroColor )
117 , m_patternEditor_noteOffColor( pOther->m_patternEditor_noteOffColor )
118 , m_patternEditor_lineColor( pOther->m_patternEditor_lineColor )
119 , m_patternEditor_line1Color( pOther->m_patternEditor_line1Color )
120 , m_patternEditor_line2Color( pOther->m_patternEditor_line2Color )
121 , m_patternEditor_line3Color( pOther->m_patternEditor_line3Color )
122 , m_patternEditor_line4Color( pOther->m_patternEditor_line4Color )
123 , m_patternEditor_line5Color( pOther->m_patternEditor_line5Color )
124 , m_selectionHighlightColor( pOther->m_selectionHighlightColor )
125 , m_selectionInactiveColor( pOther->m_selectionInactiveColor )
126 , m_windowColor( pOther->m_windowColor )
127 , m_windowTextColor( pOther->m_windowTextColor )
128 , m_baseColor( pOther->m_baseColor )
129 , m_alternateBaseColor( pOther->m_alternateBaseColor )
130 , m_textColor( pOther->m_textColor )
131 , m_buttonColor( pOther->m_buttonColor )
132 , m_buttonTextColor( pOther->m_buttonTextColor )
133 , m_lightColor( pOther->m_lightColor )
134 , m_midLightColor( pOther->m_midLightColor )
135 , m_midColor( pOther->m_midColor )
136 , m_darkColor( pOther->m_darkColor )
137 , m_shadowTextColor( pOther->m_shadowTextColor )
138 , m_highlightColor( pOther->m_highlightColor )
139 , m_highlightedTextColor( pOther->m_highlightedTextColor )
140 , m_toolTipBaseColor( pOther->m_toolTipBaseColor )
141 , m_toolTipTextColor( pOther->m_toolTipTextColor )
142 , m_accentColor( pOther->m_accentColor )
143 , m_accentTextColor( pOther->m_accentTextColor )
144 , m_widgetColor( pOther->m_widgetColor )
145 , m_widgetTextColor( pOther->m_widgetTextColor )
146 , m_buttonRedColor( pOther->m_buttonRedColor )
147 , m_buttonRedTextColor( pOther->m_buttonRedTextColor )
148 , m_spinBoxColor( pOther->m_spinBoxColor )
149 , m_spinBoxTextColor( pOther->m_spinBoxTextColor )
150 , m_playheadColor( pOther->m_playheadColor )
151 , m_cursorColor( pOther->m_cursorColor )
152{
153}
154
155float InterfaceTheme::FALLOFF_SLOW = 1.08f;
158
160 : m_sQTStyle( "Fusion" )
161 , m_fMixerFalloffSpeed( InterfaceTheme::FALLOFF_NORMAL )
162 , m_layout( InterfaceTheme::Layout::SinglePane )
163 , m_scalingPolicy( InterfaceTheme::ScalingPolicy::Smaller )
164 , m_iconColor( InterfaceTheme::IconColor::Black )
165 , m_coloringMethod( InterfaceTheme::ColoringMethod::Custom )
166 , m_nVisiblePatternColors( 18 )
167 , m_nMaxPatternColors( 50 ) {
169 for ( int ii = 0; ii < m_nMaxPatternColors; ii++ ) {
170 m_patternColors[ ii ] = QColor( 67, 96, 131 );
171 }
172}
173
174InterfaceTheme::InterfaceTheme( const std::shared_ptr<InterfaceTheme> pOther )
175 : m_sQTStyle( pOther->m_sQTStyle )
176 , m_fMixerFalloffSpeed( pOther->m_fMixerFalloffSpeed )
177 , m_layout( pOther->m_layout )
178 , m_scalingPolicy( pOther->m_scalingPolicy )
179 , m_iconColor( pOther->m_iconColor )
180 , m_coloringMethod( pOther->m_coloringMethod )
181 , m_nVisiblePatternColors( pOther->m_nVisiblePatternColors )
182 , m_nMaxPatternColors( pOther->m_nMaxPatternColors ){
183 m_patternColors.resize( pOther->m_nMaxPatternColors );
184 for ( int ii = 0; ii < pOther->m_nMaxPatternColors; ii++ ) {
185 m_patternColors[ ii ] = pOther->m_patternColors[ ii ];
186 }
187}
188
190 : m_sApplicationFontFamily( "Lucida Grande" )
191 , m_sLevel2FontFamily( "Lucida Grande" )
192 , m_sLevel3FontFamily( "Lucida Grande" )
193 , m_fontSize( FontTheme::FontSize::Medium ) {
194}
195
196FontTheme::FontTheme( const std::shared_ptr<FontTheme> pOther )
197 : m_sApplicationFontFamily( pOther->m_sApplicationFontFamily )
198 , m_sLevel2FontFamily( pOther->m_sLevel2FontFamily )
199 , m_sLevel3FontFamily( pOther->m_sLevel3FontFamily )
200 , m_fontSize( pOther->m_fontSize ) {
201}
202
204 m_pColorTheme = std::make_shared<ColorTheme>();
205 m_pInterfaceTheme = std::make_shared<InterfaceTheme>();
206 m_pFontTheme = std::make_shared<FontTheme>();
207}
208
209Theme::Theme( const std::shared_ptr<Theme> pOther ) {
210 m_pColorTheme = std::make_shared<ColorTheme>( pOther->getColorTheme() );
211 m_pInterfaceTheme = std::make_shared<InterfaceTheme>( pOther->getInterfaceTheme() );
212 m_pFontTheme = std::make_shared<FontTheme>( pOther->getFontTheme() );
213}
214
215void Theme::setTheme( const std::shared_ptr<Theme> pOther ) {
216 m_pColorTheme->m_songEditor_backgroundColor = pOther->getColorTheme()->m_songEditor_backgroundColor;
217 m_pColorTheme->m_songEditor_alternateRowColor = pOther->getColorTheme()->m_songEditor_alternateRowColor;
218 m_pColorTheme->m_songEditor_virtualRowColor = pOther->getColorTheme()->m_songEditor_virtualRowColor;
219 m_pColorTheme->m_songEditor_selectedRowColor =
220 pOther->getColorTheme()->m_songEditor_selectedRowColor;
221 m_pColorTheme->m_songEditor_selectedRowTextColor =
222 pOther->getColorTheme()->m_songEditor_selectedRowTextColor;
223 m_pColorTheme->m_songEditor_lineColor = pOther->getColorTheme()->m_songEditor_lineColor;
224 m_pColorTheme->m_songEditor_textColor = pOther->getColorTheme()->m_songEditor_textColor;
225 m_pColorTheme->m_songEditor_automationBackgroundColor =
226 pOther->getColorTheme()->m_songEditor_automationBackgroundColor;
227 m_pColorTheme->m_songEditor_automationLineColor =
228 pOther->getColorTheme()->m_songEditor_automationLineColor;
229 m_pColorTheme->m_songEditor_automationNodeColor =
230 pOther->getColorTheme()->m_songEditor_automationNodeColor;
231 m_pColorTheme->m_songEditor_stackedModeOnColor =
232 pOther->getColorTheme()->m_songEditor_stackedModeOnColor;
233 m_pColorTheme->m_songEditor_stackedModeOnNextColor =
234 pOther->getColorTheme()->m_songEditor_stackedModeOnNextColor;
235 m_pColorTheme->m_songEditor_stackedModeOffNextColor =
236 pOther->getColorTheme()->m_songEditor_stackedModeOffNextColor;
237 m_pColorTheme->m_patternEditor_backgroundColor = pOther->getColorTheme()->m_patternEditor_backgroundColor;
238 m_pColorTheme->m_patternEditor_alternateRowColor = pOther->getColorTheme()->m_patternEditor_alternateRowColor;
239 m_pColorTheme->m_patternEditor_selectedRowColor =
240 pOther->getColorTheme()->m_patternEditor_selectedRowColor;
241 m_pColorTheme->m_patternEditor_selectedRowTextColor =
242 pOther->getColorTheme()->m_patternEditor_selectedRowTextColor;
243 m_pColorTheme->m_patternEditor_octaveRowColor =
244 pOther->getColorTheme()->m_patternEditor_octaveRowColor;
245 m_pColorTheme->m_patternEditor_textColor = pOther->getColorTheme()->m_patternEditor_textColor;
246 m_pColorTheme->m_patternEditor_noteVelocityFullColor =
247 pOther->getColorTheme()->m_patternEditor_noteVelocityFullColor;
248 m_pColorTheme->m_patternEditor_noteVelocityDefaultColor =
249 pOther->getColorTheme()->m_patternEditor_noteVelocityDefaultColor;
250 m_pColorTheme->m_patternEditor_noteVelocityHalfColor =
251 pOther->getColorTheme()->m_patternEditor_noteVelocityHalfColor;
252 m_pColorTheme->m_patternEditor_noteVelocityZeroColor =
253 pOther->getColorTheme()->m_patternEditor_noteVelocityZeroColor;
254 m_pColorTheme->m_patternEditor_noteOffColor =
255 pOther->getColorTheme()->m_patternEditor_noteOffColor;
256 m_pColorTheme->m_patternEditor_lineColor = pOther->getColorTheme()->m_patternEditor_lineColor;
257 m_pColorTheme->m_patternEditor_line1Color = pOther->getColorTheme()->m_patternEditor_line1Color;
258 m_pColorTheme->m_patternEditor_line2Color = pOther->getColorTheme()->m_patternEditor_line2Color;
259 m_pColorTheme->m_patternEditor_line3Color = pOther->getColorTheme()->m_patternEditor_line3Color;
260 m_pColorTheme->m_patternEditor_line4Color = pOther->getColorTheme()->m_patternEditor_line4Color;
261 m_pColorTheme->m_patternEditor_line5Color = pOther->getColorTheme()->m_patternEditor_line5Color;
262 m_pColorTheme->m_selectionHighlightColor = pOther->getColorTheme()->m_selectionHighlightColor;
263 m_pColorTheme->m_selectionInactiveColor = pOther->getColorTheme()->m_selectionInactiveColor;
264 m_pColorTheme->m_windowColor = pOther->getColorTheme()->m_windowColor;
265 m_pColorTheme->m_windowTextColor = pOther->getColorTheme()->m_windowTextColor;
266 m_pColorTheme->m_baseColor = pOther->getColorTheme()->m_baseColor;
267 m_pColorTheme->m_alternateBaseColor = pOther->getColorTheme()->m_alternateBaseColor;
268 m_pColorTheme->m_textColor = pOther->getColorTheme()->m_textColor;
269 m_pColorTheme->m_buttonColor = pOther->getColorTheme()->m_buttonColor;
270 m_pColorTheme->m_buttonTextColor = pOther->getColorTheme()->m_buttonTextColor;
271 m_pColorTheme->m_lightColor = pOther->getColorTheme()->m_lightColor;
272 m_pColorTheme->m_midLightColor = pOther->getColorTheme()->m_midLightColor;
273 m_pColorTheme->m_midColor = pOther->getColorTheme()->m_midColor;
274 m_pColorTheme->m_darkColor = pOther->getColorTheme()->m_darkColor;
275 m_pColorTheme->m_shadowTextColor = pOther->getColorTheme()->m_shadowTextColor;
276 m_pColorTheme->m_highlightColor = pOther->getColorTheme()->m_highlightColor;
277 m_pColorTheme->m_highlightedTextColor = pOther->getColorTheme()->m_highlightedTextColor;
278 m_pColorTheme->m_toolTipBaseColor = pOther->getColorTheme()->m_toolTipBaseColor;
279 m_pColorTheme->m_toolTipTextColor = pOther->getColorTheme()->m_toolTipTextColor;
280 m_pColorTheme->m_accentColor = pOther->getColorTheme()->m_accentColor;
281 m_pColorTheme->m_accentTextColor = pOther->getColorTheme()->m_accentTextColor;
282 m_pColorTheme->m_widgetColor = pOther->getColorTheme()->m_widgetColor;
283 m_pColorTheme->m_widgetTextColor = pOther->getColorTheme()->m_widgetTextColor;
284 m_pColorTheme->m_buttonRedColor = pOther->getColorTheme()->m_buttonRedColor;
285 m_pColorTheme->m_buttonRedTextColor = pOther->getColorTheme()->m_buttonRedTextColor;
286 m_pColorTheme->m_spinBoxColor = pOther->getColorTheme()->m_spinBoxColor;
287 m_pColorTheme->m_spinBoxTextColor = pOther->getColorTheme()->m_spinBoxTextColor;
288 m_pColorTheme->m_playheadColor = pOther->getColorTheme()->m_playheadColor;
289 m_pColorTheme->m_cursorColor = pOther->getColorTheme()->m_cursorColor;
290
291 m_pInterfaceTheme->m_sQTStyle = pOther->getInterfaceTheme()->m_sQTStyle;
292 m_pInterfaceTheme->m_fMixerFalloffSpeed = pOther->getInterfaceTheme()->m_fMixerFalloffSpeed;
293 m_pInterfaceTheme->m_layout = pOther->getInterfaceTheme()->m_layout;
294 m_pInterfaceTheme->m_scalingPolicy = pOther->getInterfaceTheme()->m_scalingPolicy;
295 m_pInterfaceTheme->m_iconColor = pOther->getInterfaceTheme()->m_iconColor;
296 m_pInterfaceTheme->m_coloringMethod = pOther->getInterfaceTheme()->m_coloringMethod;
297 m_pInterfaceTheme->m_nVisiblePatternColors = pOther->getInterfaceTheme()->m_nVisiblePatternColors;
298 m_pInterfaceTheme->m_nMaxPatternColors = pOther->getInterfaceTheme()->m_nMaxPatternColors;
299 std::vector<QColor> patternColors( pOther->getInterfaceTheme()->m_nMaxPatternColors );
300 for ( int ii = 0; ii < pOther->getInterfaceTheme()->m_nMaxPatternColors; ii++ ) {
301 patternColors[ ii ] = pOther->getInterfaceTheme()->m_patternColors[ ii ];
302 }
303
304 m_pInterfaceTheme->m_patternColors = patternColors;
305
306 m_pFontTheme->m_sApplicationFontFamily = pOther->getFontTheme()->m_sApplicationFontFamily;
307 m_pFontTheme->m_sLevel2FontFamily = pOther->getFontTheme()->m_sLevel2FontFamily;
308 m_pFontTheme->m_sLevel3FontFamily = pOther->getFontTheme()->m_sLevel3FontFamily;
309 m_pFontTheme->m_fontSize = pOther->getFontTheme()->m_fontSize;
310}
311
312void Theme::writeColorTheme( XMLNode* pParent, std::shared_ptr<Theme> pTheme )
313{
314 auto pColorTheme = pTheme->getColorTheme();
315
316 XMLNode colorThemeNode = pParent->createNode( "colorTheme" );
317
318 // SONG EDITOR
319 XMLNode songEditorNode = colorThemeNode.createNode( "songEditor" );
320 songEditorNode.write_color( "backgroundColor", pColorTheme->m_songEditor_backgroundColor );
321 songEditorNode.write_color( "alternateRowColor", pColorTheme->m_songEditor_alternateRowColor );
322 songEditorNode.write_color( "virtualRowColor", pColorTheme->m_songEditor_virtualRowColor );
323 songEditorNode.write_color( "selectedRowColor",
324 pColorTheme->m_songEditor_selectedRowColor );
325 songEditorNode.write_color( "selectedRowTextColor",
326 pColorTheme->m_songEditor_selectedRowTextColor );
327 songEditorNode.write_color( "lineColor", pColorTheme->m_songEditor_lineColor );
328 songEditorNode.write_color( "textColor", pColorTheme->m_songEditor_textColor );
329 songEditorNode.write_color( "automationBackgroundColor",
330 pColorTheme->m_songEditor_automationBackgroundColor );
331 songEditorNode.write_color( "automationLineColor",
332 pColorTheme->m_songEditor_automationLineColor );
333 songEditorNode.write_color( "automationNodeColor",
334 pColorTheme->m_songEditor_automationNodeColor );
335 songEditorNode.write_color( "stackedModeOnColor",
336 pColorTheme->m_songEditor_stackedModeOnColor );
337 songEditorNode.write_color( "stackedModeOnNextColor",
338 pColorTheme->m_songEditor_stackedModeOnNextColor );
339 songEditorNode.write_color( "stackedModeOffNextColor",
340 pColorTheme->m_songEditor_stackedModeOffNextColor );
341
342 // PATTERN EDITOR
343 XMLNode patternEditorNode = colorThemeNode.createNode( "patternEditor" );
344 patternEditorNode.write_color( "backgroundColor", pColorTheme->m_patternEditor_backgroundColor );
345 patternEditorNode.write_color( "alternateRowColor", pColorTheme->m_patternEditor_alternateRowColor );
346 patternEditorNode.write_color( "selectedRowColor",
347 pColorTheme->m_patternEditor_selectedRowColor );
348 patternEditorNode.write_color( "selectedRowTextColor",
349 pColorTheme->m_patternEditor_selectedRowTextColor );
350 patternEditorNode.write_color( "octaveRowColor",
351 pColorTheme->m_patternEditor_octaveRowColor );
352 patternEditorNode.write_color( "textColor", pColorTheme->m_patternEditor_textColor );
353 patternEditorNode.write_color( "noteVelocityFullColor",
354 pColorTheme->m_patternEditor_noteVelocityFullColor );
355 patternEditorNode.write_color( "noteVelocityDefaultColor",
356 pColorTheme->m_patternEditor_noteVelocityDefaultColor );
357 patternEditorNode.write_color( "noteVelocityHalfColor",
358 pColorTheme->m_patternEditor_noteVelocityHalfColor );
359 patternEditorNode.write_color( "noteVelocityZeroColor",
360 pColorTheme->m_patternEditor_noteVelocityZeroColor );
361 patternEditorNode.write_color( "noteOffColor", pColorTheme->m_patternEditor_noteOffColor );
362
363 patternEditorNode.write_color( "lineColor", pColorTheme->m_patternEditor_lineColor );
364 patternEditorNode.write_color( "line1Color", pColorTheme->m_patternEditor_line1Color );
365 patternEditorNode.write_color( "line2Color", pColorTheme->m_patternEditor_line2Color );
366 patternEditorNode.write_color( "line3Color", pColorTheme->m_patternEditor_line3Color );
367 patternEditorNode.write_color( "line4Color", pColorTheme->m_patternEditor_line4Color );
368 patternEditorNode.write_color( "line5Color", pColorTheme->m_patternEditor_line5Color );
369
370 XMLNode selectionNode = colorThemeNode.createNode( "selection" );
371 selectionNode.write_color( "highlightColor", pColorTheme->m_selectionHighlightColor );
372 selectionNode.write_color( "inactiveColor", pColorTheme->m_selectionInactiveColor );
373
374 XMLNode paletteNode = colorThemeNode.createNode( "palette" );
375 paletteNode.write_color( "windowColor", pColorTheme->m_windowColor );
376 paletteNode.write_color( "windowTextColor", pColorTheme->m_windowTextColor );
377 paletteNode.write_color( "baseColor", pColorTheme->m_baseColor );
378 paletteNode.write_color( "alternateBaseColor", pColorTheme->m_alternateBaseColor );
379 paletteNode.write_color( "textColor", pColorTheme->m_textColor );
380 paletteNode.write_color( "buttonColor", pColorTheme->m_buttonColor );
381 paletteNode.write_color( "buttonTextColor", pColorTheme->m_buttonTextColor );
382 paletteNode.write_color( "lightColor", pColorTheme->m_lightColor );
383 paletteNode.write_color( "midLightColor", pColorTheme->m_midLightColor );
384 paletteNode.write_color( "midColor", pColorTheme->m_midColor );
385 paletteNode.write_color( "darkColor", pColorTheme->m_darkColor );
386 paletteNode.write_color( "shadowTextColor", pColorTheme->m_shadowTextColor );
387 paletteNode.write_color( "highlightColor", pColorTheme->m_highlightColor );
388 paletteNode.write_color( "highlightedTextColor", pColorTheme->m_highlightedTextColor );
389 paletteNode.write_color( "toolTipBaseColor", pColorTheme->m_toolTipBaseColor );
390 paletteNode.write_color( "toolTipTextColor", pColorTheme->m_toolTipTextColor );
391
392 XMLNode widgetNode = colorThemeNode.createNode( "widget" );
393 widgetNode.write_color( "accentColor", pColorTheme->m_accentColor );
394 widgetNode.write_color( "accentTextColor", pColorTheme->m_accentTextColor );
395 widgetNode.write_color( "widgetColor", pColorTheme->m_widgetColor );
396 widgetNode.write_color( "widgetTextColor", pColorTheme->m_widgetTextColor );
397 widgetNode.write_color( "buttonRedColor", pColorTheme->m_buttonRedColor );
398 widgetNode.write_color( "buttonRedTextColor", pColorTheme->m_buttonRedTextColor );
399 widgetNode.write_color( "spinBoxColor", pColorTheme->m_spinBoxColor );
400 widgetNode.write_color( "spinBoxTextColor", pColorTheme->m_spinBoxTextColor );
401 widgetNode.write_color( "playheadColor", pColorTheme->m_playheadColor );
402 widgetNode.write_color( "cursorColor", pColorTheme->m_cursorColor );
403}
404
405void Theme::readColorTheme( XMLNode parent, std::shared_ptr<Theme> pTheme )
406{
407 auto pColorTheme = pTheme->getColorTheme();
408
409 // SONG EDITOR
410 XMLNode songEditorNode = parent.firstChildElement( "songEditor" );
411 if ( ! songEditorNode.isNull() ) {
412 pColorTheme->m_songEditor_backgroundColor =
413 songEditorNode.read_color( "backgroundColor",
414 pColorTheme->m_songEditor_backgroundColor, false, false );
415 pColorTheme->m_songEditor_alternateRowColor =
416 songEditorNode.read_color( "alternateRowColor",
417 pColorTheme->m_songEditor_alternateRowColor, false, false );
418 pColorTheme->m_songEditor_virtualRowColor =
419 songEditorNode.read_color( "virtualRowColor",
420 pColorTheme->m_songEditor_virtualRowColor, false, false );
421 pColorTheme->m_songEditor_selectedRowColor =
422 songEditorNode.read_color( "selectedRowColor",
423 pColorTheme->m_songEditor_selectedRowColor, false, false );
424 pColorTheme->m_songEditor_selectedRowTextColor =
425 songEditorNode.read_color( "selectedRowTextColor",
426 pColorTheme->m_songEditor_selectedRowTextColor, false, false );
427 pColorTheme->m_songEditor_lineColor =
428 songEditorNode.read_color( "lineColor",
429 pColorTheme->m_songEditor_lineColor, false, false );
430 pColorTheme->m_songEditor_textColor =
431 songEditorNode.read_color( "textColor",
432 pColorTheme->m_songEditor_textColor, false, false );
433 pColorTheme->m_songEditor_automationBackgroundColor =
434 songEditorNode.read_color( "automationBackgroundColor",
435 pColorTheme->m_songEditor_automationBackgroundColor, false, false );
436 pColorTheme->m_songEditor_automationLineColor =
437 songEditorNode.read_color( "automationLineColor",
438 pColorTheme->m_songEditor_automationLineColor, false, false );
439 pColorTheme->m_songEditor_automationNodeColor =
440 songEditorNode.read_color( "automationNodeColor",
441 pColorTheme->m_songEditor_automationNodeColor, false, false );
442 pColorTheme->m_songEditor_stackedModeOnColor =
443 songEditorNode.read_color( "stackedModeOnColor",
444 pColorTheme->m_songEditor_stackedModeOnColor, false, false );
445 pColorTheme->m_songEditor_stackedModeOnNextColor =
446 songEditorNode.read_color( "stackedModeOnNextColor",
447 pColorTheme->m_songEditor_stackedModeOnNextColor, false, false );
448 pColorTheme->m_songEditor_stackedModeOffNextColor =
449 songEditorNode.read_color( "stackedModeOffNextColor",
450 pColorTheme->m_songEditor_stackedModeOffNextColor, false, false );
451 } else {
452 WARNINGLOG( "'songEditor' node not found" );
453 }
454
455 // PATTERN EDITOR
456 XMLNode patternEditorNode = parent.firstChildElement( "patternEditor" );
457 if ( ! patternEditorNode.isNull() ) {
458 pColorTheme->m_patternEditor_backgroundColor =
459 patternEditorNode.read_color( "backgroundColor",
460 pColorTheme->m_patternEditor_backgroundColor, false, false );
461 pColorTheme->m_patternEditor_alternateRowColor =
462 patternEditorNode.read_color( "alternateRowColor",
463 pColorTheme->m_patternEditor_alternateRowColor, false, false );
464 pColorTheme->m_patternEditor_selectedRowColor =
465 patternEditorNode.read_color( "selectedRowColor",
466 pColorTheme->m_patternEditor_selectedRowColor, false, false );
467 pColorTheme->m_patternEditor_selectedRowTextColor =
468 patternEditorNode.read_color( "selectedRowTextColor",
469 pColorTheme->m_patternEditor_selectedRowTextColor, false, false );
470 pColorTheme->m_patternEditor_octaveRowColor =
471 patternEditorNode.read_color( "octaveRowColor",
472 pColorTheme->m_patternEditor_octaveRowColor, false, false );
473 pColorTheme->m_patternEditor_textColor =
474 patternEditorNode.read_color( "textColor",
475 pColorTheme->m_patternEditor_textColor, false, false );
476 pColorTheme->m_patternEditor_noteVelocityFullColor =
477 patternEditorNode.read_color( "noteVelocityFullColor",
478 pColorTheme->m_patternEditor_noteVelocityFullColor, false, false );
479 pColorTheme->m_patternEditor_noteVelocityDefaultColor =
480 patternEditorNode.read_color( "noteVelocityDefaultColor",
481 pColorTheme->m_patternEditor_noteVelocityDefaultColor, false, false );
482 pColorTheme->m_patternEditor_noteVelocityHalfColor =
483 patternEditorNode.read_color( "noteVelocityHalfColor",
484 pColorTheme->m_patternEditor_noteVelocityHalfColor, false, false );
485 pColorTheme->m_patternEditor_noteVelocityZeroColor =
486 patternEditorNode.read_color( "noteVelocityZeroColor",
487 pColorTheme->m_patternEditor_noteVelocityZeroColor, false, false );
488 pColorTheme->m_patternEditor_noteOffColor =
489 patternEditorNode.read_color( "noteOffColor",
490 pColorTheme->m_patternEditor_noteOffColor, false, false );
491 pColorTheme->m_patternEditor_lineColor =
492 patternEditorNode.read_color( "lineColor",
493 pColorTheme->m_patternEditor_lineColor, false, false );
494 pColorTheme->m_patternEditor_line1Color =
495 patternEditorNode.read_color( "line1Color",
496 pColorTheme->m_patternEditor_line1Color, false, false );
497 pColorTheme->m_patternEditor_line2Color =
498 patternEditorNode.read_color( "line2Color",
499 pColorTheme->m_patternEditor_line2Color, false, false );
500 pColorTheme->m_patternEditor_line3Color =
501 patternEditorNode.read_color( "line3Color",
502 pColorTheme->m_patternEditor_line3Color, false, false );
503 pColorTheme->m_patternEditor_line4Color =
504 patternEditorNode.read_color( "line4Color",
505 pColorTheme->m_patternEditor_line4Color, false, false );
506 pColorTheme->m_patternEditor_line5Color =
507 patternEditorNode.read_color( "line5Color",
508 pColorTheme->m_patternEditor_line5Color, false, false );
509 } else {
510 WARNINGLOG( "'patternEditor' node not found" );
511 }
512
513 XMLNode selectionNode = parent.firstChildElement( "selection" );
514 if ( ! selectionNode.isNull() ) {
515 pColorTheme->m_selectionHighlightColor =
516 selectionNode.read_color( "highlightColor",
517 pColorTheme->m_selectionHighlightColor, false, false );
518 pColorTheme->m_selectionInactiveColor =
519 selectionNode.read_color( "inactiveColor",
520 pColorTheme->m_selectionInactiveColor, false, false );
521 } else {
522 WARNINGLOG( "'selection' node not found" );
523 }
524
525 XMLNode paletteNode = parent.firstChildElement( "palette" );
526 if ( ! paletteNode.isNull() ) {
527 pColorTheme->m_windowColor =
528 paletteNode.read_color( "windowColor",
529 pColorTheme->m_windowColor, false, false );
530 pColorTheme->m_windowTextColor =
531 paletteNode.read_color( "windowTextColor",
532 pColorTheme->m_windowTextColor, false, false );
533 pColorTheme->m_baseColor =
534 paletteNode.read_color( "baseColor",
535 pColorTheme->m_baseColor, false, false );
536 pColorTheme->m_alternateBaseColor =
537 paletteNode.read_color( "alternateBaseColor",
538 pColorTheme->m_alternateBaseColor, false, false );
539 pColorTheme->m_textColor =
540 paletteNode.read_color( "textColor",
541 pColorTheme->m_textColor, false, false );
542 pColorTheme->m_buttonColor =
543 paletteNode.read_color( "buttonColor",
544 pColorTheme->m_buttonColor, false, false );
545 pColorTheme->m_buttonTextColor =
546 paletteNode.read_color( "buttonTextColor",
547 pColorTheme->m_buttonTextColor, false, false );
548 pColorTheme->m_lightColor =
549 paletteNode.read_color( "lightColor",
550 pColorTheme->m_lightColor, false, false );
551 pColorTheme->m_midLightColor =
552 paletteNode.read_color( "midLightColor",
553 pColorTheme->m_midLightColor, false, false );
554 pColorTheme->m_midColor =
555 paletteNode.read_color( "midColor",
556 pColorTheme->m_midColor, false, false );
557 pColorTheme->m_darkColor =
558 paletteNode.read_color( "darkColor",
559 pColorTheme->m_darkColor, false, false );
560 pColorTheme->m_shadowTextColor =
561 paletteNode.read_color( "shadowTextColor",
562 pColorTheme->m_shadowTextColor, false, false );
563 pColorTheme->m_highlightColor =
564 paletteNode.read_color( "highlightColor",
565 pColorTheme->m_highlightColor, false, false );
566 pColorTheme->m_highlightedTextColor =
567 paletteNode.read_color( "highlightedTextColor",
568 pColorTheme->m_highlightedTextColor, false, false );
569 pColorTheme->m_toolTipBaseColor =
570 paletteNode.read_color( "toolTipBaseColor",
571 pColorTheme->m_toolTipBaseColor, false, false );
572 pColorTheme->m_toolTipTextColor =
573 paletteNode.read_color( "toolTipTextColor",
574 pColorTheme->m_toolTipTextColor, false, false );
575 } else {
576 WARNINGLOG( "'palette' node not found" );
577 }
578
579 XMLNode widgetNode = parent.firstChildElement( "widget" );
580 if ( ! widgetNode.isNull() ) {
581 pColorTheme->m_accentColor =
582 widgetNode.read_color( "accentColor",
583 pColorTheme->m_accentColor, false, false );
584 pColorTheme->m_accentTextColor =
585 widgetNode.read_color( "accentTextColor",
586 pColorTheme->m_accentTextColor, false, false );
587 pColorTheme->m_widgetColor =
588 widgetNode.read_color( "widgetColor",
589 pColorTheme->m_widgetColor, false, false );
590 pColorTheme->m_widgetTextColor =
591 widgetNode.read_color( "widgetTextColor",
592 pColorTheme->m_widgetTextColor, false, false );
593 pColorTheme->m_buttonRedColor =
594 widgetNode.read_color( "buttonRedColor",
595 pColorTheme->m_buttonRedColor, false, false );
596 pColorTheme->m_buttonRedTextColor =
597 widgetNode.read_color( "buttonRedTextColor",
598 pColorTheme->m_buttonRedTextColor, false, false );
599 pColorTheme->m_spinBoxColor =
600 widgetNode.read_color( "spinBoxColor",
601 pColorTheme->m_spinBoxColor, false, false );
602 pColorTheme->m_spinBoxTextColor =
603 widgetNode.read_color( "spinBoxTextColor",
604 pColorTheme->m_spinBoxTextColor, false, false );
605 pColorTheme->m_playheadColor =
606 widgetNode.read_color( "playheadColor",
607 pColorTheme->m_playheadColor, false, false );
608 pColorTheme->m_cursorColor =
609 widgetNode.read_color( "cursorColor",
610 pColorTheme->m_cursorColor, false, false );
611 } else {
612 WARNINGLOG( "'widget' node not found" );
613 }
614}
615
616std::shared_ptr<Theme> Theme::importTheme( const QString& sPath ) {
617 if ( ! Filesystem::file_exists( sPath ) || ! Filesystem::file_readable( sPath ) ){
618 return nullptr;
619 }
620
621 std::shared_ptr<Theme> pTheme = std::make_shared<Theme>();
622
623 INFOLOG( QString( "Importing theme to %1" ).arg( sPath ) );
624
625 XMLDoc doc;
626 if ( ! doc.read( sPath, nullptr, true ) ) {
627 ERRORLOG( "Unable to load theme." );
628 return nullptr;
629 }
630
631 XMLNode rootNode = doc.firstChildElement( "hydrogen_theme" );
632 if ( rootNode.isNull() ) {
633 ERRORLOG( "'hydrogen_theme' node not found" );
634 return nullptr;
635 }
636
637 XMLNode colorThemeNode = rootNode.firstChildElement( "colorTheme" );
638 if ( ! colorThemeNode.isNull() ) {
639 readColorTheme( colorThemeNode, pTheme );
640 } else {
641 ERRORLOG( "'colorTheme' node not found" );
642 return nullptr;
643 }
644
645 XMLNode interfaceNode = rootNode.firstChildElement( "interfaceTheme" );
646 if ( interfaceNode.isNull() ) {
647 ERRORLOG( "'interfaceTheme' node not found" );
648 return nullptr;
649 }
650 pTheme->getInterfaceTheme()->m_layout =
651 static_cast<InterfaceTheme::Layout>(
652 interfaceNode.read_int( "defaultUILayout",
653 static_cast<int>(InterfaceTheme::Layout::SinglePane),
654 false, false ));
655 pTheme->getInterfaceTheme()->m_scalingPolicy =
657 interfaceNode.read_int( "uiScalingPolicy",
659 false, false ));
660
661 // QT Style
662 pTheme->getInterfaceTheme()->m_sQTStyle =
663 interfaceNode.read_string( "QTStyle", "Fusion", false, false );
664
665 if ( pTheme->getInterfaceTheme()->m_sQTStyle == "Plastique" ){
666 pTheme->getInterfaceTheme()->m_sQTStyle = "Fusion";
667 }
668 pTheme->getInterfaceTheme()->m_iconColor =
669 static_cast<InterfaceTheme::IconColor>(
670 interfaceNode.read_int( "iconColor",
671 static_cast<int>(InterfaceTheme::IconColor::Black),
672 false, false));
673
674 // Mixer falloff speed
675 pTheme->getInterfaceTheme()->m_fMixerFalloffSpeed =
676 interfaceNode.read_float( "mixer_falloff_speed",
677 InterfaceTheme::FALLOFF_NORMAL, false, false );
678
679 //SongEditor coloring
680 pTheme->getInterfaceTheme()->m_coloringMethod =
682 interfaceNode.read_int("SongEditor_ColoringMethod",
684 false, false ));
685 std::vector<QColor> colors( pTheme->getInterfaceTheme()->m_nMaxPatternColors );
686 for ( int ii = 0; ii < pTheme->getInterfaceTheme()->m_nMaxPatternColors; ii++ ) {
687 colors[ ii ] = interfaceNode.read_color( QString( "SongEditor_pattern_color_%1" ).arg( ii ),
688 pTheme->getColorTheme()->m_accentColor,
689 false, false );
690 }
691 pTheme->getInterfaceTheme()->m_patternColors = colors;
692 pTheme->getInterfaceTheme()->m_nVisiblePatternColors =
693 interfaceNode.read_int( "SongEditor_visible_pattern_colors", 1, false, false );
694 if ( pTheme->getInterfaceTheme()->m_nVisiblePatternColors > 50 ) {
695 pTheme->getInterfaceTheme()->m_nVisiblePatternColors = 50;
696 } else if ( pTheme->getInterfaceTheme()->m_nVisiblePatternColors < 0 ) {
697 pTheme->getInterfaceTheme()->m_nVisiblePatternColors = 0;
698 }
699
700 XMLNode fontNode = rootNode.firstChildElement( "fontTheme" );
701 if ( fontNode.isNull() ) {
702 ERRORLOG( "'fontTheme' node not found" );
703 return nullptr;
704 }
705 // Font fun
706 pTheme->getFontTheme()->m_sApplicationFontFamily =
707 fontNode.read_string( "application_font_family",
708 pTheme->getFontTheme()->m_sApplicationFontFamily, false, false );
709 // The value defaults to m_sApplicationFontFamily on
710 // purpose to provide backward compatibility.
711 pTheme->getFontTheme()->m_sLevel2FontFamily =
712 fontNode.read_string( "level2_font_family",
713 pTheme->getFontTheme()->m_sLevel2FontFamily, false, false );
714 pTheme->getFontTheme()->m_sLevel3FontFamily =
715 fontNode.read_string( "level3_font_family",
716 pTheme->getFontTheme()->m_sLevel3FontFamily, false, false );
717 pTheme->getFontTheme()->m_fontSize =
718 static_cast<FontTheme::FontSize>(
719 fontNode.read_int( "font_size",
720 static_cast<int>(FontTheme::FontSize::Medium), false, false ) );
721
722 return pTheme;
723}
724
725bool Theme::exportTheme( const QString& sPath, const std::shared_ptr<Theme> pTheme ) {
726
727 INFOLOG( QString( "Exporting theme to %1" ).arg( sPath ) );
728
729 XMLDoc doc;
730 XMLNode rootNode = doc.set_root( "hydrogen_theme", "theme" );
731 // hydrogen version
732 rootNode.write_string( "version", QString( get_version().c_str() ) );
733
734 writeColorTheme( &rootNode, pTheme );
735
736 auto pInterfaceTheme = pTheme->getInterfaceTheme();
737 XMLNode interfaceNode = rootNode.createNode( "interfaceTheme" );
738 interfaceNode.write_int( "defaultUILayout",
739 static_cast<int>(pInterfaceTheme->m_layout) );
740 interfaceNode.write_int( "uiScalingPolicy",
741 static_cast<int>(pInterfaceTheme->m_scalingPolicy) );
742 interfaceNode.write_string( "QTStyle", pInterfaceTheme->m_sQTStyle );
743 interfaceNode.write_int( "iconColor",
744 static_cast<int>(pInterfaceTheme->m_iconColor) );
745 interfaceNode.write_float( "mixer_falloff_speed",
746 pInterfaceTheme->m_fMixerFalloffSpeed );
747 interfaceNode.write_int( "SongEditor_ColoringMethod",
748 static_cast<int>(pInterfaceTheme->m_coloringMethod) );
749 for ( int ii = 0; ii < pInterfaceTheme->m_nMaxPatternColors; ii++ ) {
750 interfaceNode.write_color( QString( "SongEditor_pattern_color_%1" ).arg( ii ),
751 pInterfaceTheme->m_patternColors[ ii ] );
752 }
753 interfaceNode.write_int( "SongEditor_visible_pattern_colors",
754 pInterfaceTheme->m_nVisiblePatternColors );
755
756 XMLNode fontNode = rootNode.createNode( "fontTheme" );
757 fontNode.write_string( "application_font_family",
758 pTheme->getFontTheme()->m_sApplicationFontFamily );
759 fontNode.write_string( "level2_font_family",
760 pTheme->getFontTheme()->m_sLevel2FontFamily );
761 fontNode.write_string( "level3_font_family",
762 pTheme->getFontTheme()->m_sLevel3FontFamily );
763 fontNode.write_int( "font_size",
764 static_cast<int>(pTheme->getFontTheme()->m_fontSize) );
765
766 return doc.write( sPath );
767}
768
769}
#define INFOLOG(x)
Definition Object.h:237
#define WARNINGLOG(x)
Definition Object.h:238
#define ERRORLOG(x)
Definition Object.h:239
static bool file_exists(const QString &path, bool silent=false)
returns true if the given path is an existing regular file
static bool file_readable(const QString &path, bool silent=false)
returns true if the given path is an existing readable regular file
FontSize
Enables custom scaling of the font size in the GUI.
Definition Theme.h:184
int m_nMaxPatternColors
Not read from/written to disk.
Definition Theme.h:172
static float FALLOFF_SLOW
Definition Theme.h:138
static float FALLOFF_NORMAL
Definition Theme.h:139
static float FALLOFF_FAST
Definition Theme.h:140
std::vector< QColor > m_patternColors
Definition Theme.h:169
static void readColorTheme(XMLNode parent, std::shared_ptr< Theme > pTheme)
Definition Theme.cpp:405
static bool exportTheme(const QString &sPath, const std::shared_ptr< Theme > pTheme)
Definition Theme.cpp:725
std::shared_ptr< InterfaceTheme > m_pInterfaceTheme
Definition Theme.h:219
static std::shared_ptr< Theme > importTheme(const QString &sPath)
Definition Theme.cpp:616
std::shared_ptr< FontTheme > m_pFontTheme
Definition Theme.h:220
std::shared_ptr< ColorTheme > m_pColorTheme
Definition Theme.h:218
void setTheme(const std::shared_ptr< Theme > pOther)
Definition Theme.cpp:215
static void writeColorTheme(XMLNode *parent, std::shared_ptr< Theme > pTheme)
Definition Theme.cpp:312
XMLDoc is a subclass of QDomDocument with read and write methods.
Definition Xml.h:182
XMLNode set_root(const QString &node_name, const QString &xmlns=nullptr)
create the xml header and root node
Definition Xml.cpp:391
bool read(const QString &filepath, const QString &schemapath=nullptr, bool bSilent=false)
read the content of an xml file
Definition Xml.cpp:296
bool write(const QString &filepath)
write itself into a file
Definition Xml.cpp:370
XMLNode is a subclass of QDomNode with read and write values methods.
Definition Xml.h:39
int read_int(const QString &node, int default_value, bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
reads an integer stored into a child node
Definition Xml.cpp:170
QColor read_color(const QString &node, const QColor &defaultValue=QColor(97, 167, 251), bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
Definition Xml.cpp:107
QString read_string(const QString &node, const QString &default_value, bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
reads a string stored into a child node
Definition Xml.cpp:95
float read_float(const QString &node, float default_value, bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
reads a float stored into a child node
Definition Xml.cpp:139
void write_color(const QString &node, const QColor &color)
Definition Xml.cpp:273
void write_float(const QString &node, const float value)
write a float into a child node
Definition Xml.cpp:280
XMLNode createNode(const QString &name)
create a new XMLNode that has to be appended into de XMLDoc
Definition Xml.cpp:63
void write_string(const QString &node, const QString &value)
write a string into a child node
Definition Xml.cpp:269
void write_int(const QString &node, const int value)
write an integer into a child node
Definition Xml.cpp:284
std::string get_version()
Returns the current Hydrogen version string.
Definition Version.cpp:30