Small dialog improvements.
authorAkos Polster <akos@pipacs.com>
Thu, 4 Nov 2010 23:07:26 +0000 (00:07 +0100)
committerAkos Polster <akos@pipacs.com>
Thu, 4 Nov 2010 23:07:26 +0000 (00:07 +0100)
bookview.cpp
bookview.h
infodialog.cpp
widgets/adopterwindow.h
widgets/dyalog.cpp
widgets/dyalog.h

index e11f56e..05c5be9 100644 (file)
@@ -70,7 +70,8 @@ BookView::BookView(QWidget *parent):
     scrollerMonitor = 0;
     scroller = property("kineticScroller").value<QAbstractKineticScroller *>();
 #elif defined(Q_OS_SYMBIAN)
-    FlickCharm *charm = new FlickCharm(this);
+    scrollerMonitor = 0;
+    charm = new FlickCharm(this);
     charm->activateOn(this);
 #endif
 }
@@ -226,6 +227,8 @@ void BookView::onLoadFinished(bool ok)
     }
     loaded = true;
     onSettingsChanged("scheme");
+    onSettingsChanged("zoom");
+    onSettingsChanged("font");
     emit partLoadEnd(contentIndex);
     showProgress();
 }
@@ -281,7 +284,7 @@ void BookView::paintEvent(QPaintEvent *e)
 void BookView::mousePressEvent(QMouseEvent *e)
 {
     QWebView::mousePressEvent(e);
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
     // Start monitoring kinetic scroll
     if (scrollerMonitor) {
         killTimer(scrollerMonitor);
@@ -327,6 +330,7 @@ QString BookView::tmpPath()
 
 bool BookView::eventFilter(QObject *o, QEvent *e)
 {
+#if 0
     if (e->type() != QEvent::Paint && e->type() != QEvent::MouseMove) {
         if (e->type() == QEvent::Resize) {
             qDebug() << "BookView::eventFilter QEvent::Resize to"
@@ -338,6 +342,7 @@ bool BookView::eventFilter(QObject *o, QEvent *e)
             qDebug() << "BookView::eventFilter" << Trace::event(e->type());
         }
     }
+#endif
 
     // Work around Qt bug that sometimes selects web view contents during swipe
     switch (e->type()) {
@@ -424,7 +429,7 @@ void BookView::showProgress()
 
 void BookView::timerEvent(QTimerEvent *e)
 {
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5)
     if (e->timerId() == scrollerMonitor) {
         if (scroller &&
             ((scroller->state() == QAbstractKineticScroller::AutoScrolling) ||
@@ -432,8 +437,13 @@ void BookView::timerEvent(QTimerEvent *e)
             showProgress();
         } else {
             killTimer(scrollerMonitor);
+            scrollerMonitor = -1;
         }
     }
+#elif defined(Q_OS_SYMBIAN)
+    if (e->timerId() == scrollerMonitor) {
+        if (charm && charm->)
+    }
 #endif
     QWebView::timerEvent(e);
 }
index 30af1f9..b79e8bf 100644 (file)
@@ -14,6 +14,7 @@ class QModelIndex;
 class Progress;
 class QAbstractKineticScroller;
 class ProgressDialog;
+class FlickCharm;
 
 /** Visual representation of a book. */
 class BookView: public QWebView
@@ -105,9 +106,13 @@ private:
     bool mousePressed;
     int contentsHeight; /**< Last know height of the frame. */
 
-#if defined(Q_WS_MAEMO_5)
+#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
     int scrollerMonitor;
+#endif
+#if defined(Q_WS_MAEMO_5)
     QAbstractKineticScroller *scroller;
+#elif defined(Q_OS_SYMBIAN)
+    FlickCharm *charm;
 #endif
 };
 
index eadc647..d6dee93 100644 (file)
@@ -3,10 +3,13 @@
 #include "infodialog.h"
 #include "book.h"
 #include "library.h"
+#include "trace.h"
 
 InfoDialog::InfoDialog(Book *b, QWidget *parent, bool showButtons):
         Dyalog(parent, showButtons), book(b)
 {
+    TRACE;
+
     setWindowTitle(tr("Book Details"));
 
     if (book) {
index 0c8d210..ba486b1 100644 (file)
@@ -31,10 +31,6 @@ public:
     /** Add space. */
     void addToolBarSpace();
 
-    /** Add action that is visible on the menu. */
-    QAction *addAction(QObject *receiver, const char *slot,
-                       const QString &text);
-
     /** Show window. */
     void show();
 
index 3ffdfbc..db75c88 100644 (file)
@@ -1,6 +1,7 @@
 #include <QtGui>
 
 #include "dyalog.h"
+#include "trace.h"
 
 #ifdef Q_OS_SYMBIAN
 #include "flickcharm.h"
@@ -64,6 +65,7 @@ Dyalog::Dyalog(QWidget *parent, bool showButtons_):
     closeAction->setSoftKeyRole(QAction::NegativeSoftKey);
     connect(closeAction, SIGNAL(triggered()), this, SLOT(reject()));
     addAction(closeAction);
+    leftSoftKey = 0;
     menuBar = 0;
 #endif // Q_OS_SYMBIAN
 }
@@ -81,17 +83,34 @@ void Dyalog::addStretch(int stretch)
 void Dyalog::addButton(const QString &label, QObject *receiver,
                        const char *slot, QDialogButtonBox::ButtonRole role)
 {
+    TRACE;
     if (!showButtons) {
+        qDebug() << "Ignored: showButtons is false";
         return;
     }
 #ifdef Q_OS_SYMBIAN
     Q_UNUSED(role);
-    if (!menuBar) {
-        menuBar = new QMenuBar(this);
+#if 0
+    if (!leftSoftKey) {
+        qDebug() << "Adding left soft key";
+        leftSoftKey = new QAction(label, this);
+        leftSoftKey->setSoftKeyRole(QAction::PositiveSoftKey);
+        connect(leftSoftKey, SIGNAL(triggered()), receiver, slot);
+        addAction(leftSoftKey);
+    } else {
+#endif
+        if (!menuBar) {
+            qDebug() << "Creating menu bar";
+            menuBar = new QMenuBar(this);
+            menuBar->addAction(leftSoftKey);
+        }
+        qDebug() << "Adding to menu bar";
+        QAction *action = new QAction(label, this);
+        connect(action, SIGNAL(triggered()), receiver, slot);
+        menuBar->addAction(action);
+#if 0
     }
-    QAction *action = new QAction(label, this);
-    connect(action, SIGNAL(triggered()), receiver, slot);
-    menuBar->addAction(action);
+#endif
 #else
     QPushButton *button = new QPushButton(label, this);
     connect(button, SIGNAL(clicked()), receiver, slot);
index 2150efb..ffbb231 100644 (file)
@@ -9,9 +9,11 @@ class QPushButton;
 class QScrollArea;
 class QVBoxLayout;
 class QMenuBar;
+class QAction;
 
 /** Maemo- and Mac-friendly dialog box. */
-class Dyalog: public QDialog
+class Dyalog:
+        public QDialog
 {
     Q_OBJECT
 
@@ -41,6 +43,7 @@ private:
     QDialogButtonBox *buttonBox;
     bool showButtons;
 #ifdef Q_OS_SYMBIAN
+    QAction *leftSoftKey;
     QMenuBar *menuBar;
 #endif
 };