| 130 | int mMinTimeBetweenPinch; |
| 131 | |
| 132 | void setCurrentAdapter(AbstractDocumentViewAdapter *adapter) |
| 133 | { |
| 134 | Q_ASSERT(adapter); |
| 135 | mAdapter.reset(adapter); |
| 136 | |
| 137 | adapter->widget()->setParentItem(q); |
| 138 | resizeAdapterWidget(); |
| 139 | |
| 140 | if (adapter->canZoom()) { |
| 141 | QObject::connect(adapter, &AbstractDocumentViewAdapter::zoomChanged, q, &DocumentView::slotZoomChanged); |
| 142 | QObject::connect(adapter, &AbstractDocumentViewAdapter::zoomInRequested, q, &DocumentView::zoomIn); |
| 143 | QObject::connect(adapter, &AbstractDocumentViewAdapter::zoomOutRequested, q, &DocumentView::zoomOut); |
| 144 | QObject::connect(adapter, &AbstractDocumentViewAdapter::zoomToFitChanged, q, &DocumentView::zoomToFitChanged); |
| 145 | QObject::connect(adapter, &AbstractDocumentViewAdapter::zoomToFillChanged, q, &DocumentView::zoomToFillChanged); |
| 146 | } |
| 147 | QObject::connect(adapter, &AbstractDocumentViewAdapter::scrollPosChanged, q, &DocumentView::positionChanged); |
| 148 | QObject::connect(adapter, &AbstractDocumentViewAdapter::previousImageRequested, q, &DocumentView::previousImageRequested); |
| 149 | QObject::connect(adapter, &AbstractDocumentViewAdapter::nextImageRequested, q, &DocumentView::nextImageRequested); |
| 150 | QObject::connect(adapter, &AbstractDocumentViewAdapter::toggleFullScreenRequested, q, &DocumentView::toggleFullScreenRequested); |
| 151 | QObject::connect(adapter, &AbstractDocumentViewAdapter::completed, q, &DocumentView::slotCompleted); |
| 152 | |
| 153 | adapter->loadConfig(); |
| 154 | |
| 155 | adapter->widget()->installSceneEventFilter(q); |
| 156 | if (mCurrent) { |
| 157 | adapter->widget()->setFocus(); |
| 158 | } |
| 159 | |
| 160 | if (mSetup.valid && adapter->canZoom()) { |
| 161 | adapter->setZoomToFit(mSetup.zoomToFit); |
| 162 | adapter->setZoomToFill(mSetup.zoomToFill); |
| 163 | if (!mSetup.zoomToFit && !mSetup.zoomToFill) { |
| 164 | adapter->setZoom(mSetup.zoom); |
| 165 | adapter->setScrollPos(mSetup.position); |
| 166 | } |
| 167 | } |
| 168 | Q_EMIT q->adapterChanged(); |
| 169 | Q_EMIT q->positionChanged(); |
| 170 | if (adapter->canZoom()) { |
| 171 | if (adapter->zoomToFit()) { |
| 172 | Q_EMIT q->zoomToFitChanged(true); |
| 173 | } else if (adapter->zoomToFill()) { |
| 174 | Q_EMIT q->zoomToFillChanged(true); |
| 175 | } else { |
| 176 | Q_EMIT q->zoomChanged(adapter->zoom()); |
| 177 | } |
| 178 | } |
| 179 | if (adapter->rasterImageView()) { |
| 180 | QObject::connect(adapter->rasterImageView(), &RasterImageView::currentToolChanged, q, &DocumentView::currentToolChanged); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | void setupLoadingIndicator() |
| 185 | { |
no test coverage detected