18 #include "cpthemechanger.h" |
18 #include "cpthemechanger.h" |
19 #include "cpthemechanger_p.h" |
19 #include "cpthemechanger_p.h" |
20 #include <QStringList> |
20 #include <QStringList> |
21 #include <QSettings> |
21 #include <QSettings> |
22 #include <QFileSystemWatcher> |
22 #include <QFileSystemWatcher> |
23 #include <HbIcon.h> |
23 #include <QSizeF> |
|
24 #include <hbicon.h> |
24 #include <hbinstance.h> |
25 #include <hbinstance.h> |
25 #include "cpthemeclient_p.h" |
26 #include "cpthemeclient_p.h" |
26 #include "cpthemecommon_p.h" |
27 #include "cpthemecommon_p.h" |
27 #ifdef Q_OS_SYMBIAN |
28 #ifdef Q_OS_SYMBIAN |
28 #include "cpthemeclientsymbian_p.h" |
29 #include "cpthemeclientsymbian_p.h" |
34 #if !defined(Q_OS_SYMBIAN) |
35 #if !defined(Q_OS_SYMBIAN) |
35 #include <stdio.h> |
36 #include <stdio.h> |
36 static const char* KThemePathKey = "HB_THEMES_DIR"; |
37 static const char* KThemePathKey = "HB_THEMES_DIR"; |
37 #endif |
38 #endif |
38 |
39 |
39 static const char* KDefaultTheme = "hbdefault"; |
40 static const QString KDefaultTheme = "hbdefault"; |
40 static const char* KSettingsGroup = "hborbit"; |
|
41 static const char* KSettingsCategory = "currenttheme"; |
41 static const char* KSettingsCategory = "currenttheme"; |
42 static const bool KDefaultPreviewAvailable = true; |
42 static const bool KDefaultPreviewAvailable = true; |
43 } |
43 } |
44 |
44 |
45 CpThemeChangerPrivate::CpThemeChangerPrivate(CpThemeChanger* qq): |
45 CpThemeChangerPrivate::CpThemeChangerPrivate(CpThemeChanger* qq): |
164 } |
169 } |
165 if(iconPath.isEmpty()){ |
170 if(iconPath.isEmpty()){ |
166 |
171 |
167 //if no preview graphics path specified,look for the background graphic. |
172 //if no preview graphics path specified,look for the background graphic. |
168 //first look in /scalable folder. if not there, look in pixmap folder. |
173 //first look in /scalable folder. if not there, look in pixmap folder. |
169 if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){ |
174 |
|
175 //Set thumbnail |
|
176 if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg").exists()){ |
|
177 nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_thumbnail.svg"); |
|
178 }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){ |
170 nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); |
179 nameIconPair.icon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); |
|
180 qreal width = nameIconPair.icon.width(); |
|
181 nameIconPair.icon.setHeight(width); |
171 } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){ |
182 } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){ |
172 nameIconPair.icon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png"); |
183 nameIconPair.icon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png"); |
|
184 qreal width = nameIconPair.icon.width(); |
|
185 nameIconPair.icon.setHeight(width); |
173 } else{ |
186 } else{ |
174 nameIconPair.icon = HbIcon(":/image/themePreview.svg"); |
187 nameIconPair.icon = HbIcon(":/image/themePreview.svg"); |
175 } |
188 } |
176 } else { |
189 } else { |
177 nameIconPair.icon = HbIcon(fullPathToIcon); |
190 nameIconPair.icon = HbIcon(fullPathToIcon); |
178 } |
191 } |
|
192 |
|
193 //set portrait preview |
|
194 if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_prt.svg").exists()){ |
|
195 nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_prt.svg"); |
|
196 }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg").exists()){ |
|
197 nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_prt.svg"); |
|
198 } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png").exists()){ |
|
199 nameIconPair.portraitPreviewIcon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_prt.png"); |
|
200 } else{ |
|
201 nameIconPair.portraitPreviewIcon = HbIcon(":/image/themePreview.svg"); |
|
202 } |
|
203 |
|
204 //set landscape preview |
|
205 if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_theme_preview_lsc.svg").exists()){ |
|
206 nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_theme_preview_lsc.svg"); |
|
207 }else if(QFileInfo(fullPathToIcon + "/scalable/qtg_graf_screen_bg_lsc.svg").exists()){ |
|
208 nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + "/scalable/qtg_graf_screen_bg_lsc.svg"); |
|
209 } else if(QFileInfo(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_lsc.png").exists()){ |
|
210 nameIconPair.landscapePreviewIcon = HbIcon(fullPathToIcon + "/pixmap/qtg_graf_screen_bg_lsc.png"); |
|
211 } else{ |
|
212 nameIconPair.landscapePreviewIcon = HbIcon(":/image/themePreview.svg"); |
|
213 } |
|
214 |
179 nameIconPair.name = name; |
215 nameIconPair.name = name; |
|
216 |
180 themeList.append(nameIconPair); |
217 themeList.append(nameIconPair); |
181 |
218 |
182 if (name == mCurrentTheme.name) { |
219 if (name == mCurrentTheme.name) { |
183 mCurrentTheme = nameIconPair; |
220 mCurrentTheme = nameIconPair; |
184 } |
221 } |