equal
deleted
inserted
replaced
23 ** |
23 ** |
24 ****************************************************************************/ |
24 ****************************************************************************/ |
25 #include "hbtheme.h" |
25 #include "hbtheme.h" |
26 #include "hbtheme_p.h" |
26 #include "hbtheme_p.h" |
27 #include "hbthemeclient_p.h" |
27 #include "hbthemeclient_p.h" |
28 #include "hbstandarddirs_p.h" |
|
29 #include "hbicontheme_p.h" |
28 #include "hbicontheme_p.h" |
30 #include "hbthemeutils_p.h" |
29 #include "hbthemeutils_p.h" |
31 #include "hbiconloader_p.h" |
30 #include "hbiconloader_p.h" |
32 #include "hbcolortheme_p_p.h" |
|
33 #include "hbcolortheme_p.h" |
|
34 #include "hbeffecttheme_p.h" |
31 #include "hbeffecttheme_p.h" |
35 #include "hbeffectinternal_p.h" |
32 #include "hbeffectinternal_p.h" |
|
33 #include "hbthemeindex_p.h" |
36 #include <QSettings> |
34 #include <QSettings> |
37 |
35 |
38 /*! |
36 /*! |
39 @stable |
37 @stable |
40 @hbcore |
38 @hbcore |
95 { |
93 { |
96 return d_ptr->iconTheme.description(); |
94 return d_ptr->iconTheme.description(); |
97 } |
95 } |
98 |
96 |
99 /*! |
97 /*! |
|
98 Returns the color for definition \a colorRole |
|
99 */ |
|
100 QColor HbTheme::color(const QString &colorRole) const |
|
101 { |
|
102 HbThemeIndexResource resource(colorRole); |
|
103 if (resource.isValid()) { |
|
104 return resource.colorValue(); |
|
105 } |
|
106 return QColor(); |
|
107 } |
|
108 |
|
109 /*! |
100 Constructor |
110 Constructor |
101 */ |
111 */ |
102 HbTheme::HbTheme() : d_ptr(new HbThemePrivate) |
112 HbTheme::HbTheme() : d_ptr(new HbThemePrivate) |
103 { |
113 { |
104 d_ptr->q_ptr = this; |
114 d_ptr->q_ptr = this; |
105 d_ptr->fetchCurrentThemeFromSettings(); |
115 d_ptr->fetchCurrentThemeFromSettings(); |
106 HbThemeUtils::initSettings(); |
|
107 d_ptr->handleThemeChange(); |
116 d_ptr->handleThemeChange(); |
108 } |
117 } |
109 |
118 |
110 /*! |
119 /*! |
111 Destructor |
120 Destructor |
144 Retrieves the current theme from setting |
153 Retrieves the current theme from setting |
145 */ |
154 */ |
146 void HbThemePrivate::fetchCurrentThemeFromSettings() |
155 void HbThemePrivate::fetchCurrentThemeFromSettings() |
147 { |
156 { |
148 HbThemeIndexInfo info = HbThemeUtils::getThemeIndexInfo(ActiveTheme); |
157 HbThemeIndexInfo info = HbThemeUtils::getThemeIndexInfo(ActiveTheme); |
149 if (info.themeIndexOffset > 0) { |
158 if (info.address) { |
150 currentTheme = info.name; |
159 currentTheme = info.name; |
151 return; |
160 return; |
152 } |
161 } |
153 |
162 |
154 // Fallback to settings |
163 // Fallback to settings |
165 { |
174 { |
166 Q_Q(HbTheme); |
175 Q_Q(HbTheme); |
167 QString newTheme; |
176 QString newTheme; |
168 if (str.isEmpty()) { |
177 if (str.isEmpty()) { |
169 HbThemeIndexInfo info = HbThemeUtils::getThemeIndexInfo(ActiveTheme); |
178 HbThemeIndexInfo info = HbThemeUtils::getThemeIndexInfo(ActiveTheme); |
170 if (info.themeIndexOffset > 0) { |
179 if (info.address) { |
171 newTheme = info.name; |
180 newTheme = info.name; |
172 } else { |
181 } else { |
173 newTheme = HbThemeUtils::getThemeSetting(HbThemeUtils::CurrentThemeSetting); |
182 newTheme = HbThemeUtils::getThemeSetting(HbThemeUtils::CurrentThemeSetting); |
174 } |
183 } |
175 } else { |
184 } else { |
177 // Update the new currentTheme to local settings in HbThemeUtils. |
186 // Update the new currentTheme to local settings in HbThemeUtils. |
178 HbThemeUtils::updateThemeSetting(HbThemeUtils::CurrentThemeSetting, newTheme); |
187 HbThemeUtils::updateThemeSetting(HbThemeUtils::CurrentThemeSetting, newTheme); |
179 } |
188 } |
180 |
189 |
181 iconTheme.setCurrentTheme(newTheme); |
190 iconTheme.setCurrentTheme(newTheme); |
182 HbColorTheme::instance()->setCurrentTheme(newTheme); |
|
183 HbEffectTheme::instance()->setCurrentTheme(newTheme); |
191 HbEffectTheme::instance()->setCurrentTheme(newTheme); |
184 |
192 |
185 // The server sends the signal only if the theme is changed from the previous theme |
193 // The server sends the signal only if the theme is changed from the previous theme |
186 // Hence here, we need not check whether the theme differs from currentTheme or not. |
194 // Hence here, we need not check whether the theme differs from currentTheme or not. |
187 currentTheme = newTheme; |
195 currentTheme = newTheme; |
197 /*! |
205 /*! |
198 Clears the contents to reload new css files |
206 Clears the contents to reload new css files |
199 */ |
207 */ |
200 void HbThemePrivate::updateTheme(const QStringList &updatedFiles) |
208 void HbThemePrivate::updateTheme(const QStringList &updatedFiles) |
201 { |
209 { |
202 // Reload the CSS |
|
203 HbColorTheme::instance()->reloadCss(); |
|
204 |
|
205 // Reload effects |
210 // Reload effects |
206 HbEffectInternal::reloadFxmlFiles(); |
211 HbEffectInternal::reloadFxmlFiles(); |
207 |
212 |
208 iconTheme.emitUpdateIcons(updatedFiles); |
213 iconTheme.emitUpdateIcons(updatedFiles); |
209 |
214 |