| 1272 | } |
| 1273 | |
| 1274 | void Viewer::setContinuousScrollImpl(bool enabled, bool persistSettings) |
| 1275 | { |
| 1276 | if (continuousScroll == enabled) { |
| 1277 | return; |
| 1278 | } |
| 1279 | |
| 1280 | continuousScroll = enabled; |
| 1281 | if (persistSettings) { |
| 1282 | Configuration::getConfiguration().setContinuousScroll(continuousScroll); |
| 1283 | } |
| 1284 | |
| 1285 | if (continuousScroll) { |
| 1286 | continuousViewModel->setZoomFactor(zoom); |
| 1287 | if (render->hasLoadedComic()) { |
| 1288 | continuousViewModel->setViewportSize(viewport()->width(), viewport()->height()); |
| 1289 | continuousViewModel->setNumPages(render->numPages()); |
| 1290 | continuousPageProvider->setNumPages(render->numPages()); |
| 1291 | continuousPageProvider->setRotation(continuousRotation); |
| 1292 | lastCenterPage = render->getIndex(); |
| 1293 | continuousViewModel->setAnchorPage(lastCenterPage); |
| 1294 | continuousPageProvider->requestRange(lastCenterPage - 2, lastCenterPage + 4); |
| 1295 | setActiveWidget(continuousWidget); |
| 1296 | scrollToCurrentContinuousPage(); |
| 1297 | continuousWidget->update(); |
| 1298 | viewport()->update(); |
| 1299 | } |
| 1300 | } else { |
| 1301 | // Leaving continuous mode: bring Render to the reading position so |
| 1302 | // single-page mode shows the page the user was on. |
| 1303 | if (render->hasLoadedComic() && lastCenterPage >= 0) { |
| 1304 | const int page = qBound(0, lastCenterPage, static_cast<int>(render->numPages()) - 1); |
| 1305 | if (static_cast<int>(render->getIndex()) != page) { |
| 1306 | render->goTo(page); |
| 1307 | } |
| 1308 | } |
| 1309 | lastCenterPage = -1; |
| 1310 | if (render->hasLoadedComic()) { |
| 1311 | updatePage(); |
| 1312 | } |
| 1313 | } |
| 1314 | } |
| 1315 | |
| 1316 | void Viewer::setContinuousScrollWithoutStoringSetting(bool enabled) |
| 1317 | { |
nothing calls this directly
no test coverage detected