Changeset View
Changeset View
Standalone View
Standalone View
src/libkirigami/platformtheme.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 102 | { | |||
---|---|---|---|---|---|
103 | setColorCompressTimer = new QTimer(q); | 103 | setColorCompressTimer = new QTimer(q); | ||
104 | setColorCompressTimer->setSingleShot(true); | 104 | setColorCompressTimer->setSingleShot(true); | ||
105 | setColorCompressTimer->setInterval(0); | 105 | setColorCompressTimer->setInterval(0); | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | PlatformThemePrivate::~PlatformThemePrivate() | 108 | PlatformThemePrivate::~PlatformThemePrivate() | ||
109 | {} | 109 | {} | ||
110 | 110 | | |||
111 | void setPaletteColor(QPalette& customPalette, QPalette::ColorGroup cg, QPalette::ColorRole cr, const QColor &color) | ||||
112 | { | ||||
113 | if (customPalette.color(cg, cr) != color) { | ||||
114 | customPalette.setColor(cg, cr, color); | ||||
115 | } | ||||
116 | } | ||||
117 | | ||||
111 | void PlatformThemePrivate::syncCustomPalette() | 118 | void PlatformThemePrivate::syncCustomPalette() | ||
112 | { | 119 | { | ||
113 | for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) { | 120 | for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) { | ||
114 | customPalette.setBrush(state, QPalette::WindowText, q->textColor()); | 121 | setPaletteColor(customPalette, state, QPalette::WindowText, q->textColor()); | ||
115 | customPalette.setBrush(state, QPalette::Window, q->backgroundColor()); | 122 | setPaletteColor(customPalette, state, QPalette::Window, q->backgroundColor()); | ||
116 | customPalette.setBrush(state, QPalette::Base, q->backgroundColor()); | 123 | setPaletteColor(customPalette, state, QPalette::Base, q->backgroundColor()); | ||
117 | customPalette.setBrush(state, QPalette::Text, q->textColor()); | 124 | setPaletteColor(customPalette, state, QPalette::Text, q->textColor()); | ||
118 | customPalette.setBrush(state, QPalette::Button, q->backgroundColor()); | 125 | setPaletteColor(customPalette, state, QPalette::Button, q->backgroundColor()); | ||
119 | customPalette.setBrush(state, QPalette::ButtonText, q->textColor()); | 126 | setPaletteColor(customPalette, state, QPalette::ButtonText, q->textColor()); | ||
120 | customPalette.setBrush(state, QPalette::Highlight, q->highlightColor()); | 127 | setPaletteColor(customPalette, state, QPalette::Highlight, q->highlightColor()); | ||
121 | customPalette.setBrush(state, QPalette::HighlightedText, q->highlightedTextColor()); | 128 | setPaletteColor(customPalette, state, QPalette::HighlightedText, q->highlightedTextColor()); | ||
122 | customPalette.setBrush(state, QPalette::ToolTipBase, q->backgroundColor()); | 129 | setPaletteColor(customPalette, state, QPalette::ToolTipBase, q->backgroundColor()); | ||
123 | customPalette.setBrush(state, QPalette::ToolTipText, q->textColor()); | 130 | setPaletteColor(customPalette, state, QPalette::ToolTipText, q->textColor()); | ||
124 | /*Those shouldn't be needed | 131 | /*Those shouldn't be needed | ||
125 | customPalette.setColor(state, QPalette::Light, KColorScheme::shade(backgroundColor(), KColorScheme::LightShade)); | 132 | customPalette.setColor(state, QPalette::Light, KColorScheme::shade(backgroundColor(), KColorScheme::LightShade)); | ||
126 | customPalette.setColor(state, QPalette::Midlight, KColorScheme::shade(backgroundColor(), KColorScheme::MidlightShade)); | 133 | customPalette.setColor(state, QPalette::Midlight, KColorScheme::shade(backgroundColor(), KColorScheme::MidlightShade)); | ||
127 | customPalette.setColor(state, QPalette::Mid, KColorScheme::shade(backgroundColor(), KColorScheme::MidShade)); | 134 | customPalette.setColor(state, QPalette::Mid, KColorScheme::shade(backgroundColor(), KColorScheme::MidShade)); | ||
128 | customPalette.setColor(state, QPalette::Dark, KColorScheme::shade(backgroundColor(), KColorScheme::DarkShade)); | 135 | customPalette.setColor(state, QPalette::Dark, KColorScheme::shade(backgroundColor(), KColorScheme::DarkShade)); | ||
129 | customPalette.setColor(state, QPalette::Shadow, KColorScheme::shade(backgroundColor(), KColorScheme::ShadowShade)); | 136 | customPalette.setColor(state, QPalette::Shadow, KColorScheme::shade(backgroundColor(), KColorScheme::ShadowShade)); | ||
130 | 137 | | |||
131 | customPalette.setBrush(state, QPalette::AlternateBase, backgroundColor().darker(120));*/ | 138 | setPaletteColor(customPalette, state, QPalette::AlternateBase, backgroundColor().darker(120));*/ | ||
132 | customPalette.setBrush(state, QPalette::Link, q->linkColor()); | 139 | setPaletteColor(customPalette, state, QPalette::Link, q->linkColor()); | ||
133 | customPalette.setBrush(state, QPalette::LinkVisited, q->visitedLinkColor()); | 140 | setPaletteColor(customPalette, state, QPalette::LinkVisited, q->visitedLinkColor()); | ||
134 | } | 141 | } | ||
135 | emit q->paletteChanged(customPalette); | 142 | emit q->paletteChanged(customPalette); | ||
136 | } | 143 | } | ||
137 | 144 | | |||
138 | void PlatformThemePrivate::findParentStyle() | 145 | void PlatformThemePrivate::findParentStyle() | ||
139 | { | 146 | { | ||
140 | if (m_parentTheme) { | 147 | if (m_parentTheme) { | ||
141 | m_parentTheme->d->m_childThemes.remove(q); | 148 | m_parentTheme->d->m_childThemes.remove(q); | ||
▲ Show 20 Lines • Show All 586 Lines • Show Last 20 Lines |