#include "book.h"
#include "bookview.h"
#include "library.h"
-#include "selectionsuppressor.h"
#include "settings.h"
#include "trace.h"
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)
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;
+}
signals:
void chapterLoadStart(int index);
void chapterLoadEnd(int index);
+ void suppressedMouseButtonPress();
public slots:
void goPrevious();
protected:
virtual void paintEvent(QPaintEvent *e);
virtual void mousePressEvent(QMouseEvent *e);
+ bool eventFilter(QObject *o, QEvent *e);
private:
void loadContent(int index);
qreal positionAfterLoad;
QImage bookmarkImage;
bool loaded;
+ bool mousePressed;
};
#endif // BOOKVIEW_H
HEADERS += \
mainwindow.h \
bookview.h \
- selectionsuppressor.h \
opshandler.h \
unzip/unzip.h \
unzip/ioapi.h \
#include "fullscreenwindow.h"
#include "translucentbutton.h"
+#include "trace.h"
FullScreenWindow::FullScreenWindow(QWidget *parent): QMainWindow(parent), child(0)
{
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);
}
child = c;
child->setParent(centralWidget());
centralWidget()->layout()->addWidget(child);
+ connect(child, SIGNAL(suppressedMouseButtonPress()),
+ restoreButton, SLOT(flash()));
}
}
+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]
+++ /dev/null
-#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
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);
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 *);