summaryrefslogtreecommitdiff
path: root/noncore/styles
Unidiff
Diffstat (limited to 'noncore/styles') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/theme/othemebase.cpp13
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
@@ -13,48 +13,49 @@
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
37template class QIntCache<OThemePixmap> 38template class QIntCache<OThemePixmap>
38; 39;
39 40
40static const char *widgetEntries[] = 41static 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
@@ -252,82 +253,82 @@ void OThemeBase::copyWidgetConfig( int sourceID, int destID, QString *pixnames,
252} 253}
253 254
254void OThemeBase::readConfig( Qt::GUIStyle /*style*/ ) 255void 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
322OThemeBase::OThemeBase( const QString & configFile ) 323OThemeBase::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
332void OThemeBase::applyConfigFile( const QString &/*file*/ ) 333void OThemeBase::applyConfigFile( const QString &/*file*/ )
333{ 334{