From: Akos Polster Date: Sat, 2 Oct 2010 15:23:44 +0000 (+0200) Subject: Fix progress and bookmark positions. Fix runaway scroll monitor timer. X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=6de16d43da4ef15e56e83bc4a1bb83f218a9ee3c;p=dorian Fix progress and bookmark positions. Fix runaway scroll monitor timer. --- diff --git a/bookview.cpp b/bookview.cpp index fbbf608..59fc173 100644 --- a/bookview.cpp +++ b/bookview.cpp @@ -25,7 +25,7 @@ BookView::BookView(QWidget *parent): QWebView(parent), contentIndex(-1), mBook(0), restorePositionAfterLoad(false), positionAfterLoad(0), loaded(false), - contentsHeight(0), scrollerMonitor(-1) + contentsHeight(0) { Trace t("BookView::BookView"); settings()->setAttribute(QWebSettings::AutoLoadImages, true); @@ -79,6 +79,7 @@ BookView::BookView(QWidget *parent): setBook(0); #ifdef Q_WS_MAEMO_5 + scrollerMonitor = 0; scroller = property("kineticScroller").value(); #endif } @@ -263,8 +264,11 @@ void BookView::mousePressEvent(QMouseEvent *e) QWebView::mousePressEvent(e); #ifdef Q_WS_MAEMO_5 // Start monitoring kinetic scroll + if (scrollerMonitor) { + killTimer(scrollerMonitor); + } if (scroller) { - scrollerMonitor = startTimer(250); + scrollerMonitor = startTimer(500); } #else // Handle mouse presses on the scroll bar @@ -307,6 +311,9 @@ bool BookView::eventFilter(QObject *o, QEvent *e) if (e->type() == QEvent::Resize) { qDebug() << "BookView::eventFilter QEvent::Resize to" << page()->mainFrame()->contentsSize().height(); + } else if (e->type() == QEvent::Timer) { + qDebug() << "BookView::eventFilter" << "QEvent::Timer" + << ((QTimerEvent *)e)->timerId(); } else { qDebug() << "BookView::eventFilter" << Trace::event(e->type()); } diff --git a/bookview.h b/bookview.h index 50be62d..e3c7700 100644 --- a/bookview.h +++ b/bookview.h @@ -95,8 +95,8 @@ private: bool mousePressed; int contentsHeight; /**< Last know height of the frame. */ - int scrollerMonitor; #ifdef Q_WS_MAEMO_5 + int scrollerMonitor; QAbstractKineticScroller *scroller; #endif }; diff --git a/mainwindow.cpp b/mainwindow.cpp index 42fd7e0..6511bd9 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4,6 +4,8 @@ #include #include #include +#include +#include #ifdef Q_WS_MAEMO_5 # include @@ -199,7 +201,7 @@ void MainWindow::showRegular() #else previousButton->setGeometry(0, geo.height() - TranslucentButton::pixels, TranslucentButton::pixels, TranslucentButton::pixels); - nextButton->setGeometry(geo.width() - TranslucentButton::pixels, + nextButton->setGeometry(geo.width() - TranslucentButton::pixels - 25, toolBar->height(), TranslucentButton::pixels, TranslucentButton::pixels); #endif // Q_WS_MAEMO_5 qDebug() << "previousButton geometry" << previousButton->geometry(); @@ -218,8 +220,13 @@ void MainWindow::showBig() otherChildren << progress << nextButton << previousButton; QRect screen = QApplication::desktop()->screenGeometry(); progress->setGeometry(0, 0, screen.width(), PROGRESS_HEIGHT); +#if defined(Q_WS_MAEMO_5) nextButton->setGeometry(screen.width() - TranslucentButton::pixels, 0, TranslucentButton::pixels, TranslucentButton::pixels); +#else + nextButton->setGeometry(screen.width() - TranslucentButton::pixels - 25, 0, + TranslucentButton::pixels, TranslucentButton::pixels); +#endif // Q_WS_MAEMO_5 previousButton->setGeometry(0, screen.height() - TranslucentButton::pixels, TranslucentButton::pixels, TranslucentButton::pixels); @@ -408,7 +415,7 @@ void MainWindow::resizeEvent(QResizeEvent *e) #else previousButton->setGeometry(0, e->size().height() - TranslucentButton::pixels, TranslucentButton::pixels, TranslucentButton::pixels); - nextButton->setGeometry(e->size().width() - TranslucentButton::pixels, + nextButton->setGeometry(e->size().width() - TranslucentButton::pixels - 25, toolBar->height(), TranslucentButton::pixels, TranslucentButton::pixels); #endif // Q_WS_MAEMO_5 qDebug() << "previousButton geometry" << previousButton->geometry(); diff --git a/model/book.cpp b/model/book.cpp index 5303f9b..599ab8f 100644 --- a/model/book.cpp +++ b/model/book.cpp @@ -177,7 +177,7 @@ bool Book::parse() foreach (QString key, coverKeys) { if (content.contains(key)) { qDebug() << "Loading cover image from" << content[key].href; - cover = makeCover(rootPath() + "/" + content[key].href); + cover = makeCover(QDir(rootPath()).absoluteFilePath(content[key].href)); break; } } @@ -196,7 +196,7 @@ bool Book::parse() } if (!ncxFileName.isEmpty()) { qDebug() << "Parsing NCX file" << ncxFileName; - QFile ncxFile(rootPath() + "/" + ncxFileName); + QFile ncxFile(QDir(rootPath()).absoluteFilePath(ncxFileName)); source = new QXmlInputSource(&ncxFile); NcxHandler *ncxHandler = new NcxHandler(*this); errorHandler = new XmlErrorHandler(); @@ -211,7 +211,7 @@ bool Book::parse() // Calculate book part sizes size = 0; foreach (QString part, parts) { - QFileInfo info(content[part].href); + QFileInfo info(QDir(rootPath()).absoluteFilePath(content[part].href)); content[part].size = info.size(); size += content[part].size; } diff --git a/pkg/changelog b/pkg/changelog index c3685aa..282572b 100644 --- a/pkg/changelog +++ b/pkg/changelog @@ -3,6 +3,7 @@ dorian (0.2.1-1) unstable; urgency=low * Fix TOC in "The Awakening" (and possibly other Google books) [#6318] * Works on Symbian (far from usable) * Make modal dialogs closeable on Mac + * Fix progress and bookmark positions -- Akos Polster Thu, 16 Sep 2010 02:00:00 +0200 diff --git a/widgets/fullscreenwindow.cpp b/widgets/fullscreenwindow.cpp index 2753d79..cc3f0ec 100644 --- a/widgets/fullscreenwindow.cpp +++ b/widgets/fullscreenwindow.cpp @@ -11,6 +11,7 @@ FullScreenWindow::FullScreenWindow(QWidget *parent): AdopterWindow(parent) setAttribute(Qt::WA_Maemo5StackedWindow, true); setAttribute(Qt::WA_Maemo5NonComposited, true); #endif // Q_WS_MAEMO_5 + toolBar->hide(); QFrame *frame = new QFrame(this); QVBoxLayout *layout = new QVBoxLayout(frame); layout->setMargin(0); diff --git a/widgets/progress.cpp b/widgets/progress.cpp index db1733a..d0a1409 100644 --- a/widgets/progress.cpp +++ b/widgets/progress.cpp @@ -3,13 +3,15 @@ #include "progress.h" #include "trace.h" -Progress::Progress(QWidget *parent): QLabel(parent), progress(0), timer(-1) +Progress::Progress(QWidget *parent): QLabel(parent), progress(-1.0), timer(-1) { hide(); } void Progress::setProgress(qreal p) { + Trace t("Progress::setProgress"); + qDebug() << p; if (progress != p) { progress = p; flash();