From: Akos Polster Date: Sun, 2 Jan 2011 16:30:17 +0000 (+0100) Subject: Maintain reading position on Symbian between orientations. X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=a477146d205b88aa0e3422028f3b9b81fc60c7ec;hp=150b38724b43dc5746b7e12cadd52483fc524535;p=dorian Maintain reading position on Symbian between orientations. --- diff --git a/adopterwindow.cpp b/adopterwindow.cpp index 2230675..735d37c 100644 --- a/adopterwindow.cpp +++ b/adopterwindow.cpp @@ -143,7 +143,7 @@ void AdopterWindow::resizeEvent(QResizeEvent *event) } #elif defined(Q_OS_SYMBIAN) if (bookView) { - QTimer::singleShot(110, bookView, SLOT(adjustPosition())); + QTimer::singleShot(1000, bookView, SLOT(adjustPosition())); } #endif } diff --git a/bookview.cpp b/bookview.cpp index bda16e4..9f3daf5 100644 --- a/bookview.cpp +++ b/bookview.cpp @@ -516,13 +516,17 @@ void BookView::onMediaKeysPressed(MediaKeysObserver::MediaKeys key) void BookView::adjustPosition() { - QSize desktop = QApplication::desktop()->size(); - qreal ratio = (qreal)(desktop.width()) / (qreal)(desktop.height()); + TRACE; + const qreal portraitMagic = 1.66; + const qreal landscapeMagic = 0.655; if (mBook) { + QSize desktop = QApplication::desktop()->size(); + int screenHeight = desktop.height(); + int screenWidth = desktop.width(); + qreal ratio = (screenWidthmainFrame(); - int height = frame->contentsSize().height(); - int pos = frame->scrollPosition().y(); - qreal relativePos = (qreal)pos / (qreal)height; - // FIXME: Finish me + int current = frame->scrollPosition().y(); + qDebug() << "From" << current << "to" << (int)(current * ratio); + frame->scroll(0, (int)(current * ratio) - current); } } diff --git a/pkg/changelog b/pkg/changelog index 78f4548..f46ed20 100644 --- a/pkg/changelog +++ b/pkg/changelog @@ -7,6 +7,7 @@ dorian (0.4.4-1) unstable; urgency=low * Maintain date book added to the library and date book last read * Show presence of extra book parts * Allow editing bookmark notes + * Maintain reading position between orientations -- Akos Polster Sun, 5 Dec 2010 02:00:00 +0100