From: Akos Polster Date: Sun, 29 Aug 2010 19:46:44 +0000 (+0200) Subject: Set zoom level in steps. Add icons to some buttons. Adjust dialog box layout accordin... X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;h=a0350a125756f86873ddd67bda42dd22759fd1e8;p=dorian Set zoom level in steps. Add icons to some buttons. Adjust dialog box layout according to orientation. --- diff --git a/bookmarksdialog.cpp b/bookmarksdialog.cpp index 9ae5666..08c4079 100644 --- a/bookmarksdialog.cpp +++ b/bookmarksdialog.cpp @@ -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())); diff --git a/chaptersdialog.cpp b/chaptersdialog.cpp index 2f279e0..1aaffd3 100644 --- a/chaptersdialog.cpp +++ b/chaptersdialog.cpp @@ -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 } diff --git a/dorian.qrc b/dorian.qrc index 39744a0..06f35c9 100644 --- a/dorian.qrc +++ b/dorian.qrc @@ -38,5 +38,7 @@ icons/chapters.png icons/mac/chapters.png icons/library.png + icons/add.png + icons/folder.png diff --git a/icons/add.png b/icons/add.png new file mode 100755 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 index 0000000..8666761 Binary files /dev/null and b/icons/folder.png differ diff --git a/librarydialog.cpp b/librarydialog.cpp index 4386e7d..767667a 100644 --- a/librarydialog.cpp +++ b/librarydialog.cpp @@ -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); diff --git a/mainwindow.cpp b/mainwindow.cpp index 3182b08..46da063 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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())); diff --git a/pkg/acknowledgements.txt b/pkg/acknowledgements.txt index e8c4396..286af97 100644 --- a/pkg/acknowledgements.txt +++ b/pkg/acknowledgements.txt @@ -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) diff --git a/pkg/changelog b/pkg/changelog index 25e290f..3977a92 100644 --- a/pkg/changelog +++ b/pkg/changelog @@ -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 Sun, 29 Aug 2010 02:00:00 +0200 dorian (0.1.5-1) unstable; urgency=low diff --git a/settingswindow.cpp b/settingswindow.cpp index 247cffc..5c5dce4 100644 --- a/settingswindow.cpp +++ b/settingswindow.cpp @@ -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 diff --git a/settingswindow.h b/settingswindow.h index fee2f2b..d5193c2 100644 --- a/settingswindow.h +++ b/settingswindow.h @@ -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; }; diff --git a/widgets/dyalog.cpp b/widgets/dyalog.cpp index 7fb94ff..427e496 100644 --- a/widgets/dyalog.cpp +++ b/widgets/dyalog.cpp @@ -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(); diff --git a/widgets/listwindow.cpp b/widgets/listwindow.cpp index d1c48a5..28a1e43 100644 --- a/widgets/listwindow.cpp +++ b/widgets/listwindow.cpp @@ -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 diff --git a/widgets/listwindow.h b/widgets/listwindow.h index 3b689f6..4a75974 100644 --- a/widgets/listwindow.h +++ b/widgets/listwindow.h @@ -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); /**