mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
LuaSettings: Add a method to initialize a setting properly (#7371)
* LuaSettings/DocSettings: Updated readSetting API to allow proper initialization to default. Use it to initialize tables, e.g., fixing corner-cases in readerFooter that could prevent settings from being saved. (Fixes an issue reported on Gitter). * LuaSettings/DocSettings: Add simpler API than the the flip* ones to toggle boolean settings. * Update LuaSettings/DocSettigns usage throughout the codebase to use the dedicated boolean methods wher appropriate, and clean up some of the more mind-bending uses. * FileChooser: Implement an extended default exclusion list (fix #2360) * ScreenSaver: Refactor to avoid the pile of kludges this was threatening to become. Code should be easier to follow and use, and fallbacks now behave as expected (fix #4418).
This commit is contained in:
@@ -56,15 +56,15 @@ end
|
||||
function ReaderDogear:onReadSettings(config)
|
||||
if not self.ui.document.info.has_pages then
|
||||
-- Adjust to CreDocument margins (as done in ReaderTypeset)
|
||||
local h_margins = config:readSetting("copt_h_page_margins") or
|
||||
G_reader_settings:readSetting("copt_h_page_margins") or
|
||||
DCREREADER_CONFIG_H_MARGIN_SIZES_MEDIUM
|
||||
local t_margin = config:readSetting("copt_t_page_margin") or
|
||||
G_reader_settings:readSetting("copt_t_page_margin") or
|
||||
DCREREADER_CONFIG_T_MARGIN_SIZES_LARGE
|
||||
local b_margin = config:readSetting("copt_b_page_margin") or
|
||||
G_reader_settings:readSetting("copt_b_page_margin") or
|
||||
DCREREADER_CONFIG_B_MARGIN_SIZES_LARGE
|
||||
local h_margins = config:readSetting("copt_h_page_margins")
|
||||
or G_reader_settings:readSetting("copt_h_page_margins")
|
||||
or DCREREADER_CONFIG_H_MARGIN_SIZES_MEDIUM
|
||||
local t_margin = config:readSetting("copt_t_page_margin")
|
||||
or G_reader_settings:readSetting("copt_t_page_margin")
|
||||
or DCREREADER_CONFIG_T_MARGIN_SIZES_LARGE
|
||||
local b_margin = config:readSetting("copt_b_page_margin")
|
||||
or G_reader_settings:readSetting("copt_b_page_margin")
|
||||
or DCREREADER_CONFIG_B_MARGIN_SIZES_LARGE
|
||||
local margins = { h_margins[1], t_margin, h_margins[2], b_margin }
|
||||
self:onSetPageMargins(margins)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user