hydrogen 1.2.6
Theme.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2008-2025 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
22#ifndef THEME_H
23#define THEME_H
24
25#include <vector>
26#include <memory>
27
28#include <core/Object.h>
29#include <core/Helpers/Xml.h>
30
31#include <QString>
32#include <QColor>
33
34namespace H2Core
35{
36
42class ColorTheme : public H2Core::Object<ColorTheme>
43{
45public:
46 ColorTheme();
47 ColorTheme( const std::shared_ptr<ColorTheme> pOther );
48
62
80
83
84 // QWidget palette stuff
115
116 // General widget stuff
127};
128
129
131class InterfaceTheme : public H2Core::Object<InterfaceTheme>
132{
134public:
136 InterfaceTheme( const std::shared_ptr<InterfaceTheme> pOther );
137
138 static float FALLOFF_SLOW;
139 static float FALLOFF_NORMAL;
140 static float FALLOFF_FAST;
141
142 enum class Layout {
145 };
146
147 enum class ScalingPolicy {
151 };
152
153 enum class IconColor {
154 Black = 0,
156 };
157
158 enum class ColoringMethod {
161 };
162
163 QString m_sQTStyle;
169 std::vector<QColor> m_patternColors;
173};
174
176class FontTheme : public H2Core::Object<FontTheme>
177{
179public:
180 FontTheme();
181 FontTheme( const std::shared_ptr<FontTheme> pOther );
182
184 enum class FontSize {
186 Small = 1,
188 };
189
194};
195
197class Theme : public H2Core::Object<Theme> {
199public:
200 Theme();
201 Theme( const std::shared_ptr<Theme> pOther );
202
203 void setTheme( const std::shared_ptr<Theme> pOther );
204
205 const std::shared_ptr<ColorTheme> getColorTheme() const;
206 void setColorTheme( const std::shared_ptr<ColorTheme> pNewColorTheme );
207 const std::shared_ptr<InterfaceTheme> getInterfaceTheme() const;
208 void setInterfaceTheme( const std::shared_ptr<InterfaceTheme> pNewInterfaceTheme );
209 const std::shared_ptr<FontTheme> getFontTheme() const;
210 void setFontTheme( const std::shared_ptr<FontTheme> pNewFontTheme );
211
212 static void writeColorTheme( XMLNode* parent, std::shared_ptr<Theme> pTheme );
213 static void readColorTheme( XMLNode parent, std::shared_ptr<Theme> pTheme );
214 static std::shared_ptr<Theme> importTheme( const QString& sPath );
215 static bool exportTheme( const QString& sPath, const std::shared_ptr<Theme> pTheme );
216
217private:
218 std::shared_ptr<ColorTheme> m_pColorTheme;
219 std::shared_ptr<InterfaceTheme> m_pInterfaceTheme;
220 std::shared_ptr<FontTheme> m_pFontTheme;
221};
222
223inline const std::shared_ptr<ColorTheme> Theme::getColorTheme() const {
224 return m_pColorTheme;
225}
226inline void Theme::setColorTheme( const std::shared_ptr<ColorTheme> pNewColorTheme ) {
227 m_pColorTheme = pNewColorTheme;
228}
229inline const std::shared_ptr<InterfaceTheme> Theme::getInterfaceTheme() const {
230 return m_pInterfaceTheme;
231}
232inline void Theme::setInterfaceTheme( const std::shared_ptr<InterfaceTheme> pNewInterfaceTheme ) {
233 m_pInterfaceTheme = pNewInterfaceTheme;
234}
235inline const std::shared_ptr<FontTheme> Theme::getFontTheme() const {
236 return m_pFontTheme;
237}
238inline void Theme::setFontTheme( const std::shared_ptr<FontTheme> pNewFontTheme ) {
239 m_pFontTheme = pNewFontTheme;
240}
241
242};
243
244#endif
245
#define H2_OBJECT(name)
Definition Object.h:227
QColor m_spinBoxColor
Definition Theme.h:123
QColor m_darkColor
Between Button and Dark.
Definition Theme.h:106
QColor m_playheadColor
Definition Theme.h:125
QColor m_patternEditor_lineColor
Definition Theme.h:74
QColor m_widgetTextColor
Definition Theme.h:120
QColor m_patternEditor_noteVelocityHalfColor
Definition Theme.h:71
QColor m_buttonRedColor
Definition Theme.h:121
QColor m_songEditor_automationBackgroundColor
Definition Theme.h:56
QColor m_lightColor
Lighter than Button color.
Definition Theme.h:100
QColor m_songEditor_virtualRowColor
Definition Theme.h:51
QColor m_highlightColor
A color to indicate a selected item or the current item.
Definition Theme.h:110
QColor m_patternEditor_noteVelocityZeroColor
Definition Theme.h:72
QColor m_patternEditor_line5Color
Definition Theme.h:79
QColor m_selectionInactiveColor
Definition Theme.h:82
QColor m_patternEditor_octaveRowColor
Definition Theme.h:67
QColor m_toolTipBaseColor
Definition Theme.h:113
QColor m_songEditor_selectedRowColor
Definition Theme.h:52
QColor m_midColor
Darker than Button.
Definition Theme.h:104
QColor m_windowTextColor
A general foreground color.
Definition Theme.h:88
QColor m_windowColor
A general background color.
Definition Theme.h:86
QColor m_songEditor_automationLineColor
Definition Theme.h:57
QColor m_alternateBaseColor
Used as the alternate background color in views with alternating row colors.
Definition Theme.h:92
QColor m_toolTipTextColor
Definition Theme.h:114
QColor m_songEditor_alternateRowColor
Definition Theme.h:50
QColor m_shadowTextColor
A very dark color.
Definition Theme.h:108
QColor m_songEditor_stackedModeOnColor
Definition Theme.h:59
QColor m_spinBoxTextColor
Definition Theme.h:124
QColor m_patternEditor_noteOffColor
Definition Theme.h:73
QColor m_patternEditor_line2Color
Definition Theme.h:76
QColor m_midLightColor
Between Button and Light.
Definition Theme.h:102
QColor m_cursorColor
Definition Theme.h:126
QColor m_buttonColor
The general button background color.
Definition Theme.h:96
QColor m_patternEditor_noteVelocityFullColor
Definition Theme.h:69
QColor m_accentColor
Definition Theme.h:117
QColor m_songEditor_stackedModeOnNextColor
Definition Theme.h:60
QColor m_patternEditor_textColor
Definition Theme.h:68
QColor m_songEditor_automationNodeColor
Definition Theme.h:58
QColor m_songEditor_textColor
Definition Theme.h:55
QColor m_patternEditor_noteVelocityDefaultColor
Definition Theme.h:70
QColor m_buttonTextColor
A foreground color used with the Button color.
Definition Theme.h:98
QColor m_patternEditor_line4Color
Definition Theme.h:78
QColor m_textColor
The foreground color used with Base.
Definition Theme.h:94
QColor m_patternEditor_backgroundColor
Definition Theme.h:63
QColor m_buttonRedTextColor
Definition Theme.h:122
QColor m_songEditor_backgroundColor
Definition Theme.h:49
QColor m_songEditor_stackedModeOffNextColor
Definition Theme.h:61
QColor m_accentTextColor
Definition Theme.h:118
QColor m_songEditor_lineColor
Definition Theme.h:54
QColor m_patternEditor_alternateRowColor
Definition Theme.h:64
QColor m_selectionHighlightColor
Definition Theme.h:81
QColor m_patternEditor_line3Color
Definition Theme.h:77
QColor m_patternEditor_line1Color
Definition Theme.h:75
QColor m_patternEditor_selectedRowColor
Definition Theme.h:65
QColor m_songEditor_selectedRowTextColor
Definition Theme.h:53
QColor m_baseColor
Used as the background color for text entry widgets; usually white or another light color.
Definition Theme.h:90
QColor m_widgetColor
Definition Theme.h:119
QColor m_patternEditor_selectedRowTextColor
Definition Theme.h:66
QColor m_highlightedTextColor
A text color that contrasts with Highlight.
Definition Theme.h:112
FontSize m_fontSize
Definition Theme.h:193
FontSize
Enables custom scaling of the font size in the GUI.
Definition Theme.h:184
QString m_sApplicationFontFamily
Definition Theme.h:190
QString m_sLevel2FontFamily
Definition Theme.h:191
QString m_sLevel3FontFamily
Definition Theme.h:192
float m_fMixerFalloffSpeed
Definition Theme.h:164
int m_nMaxPatternColors
Not read from/written to disk.
Definition Theme.h:172
ScalingPolicy m_scalingPolicy
Definition Theme.h:166
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
ColoringMethod m_coloringMethod
Definition Theme.h:168
IconColor m_iconColor
Definition Theme.h:167
static void readColorTheme(XMLNode parent, std::shared_ptr< Theme > pTheme)
Definition Theme.cpp:405
void setInterfaceTheme(const std::shared_ptr< InterfaceTheme > pNewInterfaceTheme)
Definition Theme.h:232
static bool exportTheme(const QString &sPath, const std::shared_ptr< Theme > pTheme)
Definition Theme.cpp:725
const std::shared_ptr< FontTheme > getFontTheme() const
Definition Theme.h:235
const std::shared_ptr< ColorTheme > getColorTheme() const
Definition Theme.h:223
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
void setColorTheme(const std::shared_ptr< ColorTheme > pNewColorTheme)
Definition Theme.h:226
void setFontTheme(const std::shared_ptr< FontTheme > pNewFontTheme)
Definition Theme.h:238
static void writeColorTheme(XMLNode *parent, std::shared_ptr< Theme > pTheme)
Definition Theme.cpp:312
const std::shared_ptr< InterfaceTheme > getInterfaceTheme() const
Definition Theme.h:229
XMLNode is a subclass of QDomNode with read and write values methods.
Definition Xml.h:39