Refactor using Fable

This commit is contained in:
Agel committed 2026-07-31 17:31:02 +02:00
1 parent 1a60a6b93c
commit 83968646c6
90 files changed
+2080 -2267

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <QSize>
#include <QVector>
// Pure page-pairing logic for manga mode. Given the natural sizes of the
// page images, decides which pages display alone and which form two-page
// spreads. Holds no Qt object state and emits nothing — the owning model
// drives signals and persistence.
class MangaPagination {
public:
struct Pair {
int first = -1;
int second = -1; // -1 = solo page
};
void clear();
// Portrait viewport: every page solo. Landscape: cover solo, optional
// shift page solo, consecutive portrait pages paired, wide pages solo.
void rebuild(const QVector<QSize> &naturalSizes, bool landscape, bool pageShift);
int count() const;
Pair at(int pairIndex) const;
int pairIndexForChunk(int chunkIndex) const;
// Chunk to keep on screen across a shift toggle. Anchoring on the
// higher-index chunk when shift turns on (and lower when it turns off)
// keeps repeated back-and-forth toggling stable with no drift.
int anchorChunkForShiftToggle(int currentPairIndex, bool shiftTurningOn) const;
private:
QVector<Pair> m_pairs;
};