Set zoom level in steps. Add icons to some buttons. Adjust dialog box layout accordin...
authorAkos Polster <polster@marzipan.pipacs.com>
Sun, 29 Aug 2010 19:46:44 +0000 (21:46 +0200)
committerAkos Polster <polster@marzipan.pipacs.com>
Sun, 29 Aug 2010 19:46:44 +0000 (21:46 +0200)
14 files changed:
bookmarksdialog.cpp
chaptersdialog.cpp
dorian.qrc
icons/add.png [new file with mode: 0755]
icons/folder.png [new file with mode: 0644]
librarydialog.cpp
mainwindow.cpp
pkg/acknowledgements.txt
pkg/changelog
settingswindow.cpp
settingswindow.h
widgets/dyalog.cpp
widgets/listwindow.cpp
widgets/listwindow.h

index 9ae5666..08c4079 100644 (file)
@@ -13,7 +13,7 @@ BookmarksDialog::BookmarksDialog(Book *book_, QWidget *parent):
         return;
     }
 
-    addAction(tr("Add bookmark"), this, SLOT(onAdd()));
+    addAction(tr("Add bookmark"), this, SLOT(onAdd()), ":/icons/add.png");
 #ifndef Q_WS_MAEMO_5
     addItemAction(tr("Go to"), this, SLOT(onGo()));
     addItemAction(tr("Delete"), this, SLOT(onDelete()));
index 2f279e0..1aaffd3 100644 (file)
@@ -24,7 +24,8 @@ ChaptersDialog::ChaptersDialog(Book *book, QWidget *parent): ListWindow(parent)
             this, SLOT(onItemActivated(const QModelIndex &)));
 
 #ifndef Q_WS_MAEMO_5
-    addAction(tr("Close"), this, SLOT(close()), QDialogButtonBox::RejectRole);
+    addAction(tr("Close"), this, SLOT(close()), QString(),
+              QDialogButtonBox::RejectRole);
 #endif // Q_WS_MAEMO_5
 }
 
index 39744a0..06f35c9 100644 (file)
@@ -38,5 +38,7 @@
         <file>icons/chapters.png</file>
         <file>icons/mac/chapters.png</file>
         <file>icons/library.png</file>
+        <file>icons/add.png</file>
+        <file>icons/folder.png</file>
     </qresource>
 </RCC>
diff --git a/icons/add.png b/icons/add.png
new file mode 100755 (executable)
index 0000000..dc73a6d
Binary files /dev/null and b/icons/add.png differ
diff --git a/icons/folder.png b/icons/folder.png
new file mode 100644 (file)
index 0000000..8666761
Binary files /dev/null and b/icons/folder.png differ
index 4386e7d..767667a 100644 (file)
@@ -31,8 +31,9 @@ LibraryDialog::LibraryDialog(QWidget *parent): ListWindow(parent)
     addItemAction(tr("Delete"), this, SLOT(onRemove()));
 #endif // ! Q_WS_MAEMO_5
 
-    addAction(tr("Add book"), this, SLOT(onAdd()));
-    addAction(tr("Add books from folder"), this, SLOT(onAddFolder()));
+    addAction(tr("Add book"), this, SLOT(onAdd()), ":/icons/add.png");
+    addAction(tr("Add books from folder"), this, SLOT(onAddFolder()),
+              ":/icons/folder.png");
 
     // Create and add list view
     list = new ListView(this);
index 3182b08..46da063 100755 (executable)
@@ -149,7 +149,7 @@ MainWindow::MainWindow(QWidget *parent):
     // Handle progress
     connect(view, SIGNAL(progress(qreal)), progress, SLOT(setProgress(qreal)));
 
-    // Shadow window for full screen
+    // Shadow window for full screen reading
     fullScreenWindow = new FullScreenWindow(this);
     connect(fullScreenWindow, SIGNAL(restore()), this, SLOT(showRegular()));
 
index e8c4396..286af97 100644 (file)
@@ -1,8 +1,12 @@
 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/)
