-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/appearance2/config.in | 2 | ||||
-rw-r--r-- | noncore/settings/appearance2/exceptlistitem.h | 8 | ||||
-rw-r--r-- | noncore/settings/appearance2/stylelistitem.h | 3 |
4 files changed, 11 insertions, 10 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 93e28fa..eea1a19 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -270,197 +270,197 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | |||
270 | 270 | ||
271 | m_color_list-> setCurrentItem ( 0 ); | 271 | m_color_list-> setCurrentItem ( 0 ); |
272 | 272 | ||
273 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); | 273 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); |
274 | tempButton->setText( tr( "Edit..." ) ); | 274 | tempButton->setText( tr( "Edit..." ) ); |
275 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); | 275 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); |
276 | gridLayout->addWidget( tempButton, 0, 1 ); | 276 | gridLayout->addWidget( tempButton, 0, 1 ); |
277 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 277 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
278 | 278 | ||
279 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); | 279 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); |
280 | tempButton->setText( tr( "Delete" ) ); | 280 | tempButton->setText( tr( "Delete" ) ); |
281 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); | 281 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); |
282 | gridLayout->addWidget( tempButton, 1, 1 ); | 282 | gridLayout->addWidget( tempButton, 1, 1 ); |
283 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 283 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
284 | 284 | ||
285 | tempButton = new QPushButton( tab, "saveSchemeButton" ); | 285 | tempButton = new QPushButton( tab, "saveSchemeButton" ); |
286 | tempButton->setText( tr( "Save" ) ); | 286 | tempButton->setText( tr( "Save" ) ); |
287 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); | 287 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); |
288 | gridLayout->addWidget( tempButton, 2, 1 ); | 288 | gridLayout->addWidget( tempButton, 2, 1 ); |
289 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 289 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
290 | 290 | ||
291 | return tab; | 291 | return tab; |
292 | } | 292 | } |
293 | 293 | ||
294 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | 294 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) |
295 | { | 295 | { |
296 | QWidget *tab = new QWidget ( parent ); | 296 | QWidget *tab = new QWidget ( parent ); |
297 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 297 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
298 | 298 | ||
299 | /* | 299 | /* |
300 | * show scrollbars on the left? | 300 | * show scrollbars on the left? |
301 | */ | 301 | */ |
302 | m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab ); | 302 | m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab ); |
303 | m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) ); | 303 | m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) ); |
304 | QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) ); | 304 | QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) ); |
305 | vertLayout->addWidget( m_leftHand ); | 305 | vertLayout->addWidget( m_leftHand ); |
306 | 306 | ||
307 | QFrame *f = new QFrame ( tab ); | 307 | QFrame *f = new QFrame ( tab ); |
308 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 308 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
309 | vertLayout-> addWidget ( f ); | 309 | vertLayout-> addWidget ( f ); |
310 | vertLayout-> addSpacing ( 3 ); | 310 | vertLayout-> addSpacing ( 3 ); |
311 | 311 | ||
312 | 312 | ||
313 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 313 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
314 | 314 | ||
315 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 315 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
316 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 316 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
317 | 317 | ||
318 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 318 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
319 | gridLayout-> addWidget ( label, 0, 0 ); | 319 | gridLayout-> addWidget ( label, 0, 0 ); |
320 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 320 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
321 | 321 | ||
322 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 322 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
323 | btngrp-> hide ( ); | 323 | btngrp-> hide ( ); |
324 | btngrp-> setExclusive ( true ); | 324 | btngrp-> setExclusive ( true ); |
325 | 325 | ||
326 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 326 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
327 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 327 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
328 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 328 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
329 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 329 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
330 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 330 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
331 | m_tabstyle_list-> setCurrentItem ( style ); | 331 | m_tabstyle_list-> setCurrentItem ( style ); |
332 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 332 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
333 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 333 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
334 | 334 | ||
335 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 335 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
336 | btngrp-> insert ( m_tabstyle_top ); | 336 | btngrp-> insert ( m_tabstyle_top ); |
337 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 337 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
338 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 338 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
339 | 339 | ||
340 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 340 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
341 | btngrp-> insert ( m_tabstyle_bottom ); | 341 | btngrp-> insert ( m_tabstyle_bottom ); |
342 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 342 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
343 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 343 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
344 | 344 | ||
345 | m_tabstyle_top-> setChecked ( tabtop ); | 345 | m_tabstyle_top-> setChecked ( tabtop ); |
346 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 346 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
347 | 347 | ||
348 | m_original_tabstyle = style; | 348 | m_original_tabstyle = style; |
349 | m_original_tabpos = tabtop; | 349 | m_original_tabpos = tabtop; |
350 | 350 | ||
351 | vertLayout-> addSpacing ( 3 ); | 351 | vertLayout-> addSpacing ( 3 ); |
352 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | 352 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); |
353 | 353 | ||
354 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | 354 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); |
355 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | 355 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); |
356 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | 356 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); |
357 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); | 357 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); |
358 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | 358 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); |
359 | 359 | ||
360 | rotbtngrp-> hide ( ); | 360 | rotbtngrp-> hide ( ); |
361 | rotbtngrp-> setExclusive ( true ); | 361 | rotbtngrp-> setExclusive ( true ); |
362 | rotbtngrp-> insert ( m_rotdir_cw ); | 362 | rotbtngrp-> insert ( m_rotdir_cw ); |
363 | rotbtngrp-> insert ( m_rotdir_ccw ); | 363 | rotbtngrp-> insert ( m_rotdir_ccw ); |
364 | rotbtngrp-> insert ( m_rotdir_flip ); | 364 | rotbtngrp-> insert ( m_rotdir_flip ); |
365 | 365 | ||
366 | QImage ccwImage = Resource::loadImage( "redo" ); | 366 | QImage ccwImage = Opie::Core::OResource::loadImage( "redo", Opie::Core::OResource::SmallIcon ); |
367 | QPixmap cw, ccw, flip; | 367 | QPixmap cw, ccw, flip; |
368 | cw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 368 | cw.convertFromImage( ccwImage ); |
369 | ccw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ).mirror( 1, 0 ) ); | 369 | ccw.convertFromImage( ccwImage.mirror( 1, 0 ) ); |
370 | flip.convertFromImage( Resource::loadImage( "pass" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 370 | flip.convertFromImage( Opie::Core::OResource::loadImage( "pass", Opie::Core::OResource::SmallIcon ) ); |
371 | 371 | ||
372 | m_rotdir_cw-> setPixmap( cw ); | 372 | m_rotdir_cw-> setPixmap( cw ); |
373 | m_rotdir_ccw-> setPixmap( ccw ); | 373 | m_rotdir_ccw-> setPixmap( ccw ); |
374 | m_rotdir_flip-> setPixmap( flip ); | 374 | m_rotdir_flip-> setPixmap( flip ); |
375 | 375 | ||
376 | rotLay-> addWidget ( rotlabel, 0 ); | 376 | rotLay-> addWidget ( rotlabel, 0 ); |
377 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 377 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
378 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 378 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
379 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 379 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
380 | 380 | ||
381 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 381 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
382 | ODirection rot = CW; | 382 | ODirection rot = CW; |
383 | 383 | ||
384 | if (rotDirection == -1) | 384 | if (rotDirection == -1) |
385 | { | 385 | { |
386 | rot = ODevice::inst ( )-> direction ( ); | 386 | rot = ODevice::inst ( )-> direction ( ); |
387 | } | 387 | } |
388 | else | 388 | else |
389 | { | 389 | { |
390 | rot = (ODirection)rotDirection; | 390 | rot = (ODirection)rotDirection; |
391 | } | 391 | } |
392 | 392 | ||
393 | m_rotdir_cw-> setChecked ( rot == CW ); | 393 | m_rotdir_cw-> setChecked ( rot == CW ); |
394 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 394 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
395 | m_rotdir_flip-> setChecked ( rot == Flip ); | 395 | m_rotdir_flip-> setChecked ( rot == Flip ); |
396 | 396 | ||
397 | 397 | ||
398 | /* | 398 | /* |
399 | * add a spacing | 399 | * add a spacing |
400 | */ | 400 | */ |
401 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 401 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
402 | return tab; | 402 | return tab; |
403 | } | 403 | } |
404 | 404 | ||
405 | 405 | ||
406 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 406 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
407 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 407 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
408 | { | 408 | { |
409 | setCaption( tr( "Appearance Settings" ) ); | 409 | setCaption( tr( "Appearance Settings" ) ); |
410 | 410 | ||
411 | Config config( "qpe" ); | 411 | Config config( "qpe" ); |
412 | config.setGroup( "Appearance" ); | 412 | config.setGroup( "Appearance" ); |
413 | 413 | ||
414 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 414 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
415 | 415 | ||
416 | m_sample = new SampleWindow ( this ); | 416 | m_sample = new SampleWindow ( this ); |
417 | 417 | ||
418 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 418 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
420 | 420 | ||
421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
422 | QWidget *styletab; | 422 | QWidget *styletab; |
423 | 423 | ||
424 | m_color_list = 0; | 424 | m_color_list = 0; |
425 | 425 | ||
426 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 426 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
427 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 427 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
428 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); | 428 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
429 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 429 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
430 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 430 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
431 | 431 | ||
432 | top-> addWidget ( tw, 10 ); | 432 | top-> addWidget ( tw, 10 ); |
433 | top-> addWidget ( m_sample, 1 ); | 433 | top-> addWidget ( m_sample, 1 ); |
434 | 434 | ||
435 | tw-> setCurrentTab ( styletab ); | 435 | tw-> setCurrentTab ( styletab ); |
436 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); | 436 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); |
437 | 437 | ||
438 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 438 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
439 | } | 439 | } |
440 | 440 | ||
441 | Appearance::~Appearance() | 441 | Appearance::~Appearance() |
442 | {} | 442 | {} |
443 | 443 | ||
444 | void Appearance::tabChanged ( QWidget *w ) | 444 | void Appearance::tabChanged ( QWidget *w ) |
445 | { | 445 | { |
446 | if ( w == m_advtab ) | 446 | if ( w == m_advtab ) |
447 | { | 447 | { |
448 | m_sample-> hide ( ); | 448 | m_sample-> hide ( ); |
449 | updateGeometry ( ); // shouldn't be necessary ... | 449 | updateGeometry ( ); // shouldn't be necessary ... |
450 | } | 450 | } |
451 | else | 451 | else |
452 | m_sample-> show ( ); | 452 | m_sample-> show ( ); |
453 | } | 453 | } |
454 | 454 | ||
455 | void Appearance::accept ( ) | 455 | void Appearance::accept ( ) |
456 | { | 456 | { |
457 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 457 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
458 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 458 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
459 | 459 | ||
460 | Config config ( "qpe" ); | 460 | Config config ( "qpe" ); |
461 | config. setGroup ( "Appearance" ); | 461 | config. setGroup ( "Appearance" ); |
462 | 462 | ||
463 | if ( m_style_changed ) | 463 | if ( m_style_changed ) |
464 | { | 464 | { |
465 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 465 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
466 | if ( item ) | 466 | if ( item ) |
diff --git a/noncore/settings/appearance2/config.in b/noncore/settings/appearance2/config.in index 9e30429..2f23c1c 100644 --- a/noncore/settings/appearance2/config.in +++ b/noncore/settings/appearance2/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config APPEARANCE2 | 1 | config APPEARANCE2 |
2 | boolean "opie-appearance (control color, widget view etc)" | 2 | boolean "opie-appearance (control color, widget view etc)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBQTAUX | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBQTAUX |
diff --git a/noncore/settings/appearance2/exceptlistitem.h b/noncore/settings/appearance2/exceptlistitem.h index 365fa90..b8cec86 100644 --- a/noncore/settings/appearance2/exceptlistitem.h +++ b/noncore/settings/appearance2/exceptlistitem.h | |||
@@ -1,186 +1,186 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef EXCEPTLISTITEM_H | 31 | #ifndef EXCEPTLISTITEM_H |
32 | #define EXCEPTLISTITEM_H | 32 | #define EXCEPTLISTITEM_H |
33 | 33 | ||
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qpixmap.h> | 35 | #include <qpixmap.h> |
36 | #include <qimage.h> | 36 | #include <qimage.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | 38 | ||
39 | class ExceptListItem : public QListViewItem { | 39 | class ExceptListItem : public QListViewItem { |
40 | public: | 40 | public: |
41 | ExceptListItem ( QListView *lv, QListViewItem *after, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv, after ) | 41 | ExceptListItem ( QListView *lv, QListViewItem *after, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv, after ) |
42 | { | 42 | { |
43 | m_text = t; | 43 | m_text = t; |
44 | 44 | ||
45 | m_nofont = nofont; | 45 | m_nofont = nofont; |
46 | m_nostyle = nostyle; | 46 | m_nostyle = nostyle; |
47 | m_nodeco = nodeco; | 47 | m_nodeco = nodeco; |
48 | 48 | ||
49 | init ( ); | 49 | init ( ); |
50 | } | 50 | } |
51 | 51 | ||
52 | virtual ~ExceptListItem ( ) | 52 | virtual ~ExceptListItem ( ) |
53 | { | 53 | { |
54 | } | 54 | } |
55 | 55 | ||
56 | static void overlay ( QImage &img, const QImage &ovl ) | 56 | static void overlay ( QImage &img, const QImage &ovl ) |
57 | { | 57 | { |
58 | if (( img. size ( ) != ovl. size ( )) || | 58 | if (( img. size ( ) != ovl. size ( )) || |
59 | ( img. depth ( ) != ovl. depth ( ))) | 59 | ( img. depth ( ) != ovl. depth ( ))) |
60 | return; | 60 | return; |
61 | 61 | ||
62 | for ( int y = 0; y != img. height ( ); y++ ) { | 62 | for ( int y = 0; y != img. height ( ); y++ ) { |
63 | QRgb *iline = (QRgb *) img. scanLine ( y ); | 63 | QRgb *iline = (QRgb *) img. scanLine ( y ); |
64 | QRgb *oline = (QRgb *) ovl. scanLine ( y ); | 64 | QRgb *oline = (QRgb *) ovl. scanLine ( y ); |
65 | 65 | ||
66 | for ( int x = 0; x != img. width ( ); x++ ) { | 66 | for ( int x = 0; x != img. width ( ); x++ ) { |
67 | QRgb i = *iline; | 67 | QRgb i = *iline; |
68 | QRgb o = *oline; | 68 | QRgb o = *oline; |
69 | 69 | ||
70 | *iline = qRgba (( qRed ( i ) + qRed ( o )) / 2, | 70 | *iline = qRgba (( qRed ( i ) + qRed ( o )) / 2, |
71 | ( qGreen ( i ) + qGreen ( o )) / 2, | 71 | ( qGreen ( i ) + qGreen ( o )) / 2, |
72 | ( qBlue ( i ) + qBlue ( o )) / 2, | 72 | ( qBlue ( i ) + qBlue ( o )) / 2, |
73 | ( qAlpha ( i ) + qAlpha ( o )) / 2 ); | 73 | ( qAlpha ( i ) + qAlpha ( o )) / 2 ); |
74 | iline++; | 74 | iline++; |
75 | oline++; | 75 | oline++; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | static void init ( ) | 80 | static void init ( ) |
81 | { | 81 | { |
82 | static bool init = false; | 82 | static bool init = false; |
83 | 83 | ||
84 | if ( init ) | 84 | if ( init ) |
85 | return; | 85 | return; |
86 | 86 | ||
87 | QImage noimg = Resource::loadImage ( "appearance/no.png" ); | 87 | QImage noimg = Opie::Core::OResource::loadImage ( "appearance/no.png", Opie::Core::OResource::SmallIcon ); |
88 | QImage fontimg = Resource::loadImage ( "appearance/font.png" ); | 88 | QImage fontimg = Opie::Core::OResource::loadImage ( "appearance/font.png", Opie::Core::OResource::SmallIcon ); |
89 | QImage styleimg = Resource::loadImage ( "appearance/style.png" ); | 89 | QImage styleimg = Opie::Core::OResource::loadImage ( "appearance/style.png", Opie::Core::OResource::SmallIcon ); |
90 | QImage decoimg = Resource::loadImage ( "appearance/deco.png" ); | 90 | QImage decoimg = Opie::Core::OResource::loadImage ( "appearance/deco.png", Opie::Core::OResource::SmallIcon ); |
91 | 91 | ||
92 | s_fontpix [0] = new QPixmap ( ); | 92 | s_fontpix [0] = new QPixmap ( ); |
93 | s_fontpix [0]-> convertFromImage ( fontimg ); | 93 | s_fontpix [0]-> convertFromImage ( fontimg ); |
94 | overlay ( fontimg, noimg ); | 94 | overlay ( fontimg, noimg ); |
95 | s_fontpix [1] = new QPixmap ( ); | 95 | s_fontpix [1] = new QPixmap ( ); |
96 | s_fontpix [1]-> convertFromImage ( fontimg ); | 96 | s_fontpix [1]-> convertFromImage ( fontimg ); |
97 | 97 | ||
98 | s_stylepix [0] = new QPixmap ( ); | 98 | s_stylepix [0] = new QPixmap ( ); |
99 | s_stylepix [0]-> convertFromImage ( styleimg ); | 99 | s_stylepix [0]-> convertFromImage ( styleimg ); |
100 | overlay ( styleimg, noimg ); | 100 | overlay ( styleimg, noimg ); |
101 | s_stylepix [1] = new QPixmap ( ); | 101 | s_stylepix [1] = new QPixmap ( ); |
102 | s_stylepix [1]-> convertFromImage ( styleimg ); | 102 | s_stylepix [1]-> convertFromImage ( styleimg ); |
103 | 103 | ||
104 | s_decopix [0] = new QPixmap ( ); | 104 | s_decopix [0] = new QPixmap ( ); |
105 | s_decopix [0]-> convertFromImage ( decoimg ); | 105 | s_decopix [0]-> convertFromImage ( decoimg ); |
106 | overlay ( decoimg, noimg ); | 106 | overlay ( decoimg, noimg ); |
107 | s_decopix [1] = new QPixmap ( ); | 107 | s_decopix [1] = new QPixmap ( ); |
108 | s_decopix [1]-> convertFromImage ( decoimg ); | 108 | s_decopix [1]-> convertFromImage ( decoimg ); |
109 | 109 | ||
110 | init = true; | 110 | init = true; |
111 | } | 111 | } |
112 | 112 | ||
113 | bool noFont ( ) const | 113 | bool noFont ( ) const |
114 | { | 114 | { |
115 | return m_nofont; | 115 | return m_nofont; |
116 | } | 116 | } |
117 | 117 | ||
118 | bool noStyle ( ) const | 118 | bool noStyle ( ) const |
119 | { | 119 | { |
120 | return m_nostyle; | 120 | return m_nostyle; |
121 | } | 121 | } |
122 | 122 | ||
123 | bool noDeco ( ) const | 123 | bool noDeco ( ) const |
124 | { | 124 | { |
125 | return m_nodeco; | 125 | return m_nodeco; |
126 | } | 126 | } |
127 | 127 | ||
128 | void setNoDeco ( bool b ) | 128 | void setNoDeco ( bool b ) |
129 | { | 129 | { |
130 | if ( b != m_nodeco ) { | 130 | if ( b != m_nodeco ) { |
131 | m_nodeco = b; | 131 | m_nodeco = b; |
132 | repaint ( ); | 132 | repaint ( ); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | void setNoStyle ( bool b ) | 136 | void setNoStyle ( bool b ) |
137 | { | 137 | { |
138 | if ( b != m_nostyle ) { | 138 | if ( b != m_nostyle ) { |
139 | m_nostyle = b; | 139 | m_nostyle = b; |
140 | repaint ( ); | 140 | repaint ( ); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void setNoFont ( bool b ) | 144 | void setNoFont ( bool b ) |
145 | { | 145 | { |
146 | if ( b != m_nofont ) { | 146 | if ( b != m_nofont ) { |
147 | m_nofont = b; | 147 | m_nofont = b; |
148 | repaint ( ); | 148 | repaint ( ); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | QString pattern ( ) const | 152 | QString pattern ( ) const |
153 | { | 153 | { |
154 | return m_text; | 154 | return m_text; |
155 | } | 155 | } |
156 | 156 | ||
157 | void setPattern ( const QString &s ) | 157 | void setPattern ( const QString &s ) |
158 | { | 158 | { |
159 | if ( s != m_text ) { | 159 | if ( s != m_text ) { |
160 | m_text = s; | 160 | m_text = s; |
161 | widthChanged ( 3 ); | 161 | widthChanged ( 3 ); |
162 | repaint ( ); | 162 | repaint ( ); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | QString text ( int i ) const | 166 | QString text ( int i ) const |
167 | { | 167 | { |
168 | if ( i == 3 ) | 168 | if ( i == 3 ) |
169 | return m_text; | 169 | return m_text; |
170 | else | 170 | else |
171 | return QString::null; | 171 | return QString::null; |
172 | 172 | ||
173 | } | 173 | } |
174 | 174 | ||
175 | const QPixmap *pixmap ( int i ) const | 175 | const QPixmap *pixmap ( int i ) const |
176 | { | 176 | { |
177 | if ( i == 0 ) | 177 | if ( i == 0 ) |
178 | return (const QPixmap *) s_stylepix [m_nostyle ? 1 : 0]; | 178 | return (const QPixmap *) s_stylepix [m_nostyle ? 1 : 0]; |
179 | else if ( i == 1 ) | 179 | else if ( i == 1 ) |
180 | return (const QPixmap *) s_fontpix [m_nofont ? 1 : 0]; | 180 | return (const QPixmap *) s_fontpix [m_nofont ? 1 : 0]; |
181 | else if ( i == 2 ) | 181 | else if ( i == 2 ) |
182 | return (const QPixmap *) s_decopix [m_nodeco ? 1 : 0]; | 182 | return (const QPixmap *) s_decopix [m_nodeco ? 1 : 0]; |
183 | else | 183 | else |
184 | return 0; | 184 | return 0; |
185 | } | 185 | } |
186 | 186 | ||
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h index 613fa71..3946190 100644 --- a/noncore/settings/appearance2/stylelistitem.h +++ b/noncore/settings/appearance2/stylelistitem.h | |||
@@ -1,121 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef STYLELISTITEM_H | 31 | #ifndef STYLELISTITEM_H |
32 | #define STYLELISTITEM_H | 32 | #define STYLELISTITEM_H |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/oresource.h> | ||
36 | |||
35 | #include <qpe/styleinterface.h> | 37 | #include <qpe/styleinterface.h> |
36 | #include <qpe/qlibrary.h> | 38 | #include <qpe/qlibrary.h> |
37 | #include <qpe/resource.h> | ||
38 | 39 | ||
39 | /* QT */ | 40 | /* QT */ |
40 | #include <qlistbox.h> | 41 | #include <qlistbox.h> |
41 | #include <qfileinfo.h> | 42 | #include <qfileinfo.h> |
42 | 43 | ||
43 | #include <stdio.h> | 44 | #include <stdio.h> |
44 | 45 | ||
45 | class StyleListItem : public QListBoxText { | 46 | class StyleListItem : public QListBoxText { |
46 | public: | 47 | public: |
47 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) | 48 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) |
48 | { | 49 | { |
49 | m_lib = 0; | 50 | m_lib = 0; |
50 | m_style_if = 0; | 51 | m_style_if = 0; |
51 | m_settings_if = 0; | 52 | m_settings_if = 0; |
52 | m_style = sty; | 53 | m_style = sty; |
53 | } | 54 | } |
54 | 55 | ||
55 | StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) | 56 | StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) |
56 | { | 57 | { |
57 | m_lib = lib; | 58 | m_lib = lib; |
58 | m_style_if = iface; | 59 | m_style_if = iface; |
59 | m_settings_if = 0; | 60 | m_settings_if = 0; |
60 | m_style = iface-> style ( ); | 61 | m_style = iface-> style ( ); |
61 | 62 | ||
62 | iface-> queryInterface ( IID_StyleExtended, (QUnknownInterface **) &m_settings_if ); | 63 | iface-> queryInterface ( IID_StyleExtended, (QUnknownInterface **) &m_settings_if ); |
63 | } | 64 | } |
64 | 65 | ||
65 | virtual ~StyleListItem ( ) | 66 | virtual ~StyleListItem ( ) |
66 | { | 67 | { |
67 | delete m_style; | 68 | delete m_style; |
68 | 69 | ||
69 | if ( m_settings_if ) | 70 | if ( m_settings_if ) |
70 | m_settings_if-> release ( ); | 71 | m_settings_if-> release ( ); |
71 | if ( m_style_if ) | 72 | if ( m_style_if ) |
72 | m_style_if-> release ( ); | 73 | m_style_if-> release ( ); |
73 | delete m_lib; | 74 | delete m_lib; |
74 | } | 75 | } |
75 | 76 | ||
76 | bool hasSettings ( ) const | 77 | bool hasSettings ( ) const |
77 | { | 78 | { |
78 | return m_settings_if ? m_settings_if-> hasSettings ( ) : false; | 79 | return m_settings_if ? m_settings_if-> hasSettings ( ) : false; |
79 | } | 80 | } |
80 | 81 | ||
81 | QWidget *settings ( QWidget *parent ) | 82 | QWidget *settings ( QWidget *parent ) |
82 | { | 83 | { |
83 | return m_settings_if ? m_settings_if-> create ( parent ) : 0; | 84 | return m_settings_if ? m_settings_if-> create ( parent ) : 0; |
84 | } | 85 | } |
85 | 86 | ||
86 | bool setSettings ( bool accepted ) | 87 | bool setSettings ( bool accepted ) |
87 | { | 88 | { |
88 | if ( !m_settings_if ) | 89 | if ( !m_settings_if ) |
89 | return false; | 90 | return false; |
90 | 91 | ||
91 | if ( accepted ) | 92 | if ( accepted ) |
92 | return m_settings_if-> accept ( ); | 93 | return m_settings_if-> accept ( ); |
93 | else { | 94 | else { |
94 | m_settings_if-> reject ( ); | 95 | m_settings_if-> reject ( ); |
95 | return false; | 96 | return false; |
96 | } | 97 | } |
97 | } | 98 | } |
98 | 99 | ||
99 | QString key ( ) | 100 | QString key ( ) |
100 | { | 101 | { |
101 | if ( m_lib ) | 102 | if ( m_lib ) |
102 | return QFileInfo ( m_lib-> library ( )). fileName ( ); | 103 | return QFileInfo ( m_lib-> library ( )). fileName ( ); |
103 | else | 104 | else |
104 | return text ( ); | 105 | return text ( ); |
105 | } | 106 | } |
106 | 107 | ||
107 | QStyle *style ( ) | 108 | QStyle *style ( ) |
108 | { | 109 | { |
109 | return m_style; | 110 | return m_style; |
110 | } | 111 | } |
111 | 112 | ||
112 | private: | 113 | private: |
113 | QLibrary *m_lib; | 114 | QLibrary *m_lib; |
114 | QStyle *m_style; | 115 | QStyle *m_style; |
115 | StyleInterface *m_style_if; | 116 | StyleInterface *m_style_if; |
116 | StyleExtendedInterface *m_settings_if; | 117 | StyleExtendedInterface *m_settings_if; |
117 | 118 | ||
118 | }; | 119 | }; |
119 | 120 | ||
120 | 121 | ||
121 | #endif | 122 | #endif |