| 12 | #include <utility> |
| 13 | |
| 14 | BookmarksDialog::BookmarksDialog(QWidget *parent) |
| 15 | : QDialog(parent) |
| 16 | { |
| 17 | setModal(true); |
| 18 | |
| 19 | // animation = new QPropertyAnimation(this,"windowOpacity"); |
| 20 | // animation->setDuration(150); |
| 21 | |
| 22 | auto layout = new QHBoxLayout(); |
| 23 | |
| 24 | // bookmarks |
| 25 | auto bookmarksL = new QGridLayout(); |
| 26 | |
| 27 | pages.push_back(new QLabel(tr("Lastest Page"))); |
| 28 | for (int i = 0; i < 3; i++) |
| 29 | pages.push_back(new QLabel("-")); |
| 30 | |
| 31 | QString labelsStyle = "QLabel {color:white;}"; |
| 32 | |
| 33 | for (QLabel *const label : std::as_const(pages)) { |
| 34 | label->setStyleSheet(labelsStyle); |
| 35 | } |
| 36 | |
| 37 | QScreen *screen = parent != nullptr ? parent->window()->screen() : nullptr; |
| 38 | if (screen == nullptr) { |
| 39 | screen = QApplication::screens().constFirst(); |
| 40 | } |
| 41 | |
| 42 | int heightDesktopResolution = screen != nullptr ? screen->size().height() : 600; |
| 43 | int height, width; |
| 44 | height = heightDesktopResolution * 0.50; |
| 45 | width = height * 0.65; |
| 46 | |
| 47 | coverSize = QSize(width, height); |
| 48 | |
| 49 | for (int i = 0; i < 4; i++) { |
| 50 | QLabel *l = new QLabel(); |
| 51 | l->setFixedSize(coverSize); |
| 52 | l->setScaledContents(false); |
| 53 | // l->setPixmap(QPixmap(":/images/notCover.png")); |
| 54 | l->installEventFilter(this); |
| 55 | images.push_back(l); |
| 56 | } |
| 57 | |
| 58 | for (int i = 0; i < 3; i++) |
| 59 | bookmarksL->addWidget(pages.at(i + 1), 0, i, Qt::AlignCenter); |
| 60 | |
| 61 | for (int i = 0; i < 3; i++) |
| 62 | bookmarksL->addWidget(images.at(i + 1), 1, i, Qt::AlignCenter); |
| 63 | |
| 64 | // last page |
| 65 | auto lp = new QGridLayout(); |
| 66 | lp->addWidget(pages.at(0), 0, 0, Qt::AlignCenter); |
| 67 | lp->addWidget(images.at(0), 1, 0, Qt::AlignCenter); |
| 68 | |
| 69 | layout->addLayout(bookmarksL); |
| 70 | auto f = new QFrame(this); |
| 71 | f->setFrameStyle(QFrame::VLine | QFrame::Sunken); |