| 100 | } |
| 101 | |
| 102 | void BookmarksDialog::setBookmarks(const Bookmarks &bm) |
| 103 | { |
| 104 | lastPage = bm.getLastPage(); |
| 105 | if (lastPage > 0) { |
| 106 | QPixmap p = QPixmap::fromImage(bm.getLastPagePixmap()); |
| 107 | if (p.isNull()) { |
| 108 | images.at(0)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
| 109 | images.at(0)->setText(tr("Loading...")); |
| 110 | } else { |
| 111 | images.at(0)->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); |
| 112 | images.at(0)->setPixmap(p.scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
| 113 | } |
| 114 | } else { |
| 115 | images.at(0)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
| 116 | images.at(0)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
| 117 | } |
| 118 | |
| 119 | QList<int> l = bm.getBookmarkPages(); |
| 120 | int s = l.count(); |
| 121 | for (int i = 0; i < s; i++) { |
| 122 | pages.at(i + 1)->setText(QString::number(l.at(i) + 1)); |
| 123 | QPixmap p = QPixmap::fromImage(bm.getBookmarkPixmap(l.at(i))); |
| 124 | if (p.isNull()) { |
| 125 | images.at(i + 1)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
| 126 | images.at(i + 1)->setText(tr("Loading...")); |
| 127 | } else { |
| 128 | images.at(i + 1)->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); |
| 129 | images.at(i + 1)->setPixmap(p.scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
| 130 | } |
| 131 | } |
| 132 | for (int i = s; i < 3; i++) { |
| 133 | pages.at(i + 1)->setText("-"); |
| 134 | images.at(i + 1)->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); |
| 135 | images.at(i + 1)->setPixmap(QPixmap(":/images/notCover.png").scaled(coverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | bool BookmarksDialog::eventFilter(QObject *obj, QEvent *event) |
| 140 | { |
nothing calls this directly
no test coverage detected