Add checkbox for fallback

reviewable/pr11491/r2
Daniel Kauss 3 months ago
parent 4011851ab8
commit e4a67d16d0

@ -366,7 +366,7 @@ function BookInfo:getCoverImage(doc, file, force_orig)
end
if doc then
cover_bb = doc:getCoverPageImage()
if not cover_bb and doc.loadDocument then -- try falling back to first page image
if not cover_bb and doc.loadDocument and G_reader_settings:readSetting("cover_fallback") then
local img_pos = Geom:new{x = 50, y = 50}
doc:gotoPage(0)
doc._document:loadDocument(doc.file, false)

@ -167,6 +167,11 @@ function FileManagerMenu:setUpdateItemTable()
callback = function() FileChooser:toggleShowFilesMode("show_unsupported") end,
separator = true,
},
{
text = _("Use cover fallback image"),
checked_func = function() return G_reader_settings:readSetting("cover_fallback") end,
callback = function() FileChooser:toggleCoverFallback() end,
},
{
text = _("Classic mode settings"),
sub_item_table = {

@ -24,6 +24,7 @@ local FileChooser = Menu:extend{
show_finished = G_reader_settings:readSetting("show_finished", true), -- books marked as finished
show_hidden = G_reader_settings:readSetting("show_hidden", false), -- folders/files starting with "."
show_unsupported = G_reader_settings:readSetting("show_unsupported", false), -- set to true to ignore file_filter
cover_fallback = G_reader_settings:readSetting("cover_fallback", false), -- set to true to use first image as cover fallback
file_filter = nil, -- function defined in the caller, returns true for files to be shown
-- NOTE: Input is *always* a relative entry name
exclude_dirs = { -- const
@ -567,6 +568,12 @@ function FileChooser:toggleShowFilesMode(mode)
self:refreshPath()
end
function FileChooser:toggleCoverFallback()
local newValue = not G_reader_settings:readSetting("cover_fallback")
G_reader_settings:saveSetting("cover_fallback", newValue)
self:refreshPath()
end
function FileChooser:onMenuSelect(item)
-- parent directory of dir without permission get nil mode
-- we need to change to parent path in this case

Loading…
Cancel
Save