summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp8
-rw-r--r--noncore/settings/appearance2/exceptlistitem.h2
2 files changed, 7 insertions, 3 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 22b12b4..f611799 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -257,100 +257,102 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
257 257
258 return tab; 258 return tab;
259} 259}
260 260
261QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 261QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
262{ 262{
263 QWidget *tab = new QWidget ( parent ); 263 QWidget *tab = new QWidget ( parent );
264 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 264 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
265 265
266 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 266 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
267 267
268 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); 268 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab );
269 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); 269 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" ));
270 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); 270 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 );
271 271
272 QLabel *l = new QLabel ( tab ); 272 QLabel *l = new QLabel ( tab );
273 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); 273 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" )));
274 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); 274 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 );
275 275
276 m_except = new QListView ( tab ); 276 m_except = new QListView ( tab );
277 m_except-> addColumn ( Resource::loadIconSet ( "appearance/style.png" ), "", 24 ); 277 m_except-> addColumn ( Resource::loadIconSet ( "appearance/style.png" ), "", 24 );
278 m_except-> addColumn ( Resource::loadIconSet ( "appearance/font.png" ), "", 24 ); 278 m_except-> addColumn ( Resource::loadIconSet ( "appearance/font.png" ), "", 24 );
279 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco.png" ), "", 24 ); 279 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco.png" ), "", 24 );
280 m_except-> addColumn ( tr( "Binary file(s)" )); 280 m_except-> addColumn ( tr( "Binary file(s)" ));
281 m_except-> setColumnAlignment ( 0, AlignCenter ); 281 m_except-> setColumnAlignment ( 0, AlignCenter );
282 m_except-> setColumnAlignment ( 1, AlignCenter ); 282 m_except-> setColumnAlignment ( 1, AlignCenter );
283 m_except-> setColumnAlignment ( 2, AlignCenter ); 283 m_except-> setColumnAlignment ( 2, AlignCenter );
284 m_except-> setAllColumnsShowFocus ( true ); 284 m_except-> setAllColumnsShowFocus ( true );
285 m_except-> setMinimumHeight ( 30 ); 285 m_except-> setMinimumHeight ( 30 );
286 m_except-> header ( )-> setClickEnabled ( false ); 286 m_except-> header ( )-> setClickEnabled ( false );
287 m_except-> header ( )-> setResizeEnabled ( false ); 287 m_except-> header ( )-> setResizeEnabled ( false );
288 m_except-> header ( )-> setMovingEnabled ( false ); 288 m_except-> header ( )-> setMovingEnabled ( false );
289 m_except-> setSorting ( -1 );
289 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); 290 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 );
290 291
291 connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); 292 connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int )));
292 293
293 QToolButton *tb = new QToolButton ( tab ); 294 QToolButton *tb = new QToolButton ( tab );
294 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); 295 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" ));
295 tb-> setFocusPolicy ( QWidget::StrongFocus ); 296 tb-> setFocusPolicy ( QWidget::StrongFocus );
296 lay-> addWidget ( tb, 2, 1 ); 297 lay-> addWidget ( tb, 2, 1 );
297 connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); 298 connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( )));
298 299
299 tb = new QToolButton ( tab ); 300 tb = new QToolButton ( tab );
300 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); 301 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" ));
301 tb-> setFocusPolicy ( QWidget::StrongFocus ); 302 tb-> setFocusPolicy ( QWidget::StrongFocus );
302 lay-> addWidget ( tb, 3, 1 ); 303 lay-> addWidget ( tb, 3, 1 );
303 connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); 304 connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( )));
304 305
305 tb = new QToolButton ( tab ); 306 tb = new QToolButton ( tab );
306 tb-> setIconSet ( Resource::loadIconSet ( "up" )); 307 tb-> setIconSet ( Resource::loadIconSet ( "up" ));
307 tb-> setFocusPolicy ( QWidget::StrongFocus ); 308 tb-> setFocusPolicy ( QWidget::StrongFocus );
308 lay-> addWidget ( tb, 4, 1 ); 309 lay-> addWidget ( tb, 4, 1 );
309 connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); 310 connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( )));
310 311
311 tb = new QToolButton ( tab ); 312 tb = new QToolButton ( tab );
312 tb-> setIconSet ( Resource::loadIconSet ( "down" )); 313 tb-> setIconSet ( Resource::loadIconSet ( "down" ));
313 tb-> setFocusPolicy ( QWidget::StrongFocus ); 314 tb-> setFocusPolicy ( QWidget::StrongFocus );
314 lay-> addWidget ( tb, 5, 1 ); 315 lay-> addWidget ( tb, 5, 1 );
315 connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); 316 connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( )));
316 317
317 lay-> setRowStretch ( 6, 10 ); 318 lay-> setRowStretch ( 6, 10 );
318 lay-> setColStretch ( 0, 10 ); 319 lay-> setColStretch ( 0, 10 );
319 320
320 QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); 321 QStringList sl = cfg. readListEntry ( "NoStyle", ';' );
322 QListViewItem *lvit = 0;
321 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 323 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
322 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); 324 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 );
323 325
324 new ExceptListItem ( m_except, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); 326 lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 );
325 } 327 }
326 328
327 329
328 vertLayout-> addSpacing ( 3 ); 330 vertLayout-> addSpacing ( 3 );
329 QFrame *f = new QFrame ( tab ); 331 QFrame *f = new QFrame ( tab );
330 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); 332 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
331 vertLayout-> addWidget ( f ); 333 vertLayout-> addWidget ( f );
332 vertLayout-> addSpacing ( 3 ); 334 vertLayout-> addSpacing ( 3 );
333 335
334 336
335 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 337 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
336 338
337 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; 339 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
338 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); 340 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
339 341
340 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 342 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
341 gridLayout-> addWidget ( label, 0, 0 ); 343 gridLayout-> addWidget ( label, 0, 0 );
342 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 344 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
343 btngrp-> hide ( ); 345 btngrp-> hide ( );
344 btngrp-> setExclusive ( true ); 346 btngrp-> setExclusive ( true );
345 347
346 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 348 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
347 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 349 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
348 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 350 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
349 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 351 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
350 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 352 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
351 m_tabstyle_list-> setCurrentItem ( style ); 353 m_tabstyle_list-> setCurrentItem ( style );
352 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 354 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
353 355
354 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 356 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
355 btngrp-> insert ( m_tabstyle_top ); 357 btngrp-> insert ( m_tabstyle_top );
356 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 358 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
@@ -426,64 +428,66 @@ void Appearance::accept ( )
426 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 428 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
427 if ( item ) 429 if ( item )
428 config.writeEntry( "Style", item-> key ( )); 430 config.writeEntry( "Style", item-> key ( ));
429 } 431 }
430 432
431 if ( m_deco_changed ) { 433 if ( m_deco_changed ) {
432 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 434 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
433 if ( item ) 435 if ( item )
434 config.writeEntry( "Decoration", item-> key ( )); 436 config.writeEntry( "Decoration", item-> key ( ));
435 } 437 }
436 438
437 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 439 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
438 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 440 config. writeEntry ( "TabStyle", newtabstyle + 1 );
439 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 441 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
440 } 442 }
441 443
442 if ( m_font_changed ) { 444 if ( m_font_changed ) {
443 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 445 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
444 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 446 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
445 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 447 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
446 } 448 }
447 449
448 450
449 if ( m_color_changed ) 451 if ( m_color_changed )
450 { 452 {
451 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 453 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
452 454
453 if ( item ) 455 if ( item )
454 item-> save ( config ); 456 item-> save ( config );
455 } 457 }
456 458
457 459
460 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
461
458 QStringList sl; 462 QStringList sl;
459 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { 463 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) {
460 int fl = 0; 464 int fl = 0;
461 fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); 465 fl |= ( it-> noStyle ( ) ? 0x01 : 0 );
462 fl |= ( it-> noFont ( ) ? 0x02 : 0 ); 466 fl |= ( it-> noFont ( ) ? 0x02 : 0 );
463 fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); 467 fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
464 sl << ( QString::number ( fl, 32 ) + it-> pattern ( )); 468 sl << ( QString::number ( fl, 32 ) + it-> pattern ( ));
465 } 469 }
466 config. writeEntry ( "NoStyle", sl, ';' ); 470 config. writeEntry ( "NoStyle", sl, ';' );
467 config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); 471 config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
468 472
469 config. write ( ); // need to flush the config info first 473 config. write ( ); // need to flush the config info first
470 Global::applyStyle ( ); 474 Global::applyStyle ( );
471 475
472 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { 476 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
473 QCopEnvelope e( "QPE/System", "restart()" ); 477 QCopEnvelope e( "QPE/System", "restart()" );
474 } 478 }
475 479
476 QDialog::accept ( ); 480 QDialog::accept ( );
477} 481}
478 482
479void Appearance::done ( int r ) 483void Appearance::done ( int r )
480{ 484{
481 QDialog::done ( r ); 485 QDialog::done ( r );
482 close ( ); 486 close ( );
483} 487}
484 488
485 489
486void Appearance::styleClicked ( int index ) 490void Appearance::styleClicked ( int index )
487{ 491{
488 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 492 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
489 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 493 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
@@ -623,65 +627,65 @@ void Appearance::saveSchemeClicked()
623 else 627 else
624 { 628 {
625 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); 629 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
626 } 630 }
627 } 631 }
628 delete d; 632 delete d;
629} 633}
630 634
631void Appearance::deleteSchemeClicked() 635void Appearance::deleteSchemeClicked()
632{ 636{
633 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 637 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
634 638
635 if ( !item ) 639 if ( !item )
636 return; 640 return;
637 641
638 if ( m_color_list-> currentItem ( ) > 0 ) 642 if ( m_color_list-> currentItem ( ) > 0 )
639 { 643 {
640 if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?", 644 if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?",
641 tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { 645 tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
642 QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" ); 646 QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" );
643 delete item; 647 delete item;
644 } 648 }
645 } 649 }
646 else 650 else
647 { 651 {
648 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); 652 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." ));
649 } 653 }
650} 654}
651 655
652 656
653void Appearance::addExcept ( ) 657void Appearance::addExcept ( )
654{ 658{
655 ExceptListItem *it = new ExceptListItem ( m_except, tr( "<new>" ), true, true, true ); 659 ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true );
656 m_except-> ensureItemVisible ( it ); 660 m_except-> ensureItemVisible ( it );
657 m_except-> setSelected ( it, true ); 661 m_except-> setSelected ( it, true );
658} 662}
659 663
660void Appearance::delExcept ( ) 664void Appearance::delExcept ( )
661{ 665{
662 if ( m_except-> selectedItem ( )) { 666 if ( m_except-> selectedItem ( )) {
663 m_except-> setFocus ( ); 667 m_except-> setFocus ( );
664 delete m_except-> selectedItem ( ); 668 delete m_except-> selectedItem ( );
665 } 669 }
666} 670}
667 671
668void Appearance::upExcept ( ) 672void Appearance::upExcept ( )
669{ 673{
670 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); 674 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
671 675
672 if ( it && it-> itemAbove ( )) 676 if ( it && it-> itemAbove ( ))
673 it-> itemAbove ( )-> moveItem ( it ); 677 it-> itemAbove ( )-> moveItem ( it );
674} 678}
675 679
676void Appearance::downExcept ( ) 680void Appearance::downExcept ( )
677{ 681{
678 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); 682 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
679 683
680 if ( it && it-> itemBelow ( )) 684 if ( it && it-> itemBelow ( ))
681 it-> moveItem ( it-> itemBelow ( )); 685 it-> moveItem ( it-> itemBelow ( ));
682} 686}
683 687
684class ExEdit : public QLineEdit { 688class ExEdit : public QLineEdit {
685public: 689public:
686 ExEdit ( ExceptListItem *item ) 690 ExEdit ( ExceptListItem *item )
687 : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) 691 : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item )
diff --git a/noncore/settings/appearance2/exceptlistitem.h b/noncore/settings/appearance2/exceptlistitem.h
index 5eda79c..7b4fa48 100644
--- a/noncore/settings/appearance2/exceptlistitem.h
+++ b/noncore/settings/appearance2/exceptlistitem.h
@@ -6,65 +6,65 @@
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#ifndef EXCEPTLISTITEM_H 28#ifndef EXCEPTLISTITEM_H
29#define EXCEPTLISTITEM_H 29#define EXCEPTLISTITEM_H
30 30
31#include <qlistview.h> 31#include <qlistview.h>
32#include <qpixmap.h> 32#include <qpixmap.h>
33#include <qimage.h> 33#include <qimage.h>
34#include <qpainter.h> 34#include <qpainter.h>
35 35
36class ExceptListItem : public QListViewItem { 36class ExceptListItem : public QListViewItem {
37public: 37public:
38 ExceptListItem ( QListView *lv, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv ) 38 ExceptListItem ( QListView *lv, QListViewItem *after, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv, after )
39 { 39 {
40 m_text = t; 40 m_text = t;
41 41
42 m_nofont = nofont; 42 m_nofont = nofont;
43 m_nostyle = nostyle; 43 m_nostyle = nostyle;
44 m_nodeco = nodeco; 44 m_nodeco = nodeco;
45 45
46 init ( ); 46 init ( );
47 } 47 }
48 48
49 virtual ~ExceptListItem ( ) 49 virtual ~ExceptListItem ( )
50 { 50 {
51 } 51 }
52 52
53 static void overlay ( QImage &img, const QImage &ovl ) 53 static void overlay ( QImage &img, const QImage &ovl )
54 { 54 {
55 if (( img. size ( ) != ovl. size ( )) || 55 if (( img. size ( ) != ovl. size ( )) ||
56 ( img. depth ( ) != ovl. depth ( ))) 56 ( img. depth ( ) != ovl. depth ( )))
57 return; 57 return;
58 58
59 for ( int y = 0; y != img. height ( ); y++ ) { 59 for ( int y = 0; y != img. height ( ); y++ ) {
60 QRgb *iline = (QRgb *) img. scanLine ( y ); 60 QRgb *iline = (QRgb *) img. scanLine ( y );
61 QRgb *oline = (QRgb *) ovl. scanLine ( y ); 61 QRgb *oline = (QRgb *) ovl. scanLine ( y );
62 62
63 for ( int x = 0; x != img. width ( ); x++ ) { 63 for ( int x = 0; x != img. width ( ); x++ ) {
64 QRgb i = *iline; 64 QRgb i = *iline;
65 QRgb o = *oline; 65 QRgb o = *oline;
66 66
67 *iline = qRgba (( qRed ( i ) + qRed ( o )) / 2, 67 *iline = qRgba (( qRed ( i ) + qRed ( o )) / 2,
68 ( qGreen ( i ) + qGreen ( o )) / 2, 68 ( qGreen ( i ) + qGreen ( o )) / 2,
69 ( qBlue ( i ) + qBlue ( o )) / 2, 69 ( qBlue ( i ) + qBlue ( o )) / 2,
70 ( qAlpha ( i ) + qAlpha ( o )) / 2 ); 70 ( qAlpha ( i ) + qAlpha ( o )) / 2 );