| 23 | #include <QScrollBar> |
| 24 | |
| 25 | Viewer::Viewer(QWidget *parent) |
| 26 | : QScrollArea(parent), |
| 27 | fullscreen(false), |
| 28 | information(false), |
| 29 | doublePage(false), |
| 30 | doubleMangaPage(false), |
| 31 | continuousScroll(false), |
| 32 | zoom(100), |
| 33 | currentPage(nullptr), |
| 34 | wheelStop(false), |
| 35 | direction(1), |
| 36 | drag(false), |
| 37 | shouldOpenNext(false), |
| 38 | shouldOpenPrevious(false), |
| 39 | magnifyingGlassShown(false), |
| 40 | restoreMagnifyingGlass(false), |
| 41 | mouseHandler(std::make_unique<YACReader::MouseHandler>(this)) |
| 42 | { |
| 43 | translator = new YACReaderTranslator(this); |
| 44 | translator->hide(); |
| 45 | translatorAnimation = new QPropertyAnimation(translator, "pos"); |
| 46 | translatorAnimation->setDuration(150); |
| 47 | translatorXPos = -10000; |
| 48 | translator->move(-translator->width(), 10); |
| 49 | // current comic page (used in non-continuous mode when a comic is open) |
| 50 | content = new QLabel(this); |
| 51 | content->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); |
| 52 | if (!(devicePixelRatioF() > 1)) |
| 53 | content->setScaledContents(true); |
| 54 | content->setAlignment(Qt::AlignTop | Qt::AlignHCenter); |
| 55 | content->setMouseTracking(true); |
| 56 | |
| 57 | // dedicated widget for status messages ("Press 'O' to open comic.", "Loading...", etc.) |
| 58 | messageLabel = new QLabel(this); |
| 59 | messageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); |
| 60 | messageLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter); |
| 61 | messageLabel->setText(tr("Press 'O' to open comic.")); |
| 62 | messageLabel->setFont(QFont("courier new", 12)); |
| 63 | messageLabel->setMouseTracking(true); |
| 64 | |
| 65 | setWidget(messageLabel); |
| 66 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 67 | setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 68 | setFrameStyle(QFrame::NoFrame); |
| 69 | setAlignment(Qt::AlignCenter); |
| 70 | |
| 71 | continuousWidget = new ContinuousPageWidget(); |
| 72 | continuousPageProvider = new ContinuousPageProvider(this); |
| 73 | continuousViewModel = new ContinuousViewModel(QWIDGETSIZE_MAX, this); |
| 74 | continuousWidget->setViewModel(continuousViewModel); |
| 75 | continuousWidget->setProvider(continuousPageProvider); |
| 76 | continuousWidget->installEventFilter(this); |
| 77 | //--------------------------------------- |
| 78 | mglass = new MagnifyingGlass( |
| 79 | Configuration::getConfiguration().getMagnifyingGlassSize(), |
| 80 | Configuration::getConfiguration().getMagnifyingGlassZoom(), |
| 81 | this); |
| 82 |
nothing calls this directly
no test coverage detected