old render cleanup part 2

This commit is contained in:
Agel committed 2026-10-25 15:10:38 +01:00
1 parent acc7e71e7b
commit cef762c3ee
40 files changed
+329 -3643

No files matched your search

+3 -34
View File
@@ -6,28 +6,16 @@
#include <QString>
#include <QVariantList>
#include <QVector>
#include "backend/FormatReader.h"
#include "reading/MangaPagination.h"
#include "state/BookPositionStore.h"
class FormatReader;
struct ContentChunk {
int chapterIndex = 0;
QSize naturalSize;
QString imageUrl;
};
class ReadingModel : public QObject {
Q_OBJECT
Q_PROPERTY(QString chapterTitle READ chapterTitle NOTIFY chapterChanged)
Q_PROPERTY(int currentChapter READ currentChapter NOTIFY chapterChanged)
Q_PROPERTY(int totalChapters READ totalChapters NOTIFY totalChaptersChanged)
Q_PROPERTY(double progress READ progress NOTIFY currentPageChanged)
Q_PROPERTY(int currentPage READ currentPage NOTIFY currentPageChanged)
Q_PROPERTY(int totalPages READ totalPages NOTIFY totalPagesChanged)
Q_PROPERTY(bool hasChapters READ hasChapters NOTIFY totalChaptersChanged)
Q_PROPERTY(int totalPagePairs READ totalPagePairs NOTIFY totalPagePairsChanged)
Q_PROPERTY(bool isMangaMode READ isMangaMode NOTIFY isMangaModeChanged)
Q_PROPERTY(bool pageShift READ pageShift NOTIFY pageShiftChanged)
Q_PROPERTY(bool mangaRTL READ mangaRTL NOTIFY mangaRTLChanged)
@@ -35,15 +23,10 @@ public:
explicit ReadingModel(BookPositionStore &positions, QObject *parent = nullptr);
~ReadingModel() override;
QString chapterTitle() const;
int currentChapter() const;
int totalChapters() const;
double progress() const;
int currentPage() const;
int totalPages() const;
bool hasChapters() const;
int totalPagePairs() const;
bool isMangaMode() const;
bool pageShift() const;
bool mangaRTL() const;
@@ -52,10 +35,6 @@ public:
// Called from QML on every page navigation
Q_INVOKABLE void setScrollInfo(int topChunkIndex, qreal proportion);
Q_INVOKABLE void nextChapter();
Q_INVOKABLE void previousChapter();
Q_INVOKABLE void goToChapter(int index);
// Manga page-pair API
Q_INVOKABLE QVariantList pagePair(int pairIndex) const;
Q_INVOKABLE int pairIndexForChunk(int chunkIndex) const;
@@ -70,38 +49,28 @@ public:
Q_INVOKABLE void setMangaRTL(bool rtl);
signals:
void chapterChanged();
void totalChaptersChanged();
void currentPageChanged();
void totalPagesChanged();
void totalPagePairsChanged();
void isMangaModeChanged();
void pageShiftChanged();
void mangaRTLChanged();
// Fired after setPageShift rebuilds pairs; carries the new pair index to display.
void pagePairsRebuilt(int newPairIndex);
void scrollToChunkRequested(int chunkIndex);
void restoreReady(int chunkIndex);
private:
void loadAllChapters();
void loadPages();
void rebuildPagePairs();
FormatReader *m_reader = nullptr;
int m_currentChapter = 0;
int m_totalChapters = 0;
int m_currentPage = 0;
int m_totalPages = 0;
bool m_isMangaMode = false;
bool m_mangaLandscape = false;
bool m_pageShift = true;
bool m_mangaRTL = true;
QVector<ContentChunk> m_chunks;
QVector<int> m_chapterStartIndices;
QVector<QString> m_chapterTitles;
QVector<PageInfo> m_pages;
MangaPagination m_pagination;
qreal m_yOffset = 0.0;