From 77e2fb13d4293405ea15e33b061dd915a56469d2 Mon Sep 17 00:00:00 2001 From: Akos Polster Date: Sat, 31 Jul 2010 10:28:15 +0200 Subject: [PATCH] Make returning from full screen mode even more obvious. --- bookview.cpp | 26 ++++++++++++++++++++++++-- bookview.h | 3 +++ dorian.pro | 1 - fullscreenwindow.cpp | 6 ++++++ pkg/changelog | 6 ++++++ pkg/version.txt | 2 +- selectionsuppressor.h | 47 ----------------------------------------------- translucentbutton.cpp | 2 +- translucentbutton.h | 4 +++- 9 files changed, 44 insertions(+), 53 deletions(-) delete mode 100644 selectionsuppressor.h diff --git a/bookview.cpp b/bookview.cpp index 25a18b2..ce2de0d 100644 --- a/bookview.cpp +++ b/bookview.cpp @@ -8,7 +8,6 @@ #include "book.h" #include "bookview.h" #include "library.h" -#include "selectionsuppressor.h" #include "settings.h" #include "trace.h" @@ -32,7 +31,8 @@ BookView::BookView(QWidget *parent): page()->setContentEditable(false); #if defined(Q_WS_MAEMO_5) - (void)new SelectionSuppressor(this); + // Suppress unwanted text selections on Maemo + installEventFilter(this); #endif QWebFrame *frame = page()->mainFrame(); #if defined(Q_WS_MAEMO_5) @@ -297,3 +297,25 @@ void BookView::removeIcons() QFile(ICON_PREFIX + QString("/previous.png")).remove(); QDir().rmpath(tmpPath()); } + +bool BookView::eventFilter(QObject *, QEvent *e) { + switch (e->type()) { + case QEvent::MouseButtonPress: + emit suppressedMouseButtonPress(); + mousePressed = true; + break; + case QEvent::MouseButtonRelease: + mousePressed = false; + break; + case QEvent::MouseMove: + if (mousePressed) { + return true; + } + break; + case QEvent::MouseButtonDblClick: + return true; + default: + break; + } + return false; +} diff --git a/bookview.h b/bookview.h index eea5208..f1627c4 100644 --- a/bookview.h +++ b/bookview.h @@ -28,6 +28,7 @@ public: signals: void chapterLoadStart(int index); void chapterLoadEnd(int index); + void suppressedMouseButtonPress(); public slots: void goPrevious(); @@ -38,6 +39,7 @@ public slots: protected: virtual void paintEvent(QPaintEvent *e); virtual void mousePressEvent(QMouseEvent *e); + bool eventFilter(QObject *o, QEvent *e); private: void loadContent(int index); @@ -52,6 +54,7 @@ private: qreal positionAfterLoad; QImage bookmarkImage; bool loaded; + bool mousePressed; }; #endif // BOOKVIEW_H diff --git a/dorian.pro b/dorian.pro index cd1cdd2..5e71141 100644 --- a/dorian.pro +++ b/dorian.pro @@ -26,7 +26,6 @@ SOURCES += \ HEADERS += \ mainwindow.h \ bookview.h \ - selectionsuppressor.h \ opshandler.h \ unzip/unzip.h \ unzip/ioapi.h \ diff --git a/fullscreenwindow.cpp b/fullscreenwindow.cpp index bdea6a4..fa3446b 100644 --- a/fullscreenwindow.cpp +++ b/fullscreenwindow.cpp @@ -2,6 +2,7 @@ #include "fullscreenwindow.h" #include "translucentbutton.h" +#include "trace.h" FullScreenWindow::FullScreenWindow(QWidget *parent): QMainWindow(parent), child(0) { @@ -32,8 +33,11 @@ void FullScreenWindow::showFullScreen() void FullScreenWindow::MOUSE_ACTIVATE_EVENT(QMouseEvent *event) { + Trace t("FullScreenWindow::MOUSE_ACTIVATE_EVENT"); if (fullScreenZone().contains(event->x(), event->y())) { emit restore(); + } else { + restoreButton->flash(); } QMainWindow::MOUSE_ACTIVATE_EVENT(event); } @@ -56,6 +60,8 @@ void FullScreenWindow::takeChild(QWidget *c) child = c; child->setParent(centralWidget()); centralWidget()->layout()->addWidget(child); + connect(child, SIGNAL(suppressedMouseButtonPress()), + restoreButton, SLOT(flash())); } } diff --git a/pkg/changelog b/pkg/changelog index 4e8fb89..8ae7ea0 100644 --- a/pkg/changelog +++ b/pkg/changelog @@ -1,3 +1,9 @@ +dorian (0.0.14-1) unstable; urgency=low + + * Make returning from full screen even more obvious + + -- Akos Polster Sat, 31 Jul 2010 20:00:00 +0200 + dorian (0.0.13-1) unstable; urgency=low * Fix multiple navigation arrows [#6041] diff --git a/pkg/version.txt b/pkg/version.txt index 43b2961..9789c4c 100644 --- a/pkg/version.txt +++ b/pkg/version.txt @@ -1 +1 @@ -0.0.13 +0.0.14 diff --git a/selectionsuppressor.h b/selectionsuppressor.h deleted file mode 100644 index 30c8d6e..0000000 --- a/selectionsuppressor.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef SELECTIONSUPPRESSOR_H -#define SELECTIONSUPPRESSOR_H - -#include -#include -#include - -class SelectionSuppressor: public QObject -{ - Q_OBJECT - -public: - SelectionSuppressor(QWebView *view): QObject(view), mousePressed(false) - { - view->installEventFilter(this); - } - -protected: - inline bool eventFilter(QObject *, QEvent *e); - -private: - bool mousePressed; -}; - -bool SelectionSuppressor::eventFilter(QObject *, QEvent *e) -{ - switch (e->type()) { - case QEvent::MouseButtonPress: - mousePressed = true; - break; - case QEvent::MouseButtonRelease: - mousePressed = false; - break; - case QEvent::MouseMove: - if (mousePressed) { - return true; - } - break; - case QEvent::MouseButtonDblClick: - return true; - default: - break; - } - return false; -} - -#endif // SELECTIONSUPPRESSOR_H diff --git a/translucentbutton.cpp b/translucentbutton.cpp index 8be09aa..4a680e8 100644 --- a/translucentbutton.cpp +++ b/translucentbutton.cpp @@ -26,7 +26,7 @@ void TranslucentButton::paintEvent(QPaintEvent *) void TranslucentButton::flash() { QPropertyAnimation *ani = new QPropertyAnimation(this, "opacity", 0); - ani->setDuration(5000); + ani->setDuration(3000); ani->setStartValue(0.); ani->setEndValue(1.); ani->setEasingCurve(QEasingCurve::OutQuart); diff --git a/translucentbutton.h b/translucentbutton.h index bdb3c29..6ee333b 100644 --- a/translucentbutton.h +++ b/translucentbutton.h @@ -11,10 +11,12 @@ class TranslucentButton: public QWidget public: explicit TranslucentButton(const QString &name, QWidget *parent); - void flash(); qreal opacity() const {return mOpacity;} void setOpacity(qreal opacity); +public slots: + void flash(); + protected: virtual void paintEvent(QPaintEvent *); -- 1.7.9.5