mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add preLoadSettings methods for cache_document_size setting
cache_document_size should be configurable for every docuemnt and it must be loaded before document open, so I added the preLoadSettings method
This commit is contained in:
@@ -49,6 +49,7 @@ function openFile(filename)
|
||||
end
|
||||
if reader then
|
||||
InfoMessage:show("Opening document, please wait... ", 0)
|
||||
reader:preLoadSettings(filename)
|
||||
local ok, err = reader:open(filename)
|
||||
if ok then
|
||||
reader:loadSettings(filename)
|
||||
|
||||
@@ -907,11 +907,19 @@ function UniReader:initGlobalSettings(settings)
|
||||
end
|
||||
end
|
||||
|
||||
-- Method to load settings before document open
|
||||
function UniReader:preLoadSettings(filename)
|
||||
self.settings = DocSettings:open(filename)
|
||||
|
||||
local cache_d_size = self.settings:readSetting("cache_document_size")
|
||||
if cache_d_size then
|
||||
self.cache_document_size = cache_d_size
|
||||
end
|
||||
end
|
||||
|
||||
-- This is a low-level method that can be shared with all readers.
|
||||
function UniReader:loadSettings(filename)
|
||||
if self.doc ~= nil then
|
||||
self.settings = DocSettings:open(filename,self.cache_document_size)
|
||||
|
||||
local gamma = self.settings:readSetting("gamma")
|
||||
if gamma then
|
||||
self.globalgamma = gamma
|
||||
|
||||
Reference in New Issue
Block a user