summaryrefslogtreecommitdiff
authorkergoth <kergoth>2003-04-15 03:04:15 (UTC)
committer kergoth <kergoth>2003-04-15 03:04:15 (UTC)
commita0dd69741995f33de4eea6a5f97f46b91dff4cb8 (patch) (unidiff)
tree2214fb9416b1914355d438cd5d0200b51d1fd2f4
parentf1379d479d192f8c1dc99cd982aaaf545c4867f6 (diff)
downloadopie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.zip
opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.tar.gz
opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.tar.bz2
Add a third rotation direction, for 180 degree.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp10
-rw-r--r--noncore/settings/appearance2/appearance.cpp24
-rw-r--r--noncore/settings/appearance2/appearance.h1
3 files changed, 26 insertions, 9 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index 0ead016..b490626 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -76,63 +76,65 @@ QIconSet RotateApplet::icon ( ) const
76{ 76{
77 QPixmap pix; 77 QPixmap pix;
78 QImage img = Resource::loadImage ( "Rotation" ); 78 QImage img = Resource::loadImage ( "Rotation" );
79 79
80 if ( !img. isNull ( )) 80 if ( !img. isNull ( ))
81 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 81 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
82 return pix; 82 return pix;
83} 83}
84 84
85QPopupMenu *RotateApplet::popup ( QWidget * ) const 85QPopupMenu *RotateApplet::popup ( QWidget * ) const
86{ 86{
87 return 0; 87 return 0;
88} 88}
89 89
90void RotateApplet::activated ( ) 90void RotateApplet::activated ( )
91{ 91{
92 int defaultRotation = QPEApplication::defaultRotation(); 92 int defaultRotation = QPEApplication::defaultRotation();
93 93
94 int newRotation; 94 int newRotation;
95 95
96 Config cfg( "qpe" ); 96 Config cfg( "qpe" );
97 cfg.setGroup( "Appearance" ); 97 cfg.setGroup( "Appearance" );
98 98
99 // 0 -> 90° clockwise, 1 -> 90° counterclockwise 99 // 0 -> 90° clockwise, 1 -> 90° counterclockwise
100 bool rotDirection = cfg.readBoolEntry( "rotatedir", 0 ); 100 int rotDirection = cfg.readNumEntry( "rotatedir", 0 );
101 101
102 // hide inputs methods before rotation 102 // hide inputs methods before rotation
103 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); 103 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
104 104
105 if ( m_flipped ) { 105 if ( m_flipped ) {
106 // if flipped, flip back to the original state, 106 // if flipped, flip back to the original state,
107 // regardless of rotation direction 107 // regardless of rotation direction
108 newRotation = defaultRotation; 108 newRotation = defaultRotation;
109 } else { 109 } else {
110 if ( rotDirection ) { 110 if ( rotDirection == 1 ) {
111 newRotation = ( defaultRotation + 90 ) % 360; 111 newRotation = ( defaultRotation + 90 ) % 360;
112 } else { 112 } else if ( rotDirection == 0 ) {
113 newRotation = ( defaultRotation + 270 ) % 360; 113 newRotation = ( defaultRotation + 270 ) % 360;
114 } 114 } else {
115 newRotation = ( defaultRotation + 180 ) % 360;
116 }
115 } 117 }
116 118
117 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); 119 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
118 env << newRotation; 120 env << newRotation;
119 121
120 m_flipped = !m_flipped; 122 m_flipped = !m_flipped;
121} 123}
122 124
123 125
124QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 126QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
125{ 127{
126 *iface = 0; 128 *iface = 0;
127 if ( uuid == IID_QUnknown ) 129 if ( uuid == IID_QUnknown )
128 *iface = this; 130 *iface = this;
129 else if ( uuid == IID_MenuApplet ) 131 else if ( uuid == IID_MenuApplet )
130 *iface = this; 132 *iface = this;
131 133
132 if ( *iface ) 134 if ( *iface )
133 (*iface)-> addRef ( ); 135 (*iface)-> addRef ( );
134 return QS_OK; 136 return QS_OK;
135} 137}
136 138
137Q_EXPORT_INTERFACE( ) 139Q_EXPORT_INTERFACE( )
138{ 140{
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 32234f0..83532de 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -388,66 +388,72 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
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 ); 403 vertLayout-> addSpacing ( 3 );
404 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); 404 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
405 405
406 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); 406 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
407 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); 407 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
408 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); 408 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
409 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); 409 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
410 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); 410 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
411 QPixmap ccw1; 411 QPixmap ccw1;
412 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
413 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
412 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); 414 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
413 415
414 rotbtngrp-> hide ( ); 416 rotbtngrp-> hide ( );
415 rotbtngrp-> setExclusive ( true ); 417 rotbtngrp-> setExclusive ( true );
416 rotbtngrp-> insert ( m_rotdir_cw ); 418 rotbtngrp-> insert ( m_rotdir_cw );
417 rotbtngrp-> insert ( m_rotdir_ccw ); 419 rotbtngrp-> insert ( m_rotdir_ccw );
420 rotbtngrp-> insert ( m_rotdir_flip );
418 421
419 ccw1. convertFromImage( ccwImage ); 422 ccw1. convertFromImage( ccwImage );
420 m_rotdir_cw-> setPixmap( cw1 ); 423 m_rotdir_cw-> setPixmap( cw1 );
421 m_rotdir_ccw-> setPixmap( ccw1 ); 424 m_rotdir_ccw-> setPixmap( ccw1 );
425 m_rotdir_flip-> setPixmap( flip1 );
422 426
423 rotLay-> addWidget ( rotlabel, 0 ); 427 rotLay-> addWidget ( rotlabel, 0 );
424 rotLay-> addWidget ( m_rotdir_cw, 0 ); 428 rotLay-> addWidget ( m_rotdir_cw, 0 );
425 rotLay-> addWidget ( m_rotdir_ccw, 0 ); 429 rotLay-> addWidget ( m_rotdir_ccw, 0 );
430 rotLay-> addWidget ( m_rotdir_flip, 0 );
426 431
427 bool rotcw = !(cfg. readBoolEntry ( "rotatedir", 0 )); 432 int rot = cfg. readNumEntry ( "rotatedir", 0 );
428 m_rotdir_cw-> setChecked ( rotcw ); 433 m_rotdir_cw-> setChecked ( rot == 0 );
429 m_rotdir_ccw-> setChecked ( !rotcw ); 434 m_rotdir_ccw-> setChecked ( rot == 1 );
435 m_rotdir_flip-> setChecked ( rot == 2 );
430 436
431 return tab; 437 return tab;
432} 438}
433 439
434 440
435Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 441Appearance::Appearance( QWidget* parent, const char* name, WFlags )
436 : QDialog ( parent, name, true, WStyle_ContextHelp ) 442 : QDialog ( parent, name, true, WStyle_ContextHelp )
437{ 443{
438 setCaption( tr( "Appearance Settings" ) ); 444 setCaption( tr( "Appearance Settings" ) );
439 445
440 Config config( "qpe" ); 446 Config config( "qpe" );
441 config.setGroup( "Appearance" ); 447 config.setGroup( "Appearance" );
442 448
443 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 449 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
444 450
445 m_sample = new SampleWindow ( this ); 451 m_sample = new SampleWindow ( this );
446 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 452 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
447 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 453 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
448 454
449 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 455 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
450 QWidget *styletab; 456 QWidget *styletab;
451 457
452 m_color_list = 0; 458 m_color_list = 0;
453 459
@@ -462,87 +468,95 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags )
462 468
463 tw-> setCurrentTab ( styletab ); 469 tw-> setCurrentTab ( styletab );
464 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 470 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
465 471
466 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 472 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
467} 473}
468 474
469Appearance::~Appearance() 475Appearance::~Appearance()
470{ 476{
471} 477}
472 478
473void Appearance::tabChanged ( QWidget *w ) 479void Appearance::tabChanged ( QWidget *w )
474{ 480{
475 if ( w == m_advtab ) { 481 if ( w == m_advtab ) {
476 m_sample-> hide ( ); 482 m_sample-> hide ( );
477 updateGeometry ( ); // shouldn't be necessary ... 483 updateGeometry ( ); // shouldn't be necessary ...
478 } 484 }
479 else 485 else
480 m_sample-> show ( ); 486 m_sample-> show ( );
481} 487}
482 488
483void Appearance::accept ( ) 489void Appearance::accept ( )
484{ 490{
485 bool newtabpos = m_tabstyle_top-> isChecked ( ); 491 bool newtabpos = m_tabstyle_top-> isChecked ( );
486 bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( );
487 int newtabstyle = m_tabstyle_list-> currentItem ( ); 492 int newtabstyle = m_tabstyle_list-> currentItem ( );
488 493
489 Config config ( "qpe" ); 494 Config config ( "qpe" );
490 config. setGroup ( "Appearance" ); 495 config. setGroup ( "Appearance" );
491 496
492 if ( m_style_changed ) { 497 if ( m_style_changed ) {
493 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 498 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
494 if ( item ) 499 if ( item )
495 config.writeEntry( "Style", item-> key ( )); 500 config.writeEntry( "Style", item-> key ( ));
496 } 501 }
497 502
498 if ( m_deco_changed ) { 503 if ( m_deco_changed ) {
499 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 504 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
500 if ( item ) 505 if ( item )
501 config.writeEntry( "Decoration", item-> key ( )); 506 config.writeEntry( "Decoration", item-> key ( ));
502 } 507 }
503 508
504 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 509 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
505 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 510 config. writeEntry ( "TabStyle", newtabstyle + 1 );
506 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 511 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
507 } 512 }
508 513
509 if ( m_font_changed ) { 514 if ( m_font_changed ) {
510 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 515 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
511 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 516 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
512 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 517 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
513 } 518 }
514 519
515 520
516 if ( m_color_changed ) 521 if ( m_color_changed )
517 { 522 {
518 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 523 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
519 524
520 if ( item ) 525 if ( item )
521 item-> save ( config ); 526 item-> save ( config );
522 } 527 }
523 528
524 config. writeEntry ( "rotatedir", is_rotdir_ccw ); 529 bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( );
530 int rotval;
531 if (m_rotdir_ccw-> isChecked ( )) {
532 rotval = 1;
533 } else if (m_rotdir_cw-> isChecked ( )) {
534 rotval = 0;
535 } else {
536 rotval = 2;
537 }
538 config. writeEntry ( "rotatedir", rotval );
525 539
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 540 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
527 541
528 QStringList sl; 542 QStringList sl;
529 QString exceptstr; 543 QString exceptstr;
530 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { 544 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) {
531 int fl = 0; 545 int fl = 0;
532 fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); 546 fl |= ( it-> noStyle ( ) ? 0x01 : 0 );
533 fl |= ( it-> noFont ( ) ? 0x02 : 0 ); 547 fl |= ( it-> noFont ( ) ? 0x02 : 0 );
534 fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); 548 fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
535 exceptstr = QString::number ( fl, 32 ); 549 exceptstr = QString::number ( fl, 32 );
536 exceptstr.append( it-> pattern ( )); 550 exceptstr.append( it-> pattern ( ));
537 sl << exceptstr; 551 sl << exceptstr;
538 } 552 }
539 config. writeEntry ( "NoStyle", sl, ';' ); 553 config. writeEntry ( "NoStyle", sl, ';' );
540 config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); 554 config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
541 555
542 config. write ( ); // need to flush the config info first 556 config. write ( ); // need to flush the config info first
543 Global::applyStyle ( ); 557 Global::applyStyle ( );
544 558
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 ) { 559 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 ) {
546 QCopEnvelope e( "QPE/System", "restart()" ); 560 QCopEnvelope e( "QPE/System", "restart()" );
547 } 561 }
548 562
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index 0e42298..da9e976 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -96,31 +96,32 @@ private:
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; 118 QRadioButton *m_rotdir_cw;
119 QRadioButton *m_rotdir_ccw; 119 QRadioButton *m_rotdir_ccw;
120 QRadioButton *m_rotdir_flip;
120 121
121 QWidget * m_advtab; 122 QWidget * m_advtab;
122 QListView * m_except; 123 QListView * m_except;
123 QCheckBox * m_force; 124 QCheckBox * m_force;
124}; 125};
125 126
126#endif 127#endif