author | sandman <sandman> | 2002-09-27 01:24:35 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-27 01:24:35 (UTC) |
commit | 599a9ab17fd0bbaf612d04b74cf152d4943919e5 (patch) (unidiff) | |
tree | ae1d9f6fdeca12eee2e49474cf755d62995b9979 | |
parent | afac99bfbfedb9bfc48bc7e55b806aa9cc80dd96 (diff) | |
download | opie-599a9ab17fd0bbaf612d04b74cf152d4943919e5.zip opie-599a9ab17fd0bbaf612d04b74cf152d4943919e5.tar.gz opie-599a9ab17fd0bbaf612d04b74cf152d4943919e5.tar.bz2 |
commented out a bunch of debug printf's
-rw-r--r-- | noncore/styles/theme/othemebase.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp index 21d16f2..58005b5 100644 --- a/noncore/styles/theme/othemebase.cpp +++ b/noncore/styles/theme/othemebase.cpp | |||
@@ -1,84 +1,85 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org> | 2 | Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org> |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | #include "othemebase.h" | 18 | #include "othemebase.h" |
19 | #include "ogfxeffect.h" | 19 | #include "ogfxeffect.h" |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | //#include <kdebug.h> | 21 | //#include <kdebug.h> |
22 | //#include <klocale.h> | 22 | //#include <klocale.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | //#include <kglobal.h> | 24 | //#include <kglobal.h> |
25 | //#include <kglobalsettings.h> | 25 | //#include <kglobalsettings.h> |
26 | //#include <kstddirs.h> | 26 | //#include <kstddirs.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qpainter.h> | 30 | #include <qpainter.h> |
31 | #include <qbitmap.h> | 31 | #include <qbitmap.h> |
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include <qstringlist.h> | 33 | #include <qstringlist.h> |
34 | 34 | ||
35 | #include <stdio.h> | 35 | #include <stdio.h> |
36 | 36 | ||
37 | |||
37 | template class QIntCache<OThemePixmap> | 38 | template class QIntCache<OThemePixmap> |
38 | ; | 39 | ; |
39 | 40 | ||
40 | static const char *widgetEntries[] = | 41 | static const char *widgetEntries[] = |
41 | { // unsunken widgets (see header) | 42 | { // unsunken widgets (see header) |
42 | "PushButton", "ComboBox", "HSBarSlider", "VSBarSlider", "Bevel", "ToolButton", | 43 | "PushButton", "ComboBox", "HSBarSlider", "VSBarSlider", "Bevel", "ToolButton", |
43 | "ScrollButton", "HScrollDeco", "VScrollDeco", "ComboDeco", "MenuItem", "Tab", | 44 | "ScrollButton", "HScrollDeco", "VScrollDeco", "ComboDeco", "MenuItem", "Tab", |
44 | "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", | 45 | "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", |
45 | // sunken widgets | 46 | // sunken widgets |
46 | "PushButtonDown", "ComboBoxDown", "HSBarSliderDown", "VSBarSliderDown", | 47 | "PushButtonDown", "ComboBoxDown", "HSBarSliderDown", "VSBarSliderDown", |
47 | "BevelDown", "ToolButtonDown", "ScrollButtonDown", "HScrollDecoDown", | 48 | "BevelDown", "ToolButtonDown", "ScrollButtonDown", "HScrollDecoDown", |
48 | "VScrollDecoDown", "ComboDecoDown", "MenuItemDown", "TabDown", "SunkenArrowUp", | 49 | "VScrollDecoDown", "ComboDecoDown", "MenuItemDown", "TabDown", "SunkenArrowUp", |
49 | "SunkenArrowDown", "SunkenArrowLeft", "SunkenArrowRight", | 50 | "SunkenArrowDown", "SunkenArrowLeft", "SunkenArrowRight", |
50 | // everything else | 51 | // everything else |
51 | "HScrollGroove", "VScrollGroove", "Slider", "SliderGroove", "CheckBoxDown", | 52 | "HScrollGroove", "VScrollGroove", "Slider", "SliderGroove", "CheckBoxDown", |
52 | "CheckBox", "RadioDown", "Radio", "HBarHandle", "VBarHandle", | 53 | "CheckBox", "RadioDown", "Radio", "HBarHandle", "VBarHandle", |
53 | "ToolBar", "Splitter", "CheckMark", "MenuBar", "DisableArrowUp", | 54 | "ToolBar", "Splitter", "CheckMark", "MenuBar", "DisableArrowUp", |
54 | "DisableArrowDown", "DisableArrowLeft", "DisableArrowRight", "ProgressBar", | 55 | "DisableArrowDown", "DisableArrowLeft", "DisableArrowRight", "ProgressBar", |
55 | "ProgressBackground", "MenuBarItem", "Background" | 56 | "ProgressBackground", "MenuBarItem", "Background" |
56 | }; | 57 | }; |
57 | 58 | ||
58 | #define INHERIT_ITEMS 16 | 59 | #define INHERIT_ITEMS 16 |
59 | 60 | ||
60 | 61 | ||
61 | // This is used to encode the keys. I used to use masks but I think this | 62 | // This is used to encode the keys. I used to use masks but I think this |
62 | // bitfield is nicer :) I don't know why C++ coders don't use these more.. | 63 | // bitfield is nicer :) I don't know why C++ coders don't use these more.. |
63 | // (mosfet) | 64 | // (mosfet) |
64 | struct kthemeKeyData | 65 | struct kthemeKeyData |
65 | { | 66 | { |
66 | unsigned int id : | 67 | unsigned int id : |
67 | 6; | 68 | 6; |
68 | unsigned int width : | 69 | unsigned int width : |
69 | 12; | 70 | 12; |
70 | unsigned int height : | 71 | unsigned int height : |
71 | 12; | 72 | 12; |
72 | unsigned int border : | 73 | unsigned int border : |
73 | 1; | 74 | 1; |
74 | unsigned int mask : | 75 | unsigned int mask : |
75 | 1; | 76 | 1; |
76 | }; | 77 | }; |
77 | 78 | ||
78 | union kthemeKey{ | 79 | union kthemeKey{ |
79 | kthemeKeyData data; | 80 | kthemeKeyData data; |
80 | unsigned int cacheKey; | 81 | unsigned int cacheKey; |
81 | }; | 82 | }; |
82 | 83 | ||
83 | class MyConfig : public Config | 84 | class MyConfig : public Config |
84 | { | 85 | { |
@@ -228,130 +229,130 @@ void OThemeBase::copyWidgetConfig( int sourceID, int destID, QString *pixnames, | |||
228 | } | 229 | } |
229 | if ( !duplicate[ destID ] ) { | 230 | if ( !duplicate[ destID ] ) { |
230 | pixmaps[ destID ] = loadPixmap( pixnames[ destID ] ); | 231 | pixmaps[ destID ] = loadPixmap( pixnames[ destID ] ); |
231 | if ( scaleHints[ destID ] == TileScale && blends[ destID ] == 0.0 ) | 232 | if ( scaleHints[ destID ] == TileScale && blends[ destID ] == 0.0 ) |
232 | images[ destID ] = NULL; | 233 | images[ destID ] = NULL; |
233 | else | 234 | else |
234 | images[ destID ] = loadImage( pixnames[ destID ] ); | 235 | images[ destID ] = loadImage( pixnames[ destID ] ); |
235 | } | 236 | } |
236 | } | 237 | } |
237 | 238 | ||
238 | // border pixmap | 239 | // border pixmap |
239 | pbDuplicate[ destID ] = false; | 240 | pbDuplicate[ destID ] = false; |
240 | pbPixmaps[ destID ] = NULL; | 241 | pbPixmaps[ destID ] = NULL; |
241 | pbWidth[ destID ] = pbWidth[ sourceID ]; | 242 | pbWidth[ destID ] = pbWidth[ sourceID ]; |
242 | brdnames[ destID ] = brdnames[ sourceID ]; | 243 | brdnames[ destID ] = brdnames[ sourceID ]; |
243 | if ( !brdnames[ destID ].isEmpty() ) { | 244 | if ( !brdnames[ destID ].isEmpty() ) { |
244 | pbPixmaps[ destID ] = pbPixmaps[ sourceID ]; | 245 | pbPixmaps[ destID ] = pbPixmaps[ sourceID ]; |
245 | pbDuplicate[ destID ] = true; | 246 | pbDuplicate[ destID ] = true; |
246 | } | 247 | } |
247 | 248 | ||
248 | if ( sourceID == ActiveTab && destID == InactiveTab ) | 249 | if ( sourceID == ActiveTab && destID == InactiveTab ) |
249 | aTabLine = iTabLine; | 250 | aTabLine = iTabLine; |
250 | else if ( sourceID == InactiveTab && destID == ActiveTab ) | 251 | else if ( sourceID == InactiveTab && destID == ActiveTab ) |
251 | iTabLine = aTabLine; | 252 | iTabLine = aTabLine; |
252 | } | 253 | } |
253 | 254 | ||
254 | void OThemeBase::readConfig( Qt::GUIStyle /*style*/ ) | 255 | void OThemeBase::readConfig( Qt::GUIStyle /*style*/ ) |
255 | { | 256 | { |
256 | #define PREBLEND_ITEMS 12 | 257 | #define PREBLEND_ITEMS 12 |
257 | static WidgetType preBlend[] = {Slider, IndicatorOn, IndicatorOff, | 258 | static WidgetType preBlend[] = {Slider, IndicatorOn, IndicatorOff, |
258 | ExIndicatorOn, ExIndicatorOff, HScrollDeco, VScrollDeco, HScrollDecoDown, | 259 | ExIndicatorOn, ExIndicatorOff, HScrollDeco, VScrollDeco, HScrollDecoDown, |
259 | VScrollDecoDown, ComboDeco, ComboDecoDown, CheckMark}; | 260 | VScrollDecoDown, ComboDeco, ComboDecoDown, CheckMark}; |
260 | 261 | ||
261 | int i; | 262 | int i; |
262 | QString tmpStr; | 263 | QString tmpStr; |
263 | QString copyfrom[ WIDGETS ]; | 264 | QString copyfrom[ WIDGETS ]; |
264 | QString pixnames[ WIDGETS ]; // used for duplicate check | 265 | QString pixnames[ WIDGETS ]; // used for duplicate check |
265 | QString brdnames[ WIDGETS ]; | 266 | QString brdnames[ WIDGETS ]; |
266 | bool loaded[ WIDGETS ]; // used for preloading for CopyWidget | 267 | bool loaded[ WIDGETS ]; // used for preloading for CopyWidget |
267 | 268 | ||
268 | if ( configFileName.isEmpty() ) { | 269 | if ( configFileName.isEmpty() ) { |
269 | Config cfg ( "qpe" ); | 270 | Config cfg ( "qpe" ); |
270 | cfg. setGroup ( "Appearance" ); | 271 | cfg. setGroup ( "Appearance" ); |
271 | 272 | ||
272 | configFileName = cfg. readEntry ( "Theme", "default" ); | 273 | configFileName = cfg. readEntry ( "Theme", "default" ); |
273 | } | 274 | } |
274 | MyConfig config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); | 275 | MyConfig config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); |
275 | 276 | ||
276 | printf ( "Opened config file: %s\n", ( configFilePath + "/themes/" + configFileName + ".themerc" ). ascii()); | 277 | //printf ( "Opened config file: %s\n", ( configFilePath + "/themes/" + configFileName + ".themerc" ). ascii()); |
277 | 278 | ||
278 | // Are we initalized? | 279 | // Are we initalized? |
279 | for ( i = 0; i < INHERIT_ITEMS; ++i ) { | 280 | for ( i = 0; i < INHERIT_ITEMS; ++i ) { |
280 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 281 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
281 | printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); | 282 | // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); |
282 | } | 283 | } |
283 | for ( ; i < INHERIT_ITEMS*2; ++i ) { | 284 | for ( ; i < INHERIT_ITEMS*2; ++i ) { |
284 | if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { | 285 | if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { |
285 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 286 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
286 | printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); | 287 | // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); |
287 | } | 288 | } |
288 | else { | 289 | else { |
289 | copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; | 290 | copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; |
290 | printf ( "%d [%s]: copy=%s\n", i, widgetEntries [i], copyfrom [i].latin1()); | 291 | // printf ( "%d [%s]: copy=%s\n", i, widgetEntries [i], copyfrom [i].latin1()); |
291 | } | 292 | } |
292 | } | 293 | } |
293 | for ( ; i < WIDGETS; ++i ) { | 294 | for ( ; i < WIDGETS; ++i ) { |
294 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 295 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
295 | printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); | 296 | // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1() ); |
296 | } | 297 | } |
297 | applyMiscResourceGroup( &config ); | 298 | applyMiscResourceGroup( &config ); |
298 | 299 | ||
299 | // initalize defaults that may not be read | 300 | // initalize defaults that may not be read |
300 | for ( i = 0; i < WIDGETS; ++i ) | 301 | for ( i = 0; i < WIDGETS; ++i ) |
301 | loaded[ i ] = false; | 302 | loaded[ i ] = false; |
302 | btnXShift = btnYShift = focus3DOffset = 0; | 303 | btnXShift = btnYShift = focus3DOffset = 0; |
303 | aTabLine = iTabLine = true; | 304 | aTabLine = iTabLine = true; |
304 | roundedButton = roundedCombo = roundedSlider = focus3D = false; | 305 | roundedButton = roundedCombo = roundedSlider = focus3D = false; |
305 | splitterWidth = 10; | 306 | splitterWidth = 10; |
306 | 307 | ||
307 | for ( i = 0; i < WIDGETS; ++i ) { | 308 | for ( i = 0; i < WIDGETS; ++i ) { |
308 | readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); | 309 | readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); |
309 | printf ( "%d [%s]: copy=%s, pix=%s, brd=%s, colors=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1(), (colors[i]?colors[i]->background().name().latin1():"<none)" )); | 310 | // printf ( "%d [%s]: copy=%s, pix=%s, brd=%s, colors=%s\n", i, widgetEntries [i], copyfrom [i].latin1(), pixnames[i].latin1(),brdnames[i].latin1(), (colors[i]?colors[i]->background().name().latin1():"<none)" )); |
310 | } | 311 | } |
311 | 312 | ||
312 | // misc items | 313 | // misc items |
313 | readMiscResourceGroup(); | 314 | readMiscResourceGroup(); |
314 | 315 | ||
315 | // Handle preblend items | 316 | // Handle preblend items |
316 | for ( i = 0; i < PREBLEND_ITEMS; ++i ) { | 317 | for ( i = 0; i < PREBLEND_ITEMS; ++i ) { |
317 | if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) | 318 | if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) |
318 | blend( preBlend[ i ] ); | 319 | blend( preBlend[ i ] ); |
319 | } | 320 | } |
320 | } | 321 | } |
321 | 322 | ||
322 | OThemeBase::OThemeBase( const QString & configFile ) | 323 | OThemeBase::OThemeBase( const QString & configFile ) |
323 | : QWindowsStyle() | 324 | : QWindowsStyle() |
324 | { | 325 | { |
325 | configFilePath = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 326 | configFilePath = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
326 | configFileName = configFile; | 327 | configFileName = configFile; |
327 | 328 | ||
328 | readConfig( Qt::WindowsStyle ); | 329 | readConfig( Qt::WindowsStyle ); |
329 | cache = new OThemeCache( cacheSize ); | 330 | cache = new OThemeCache( cacheSize ); |
330 | } | 331 | } |
331 | 332 | ||
332 | void OThemeBase::applyConfigFile( const QString &/*file*/ ) | 333 | void OThemeBase::applyConfigFile( const QString &/*file*/ ) |
333 | { | 334 | { |
334 | #if 0 | 335 | #if 0 |
335 | // handle std color scheme | 336 | // handle std color scheme |
336 | Config inConfig( file, Config::File ); | 337 | Config inConfig( file, Config::File ); |
337 | Config globalConfig ( "qpe" ); | 338 | Config globalConfig ( "qpe" ); |
338 | 339 | ||
339 | globalConfig. setGroup ( "Apperance" ); | 340 | globalConfig. setGroup ( "Apperance" ); |
340 | inConfig. setGroup( "General" ); | 341 | inConfig. setGroup( "General" ); |
341 | 342 | ||
342 | if ( inConfig.hasKey( "foreground" ) ) | 343 | if ( inConfig.hasKey( "foreground" ) ) |
343 | globalConfig.writeEntry( "Text", inConfig.readEntry( "foreground", " " ) ); | 344 | globalConfig.writeEntry( "Text", inConfig.readEntry( "foreground", " " ) ); |
344 | if ( inConfig.hasKey( "background" ) ) | 345 | if ( inConfig.hasKey( "background" ) ) |
345 | globalConfig.writeEntry( "Background", inConfig.readEntry( "background", " " ) ); | 346 | globalConfig.writeEntry( "Background", inConfig.readEntry( "background", " " ) ); |
346 | if ( inConfig.hasKey( "selectForeground" ) ) | 347 | if ( inConfig.hasKey( "selectForeground" ) ) |
347 | globalConfig.writeEntry( "HighlightedText", inConfig.readEntry( "selectForeground", " " ) ); | 348 | globalConfig.writeEntry( "HighlightedText", inConfig.readEntry( "selectForeground", " " ) ); |
348 | if ( inConfig.hasKey( "selectBackground" ) ) | 349 | if ( inConfig.hasKey( "selectBackground" ) ) |
349 | globalConfig.writeEntry( "Highlight", inConfig.readEntry( "selectBackground", " " ) ); | 350 | globalConfig.writeEntry( "Highlight", inConfig.readEntry( "selectBackground", " " ) ); |
350 | if ( inConfig.hasKey( "windowForeground" ) ) | 351 | if ( inConfig.hasKey( "windowForeground" ) ) |
351 | globalConfig.writeEntry( "Text", inConfig.readEntry( "windowForeground", " " ) ); | 352 | globalConfig.writeEntry( "Text", inConfig.readEntry( "windowForeground", " " ) ); |
352 | if ( inConfig.hasKey( "windowBackground" ) ) | 353 | if ( inConfig.hasKey( "windowBackground" ) ) |
353 | globalConfig.writeEntry( "Base", inConfig.readEntry( "windowBackground", " " ) ); | 354 | globalConfig.writeEntry( "Base", inConfig.readEntry( "windowBackground", " " ) ); |
354 | 355 | ||
355 | // Keep track of the current theme so that we can select the right one | 356 | // Keep track of the current theme so that we can select the right one |
356 | // in the KControl module. | 357 | // in the KControl module. |
357 | globalConfig.writeEntry ( "CurrentTheme", file ); | 358 | globalConfig.writeEntry ( "CurrentTheme", file ); |