Make returning from full screen mode even more obvious.
authorAkos Polster <polster@marzipan.pipacs.com>
Sat, 31 Jul 2010 08:28:15 +0000 (10:28 +0200)
committerAkos Polster <polster@marzipan.pipacs.com>
Sat, 31 Jul 2010 08:28:15 +0000 (10:28 +0200)
bookview.cpp
bookview.h
dorian.pro
fullscreenwindow.cpp
pkg/changelog
pkg/version.txt
selectionsuppressor.h [deleted file]
translucentbutton.cpp
translucentbutton.h

index 25a18b2..ce2de0d 100644 (file)
@@ -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;
+}
index eea5208..f1627c4 100644 (file)
@@ -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
index cd1cdd2..5e71141 100644 (file)
@@ -26,7 +26,6 @@ SOURCES += \
 HEADERS += \
     mainwindow.h \
     bookview.h \
-    selectionsuppressor.h \
     opshandler.h \
     unzip/unzip.h \
     unzip/ioapi.h \
index bdea6a4..fa3446b 100644 (file)
@@ -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()));
     }
 }
 
index 4e8fb89..8ae7ea0 100644 (file)
@@ -1,3 +1,9 @@
+dorian (0.0.14-1) unstable; urgency=low
+
+  * Make returning from full screen even more obvious
+
+ -- Akos Polster <akos@pipacs.com>  Sat, 31 Jul 2010 20:00:00 +0200
+
 dorian (0.0.13-1) unstable; urgency=low
 
   * Fix multiple navigation arrows [#6041]
index 43b2961..9789c4c 100644 (file)
@@ -1 +1 @@
-0.0.13
+0.0.14
diff --git a/selectionsuppressor.h b/selectionsuppressor.h
deleted file mode 100644 (file)
index 30c8d6e..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef SELECTIONSUPPRESSOR_H
-#define SELECTIONSUPPRESSOR_H
-
-#include <QWebView>
-#include <QEvent>
-#include <QMouseEvent>
-
-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
index 8be09aa..4a680e8 100644 (file)
@@ -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);
index bdb3c29..6ee333b 100644 (file)
@@ -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 *);