Use continuous scroll mode automatically when a web comic is open
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled

This commit is contained in:
luisangelsm
2026-03-24 22:17:41 +01:00
parent 15a780fc9b
commit 49eed6ba85
4 changed files with 107 additions and 23 deletions

View File

@ -111,10 +111,10 @@ Viewer::Viewer(QWidget *parent)
doublePageSwitch();
if (Configuration::getConfiguration().getDoubleMangaPage())
doubleMangaPageSwitch();
setMangaModeImpl(true, false);
if (Configuration::getConfiguration().getContinuousScroll())
setContinuousScroll(true);
setContinuousScrollImpl(true, false);
createConnections();
@ -1188,41 +1188,49 @@ void Viewer::doublePageSwitch()
Configuration::getConfiguration().setDoublePage(doublePage);
}
void Viewer::setContinuousScroll(bool enabled)
void Viewer::setContinuousScrollImpl(bool enabled, bool persistSettings)
{
if (continuousScroll == enabled) {
return;
}
continuousScroll = enabled;
Configuration::getConfiguration().setContinuousScroll(continuousScroll);
if (persistSettings) {
Configuration::getConfiguration().setContinuousScroll(continuousScroll);
}
if (continuousScroll) {
continuousViewModel->setZoomFactor(zoom);
if (render->hasLoadedComic()) {
continuousViewModel->setViewportSize(viewport()->width(), viewport()->height());
continuousViewModel->setNumPages(render->numPages());
// set the current page as model state before any layout/scroll happens
lastCenterPage = render->getIndex();
continuousViewModel->setAnchorPage(lastCenterPage);
// pick up sizes of pages already in the buffer
probeContinuousBufferedPages();
// trigger a render cycle so new pages arrive via pageRendered signal
render->update();
setActiveWidget(continuousWidget);
scrollToCurrentContinuousPage();
continuousWidget->update();
viewport()->update();
}
// if no comic is loaded, messageLabel stays as the active widget
} else {
lastCenterPage = -1;
if (render->hasLoadedComic()) {
updatePage();
}
// if no comic is loaded, messageLabel stays as the active widget
}
}
void Viewer::setContinuousScrollWithoutStoringSetting(bool enabled)
{
setContinuousScrollImpl(enabled, false);
}
void Viewer::setContinuousScroll(bool enabled)
{
setContinuousScrollImpl(enabled, true);
}
void Viewer::onContinuousScroll(int value)
{
if (!continuousScroll || !render->hasLoadedComic() || applyingContinuousModelState) {
@ -1345,21 +1353,32 @@ void Viewer::onRenderPageChanged(int page)
scrollToCurrentContinuousPage();
}
void Viewer::setMangaWithoutStoringSetting(bool manga)
void Viewer::setMangaModeImpl(bool manga, bool persistSettings)
{
if (doubleMangaPage == manga) {
return;
}
doubleMangaPage = manga;
if (persistSettings) {
Configuration &config = Configuration::getConfiguration();
config.setDoubleMangaPage(doubleMangaPage);
goToFlow->updateConfig(config.getSettings());
}
render->setManga(manga);
goToFlow->setFlowRightToLeft(doubleMangaPage);
}
void Viewer::setMangaWithoutStoringSetting(bool manga)
{
setMangaModeImpl(manga, false);
}
void Viewer::doubleMangaPageSwitch()
{
doubleMangaPage = !doubleMangaPage;
render->doubleMangaPageSwitch();
Configuration &config = Configuration::getConfiguration();
config.setDoubleMangaPage(doubleMangaPage);
goToFlow->setFlowRightToLeft(doubleMangaPage);
goToFlow->updateConfig(config.getSettings());
setMangaModeImpl(!doubleMangaPage, true);
}
void Viewer::resetContent()