readerview: do not read/save inapplicable doc_settings items (#10710)

reviewable/pr10746/r1
hius07 11 months ago committed by GitHub
parent 21949c5521
commit a311de6d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -857,8 +857,11 @@ In combination with zoom to fit page, page height, content height, content or co
end end
function ReaderView:onReadSettings(config) function ReaderView:onReadSettings(config)
self.document:setTileCacheValidity(config:readSetting("tile_cache_validity_ts")) if self.ui.paging then
self.render_mode = config:readSetting("render_mode") or 0 self.document:setTileCacheValidity(config:readSetting("tile_cache_validity_ts"))
self.render_mode = config:readSetting("render_mode") or 0
self.state.gamma = config:readSetting("gamma") or 1.0
end
local rotation_mode = nil local rotation_mode = nil
local locked = G_reader_settings:isTrue("lock_rotation") local locked = G_reader_settings:isTrue("lock_rotation")
-- Keep current rotation by doing nothing when sticky rota is enabled. -- Keep current rotation by doing nothing when sticky rota is enabled.
@ -868,17 +871,13 @@ function ReaderView:onReadSettings(config)
rotation_mode = config:readSetting("rotation_mode") -- Doc's rotation_mode = config:readSetting("rotation_mode") -- Doc's
else else
-- No doc specific rotation, pickup global defaults for the doc type -- No doc specific rotation, pickup global defaults for the doc type
if self.ui.paging then local setting_name = self.ui.paging and "kopt_rotation_mode" or "copt_rotation_mode"
rotation_mode = G_reader_settings:readSetting("kopt_rotation_mode") or Screen.DEVICE_ROTATED_UPRIGHT rotation_mode = G_reader_settings:readSetting(setting_name) or Screen.DEVICE_ROTATED_UPRIGHT
else
rotation_mode = G_reader_settings:readSetting("copt_rotation_mode") or Screen.DEVICE_ROTATED_UPRIGHT
end
end end
end end
if rotation_mode then if rotation_mode then
self:onSetRotationMode(rotation_mode) self:onSetRotationMode(rotation_mode)
end end
self.state.gamma = config:readSetting("gamma") or 1.0
local full_screen = config:readSetting("kopt_full_screen") or self.document.configurable.full_screen local full_screen = config:readSetting("kopt_full_screen") or self.document.configurable.full_screen
if full_screen == 0 then if full_screen == 0 then
self.footer_visible = false self.footer_visible = false
@ -1063,20 +1062,22 @@ function ReaderView:onPageGapUpdate(page_gap)
end end
function ReaderView:onSaveSettings() function ReaderView:onSaveSettings()
if self.document:isEdited() and G_reader_settings:readSetting("save_document") ~= "always" then if self.ui.paging then
-- Either "disable" (and the current tiles will be wrong) or "prompt" (but the if self.document:isEdited() and G_reader_settings:readSetting("save_document") ~= "always" then
-- prompt will happen later, too late to catch "Don't save"), so force cached -- Either "disable" (and the current tiles will be wrong) or "prompt" (but the
-- tiles to be ignored on next opening. -- prompt will happen later, too late to catch "Don't save"), so force cached
self.document:resetTileCacheValidity() -- tiles to be ignored on next opening.
end self.document:resetTileCacheValidity()
self.ui.doc_settings:saveSetting("tile_cache_validity_ts", self.document:getTileCacheValidity()) end
self.ui.doc_settings:saveSetting("render_mode", self.render_mode) self.ui.doc_settings:saveSetting("tile_cache_validity_ts", self.document:getTileCacheValidity())
self.ui.doc_settings:saveSetting("render_mode", self.render_mode)
self.ui.doc_settings:saveSetting("gamma", self.state.gamma)
end
-- Don't etch the current rotation in stone when sticky rotation is enabled -- Don't etch the current rotation in stone when sticky rotation is enabled
local locked = G_reader_settings:isTrue("lock_rotation") local locked = G_reader_settings:isTrue("lock_rotation")
if not locked then if not locked then
self.ui.doc_settings:saveSetting("rotation_mode", Screen:getRotationMode()) self.ui.doc_settings:saveSetting("rotation_mode", Screen:getRotationMode())
end end
self.ui.doc_settings:saveSetting("gamma", self.state.gamma)
self.ui.doc_settings:saveSetting("highlight", self.highlight.saved) self.ui.doc_settings:saveSetting("highlight", self.highlight.saved)
self.ui.doc_settings:saveSetting("inverse_reading_order", self.inverse_reading_order) self.ui.doc_settings:saveSetting("inverse_reading_order", self.inverse_reading_order)
self.ui.doc_settings:saveSetting("show_overlap_enable", self.page_overlap_enable) self.ui.doc_settings:saveSetting("show_overlap_enable", self.page_overlap_enable)
@ -1155,11 +1156,7 @@ function ReaderView:isOverlapAllowed()
end end
function ReaderView:setupTouchZones() function ReaderView:setupTouchZones()
if self.ui.rolling then (self.ui.rolling or self.ui.paging):setupTouchZones()
self.ui.rolling:setupTouchZones()
else
self.ui.paging:setupTouchZones()
end
end end
function ReaderView:onToggleReadingOrder() function ReaderView:onToggleReadingOrder()

Loading…
Cancel
Save