author | kergoth <kergoth> | 2003-04-15 03:04:15 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-15 03:04:15 (UTC) |
commit | a0dd69741995f33de4eea6a5f97f46b91dff4cb8 (patch) (side-by-side diff) | |
tree | 2214fb9416b1914355d438cd5d0200b51d1fd2f4 | |
parent | f1379d479d192f8c1dc99cd982aaaf545c4867f6 (diff) | |
download | opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.zip opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.tar.gz opie-a0dd69741995f33de4eea6a5f97f46b91dff4cb8.tar.bz2 |
Add a third rotation direction, for 180 degree.
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 10 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 24 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.h | 1 |
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 @@ -88,39 +88,41 @@ QPopupMenu *RotateApplet::popup ( QWidget * ) const } void RotateApplet::activated ( ) { int defaultRotation = QPEApplication::defaultRotation(); int newRotation; Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); // 0 -> 90° clockwise, 1 -> 90° counterclockwise - bool rotDirection = cfg.readBoolEntry( "rotatedir", 0 ); + int rotDirection = cfg.readNumEntry( "rotatedir", 0 ); // hide inputs methods before rotation QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); if ( m_flipped ) { // if flipped, flip back to the original state, // regardless of rotation direction newRotation = defaultRotation; } else { - if ( rotDirection ) { + if ( rotDirection == 1 ) { newRotation = ( defaultRotation + 90 ) % 360; - } else { + } else if ( rotDirection == 0 ) { newRotation = ( defaultRotation + 270 ) % 360; - } + } else { + newRotation = ( defaultRotation + 180 ) % 360; + } } QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); env << newRotation; m_flipped = !m_flipped; } QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; 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 @@ -400,42 +400,48 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) m_original_tabstyle = style; m_original_tabpos = tabtop; vertLayout-> addSpacing ( 3 ); QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); QPixmap ccw1; + m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); + QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); rotbtngrp-> hide ( ); rotbtngrp-> setExclusive ( true ); rotbtngrp-> insert ( m_rotdir_cw ); rotbtngrp-> insert ( m_rotdir_ccw ); + rotbtngrp-> insert ( m_rotdir_flip ); ccw1. convertFromImage( ccwImage ); m_rotdir_cw-> setPixmap( cw1 ); m_rotdir_ccw-> setPixmap( ccw1 ); + m_rotdir_flip-> setPixmap( flip1 ); rotLay-> addWidget ( rotlabel, 0 ); rotLay-> addWidget ( m_rotdir_cw, 0 ); rotLay-> addWidget ( m_rotdir_ccw, 0 ); + rotLay-> addWidget ( m_rotdir_flip, 0 ); - bool rotcw = !(cfg. readBoolEntry ( "rotatedir", 0 )); - m_rotdir_cw-> setChecked ( rotcw ); - m_rotdir_ccw-> setChecked ( !rotcw ); + int rot = cfg. readNumEntry ( "rotatedir", 0 ); + m_rotdir_cw-> setChecked ( rot == 0 ); + m_rotdir_ccw-> setChecked ( rot == 1 ); + m_rotdir_flip-> setChecked ( rot == 2 ); return tab; } Appearance::Appearance( QWidget* parent, const char* name, WFlags ) : QDialog ( parent, name, true, WStyle_ContextHelp ) { setCaption( tr( "Appearance Settings" ) ); Config config( "qpe" ); config.setGroup( "Appearance" ); @@ -474,25 +480,24 @@ void Appearance::tabChanged ( QWidget *w ) { if ( w == m_advtab ) { m_sample-> hide ( ); updateGeometry ( ); // shouldn't be necessary ... } else m_sample-> show ( ); } void Appearance::accept ( ) { bool newtabpos = m_tabstyle_top-> isChecked ( ); - bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( ); int newtabstyle = m_tabstyle_list-> currentItem ( ); Config config ( "qpe" ); config. setGroup ( "Appearance" ); if ( m_style_changed ) { StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); if ( item ) config.writeEntry( "Style", item-> key ( )); } if ( m_deco_changed ) { @@ -512,25 +517,34 @@ void Appearance::accept ( ) config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); } if ( m_color_changed ) { ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); if ( item ) item-> save ( config ); } - config. writeEntry ( "rotatedir", is_rotdir_ccw ); + bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( ); + int rotval; + if (m_rotdir_ccw-> isChecked ( )) { + rotval = 1; + } else if (m_rotdir_cw-> isChecked ( )) { + rotval = 0; + } else { + rotval = 2; + } + config. writeEntry ( "rotatedir", rotval ); m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated QStringList sl; QString exceptstr; for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { int fl = 0; fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); fl |= ( it-> noFont ( ) ? 0x02 : 0 ); fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); exceptstr = QString::number ( fl, 32 ); exceptstr.append( it-> pattern ( )); 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 @@ -108,19 +108,20 @@ private: QListBox * m_color_list; OFontSelector *m_fontselect; SampleWindow *m_sample; QComboBox * m_tabstyle_list; QRadioButton *m_tabstyle_top; QRadioButton *m_tabstyle_bottom; QRadioButton *m_rotdir_cw; QRadioButton *m_rotdir_ccw; + QRadioButton *m_rotdir_flip; QWidget * m_advtab; QListView * m_except; QCheckBox * m_force; }; #endif |