Update from old repository.
authorAkos Polster <polster@marzipan.pipacs.com>
Wed, 14 Jul 2010 22:21:57 +0000 (00:21 +0200)
committerAkos Polster <polster@marzipan.pipacs.com>
Wed, 14 Jul 2010 22:21:57 +0000 (00:21 +0200)
bookview.cpp
bookview.h
dorian.qrc
mainwindow.cpp
mainwindow.h
pkg/acknowledgements.txt
pkg/changelog
pkg/version.txt
settingswindow.cpp
settingswindow.h

index 271370e..12626e8 100644 (file)
@@ -140,6 +140,7 @@ void BookView::onLoadFinished(bool ok)
     loadFinished = true;
     addNavigationBar();
     onSettingsChanged("scheme");
+    emit chapterLoaded(contentIndex);
     if (restore) {
         restore = false;
         if (ok && mBook) {
@@ -227,8 +228,9 @@ void BookView::addBookmark()
 
 void BookView::addNavigationBar()
 {
-    QWebFrame *frame = page()->currentFrame();
-    frame->addToJavaScriptWindowObject("bv", this);
+    if (!mBook) {
+        return;
+    }
 
     QString naviPrev =
             "<a href=\"javascript:bv.goPrevious();\">"
@@ -244,7 +246,6 @@ void BookView::addNavigationBar()
             + tmpPath() +
             "/next.png\" />"
             "</a>";
-
     if (contentIndex == 0) {
         naviPrev = "";
     }
@@ -252,6 +253,8 @@ void BookView::addNavigationBar()
         naviNext = "";
     }
 
+    QWebFrame *frame = page()->currentFrame();
+    frame->addToJavaScriptWindowObject("bv", this);
     QString headerScript = "document.body.innerHTML = '" +
         naviPrev + naviNext + "<br />" + "' + document.body.innerHTML;";
     QString trailerScript = "document.body.innerHTML += '<br /><br />" +
@@ -259,8 +262,6 @@ void BookView::addNavigationBar()
 
     frame->evaluateJavaScript(headerScript);
     frame->evaluateJavaScript(trailerScript);
-
-    // qDebug() << page()->currentFrame()->toHtml();
 }
 
 QString BookView::tmpPath()
index 349965d..bb32698 100644 (file)
@@ -22,6 +22,9 @@ public:
     void addBookmark();
     void setLastBookmark();
 
+signals:
+    void chapterLoaded(int index);
+
 public slots:
     void goPrevious();
     void goNext();
index a4d4101..c716cf1 100644 (file)
@@ -33,5 +33,7 @@
         <file>icons/previous.png</file>
         <file>icons/settings-portrait.png</file>
         <file>icons/settings-landscape.png</file>
+        <file>icons/next-disabled.png</file>
+        <file>icons/previous-disabled.png</file>
     </qresource>
 </RCC>
index fffffb1..36a88fd 100755 (executable)
@@ -34,8 +34,6 @@ MainWindow::MainWindow(QWidget *parent):
 {
 #ifdef Q_WS_MAEMO_5
     setAttribute(Qt::WA_Maemo5StackedWindow, true);
-    // setAttribute(Qt::WA_Maemo5AutoOrientation, true);
-    // FIXME: There is not enough space for the toolbar in portrait mode
 #endif
     setWindowTitle("Dorian");
 
@@ -112,6 +110,9 @@ MainWindow::MainWindow(QWidget *parent):
             this, SLOT(onSettingsChanged(const QString &)));
     Settings::instance()->setValue("orientation",
                                    Settings::instance()->value("orientation"));
+
+    // Handle loading chapters
+    connect(view, SIGNAL(chapterLoaded(int)), this, SLOT(onChapterLoaded(int)));
 }
 
 void MainWindow::onCurrentBookChanged()
@@ -241,6 +242,28 @@ void MainWindow::onSettingsChanged(const QString &key)
         }
     }
 #else
-    (void)key;
+    Q_UNUSED(key);
+#endif // Q_WS_MAEMO_5
+}
+
+void MainWindow::onChapterLoaded(int index)
+{
+    bool enablePrevious = false;
+    bool enableNext = false;
+    if (book) {
+        if (index > 0) {
+            enablePrevious = true;
+        }
+        if (index < (book->toc.size() - 1)) {
+            enableNext = true;
+        }
+    }
+#ifdef Q_WS_MAEMO_5
+    previousAction->setIcon(QIcon(enablePrevious?
+        ":/icons/previous.png" : ":/icons/previous-disabled.png"));
+    nextAction->setIcon(QIcon(enableNext?
+        ":/icons/next.png": ":/icons/next-disabled.png"));
 #endif // Q_WS_MAEMO_5
+    previousAction->setEnabled(enablePrevious);
+    nextAction->setEnabled(enableNext);
 }
