From cb195e9ce89568ee11d07c393e8288f56a6c64b5 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 26 Dec 2016 22:52:53 -0800 Subject: [PATCH] feat: support disable show file name in bold also rename show_opened_doc_in_bold setting to show_file_in_bold --- frontend/ui/widget/filechooser.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index 14586fdca..4d1c1c05d 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -122,10 +122,10 @@ function FileChooser:genItemTableFromPath(path) }) end - local show_new_book_in_bold = true -- show new books in bold by default - if G_reader_settings:isTrue("show_opened_doc_in_bold") then - show_new_book_in_bold = false - end + -- set to false to show all files in regular font + -- set to "opened" to show opened files in bold + -- otherwise, show new files in bold + local show_file_in_bold = G_reader_settings:readSetting("show_file_in_bold") for _, file in ipairs(files) do local full_path = self.path.."/"..file.name @@ -138,18 +138,18 @@ function FileChooser:genItemTableFromPath(path) else sstr = string.format("%d B", file_size) end - local show_in_bold - if show_new_book_in_bold then - show_in_bold = not DocSettings:hasSidecarDir(full_path) - else - show_in_bold = DocSettings:hasSidecarDir(full_path) - end - table.insert(item_table, { + local file_item = { text = file.name, mandatory = sstr, - bold = show_in_bold, path = full_path - }) + } + if show_file_in_bold ~= false then + file_item.bold = DocSettings:hasSidecarDir(full_path) + if show_file_in_bold ~= "opened" then + file_item.bold = not file_item.bold + end + end + table.insert(item_table, file_item) end -- lfs.dir iterated node string may be encoded with some weird codepage on -- Windows we need to encode them to utf-8