-rw-r--r-- | noncore/styles/theme/othemebase.cpp | 2 | ||||
-rw-r--r-- | noncore/styles/theme/themeset.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp index d2226e6..4275dd6 100644 --- a/noncore/styles/theme/othemebase.cpp +++ b/noncore/styles/theme/othemebase.cpp | |||
@@ -261,97 +261,97 @@ void OThemeBase::readConfig( Qt::GUIStyle /*style*/ ) | |||
261 | cfg. setGroup ( "Appearance" ); | 261 | cfg. setGroup ( "Appearance" ); |
262 | 262 | ||
263 | configFileName = cfg. readEntry ( "Theme", "default" ); | 263 | configFileName = cfg. readEntry ( "Theme", "default" ); |
264 | } | 264 | } |
265 | Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); | 265 | Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); |
266 | 266 | ||
267 | // Are we initalized? | 267 | // Are we initalized? |
268 | applyMiscResourceGroup( &config ); | 268 | applyMiscResourceGroup( &config ); |
269 | for ( i = 0; i < INHERIT_ITEMS; ++i ) { | 269 | for ( i = 0; i < INHERIT_ITEMS; ++i ) { |
270 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 270 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
271 | } | 271 | } |
272 | for ( ; i < INHERIT_ITEMS*2; ++i ) { | 272 | for ( ; i < INHERIT_ITEMS*2; ++i ) { |
273 | if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { | 273 | if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { |
274 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 274 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
275 | } | 275 | } |
276 | else { | 276 | else { |
277 | copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; | 277 | copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; |
278 | } | 278 | } |
279 | } | 279 | } |
280 | for ( ; i < WIDGETS; ++i ) { | 280 | for ( ; i < WIDGETS; ++i ) { |
281 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 281 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
282 | } | 282 | } |
283 | 283 | ||
284 | // initalize defaults that may not be read | 284 | // initalize defaults that may not be read |
285 | for ( i = 0; i < WIDGETS; ++i ) | 285 | for ( i = 0; i < WIDGETS; ++i ) |
286 | loaded[ i ] = false; | 286 | loaded[ i ] = false; |
287 | btnXShift = btnYShift = focus3DOffset = 0; | 287 | btnXShift = btnYShift = focus3DOffset = 0; |
288 | aTabLine = iTabLine = true; | 288 | aTabLine = iTabLine = true; |
289 | roundedButton = roundedCombo = roundedSlider = focus3D = false; | 289 | roundedButton = roundedCombo = roundedSlider = focus3D = false; |
290 | splitterWidth = 10; | 290 | splitterWidth = 10; |
291 | 291 | ||
292 | for ( i = 0; i < WIDGETS; ++i ) { | 292 | for ( i = 0; i < WIDGETS; ++i ) { |
293 | readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); | 293 | readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); |
294 | } | 294 | } |
295 | 295 | ||
296 | // misc items | 296 | // misc items |
297 | readMiscResourceGroup(); | 297 | readMiscResourceGroup(); |
298 | 298 | ||
299 | // Handle preblend items | 299 | // Handle preblend items |
300 | for ( i = 0; i < PREBLEND_ITEMS; ++i ) { | 300 | for ( i = 0; i < PREBLEND_ITEMS; ++i ) { |
301 | if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) | 301 | if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) |
302 | blend( preBlend[ i ] ); | 302 | blend( preBlend[ i ] ); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | OThemeBase::OThemeBase( const QString & configFile ) | 306 | OThemeBase::OThemeBase( const QString & configFile ) |
307 | : QWindowsStyle() | 307 | : QWindowsStyle() |
308 | { | 308 | { |
309 | configFilePath = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 309 | configFilePath = QPEApplication::qpeDir ( ) + "plugins/styles/"; |
310 | configFileName = configFile; | 310 | configFileName = configFile; |
311 | 311 | ||
312 | readConfig( Qt::WindowsStyle ); | 312 | readConfig( Qt::WindowsStyle ); |
313 | cache = new OThemeCache( cacheSize ); | 313 | cache = new OThemeCache( cacheSize ); |
314 | } | 314 | } |
315 | 315 | ||
316 | void OThemeBase::applyConfigFile( const QString &/*file*/ ) | 316 | void OThemeBase::applyConfigFile( const QString &/*file*/ ) |
317 | { | 317 | { |
318 | #if 0 | 318 | #if 0 |
319 | // handle std color scheme | 319 | // handle std color scheme |
320 | Config inConfig( file, Config::File ); | 320 | Config inConfig( file, Config::File ); |
321 | Config globalConfig ( "qpe" ); | 321 | Config globalConfig ( "qpe" ); |
322 | 322 | ||
323 | globalConfig. setGroup ( "Apperance" ); | 323 | globalConfig. setGroup ( "Apperance" ); |
324 | inConfig. setGroup( "General" ); | 324 | inConfig. setGroup( "General" ); |
325 | 325 | ||
326 | if ( inConfig.hasKey( "foreground" ) ) | 326 | if ( inConfig.hasKey( "foreground" ) ) |
327 | globalConfig.writeEntry( "Text", inConfig.readEntry( "foreground", " " ) ); | 327 | globalConfig.writeEntry( "Text", inConfig.readEntry( "foreground", " " ) ); |
328 | if ( inConfig.hasKey( "background" ) ) | 328 | if ( inConfig.hasKey( "background" ) ) |
329 | globalConfig.writeEntry( "Background", inConfig.readEntry( "background", " " ) ); | 329 | globalConfig.writeEntry( "Background", inConfig.readEntry( "background", " " ) ); |
330 | if ( inConfig.hasKey( "selectForeground" ) ) | 330 | if ( inConfig.hasKey( "selectForeground" ) ) |
331 | globalConfig.writeEntry( "HighlightedText", inConfig.readEntry( "selectForeground", " " ) ); | 331 | globalConfig.writeEntry( "HighlightedText", inConfig.readEntry( "selectForeground", " " ) ); |
332 | if ( inConfig.hasKey( "selectBackground" ) ) | 332 | if ( inConfig.hasKey( "selectBackground" ) ) |
333 | globalConfig.writeEntry( "Highlight", inConfig.readEntry( "selectBackground", " " ) ); | 333 | globalConfig.writeEntry( "Highlight", inConfig.readEntry( "selectBackground", " " ) ); |
334 | if ( inConfig.hasKey( "windowForeground" ) ) | 334 | if ( inConfig.hasKey( "windowForeground" ) ) |
335 | globalConfig.writeEntry( "Text", inConfig.readEntry( "windowForeground", " " ) ); | 335 | globalConfig.writeEntry( "Text", inConfig.readEntry( "windowForeground", " " ) ); |
336 | if ( inConfig.hasKey( "windowBackground" ) ) | 336 | if ( inConfig.hasKey( "windowBackground" ) ) |
337 | globalConfig.writeEntry( "Base", inConfig.readEntry( "windowBackground", " " ) ); | 337 | globalConfig.writeEntry( "Base", inConfig.readEntry( "windowBackground", " " ) ); |
338 | 338 | ||
339 | // Keep track of the current theme so that we can select the right one | 339 | // Keep track of the current theme so that we can select the right one |
340 | // in the KControl module. | 340 | // in the KControl module. |
341 | globalConfig.writeEntry ( "CurrentTheme", file ); | 341 | globalConfig.writeEntry ( "CurrentTheme", file ); |
342 | 342 | ||
343 | globalConfig.write(); | 343 | globalConfig.write(); |
344 | #endif | 344 | #endif |
345 | } | 345 | } |
346 | 346 | ||
347 | OThemeBase::~OThemeBase() | 347 | OThemeBase::~OThemeBase() |
348 | { | 348 | { |
349 | int i; | 349 | int i; |
350 | for ( i = 0; i < WIDGETS; ++i ) { | 350 | for ( i = 0; i < WIDGETS; ++i ) { |
351 | if ( !duplicate[ i ] ) { | 351 | if ( !duplicate[ i ] ) { |
352 | if ( images[ i ] ) | 352 | if ( images[ i ] ) |
353 | delete images[ i ]; | 353 | delete images[ i ]; |
354 | if ( pixmaps[ i ] ) | 354 | if ( pixmaps[ i ] ) |
355 | delete pixmaps[ i ]; | 355 | delete pixmaps[ i ]; |
356 | } | 356 | } |
357 | if ( !pbDuplicate[ i ] && pbPixmaps[ i ] ) | 357 | if ( !pbDuplicate[ i ] && pbPixmaps[ i ] ) |
diff --git a/noncore/styles/theme/themeset.cpp b/noncore/styles/theme/themeset.cpp index d4005bc..3205106 100644 --- a/noncore/styles/theme/themeset.cpp +++ b/noncore/styles/theme/themeset.cpp | |||
@@ -41,84 +41,84 @@ public: | |||
41 | 41 | ||
42 | bool hasGroup ( const QString &gname ) const | 42 | bool hasGroup ( const QString &gname ) const |
43 | { | 43 | { |
44 | QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname ); | 44 | QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname ); |
45 | return ( it != groups.end() ); | 45 | return ( it != groups.end() ); |
46 | } | 46 | } |
47 | }; | 47 | }; |
48 | 48 | ||
49 | class MyItem : public QListViewItem | 49 | class MyItem : public QListViewItem |
50 | { | 50 | { |
51 | public: | 51 | public: |
52 | MyItem ( QListView *lv, QListViewItem *after, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, after, name, comm ) | 52 | MyItem ( QListView *lv, QListViewItem *after, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, after, name, comm ) |
53 | { | 53 | { |
54 | m_theme = theme; | 54 | m_theme = theme; |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | QString m_theme; | 58 | QString m_theme; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl ) | 62 | ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl ) |
63 | : QWidget ( parent, name, fl ) | 63 | : QWidget ( parent, name, fl ) |
64 | { | 64 | { |
65 | setCaption ( tr( "Theme Style" ) ); | 65 | setCaption ( tr( "Theme Style" ) ); |
66 | 66 | ||
67 | Config config ( "qpe" ); | 67 | Config config ( "qpe" ); |
68 | config. setGroup ( "Appearance" ); | 68 | config. setGroup ( "Appearance" ); |
69 | 69 | ||
70 | QString active = config. readEntry ( "Theme", "default" ); | 70 | QString active = config. readEntry ( "Theme", "default" ); |
71 | 71 | ||
72 | QVBoxLayout *vbox = new QVBoxLayout ( this ); | 72 | QVBoxLayout *vbox = new QVBoxLayout ( this ); |
73 | vbox-> setSpacing ( 3 ); | 73 | vbox-> setSpacing ( 3 ); |
74 | vbox-> setMargin ( 6 ); | 74 | vbox-> setMargin ( 6 ); |
75 | 75 | ||
76 | vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this )); | 76 | vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this )); |
77 | 77 | ||
78 | m_list = new QListView ( this ); | 78 | m_list = new QListView ( this ); |
79 | m_list-> addColumn ( tr( "Name" )); | 79 | m_list-> addColumn ( tr( "Name" )); |
80 | m_list-> addColumn ( tr( "Description" )); | 80 | m_list-> addColumn ( tr( "Description" )); |
81 | m_list-> setSelectionMode ( QListView::Single ); | 81 | m_list-> setSelectionMode ( QListView::Single ); |
82 | m_list-> setAllColumnsShowFocus ( true ); | 82 | m_list-> setAllColumnsShowFocus ( true ); |
83 | m_list-> setSorting ( -1 ); | 83 | m_list-> setSorting ( -1 ); |
84 | vbox-> addWidget ( m_list, 10 ); | 84 | vbox-> addWidget ( m_list, 10 ); |
85 | 85 | ||
86 | QListViewItem *item = new MyItem ( m_list, 0, tr( "[No theme]" ), "", "" ); | 86 | QListViewItem *item = new MyItem ( m_list, 0, tr( "[No theme]" ), "", "" ); |
87 | m_list-> setSelected ( item, true ); | 87 | m_list-> setSelected ( item, true ); |
88 | 88 | ||
89 | QString path = QPEApplication::qpeDir() + "/plugins/styles/themes"; | 89 | QString path = QPEApplication::qpeDir() + "plugins/styles/themes"; |
90 | QStringList list = QDir ( path, "*.themerc" ). entryList ( ); | 90 | QStringList list = QDir ( path, "*.themerc" ). entryList ( ); |
91 | 91 | ||
92 | for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) { | 92 | for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) { |
93 | MyConfig cfg ( path + "/" + *it, Config::File ); | 93 | MyConfig cfg ( path + "/" + *it, Config::File ); |
94 | 94 | ||
95 | if ( cfg. hasGroup ( "Misc" )) { | 95 | if ( cfg. hasGroup ( "Misc" )) { |
96 | cfg. setGroup ( "Misc" ); | 96 | cfg. setGroup ( "Misc" ); |
97 | 97 | ||
98 | QString name = cfg. readEntry ( "Name" ); | 98 | QString name = cfg. readEntry ( "Name" ); |
99 | QString comm = cfg. readEntry ( "Comment" ); | 99 | QString comm = cfg. readEntry ( "Comment" ); |
100 | 100 | ||
101 | if ( !name. isEmpty ( )) { | 101 | if ( !name. isEmpty ( )) { |
102 | QString fname = (*it). left ((*it). length ( ) - 8 ); | 102 | QString fname = (*it). left ((*it). length ( ) - 8 ); |
103 | 103 | ||
104 | item = new MyItem ( m_list, item, name, comm, fname ); | 104 | item = new MyItem ( m_list, item, name, comm, fname ); |
105 | if ( active == fname ) { | 105 | if ( active == fname ) { |
106 | m_list-> setSelected ( item, true ); | 106 | m_list-> setSelected ( item, true ); |
107 | } | 107 | } |
108 | } | 108 | } |
109 | } | 109 | } |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | bool ThemeSettings::writeConfig ( ) | 113 | bool ThemeSettings::writeConfig ( ) |
114 | { | 114 | { |
115 | Config config ( "qpe" ); | 115 | Config config ( "qpe" ); |
116 | config. setGroup ( "Appearance" ); | 116 | config. setGroup ( "Appearance" ); |
117 | 117 | ||
118 | MyItem *it = (MyItem *) m_list-> selectedItem ( ); | 118 | MyItem *it = (MyItem *) m_list-> selectedItem ( ); |
119 | config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" )); | 119 | config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" )); |
120 | config. write ( ); | 120 | config. write ( ); |
121 | 121 | ||
122 | return true; | 122 | return true; |
123 | } | 123 | } |
124 | 124 | ||