Commit 10418664 authored by Pino Toscano's avatar Pino Toscano

Improve the Orientation menu, as suggested by our usability export Florian:

instead of choosing the orientation degrees (eg 0, 90, etc), use two Rotate Left/Right actions to rotate the whole document 90 degrees resp. on the left or on the right.
Also add an 'Original orientation' action to restore to the orientation of the document.

svn path=/trunk/playground/graphics/okular/; revision=625297
parent e642b97c
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="okular_part" version="21">
<kpartgui name="okular_part" version="22">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Action name="get_new_stuff" group="file_open"/>
......@@ -29,7 +29,11 @@
<Action name="view_continuous"/>
<Action name="view_render_mode"/>
<Separator/>
<Action name="view_orientation"/>
<Menu name="view_orientation"><text>&amp;Orientation</text>
<Action name="view_orientation_rotate_cw"/>
<Action name="view_orientation_rotate_ccw"/>
<Action name="view_orientation_original"/>
</Menu>
<Action name="view_pagesizes"/>
</Menu>
<Menu name="go"><text>&amp;Go</text>
......
......@@ -134,7 +134,9 @@ public:
QTimer dragScrollTimer;
// actions
KSelectAction * aOrientation;
KAction * aRotateClockwise;
KAction * aRotateCounterClockwise;
KAction * aRotateOriginal;
KSelectAction * aPageSizes;
QAction * aMouseNormal;
QAction * aMouseSelect;
......@@ -250,7 +252,9 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
// create and initialize private storage structure
d = new PageViewPrivate();
d->document = document;
d->aOrientation = 0;
d->aRotateClockwise = 0;
d->aRotateCounterClockwise = 0;
d->aRotateOriginal = 0;
d->aRenderMode = 0;
d->zoomMode = (PageView::ZoomMode) Okular::Settings::zoomMode();
d->zoomFactor = Okular::Settings::zoomFactor();
......@@ -323,19 +327,20 @@ void PageView::setupActions( KActionCollection * ac )
{
d->actionCollection = ac;
d->aOrientation = new KSelectAction(i18n("&Orientation"), this);
ac->addAction("view_orientation", d->aOrientation);
// orientation menu actions
d->aRotateClockwise = new KAction( KIcon( "rotate_cw" ), i18n( "Rotate Right" ), this );
ac->addAction( "view_orientation_rotate_cw", d->aRotateClockwise );
connect( d->aRotateClockwise, SIGNAL( triggered() ), this, SLOT( slotRotateClockwise() ) );
d->aRotateCounterClockwise = new KAction( KIcon( "rotate_ccw" ), i18n( "Rotate Left" ), this );
ac->addAction( "view_orientation_rotate_ccw", d->aRotateCounterClockwise );
connect( d->aRotateCounterClockwise, SIGNAL( triggered() ), this, SLOT( slotRotateCounterClockwise() ) );
d->aRotateOriginal = new KAction( i18n( "Original Orientation" ), this );
ac->addAction( "view_orientation_original", d->aRotateOriginal );
connect( d->aRotateOriginal, SIGNAL( triggered() ), this, SLOT( slotRotateOriginal() ) );
d->aPageSizes = new KSelectAction(i18n("&Page Size"), this);
ac->addAction("view_pagesizes", d->aPageSizes);
QStringList rotations;
rotations.append( i18n( "Default" ) );
rotations.append( i18n( "Rotated 90 Degrees" ) );
rotations.append( i18n( "Rotated 180 Degrees" ) );
rotations.append( i18n( "Rotated 270 Degrees" ) );
d->aOrientation->setItems( rotations );
connect( d->aOrientation , SIGNAL( triggered( int ) ),
d->document , SLOT( slotRotation( int ) ) );
connect( d->aPageSizes , SIGNAL( triggered( int ) ),
d->document , SLOT( slotPageSizes( int ) ) );
......@@ -2980,6 +2985,23 @@ void PageView::slotScrollDown()
slotAutoScoll();
setFocus();
}
void PageView::slotRotateClockwise()
{
int id = ( (int)d->document->rotation() + 1 ) % 4;
d->document->slotRotation( id );
}
void PageView::slotRotateCounterClockwise()
{
int id = ( (int)d->document->rotation() + 3 ) % 4;
d->document->slotRotation( id );
}
void PageView::slotRotateOriginal()
{
d->document->slotRotation( 0 );
}
//END private SLOTS
#include "pageview.moc"
......@@ -183,6 +183,9 @@ Q_OBJECT
void slotToggleAnnotator( bool );
void slotScrollUp();
void slotScrollDown();
void slotRotateClockwise();
void slotRotateCounterClockwise();
void slotRotateOriginal();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment