From: Akos Polster Date: Sun, 15 Aug 2010 09:41:37 +0000 (+0200) Subject: Small reorg. X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=6d93a09221b5d3a237c5ba661e7240a9d5013837;p=dorian Small reorg. --- diff --git a/model/book.cpp b/model/book.cpp index 38242ca..66e2392 100644 --- a/model/book.cpp +++ b/model/book.cpp @@ -19,6 +19,13 @@ const int COVER_WIDTH = 53; const int COVER_HEIGHT = 59; +static QImage makeCover(const QString &path) +{ + return QImage(path).scaled(COVER_WIDTH, COVER_HEIGHT, + Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation). + scaled(COVER_WIDTH, COVER_HEIGHT, Qt::KeepAspectRatio); +} + Book::Book(const QString &p, QObject *parent): QObject(parent) { mPath = ""; @@ -26,9 +33,7 @@ Book::Book(const QString &p, QObject *parent): QObject(parent) QFileInfo info(p); mPath = info.absoluteFilePath(); title = info.baseName(); - cover = QImage(":/icons/book.png").scaled(COVER_WIDTH, COVER_HEIGHT, - Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation). - scaled(COVER_WIDTH, COVER_HEIGHT, Qt::KeepAspectRatio); + cover = makeCover(":/icons/book.png"); } } @@ -146,9 +151,7 @@ bool Book::parse() foreach (QString key, coverKeys) { if (content.contains(key)) { t.trace("Loading cover image from " + content[key].href); - cover = QImage(content[key].href).scaled(COVER_WIDTH, COVER_HEIGHT, - Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation). - scaled(COVER_WIDTH, COVER_HEIGHT, Qt::KeepAspectRatio); + cover = makeCover(content[key].href); break; } } @@ -248,9 +251,7 @@ void Book::load() cover = settings.value(key + "cover").value().scaled(COVER_WIDTH, COVER_HEIGHT, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if (cover.isNull()) { - cover = QImage(":/icons/book.png").scaled(COVER_WIDTH, COVER_HEIGHT, - Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation). - scaled(COVER_WIDTH, COVER_HEIGHT, Qt::KeepAspectRatio); + cover = makeCover(":/icons/book.png"); } // Load bookmarks diff --git a/pkg/changelog b/pkg/changelog index 8a0fb85..1be16b8 100644 --- a/pkg/changelog +++ b/pkg/changelog @@ -1,3 +1,7 @@ +dorian (0.1.3-1) unstable; urgency=low + + -- Akos Polster Sun, 15 Aug 2010 20:00:00 +0200 + dorian (0.1.2-1) unstable; urgency=low * Improve cover image display