index bfa2a05..8698e8c 100755 (executable)
@@ -27,6 +27,7 @@ public slots:
     void showNormal();
     void showFullScreen();
     void onSettingsChanged(const QString &key);
+    void onChapterLoaded(int index);
 
 protected:
 #ifdef Q_WS_MAEMO5
index f09901a..e8c4396 100644 (file)
@@ -2,3 +2,7 @@ Book icon by bmson (http://bmson.deviantart.com/)
 Basic Icons by PixelMixer (http://pixel-mixer.com/)
 Sample book "2 B R 0 2 B" by Kurt Vonnegut, digitized by
     Project Gutenberg (http://www.gutenberg.org/)
+Zlib data compression library are copyright (C) 1995-2010 Jean-loup Gailly and
+    Mark Adler (http://zlib.net/)
+Minizip library copyright (C) 1998-2010 Gilles Vollant, Even Rouault and
+    Mathias Svensson (http://www.winimage.com/zLibDll/minizip.html)q
index 5be5bfe..ceeb7f3 100644 (file)
@@ -1,3 +1,11 @@
+dorian (0.0.6-1) unstable; urgency=low
+
+  * Fix crash when deleting book: https://code.nokia.com/dorian/ticket/1
+  * Fix slow zooming on N900: https://code.nokia.com/dorian/ticket/2
+  * Disable arrows when can't be used: https://code.nokia.com/dorian/ticket/4
+
+ -- Akos Polster <akos@pipacs.com>  Tue, 13 Jul 2010 19:00:00 +0200
+
 dorian (0.0.5-1) unstable; urgency=low
 
   * Improve full-screen navigation even further
index bbdeab6..1750564 100644 (file)
@@ -1 +1 @@
-0.0.5
+0.0.6
index 033ed67..dfd60b6 100644 (file)
@@ -33,7 +33,7 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
 
     QLabel *zoomLabel = new QLabel(tr("Zoom level:"), contents);
     layout->addWidget(zoomLabel);
-    QSlider *zoomSlider = new QSlider(Qt::Horizontal, contents);
+    zoomSlider = new QSlider(Qt::Horizontal, contents);
     zoomSlider->setMinimum(50);
     zoomSlider->setMaximum(300);
     zoomSlider->setValue(Settings::instance()->value("zoom").toInt());
@@ -43,7 +43,7 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
     layout->addWidget(fontLabel);
     QString defaultFamily = fontLabel->fontInfo().family();
     QString family = Settings::instance()->value("font", defaultFamily).toString();
-    QFontComboBox *fontButton = new QFontComboBox(contents);
+    fontButton = new QFontComboBox(contents);
     fontButton->setCurrentFont(QFont(family));
     fontButton->setEditable(false);
     layout->addWidget(fontButton);
@@ -172,12 +172,20 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
 
 void SettingsWindow::onSliderValueChanged(int value)
 {
+#ifdef Q_WS_MAEMO_5 // Re-scaling the book view is too much for the N900
+    Q_UNUSED(value);
+#else
     Settings::instance()->setValue("zoom", value);
+#endif // Q_WS_MAEMO_5
 }
 
 void SettingsWindow::onCurrentFontChanged(const QFont &font)
 {
+#ifdef Q_WS_MAEMO_5
+    Q_UNUSED(font);
+#else
     Settings::instance()->setValue("font", font.family());
+#endif // Q_WS_MAEMO_5
 }
 
 void SettingsWindow::onSchemeButtonClicked(int id)
@@ -201,3 +209,14 @@ void SettingsWindow::onOrientationButtonClicked(int id)
     }
     Settings::instance()->setValue("orientation", orientation);
 }
+
+#ifdef Q_WS_MAEMO_5
+
+void SettingsWindow::closeEvent(QCloseEvent *e)
+{
+    Settings::instance()->setValue("zoom", zoomSlider->value());
+    Settings::instance()->setValue("font", fontButton->currentFont().family());
+    e->accept();
+}
+
+#endif // Q_WS_MAEMO_5
index 581657e..613e3ad 100644 (file)
@@ -6,6 +6,8 @@
 class QPushButton;
 class QFontComboBox;
 class QFont;
+class QSlider;
+class QFontComboBox;
 
 class SettingsWindow: public QMainWindow
 {
@@ -24,7 +26,14 @@ public slots:
     void onSchemeButtonClicked(int id);
     void onOrientationButtonClicked(int id);
 
+protected:
+#ifdef Q_WS_MAEMO_5
+    void closeEvent(QCloseEvent *e);
+#endif
+
 private:
+    QSlider *zoomSlider;
+    QFontComboBox *fontButton;
 };
 
 #endif // SETTINGSWINDOW_H