summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp30
-rw-r--r--noncore/settings/appearance2/appearance.h3
2 files changed, 33 insertions, 0 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index db863d6..32234f0 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -379,48 +379,76 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
379 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 379 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
380 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 380 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
381 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 381 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
382 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 382 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
383 m_tabstyle_list-> setCurrentItem ( style ); 383 m_tabstyle_list-> setCurrentItem ( style );
384 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 384 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
385 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" ) ); 385 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" ) );
386 386
387 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 387 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
388 btngrp-> insert ( m_tabstyle_top ); 388 btngrp-> insert ( m_tabstyle_top );
389 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 389 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
390 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); 390 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
391 391
392 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 392 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
393 btngrp-> insert ( m_tabstyle_bottom ); 393 btngrp-> insert ( m_tabstyle_bottom );
394 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 394 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
395 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); 395 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
396 396
397 m_tabstyle_top-> setChecked ( tabtop ); 397 m_tabstyle_top-> setChecked ( tabtop );
398 m_tabstyle_bottom-> setChecked ( !tabtop ); 398 m_tabstyle_bottom-> setChecked ( !tabtop );
399 399
400 m_original_tabstyle = style; 400 m_original_tabstyle = style;
401 m_original_tabpos = tabtop; 401 m_original_tabpos = tabtop;
402 402
403 vertLayout-> addSpacing ( 3 );
404 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
405
406 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
407 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
408 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
409 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
410 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
411 QPixmap ccw1;
412 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
413
414 rotbtngrp-> hide ( );
415 rotbtngrp-> setExclusive ( true );
416 rotbtngrp-> insert ( m_rotdir_cw );
417 rotbtngrp-> insert ( m_rotdir_ccw );
418
419 ccw1. convertFromImage( ccwImage );
420 m_rotdir_cw-> setPixmap( cw1 );
421 m_rotdir_ccw-> setPixmap( ccw1 );
422
423 rotLay-> addWidget ( rotlabel, 0 );
424 rotLay-> addWidget ( m_rotdir_cw, 0 );
425 rotLay-> addWidget ( m_rotdir_ccw, 0 );
426
427 bool rotcw = !(cfg. readBoolEntry ( "rotatedir", 0 ));
428 m_rotdir_cw-> setChecked ( rotcw );
429 m_rotdir_ccw-> setChecked ( !rotcw );
430
403 return tab; 431 return tab;
404} 432}
405 433
406 434
407Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 435Appearance::Appearance( QWidget* parent, const char* name, WFlags )
408 : QDialog ( parent, name, true, WStyle_ContextHelp ) 436 : QDialog ( parent, name, true, WStyle_ContextHelp )
409{ 437{
410 setCaption( tr( "Appearance Settings" ) ); 438 setCaption( tr( "Appearance Settings" ) );
411 439
412 Config config( "qpe" ); 440 Config config( "qpe" );
413 config.setGroup( "Appearance" ); 441 config.setGroup( "Appearance" );
414 442
415 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 443 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
416 444
417 m_sample = new SampleWindow ( this ); 445 m_sample = new SampleWindow ( this );
418 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 446 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." ) ); 447 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
420 448
421 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 449 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
422 QWidget *styletab; 450 QWidget *styletab;
423 451
424 m_color_list = 0; 452 m_color_list = 0;
425 453
426 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); 454 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
@@ -434,85 +462,87 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags )
434 462
435 tw-> setCurrentTab ( styletab ); 463 tw-> setCurrentTab ( styletab );
436 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 464 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
437 465
438 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 466 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
439} 467}
440 468
441Appearance::~Appearance() 469Appearance::~Appearance()
442{ 470{
443} 471}
444 472
445void Appearance::tabChanged ( QWidget *w ) 473void Appearance::tabChanged ( QWidget *w )
446{ 474{
447 if ( w == m_advtab ) { 475 if ( w == m_advtab ) {
448 m_sample-> hide ( ); 476 m_sample-> hide ( );
449 updateGeometry ( ); // shouldn't be necessary ... 477 updateGeometry ( ); // shouldn't be necessary ...
450 } 478 }
451 else 479 else
452 m_sample-> show ( ); 480 m_sample-> show ( );
453} 481}
454 482
455void Appearance::accept ( ) 483void Appearance::accept ( )
456{ 484{
457 bool newtabpos = m_tabstyle_top-> isChecked ( ); 485 bool newtabpos = m_tabstyle_top-> isChecked ( );
486 bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( );
458 int newtabstyle = m_tabstyle_list-> currentItem ( ); 487 int newtabstyle = m_tabstyle_list-> currentItem ( );
459 488
460 Config config ( "qpe" ); 489 Config config ( "qpe" );
461 config. setGroup ( "Appearance" ); 490 config. setGroup ( "Appearance" );
462 491
463 if ( m_style_changed ) { 492 if ( m_style_changed ) {
464 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 493 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
465 if ( item ) 494 if ( item )
466 config.writeEntry( "Style", item-> key ( )); 495 config.writeEntry( "Style", item-> key ( ));
467 } 496 }
468 497
469 if ( m_deco_changed ) { 498 if ( m_deco_changed ) {
470 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 499 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
471 if ( item ) 500 if ( item )
472 config.writeEntry( "Decoration", item-> key ( )); 501 config.writeEntry( "Decoration", item-> key ( ));
473 } 502 }
474 503
475 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 504 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
476 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 505 config. writeEntry ( "TabStyle", newtabstyle + 1 );
477 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 506 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
478 } 507 }
479 508
480 if ( m_font_changed ) { 509 if ( m_font_changed ) {
481 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 510 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
482 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 511 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
483 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 512 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
484 } 513 }
485 514
486 515
487 if ( m_color_changed ) 516 if ( m_color_changed )
488 { 517 {
489 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 518 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
490 519
491 if ( item ) 520 if ( item )
492 item-> save ( config ); 521 item-> save ( config );
493 } 522 }
494 523
524 config. writeEntry ( "rotatedir", is_rotdir_ccw );
495 525
496 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated 526 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
497 527
498 QStringList sl; 528 QStringList sl;
499 QString exceptstr; 529 QString exceptstr;
500 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { 530 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) {
501 int fl = 0; 531 int fl = 0;
502 fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); 532 fl |= ( it-> noStyle ( ) ? 0x01 : 0 );
503 fl |= ( it-> noFont ( ) ? 0x02 : 0 ); 533 fl |= ( it-> noFont ( ) ? 0x02 : 0 );
504 fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); 534 fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
505 exceptstr = QString::number ( fl, 32 ); 535 exceptstr = QString::number ( fl, 32 );
506 exceptstr.append( it-> pattern ( )); 536 exceptstr.append( it-> pattern ( ));
507 sl << exceptstr; 537 sl << exceptstr;
508 } 538 }
509 config. writeEntry ( "NoStyle", sl, ';' ); 539 config. writeEntry ( "NoStyle", sl, ';' );
510 config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); 540 config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
511 541
512 config. write ( ); // need to flush the config info first 542 config. write ( ); // need to flush the config info first
513 Global::applyStyle ( ); 543 Global::applyStyle ( );
514 544
515 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 ) { 545 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 ) {
516 QCopEnvelope e( "QPE/System", "restart()" ); 546 QCopEnvelope e( "QPE/System", "restart()" );
517 } 547 }
518 548
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index 065dfb7..0e42298 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -94,30 +94,33 @@ private:
94 bool m_scheme_changed; 94 bool m_scheme_changed;
95 bool m_deco_changed; 95 bool m_deco_changed;
96 bool m_color_changed; 96 bool m_color_changed;
97 97
98 int m_original_style; 98 int m_original_style;
99 int m_original_deco; 99 int m_original_deco;
100 int m_original_tabstyle; 100 int m_original_tabstyle;
101 bool m_original_tabpos; 101 bool m_original_tabpos;
102 102
103 QListBox * m_style_list; 103 QListBox * m_style_list;
104 QPushButton * m_style_settings; 104 QPushButton * m_style_settings;
105 105
106 QListBox * m_deco_list; 106 QListBox * m_deco_list;
107 107
108 QListBox * m_color_list; 108 QListBox * m_color_list;
109 109
110 OFontSelector *m_fontselect; 110 OFontSelector *m_fontselect;
111 111
112 SampleWindow *m_sample; 112 SampleWindow *m_sample;
113 113
114 QComboBox * m_tabstyle_list; 114 QComboBox * m_tabstyle_list;
115 QRadioButton *m_tabstyle_top; 115 QRadioButton *m_tabstyle_top;
116 QRadioButton *m_tabstyle_bottom; 116 QRadioButton *m_tabstyle_bottom;
117 117
118 QRadioButton *m_rotdir_cw;
119 QRadioButton *m_rotdir_ccw;
120
118 QWidget * m_advtab; 121 QWidget * m_advtab;
119 QListView * m_except; 122 QListView * m_except;
120 QCheckBox * m_force; 123 QCheckBox * m_force;
121}; 124};
122 125
123#endif 126#endif