From 4dad8319d28f08044d73357e071975a6aea93d52 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Thu, 19 Aug 2021 19:03:52 -0400 Subject: [PATCH] Auto page relocation: ePUB support --- reader.cpp | 11 ++++++++++- reader.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/reader.cpp b/reader.cpp index 1a619f1..6e43605 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1402,6 +1402,9 @@ void reader::writeconfig_pagenumber(bool persistent) { } void reader::quit_restart() { + // Saving current page number + saveReadingSettings(); + // Cleaning bookconfig_mount mountpoint string_writeconfig("/opt/ibxd", "bookconfig_unmount\n"); @@ -1437,6 +1440,13 @@ void reader::convertMuPdfVars() { mupdf::fontSize_qstr = QString::number(mupdf::fontSize); mupdf::width_qstr = QString::number(mupdf::width); mupdf::height_qstr = QString::number(mupdf::height); + if(global::reader::globalReadingSettings == false) { + if(goToSavedPageDone == false) { + string_checkconfig_ro(".config/A-page_number/config"); + mupdf::epubPageNumber = checkconfig_str_val.toInt(); + goToSavedPageDone = true; + } + } if(mupdf::epubPageNumber <= 0) { mupdf::epubPageNumber = 1; } @@ -1737,7 +1747,6 @@ void reader::showToast(QString messageToDisplay) { } void reader::saveReadingSettings() { - qDebug() << "Got there"; writeconfig_pagenumber(true); } diff --git a/reader.h b/reader.h index 0d11a59..f0cf6d5 100644 --- a/reader.h +++ b/reader.h @@ -56,6 +56,7 @@ public: bool showTopbarWidget; bool wordwidgetLock; bool isNightModeActive; + bool goToSavedPageDone; QString book_1; QString book_2; QString book_3;