Stable pages in file browser (#14570)
This commit is contained in:
1 parent
2208f41ab7
commit
6beff03d49
3 files changed
+27
-3
No files matched your search
@@ -81,6 +81,7 @@ function ReaderPageMap:_postInit()
|
||||
self.has_pagemap = true
|
||||
self:resetLayout()
|
||||
self.view:registerViewModule("pagemap", self)
|
||||
self.ui.doc_settings:saveSetting("pagemap_doc_pages", select(3, self:getCurrentPageLabel()))
|
||||
if self.ui.document.is_new and self.has_pagemap_document_provided
|
||||
and G_reader_settings:isTrue("pagemap_notify_document_provided") then
|
||||
if self.use_page_labels or self.show_page_labels then
|
||||
@@ -463,11 +464,12 @@ Since stable page numbers can start anywhere on the screen, you can choose to di
|
||||
self.view:registerViewModule("pagemap", self)
|
||||
end
|
||||
self.chars_per_synthetic_page = spin.value
|
||||
self.ui.doc_settings:saveSetting("pagemap_chars_per_synthetic_page", spin.value)
|
||||
self.page_labels_cache = nil
|
||||
self.ui.document:buildSyntheticPageMap(spin.value)
|
||||
self:updateVisibleLabels()
|
||||
UIManager:setDirty(self.view.dialog, "partial")
|
||||
self.ui.doc_settings:saveSetting("pagemap_chars_per_synthetic_page", spin.value)
|
||||
self.ui.doc_settings:saveSetting("pagemap_doc_pages", select(3, self:getCurrentPageLabel()))
|
||||
UIManager:broadcastEvent(Event:new("UsePageLabelsUpdated"))
|
||||
touchmenu_instance:updateItems()
|
||||
end,
|
||||
|
||||
@@ -501,6 +501,8 @@ function ReaderUI:init()
|
||||
self.after_open_callback = nil
|
||||
end
|
||||
|
||||
BookList.setBookInfoCache(self.document.file, self.doc_settings)
|
||||
|
||||
Device:setIgnoreInput(false) -- Allow processing of events (on Android).
|
||||
Input:inhibitInputUntil(0.2)
|
||||
|
||||
@@ -832,7 +834,8 @@ function ReaderUI:onClose(full_refresh)
|
||||
end
|
||||
UIManager:close(self.dialog, full_refresh ~= false and "full")
|
||||
if file then
|
||||
BookList.setBookInfoCache(file, self.doc_settings)
|
||||
BookList.setBookInfoCacheProperty(file, "percent_finished", self.doc_settings:readSetting("percent_finished"))
|
||||
-- other cached properties of the currently opened document are updated in real time
|
||||
end
|
||||
end
|
||||
|
||||
@@ -925,6 +928,23 @@ function ReaderUI:onOpenLastDoc()
|
||||
self:switchDocument(self.menu:getPreviousFile())
|
||||
end
|
||||
|
||||
function ReaderUI:onAnnotationsModified()
|
||||
BookList.setBookInfoCacheProperty(self.document.file, "has_annotations", self.annotation:hasAnnotations())
|
||||
end
|
||||
|
||||
function ReaderUI:onDocumentRerendered()
|
||||
if self.doc_settings:nilOrFalse("pagemap_use_page_labels") then
|
||||
BookList.setBookInfoCacheProperty(self.document.file, "pages", self.document:getPageCount())
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderUI:onUsePageLabelsUpdated()
|
||||
local pages = self.doc_settings:isTrue("pagemap_use_page_labels")
|
||||
and self.doc_settings:readSetting("pagemap_doc_pages")
|
||||
or self.doc_settings:readSetting("doc_pages")
|
||||
BookList.setBookInfoCacheProperty(self.document.file, "pages", pages)
|
||||
end
|
||||
|
||||
function ReaderUI:getCurrentPage()
|
||||
return self.paging and self.paging.current_page or self.document:getCurrentPage()
|
||||
end
|
||||
|
||||
@@ -272,7 +272,9 @@ function BookList.setBookInfoCache(file, doc_settings)
|
||||
if BookList.getBookStatusString(book_info.status) == nil then
|
||||
book_info.status = "reading"
|
||||
end
|
||||
local pages = doc_settings:readSetting("doc_pages")
|
||||
local pages = doc_settings:isTrue("pagemap_use_page_labels")
|
||||
and doc_settings:readSetting("pagemap_doc_pages")
|
||||
or doc_settings:readSetting("doc_pages")
|
||||
if pages == nil then
|
||||
local stats = doc_settings:readSetting("stats")
|
||||
if stats and stats.pages and stats.pages ~= 0 then -- crengine with statistics disabled stores 0
|
||||
|
||||
Reference in new issue
Block a user