old render cleanup part 1

This commit is contained in:
Agel committed 2026-10-25 14:22:12 +01:00
1 parent 83968646c6
commit acc7e71e7b
38 files changed
+166 -1366

No files matched your search

+1 -31
View File
@@ -34,36 +34,22 @@ AppCoordinator::AppCoordinator(Book &book,
, m_formatRegistry(formatRegistry)
, m_engine(engine)
{
// Typography changes → re-push font params into ReadingModel
connect(&m_readingPreferences, &ReadingPreferences::fontSizeChanged,
this, &AppCoordinator::onFontPrefsChanged);
connect(&m_readingPreferences, &ReadingPreferences::lineSpacingChanged,
this, &AppCoordinator::onFontPrefsChanged);
connect(&m_book, &Book::willOpenNewBook, this, &AppCoordinator::onWillOpenNewBook);
connect(&m_book, &Book::positionSaved, this, &AppCoordinator::onPositionSaved);
connect(&m_book, &Book::bookChanged, this, &AppCoordinator::onBookChanged);
connect(&m_book, &Book::contentWidthChanged, this, &AppCoordinator::onContentWidthChanged);
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
this, &AppCoordinator::onAboutToQuit);
}
void AppCoordinator::onFontPrefsChanged()
{
m_readingModel.setFontParams(m_readingPreferences.fontSize(),
m_readingPreferences.lineSpacing());
}
// Before a new book open: snapshot the outgoing book's progress into the library.
// Scroll position is handled by PageView's scroll tracker via book.saveCurrentPosition().
void AppCoordinator::onWillOpenNewBook()
{
if (m_book.hasBook())
m_historyModel.addOrUpdateBook(m_book.filePath(), m_readingModel.progress());
}
// Real-time history update: fired by PageView's scrollTrackTimer on every scroll.
// Real-time history update: fired when position is saved.
void AppCoordinator::onPositionSaved()
{
m_historyModel.addOrUpdateBook(m_book.filePath(), m_readingModel.progress());
@@ -87,34 +73,18 @@ void AppCoordinator::onBookChanged()
m_engine.removeImageProvider(provider->scheme());
m_engine.addImageProvider(provider->scheme(), provider);
provider->setFilePath(filePath);
provider->setDisplayWidth(m_contentWidth);
m_currentImageProvider = provider;
if (!reader->coverImagePath().isEmpty())
m_book.setCoverImageUrl(provider->coverImageUrl(reader->coverImagePath()));
}
m_readingModel.setFontParams(m_readingPreferences.fontSize(),
m_readingPreferences.lineSpacing());
m_readingModel.setImageLoader(m_formatRegistry.createImageLoader(filePath));
m_readingModel.setCoverImageUrl(m_book.coverImageUrl());
m_readingModel.setReader(reader);
m_readingModel.measure(true);
m_uiState.setLastFilePath(filePath);
m_historyModel.addOrUpdateBook(filePath, -1.0);
}
// Propagate content-width changes to image provider + reading model.
// Called from Book::setContentWidth which is triggered by QML's PageView.
void AppCoordinator::onContentWidthChanged(int width)
{
m_contentWidth = width;
if (m_currentImageProvider)
m_currentImageProvider->setDisplayWidth(width);
m_readingModel.setContentWidth(width);
}
// Quit: flush everything to persistent storage.
// Scroll position was last saved by PageView's scroll tracker; we save library progress here.
void AppCoordinator::onAboutToQuit()