mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
copt/kopt options: deduplicate some defaults (#10893)
This commit is contained in:
@@ -48,7 +48,7 @@ local ReaderView = OverlapGroup:extend{
|
||||
-- properties of the gap drawn between each page in scroll mode:
|
||||
page_gap = nil, -- table
|
||||
-- DjVu page rendering mode (used in djvu.c:drawPage())
|
||||
render_mode = G_defaults:readSetting("DRENDER_MODE"), -- default to COLOR
|
||||
render_mode = nil, -- default to COLOR, will be set in onReadSettings()
|
||||
-- Crengine view mode
|
||||
view_mode = G_defaults:readSetting("DCREREADER_VIEW_MODE"), -- default to page mode
|
||||
hinting = true,
|
||||
@@ -861,7 +861,7 @@ end
|
||||
function ReaderView:onReadSettings(config)
|
||||
if self.ui.paging then
|
||||
self.document:setTileCacheValidity(config:readSetting("tile_cache_validity_ts"))
|
||||
self.render_mode = config:readSetting("render_mode") or 0
|
||||
self.render_mode = config:readSetting("render_mode") or G_defaults:readSetting("DRENDER_MODE")
|
||||
if config:has("gamma") then -- old doc contrast setting
|
||||
config:saveSetting("kopt_contrast", config:readSetting("gamma"))
|
||||
config:delSetting("gamma")
|
||||
@@ -1067,7 +1067,9 @@ function ReaderView:onSaveSettings()
|
||||
self.document:resetTileCacheValidity()
|
||||
end
|
||||
self.ui.doc_settings:saveSetting("tile_cache_validity_ts", self.document:getTileCacheValidity())
|
||||
self.ui.doc_settings:saveSetting("render_mode", self.render_mode)
|
||||
if self.document.is_djvu then
|
||||
self.ui.doc_settings:saveSetting("render_mode", self.render_mode)
|
||||
end
|
||||
end
|
||||
-- Don't etch the current rotation in stone when sticky rotation is enabled
|
||||
if G_reader_settings:nilOrFalse("lock_rotation") then
|
||||
|
||||
@@ -38,9 +38,6 @@ function Configurable:loadDefaults(config_options)
|
||||
local settings_key = prefix..key
|
||||
local default = G_reader_settings:readSetting(settings_key)
|
||||
self[key] = default or options[j].default_value
|
||||
if not self[key] then
|
||||
self[key] = options[j].default_arg
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,8 +93,8 @@ local CreOptions = {
|
||||
labels = {C_("Rotation", "⤹ 90°"), C_("Rotation", "↑ 0°"), C_("Rotation", "⤸ 90°"), C_("Rotation", "↓ 180°")},
|
||||
alternate = false,
|
||||
values = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
default_value = Screen.DEVICE_ROTATED_UPRIGHT,
|
||||
args = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
default_arg = 0,
|
||||
current_func = function() return Screen:getRotationMode() end,
|
||||
event = "SetRotationMode",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
@@ -106,7 +106,6 @@ local CreOptions = {
|
||||
values = {1, 2},
|
||||
default_value = 1,
|
||||
args = {1, 2},
|
||||
default_arg = 1,
|
||||
event = "SetVisiblePages",
|
||||
--[[ Commented out, to have it also available in portrait mode
|
||||
current_func = function()
|
||||
@@ -184,7 +183,6 @@ This is disabled in scroll mode. Switching from page mode with two columns to sc
|
||||
default_value = 0,
|
||||
event = "SyncPageTopBottomMargins",
|
||||
args = {false, true},
|
||||
default_arg = false,
|
||||
hide_on_apply = true,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Keep top and bottom margins synchronized.
|
||||
@@ -310,9 +308,8 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m
|
||||
name_text = _("View Mode"),
|
||||
toggle = {_("page"), _("continuous")},
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
default_value = G_defaults:readSetting("DCREREADER_VIEW_MODE") == "page" and 0 or 1,
|
||||
args = {"page", "scroll"},
|
||||
default_arg = "page",
|
||||
event = "SetViewMode",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[- 'page' mode splits the text into pages, at the most acceptable places (page numbers and the number of pages may change when you change fonts, margins, styles, etc.).
|
||||
@@ -325,7 +322,6 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m
|
||||
values = {0, 1, 2, 3},
|
||||
default_value = 2,
|
||||
args = {0, 1, 2, 3},
|
||||
default_arg = 2,
|
||||
event = "SetBlockRenderingMode",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[
|
||||
@@ -676,7 +672,6 @@ If a font variation is not available, as well as for fractional adjustments, it
|
||||
values = {1, 0}, -- Note that 0 means crengine header status line enabled, and 1 means disabled
|
||||
default_value = 1,
|
||||
args = {1, 0},
|
||||
default_arg = 1,
|
||||
event = "SetStatusLine",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Enable or disable the rendering engine alternative status bar at the top of the screen. The items displayed can be customized via the main menu.
|
||||
@@ -690,7 +685,6 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
|
||||
values = {0, 1},
|
||||
default_value = 1,
|
||||
args = {false, true},
|
||||
default_arg = nil,
|
||||
event = "ToggleEmbeddedStyleSheet",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[Enable or disable publisher stylesheets embedded in the book.
|
||||
@@ -703,7 +697,6 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
|
||||
values = {0, 1},
|
||||
default_value = 1,
|
||||
args = {false, true},
|
||||
default_arg = nil,
|
||||
event = "ToggleEmbeddedFonts",
|
||||
enabled_func = function(configurable, document)
|
||||
return optionsutil.enableIfEquals(configurable, "embedded_css", 1)
|
||||
@@ -731,7 +724,6 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
|
||||
values = {0, 1},
|
||||
default_value = 0,
|
||||
args = {false, true},
|
||||
default_arg = nil,
|
||||
event = "ToggleImageScaling",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
help_text = _([[- 'fast' uses a fast but inaccurate scaling algorithm when scaling images.
|
||||
@@ -744,7 +736,6 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
|
||||
values = {1, 0},
|
||||
default_value = 1,
|
||||
args = {true, false},
|
||||
default_arg = nil,
|
||||
event = "ToggleNightmodeImages",
|
||||
show_func = function() return Screen.night_mode end,
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
|
||||
@@ -67,8 +67,8 @@ local KoptOptions = {
|
||||
labels = {C_("Rotation", "⤹ 90°"), C_("Rotation", "↑ 0°"), C_("Rotation", "⤸ 90°"), C_("Rotation", "↓ 180°")},
|
||||
alternate = false,
|
||||
values = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
default_value = Screen.DEVICE_ROTATED_UPRIGHT,
|
||||
args = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
default_arg = 0,
|
||||
current_func = function() return Screen:getRotationMode() end,
|
||||
event = "SetRotationMode",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
|
||||
Reference in New Issue
Block a user