Refactor using Fable
This commit is contained in:
90 files changed
+2080
-2267
No files matched your search
@@ -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;
|
||||
};
|
||||
Reference in new issue
Block a user