+Project Gutenberg (http://www.gutenberg.org/)
+
 Zlib data compression library are copyright (C) 1995-2010 Jean-loup Gailly and
-    Mark Adler (http://zlib.net/)
+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
+Mathias Svensson (http://www.winimage.com/zLibDll/minizip.html)
index 25e290f..3977a92 100644 (file)
@@ -1,5 +1,9 @@
 dorian (0.1.6-1) unstable; urgency=low
 
+  * Adjust zoom level in steps
+  * Adjust dialog boxes according to orientation
+  * Add icons to buttons
+
  -- Akos Polster <akos@pipacs.com>  Sun, 29 Aug 2010 02:00:00 +0200
 
 dorian (0.1.5-1) unstable; urgency=low
index 247cffc..5c5dce4 100644 (file)
@@ -5,11 +5,15 @@
 #include "toolbuttonbox.h"
 
 #ifdef Q_OS_SYMBIAN
-#define DEFAULT_ORIENTATION "portrait"
+const char *DEFAULT_ORIENTATION = "portrait";
 #else
-#define DEFAULT_ORIENTATION "landscape"
+const char *DEFAULT_ORIENTATION = "landscape";
 #endif
 
+const int ZOOM_MIN = 75;
+const int ZOOM_MAX = 250;
+const int ZOOM_STEP = 25;
+
 SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
 {
 #ifdef Q_WS_MAEMO_5
@@ -42,12 +46,20 @@ SettingsWindow::SettingsWindow(QWidget *parent):  QMainWindow(parent)
     layout->addWidget(grabVolume);
     grabVolume->setChecked(settings->value("usevolumekeys", false).toBool());
 
-    QLabel *zoomLabel = new QLabel(tr("Zoom level:"), contents);
+    int zoom = Settings::instance()->value("zoom").toInt();
+    if (zoom < ZOOM_MIN) {
+        zoom = ZOOM_MIN;
+    } else if (zoom > ZOOM_MAX) {
+        zoom = ZOOM_MAX;
+    }
+    zoomLabel = new QLabel(tr("Zoom level: %1%").arg(zoom), contents);
     layout->addWidget(zoomLabel);
     zoomSlider = new QSlider(Qt::Horizontal, contents);
-    zoomSlider->setMinimum(50);
-    zoomSlider->setMaximum(300);
-    zoomSlider->setValue(Settings::instance()->value("zoom").toInt());
+    zoomSlider->setMinimum(ZOOM_MIN);
+    zoomSlider->setMaximum(ZOOM_MAX);
+    zoomSlider->setSingleStep(ZOOM_STEP);
+    zoomSlider->setPageStep(ZOOM_STEP);
+    zoomSlider->setValue(zoom);
     layout->addWidget(zoomSlider);
 
     QLabel *fontLabel = new QLabel(tr("Font:"), contents);
@@ -118,8 +130,14 @@ 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);
+    int step = zoomSlider->singleStep();
+    if (value % step) {
+        zoomSlider->setValue((value + step / 2) / step * step);
+        return;
+    }
+    zoomLabel->setText(tr("Zoom level: %1%").arg(value));
+#ifdef Q_WS_MAEMO_5
+    // Re-scaling the book view is too much for the N900
 #else
     Settings::instance()->setValue("zoom", value);
 #endif // Q_WS_MAEMO_5
index fee2f2b..d5193c2 100644 (file)
@@ -8,6 +8,7 @@ class QFontComboBox;
 class QFont;
 class QSlider;
 class QFontComboBox;
+class QLabel;
 class ToolButtonBox;
 
 class SettingsWindow: public QMainWindow
@@ -36,6 +37,7 @@ protected:
 
 private:
     QSlider *zoomSlider;
+    QLabel *zoomLabel;
     QFontComboBox *fontButton;
     ToolButtonBox *orientationBox;
 };
index 7fb94ff..427e496 100644 (file)
@@ -22,11 +22,18 @@ Dyalog::Dyalog(QWidget *parent) :
     contentLayout->setMargin(0);
     content->setLayout(contentLayout);
 
-    buttonBox = new QDialogButtonBox(Qt::Vertical, this);
-    QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
-    horizontalLayout->addWidget(scroller);
-    horizontalLayout->addWidget(buttonBox);
-    setLayout(horizontalLayout);
+    QBoxLayout *boxLayout;
+    QRect screenGeometry = QApplication::desktop()->screenGeometry();
+    if (screenGeometry.width() < screenGeometry.height()) {
+        buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
+        boxLayout = new QVBoxLayout(this);
+    } else {
+        buttonBox = new QDialogButtonBox(Qt::Vertical, this);
+        boxLayout = new QHBoxLayout(this);
+    }
+    boxLayout->addWidget(scroller);
+    boxLayout->addWidget(buttonBox);
+    setLayout(boxLayout);
 
     scroller->setWidget(content);
     content->show();
index d1c48a5..28a1e43 100644 (file)
@@ -60,17 +60,17 @@ void ListWindow::addList(ListView *listView)
 }
 
 void ListWindow::addAction(const QString &title, QObject *receiver,
-                           const char *slot, QDialogButtonBox::ButtonRole role)
+                           const char *slot, const QString &iconPath,
+                           QDialogButtonBox::ButtonRole role)
 {
     Trace t("ListWindow::addAction");
 #ifndef Q_WS_MAEMO_5
+    Q_UNUSED(iconPath);
     QPushButton *button = buttonBox->addButton(title, role);
     connect(button, SIGNAL(clicked()), receiver, slot);
 #else
     Q_UNUSED(role);
-    // QAction *action = menuBar()->addAction(title);
-    // connect(action, SIGNAL(triggered()), receiver, slot);
-    QPushButton *button = new QPushButton(title, this);
+    QPushButton *button = new QPushButton(QIcon(iconPath), title, this);
     contentLayout->addWidget(button);
     connect(button, SIGNAL(clicked()), receiver, slot);
 #endif // ! Q_WS_MAEMO_5
index 3b689f6..4a75974 100644 (file)
@@ -31,6 +31,7 @@ public:
      * Activating the action invokes the slot with no parameters.
      */
     void addAction(const QString &title, QObject *receiver, const char *slot,
+        const QString &iconPath = QString(),
         QDialogButtonBox::ButtonRole role = QDialogButtonBox::ActionRole);
 
     /**