SomeGuy 2 weeks ago committed by GitHub
commit 08c8235d67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -165,18 +165,33 @@ function FileManagerMenu:setUpdateItemTable()
text = _("Show unsupported files"),
checked_func = function() return FileChooser.show_unsupported end,
callback = function() FileChooser:toggleShowFilesMode("show_unsupported") end,
},
{
text = _("Mix folders and files"),
separator = true,
enabled_func = function()
local collate = FileChooser:getCollate()
return collate.can_collate_mixed
end,
checked_func = function()
local collate = FileChooser:getCollate()
return collate.can_collate_mixed and G_reader_settings:isTrue("collate_mixed")
end,
callback = function()
G_reader_settings:flipNilOrFalse("collate_mixed")
FileChooser:refreshPath()
end,
},
{
text = _("Classic mode settings"),
text = _("Classic view properties"),
sub_item_table = {
{
text_func = function()
return T(_("Items per page: %1"),
return T(_("Entries per page: %1"),
G_reader_settings:readSetting("items_per_page") or FileChooser.items_per_page_default)
end,
help_text = _([[This sets the number of items per page in:
- File browser, history and favorites in 'classic' display mode
help_text = _([[This sets the number of entries per page in:
- File browser, history and collections in 'classic' library view
- Search results and folder shortcuts
- File and folder selection
- Calibre and OPDS browsers/search results]]),
@ -184,7 +199,7 @@ function FileManagerMenu:setUpdateItemTable()
local default_value = FileChooser.items_per_page_default
local current_value = G_reader_settings:readSetting("items_per_page") or default_value
local widget = SpinWidget:new{
title_text = _("Items per page"),
title_text = _("Entries per page"),
value = current_value,
value_min = 6,
value_max = 30,
@ -201,14 +216,17 @@ function FileManagerMenu:setUpdateItemTable()
},
{
text_func = function()
return T(_("Item font size: %1"), FileChooser.font_size)
local items_per_page = G_reader_settings:readSetting("items_per_page") or FileChooser.items_per_page_default
local items_font_size = FileChooser.font_size
or G_reader_settings:readSetting("items_font_size") or FileChooser.getItemFontSize(items_per_page)
return T(_("Entries font size: %1"), items_font_size)
end,
callback = function(touchmenu_instance)
local current_value = FileChooser.font_size
local default_value = FileChooser.getItemFontSize(G_reader_settings:readSetting("items_per_page")
or FileChooser.items_per_page_default)
local items_per_page = G_reader_settings:readSetting("items_per_page") or FileChooser.items_per_page_default
local default_value = FileChooser.getItemFontSize(items_per_page)
local current_value = FileChooser.font_size or G_reader_settings:readSetting("items_font_size") or default_value
local widget = SpinWidget:new{
title_text = _("Item font size"),
title_text = _("Entries font size"),
value = current_value,
value_min = 10,
value_max = 72,
@ -231,7 +249,7 @@ function FileManagerMenu:setUpdateItemTable()
end,
},
{
text = _("Shrink item font size to fit more text"),
text = _("Auto reduce font-size to fit more text"),
checked_func = function()
return G_reader_settings:isTrue("items_multilines_show_more_text")
end,
@ -256,7 +274,7 @@ function FileManagerMenu:setUpdateItemTable()
end,
},
{
text = _("Show new (not yet opened) files in bold"),
text = _("Show unopened files in bold"),
checked_func = function()
return G_reader_settings:hasNot("show_file_in_bold")
end,
@ -272,7 +290,7 @@ function FileManagerMenu:setUpdateItemTable()
},
},
{
text = _("History settings"),
text = _("History"),
sub_item_table = {
{
text = _("Shorten date/time"),
@ -285,7 +303,7 @@ function FileManagerMenu:setUpdateItemTable()
end,
},
{
text = _("Freeze last read date of finished books"),
text = _("Freeze last-read date for finished books"),
checked_func = function()
return G_reader_settings:isTrue("history_freeze_finished_books")
end,
@ -295,11 +313,11 @@ function FileManagerMenu:setUpdateItemTable()
separator = true,
},
{
text = _("Clear history of deleted files"),
text = _("Remove deleted files from history"),
callback = function()
UIManager:show(ConfirmBox:new{
text = _("Clear history of deleted files?"),
ok_text = _("Clear"),
text = _("Remove deleted files from history?"),
ok_text = _("Remove"),
ok_callback = function()
require("readhistory"):clearMissing()
end,
@ -307,7 +325,7 @@ function FileManagerMenu:setUpdateItemTable()
end,
},
{
text = _("Auto-remove deleted or purged items from history"),
text = _("Auto-remove deleted or purged files from history"),
checked_func = function()
return G_reader_settings:isTrue("autoremove_deleted_items_from_history")
end,
@ -317,7 +335,7 @@ function FileManagerMenu:setUpdateItemTable()
separator = true,
},
{
text = _("Show filename in Open last/previous menu items"),
text = _("Show filename in Open last/previous menu"),
checked_func = function()
return G_reader_settings:isTrue("open_last_menu_show_filename")
end,
@ -328,7 +346,7 @@ function FileManagerMenu:setUpdateItemTable()
},
},
{
text = _("Home folder settings"),
text = _("Home folder"),
sub_item_table = {
{
text = _("Set home folder"),
@ -344,7 +362,7 @@ function FileManagerMenu:setUpdateItemTable()
end,
},
{
text = _("Shorten home folder"),
text = _("Shorten home folder path"),
checked_func = function()
return G_reader_settings:nilOrTrue("shorten_home_dir")
end,
@ -382,9 +400,9 @@ To:
text_func = function()
local default_value = KeyValuePage.getDefaultItemsPerPage()
local current_value = G_reader_settings:readSetting("keyvalues_per_page") or default_value
return T(_("Info lists items per page: %1"), current_value)
return T(_("Entries per page on info lists: %1"), current_value)
end,
help_text = _([[This sets the number of items per page in:
help_text = _([[This sets the number of entries per page in:
- Book information
- Dictionary and Wikipedia lookup history
- Reading statistics details
@ -398,7 +416,7 @@ To:
value_min = 10,
value_max = 30,
default_value = default_value,
title_text = _("Info lists items per page"),
title_text = _("Entries per page on info lists"),
callback = function(spin)
if spin.value == default_value then
-- We can't know if the user has set a value or hit "Use default", but
@ -435,21 +453,6 @@ To:
FileChooser:refreshPath()
end,
}
self.menu_items.sort_mixed = {
text = _("Folders and files mixed"),
enabled_func = function()
local collate = FileChooser:getCollate()
return collate.can_collate_mixed
end,
checked_func = function()
local collate = FileChooser:getCollate()
return collate.can_collate_mixed and G_reader_settings:isTrue("collate_mixed")
end,
callback = function()
G_reader_settings:flipNilOrFalse("collate_mixed")
FileChooser:refreshPath()
end,
}
self.menu_items.start_with = self:getStartWithMenuTable()
if Device:supportsScreensaver() then
@ -906,7 +909,7 @@ function FileManagerMenu:getStartWithMenuTable()
local start_with = G_reader_settings:readSetting("start_with") or "filemanager"
for i, v in ipairs(start_withs) do
if v[2] == start_with then
return T(_("Start with: %1"), v[1])
return T(_("Open on startup: %1"), v[1])
end
end
end,

@ -81,13 +81,11 @@ function CoverBrowser:init()
end
function CoverBrowser:addToMainMenu(menu_items)
local fc = self.ui.file_chooser
local modes = {
{ _("Classic (filename only)") },
{ _("Mosaic with cover images"), "mosaic_image" },
{ _("Mosaic with text covers"), "mosaic_text" },
{ _("Detailed list with cover images and metadata"), "list_image_meta" },
{ _("Detailed list with metadata, no images"), "list_only_meta" },
{ _("Detailed list with cover images and filenames"), "list_image_filename" },
{ _("Grid"), "mosaic_image" },
{ _("Detailed list"), "list_image_meta" },
}
local sub_item_table, history_sub_item_table, collection_sub_item_table = {}, {}, {}
for i, v in ipairs(modes) do
@ -95,7 +93,15 @@ function CoverBrowser:addToMainMenu(menu_items)
sub_item_table[i] = {
text = text,
checked_func = function()
return mode == filemanager_display_mode
if filemanager_display_mode == "mosaic_text" then
return mode == "mosaic_image"
elseif filemanager_display_mode == "list_only_meta" then
return mode == "list_image_meta"
elseif filemanager_display_mode == "list_image_filename" then
return mode == "list_image_meta"
else
return mode == filemanager_display_mode
end
end,
callback = function()
self:setupFileManagerDisplayMode(mode)
@ -126,47 +132,176 @@ function CoverBrowser:addToMainMenu(menu_items)
end
sub_item_table[#modes].separator = true
table.insert(sub_item_table, {
text = _("Use this mode everywhere"),
text = _("Hide book covers"),
enabled_func = function()
return fc.display_mode_type and true or false
end,
checked_func = function()
return BookInfoManager:getSetting("unified_display_mode")
return filemanager_display_mode == "mosaic_text" or filemanager_display_mode == "list_only_meta"
end,
callback = function()
if BookInfoManager:toggleSetting("unified_display_mode") then
self:setupHistoryDisplayMode(filemanager_display_mode)
self:setupCollectionDisplayMode(filemanager_display_mode)
if filemanager_display_mode == "mosaic_image" then
self:setupFileManagerDisplayMode("mosaic_text")
elseif filemanager_display_mode == "mosaic_text" then
self:setupFileManagerDisplayMode("mosaic_image")
elseif filemanager_display_mode == "list_only_meta" then
self:setupFileManagerDisplayMode("list_image_meta")
else
self:setupFileManagerDisplayMode("list_only_meta")
end
end,
})
table.insert(sub_item_table, {
text = _("History display mode"),
text = _("Replace book title with file name"),
enabled_func = function()
return not BookInfoManager:getSetting("unified_display_mode")
return fc.display_mode_type == "list"
end,
sub_item_table = history_sub_item_table,
})
table.insert(sub_item_table, {
text = _("Collections display mode"),
enabled_func = function()
return not BookInfoManager:getSetting("unified_display_mode")
checked_func = function()
return filemanager_display_mode == "list_image_filename"
end,
callback = function()
if filemanager_display_mode == "list_image_filename" then
self:setupFileManagerDisplayMode("list_image_meta")
else
self:setupFileManagerDisplayMode("list_image_filename")
end
end,
sub_item_table = collection_sub_item_table,
separator = true,
})
------------------------------------------------------------
-- add these settings to File browser Settings submenu
if menu_items.filebrowser_settings == nil then return end
table.insert(menu_items.filebrowser_settings.sub_item_table, {
text = _("Book info cache management"),
sub_item_table = {
{
text_func = function() -- add current db size to menu text
local sstr = BookInfoManager:getDbSize()
return _("Current cache size: ") .. sstr
end,
keep_menu_open = true,
callback = function() end, -- no callback, only for information
},
{
text = _("Prune cache of removed books"),
keep_menu_open = true,
callback = function()
local ConfirmBox = require("ui/widget/confirmbox")
UIManager:close(self.file_dialog)
UIManager:show(ConfirmBox:new{
-- Checking file existences is quite fast, but deleting entries is slow.
text = _("Are you sure that you want to prune cache of removed books?\n(This may take a while.)"),
ok_text = _("Prune cache"),
ok_callback = function()
local InfoMessage = require("ui/widget/infomessage")
local msg = InfoMessage:new{ text = _("Pruning cache of removed books…") }
UIManager:show(msg)
UIManager:nextTick(function()
local summary = BookInfoManager:removeNonExistantEntries()
UIManager:close(msg)
UIManager:show( InfoMessage:new{ text = summary } )
end)
end
})
end,
},
{
text = _("Compact cache database"),
keep_menu_open = true,
callback = function()
local ConfirmBox = require("ui/widget/confirmbox")
UIManager:close(self.file_dialog)
UIManager:show(ConfirmBox:new{
text = _("Are you sure that you want to compact cache database?\n(This may take a while.)"),
ok_text = _("Compact database"),
ok_callback = function()
local InfoMessage = require("ui/widget/infomessage")
local msg = InfoMessage:new{ text = _("Compacting cache database…") }
UIManager:show(msg)
UIManager:nextTick(function()
local summary = BookInfoManager:compactDb()
UIManager:close(msg)
UIManager:show( InfoMessage:new{ text = summary } )
end)
end
})
end,
},
{
text = _("Delete cache database"),
keep_menu_open = true,
callback = function()
local ConfirmBox = require("ui/widget/confirmbox")
UIManager:close(self.file_dialog)
UIManager:show(ConfirmBox:new{
text = _("Are you sure that you want to delete cover and metadata cache?\n(This will also reset your library view settings.)"),
ok_text = _("Purge"),
ok_callback = function()
BookInfoManager:deleteDb()
end
})
end,
},
},
})
-- the end
-------------------------------------------------------------
menu_items.filemanager_display_mode = {
text = _("Display mode"),
text = _("Library view"),
sub_item_table = sub_item_table,
}
-- add Mosaic / Detailed list mode settings to File browser Settings submenu
-- next to Classic mode settings
if menu_items.filebrowser_settings == nil then return end
local fc = self.ui.file_chooser
table.insert (menu_items.filebrowser_settings.sub_item_table, 5, {
text = _("Mosaic and detailed list settings"),
table.insert(sub_item_table, {
text = _("Collections and history view"),
separator = true,
sub_item_table = {
{
text = _("Same as library view"),
checked_func = function()
return BookInfoManager:getSetting("unified_display_mode")
end,
callback = function()
if BookInfoManager:toggleSetting("unified_display_mode") then
self:setupHistoryDisplayMode(filemanager_display_mode)
self:setupCollectionDisplayMode(filemanager_display_mode)
end
end,
},
{
text = _("History"),
enabled_func = function()
return not BookInfoManager:getSetting("unified_display_mode")
end,
sub_item_table = history_sub_item_table,
},
{
text = _("Collections"),
enabled_func = function()
return not BookInfoManager:getSetting("unified_display_mode")
end,
sub_item_table = collection_sub_item_table,
separator = true,
}
}
})
-- Classic view properties
table.insert(sub_item_table, menu_items.filebrowser_settings.sub_item_table[5])
table.remove(menu_items.filebrowser_settings.sub_item_table, 5)
table.insert(sub_item_table, {
text = _("Grid and list view properties"),
separator = true,
enabled_func = function()
return fc.display_mode_type and true or false
end,
sub_item_table = {
{
text_func = function()
return T(_("Items per page in portrait mosaic mode: %1 × %2"), fc.nb_cols_portrait, fc.nb_rows_portrait)
return T(_("Grid size in portrait mode: %1 × %2"), fc.nb_cols_portrait, fc.nb_rows_portrait)
end,
enabled_func = function()
return fc.display_mode_type == "mosaic"
end,
-- Best to not "keep_menu_open = true", to see how this apply on the full view
callback = function()
@ -174,7 +309,7 @@ function CoverBrowser:addToMainMenu(menu_items)
local nb_rows = fc.nb_rows_portrait
local DoubleSpinWidget = require("/ui/widget/doublespinwidget")
local widget = DoubleSpinWidget:new{
title_text = _("Portrait mosaic mode"),
title_text = _("Portrait grid view"),
width_factor = 0.6,
left_text = _("Columns"),
left_value = nb_cols,
@ -215,14 +350,17 @@ function CoverBrowser:addToMainMenu(menu_items)
},
{
text_func = function()
return T(_("Items per page in landscape mosaic mode: %1 × %2"), fc.nb_cols_landscape, fc.nb_rows_landscape)
return T(_("Grid size in landscape mode: %1 × %2"), fc.nb_cols_landscape, fc.nb_rows_landscape)
end,
enabled_func = function()
return fc.display_mode_type == "mosaic"
end,
callback = function()
local nb_cols = fc.nb_cols_landscape
local nb_rows = fc.nb_rows_landscape
local DoubleSpinWidget = require("/ui/widget/doublespinwidget")
local widget = DoubleSpinWidget:new{
title_text = _("Landscape mosaic mode"),
title_text = _("Landscape grid view"),
width_factor = 0.6,
left_text = _("Columns"),
left_value = nb_cols,
@ -265,7 +403,10 @@ function CoverBrowser:addToMainMenu(menu_items)
text_func = function()
-- default files_per_page should be calculated by ListMenu on the first drawing,
-- use 10 if ListMenu has not been drawn yet
return T(_("Items per page in portrait list mode: %1"), fc.files_per_page or 10)
return T(_("Books per page in list view: %1"), fc.files_per_page or 10)
end,
enabled_func = function()
return fc.display_mode_type == "list"
end,
callback = function()
local files_per_page = fc.files_per_page or 10
@ -300,10 +441,13 @@ function CoverBrowser:addToMainMenu(menu_items)
separator = true,
},
{
text = _("Progress"),
text = _("Book Progress"),
sub_item_table = {
{
text = _("Show progress in mosaic mode"),
text = _("Show progress bar"),
enabled_func = function()
return fc.display_mode_type == "mosaic"
end,
checked_func = function() return BookInfoManager:getSetting("show_progress_in_mosaic") end,
callback = function()
BookInfoManager:toggleSetting("show_progress_in_mosaic")
@ -312,7 +456,10 @@ function CoverBrowser:addToMainMenu(menu_items)
separator = true,
},
{
text = _("Show progress in detailed list mode"),
text = _("Show progress information"),
enabled_func = function()
return fc.display_mode_type == "list"
end,
checked_func = function() return not BookInfoManager:getSetting("hide_page_info") end,
callback = function()
BookInfoManager:toggleSetting("hide_page_info")
@ -320,8 +467,10 @@ function CoverBrowser:addToMainMenu(menu_items)
end,
},
{
text = _("Show number of pages read instead of progress %"),
enabled_func = function() return not BookInfoManager:getSetting("hide_page_info") end,
text = _("Show number of pages read instead of percentage"),
enabled_func = function()
return not BookInfoManager:getSetting("hide_page_info") and fc.display_mode_type == "list"
end,
checked_func = function() return BookInfoManager:getSetting("show_pages_read_as_progress") end,
callback = function()
BookInfoManager:toggleSetting("show_pages_read_as_progress")
@ -330,20 +479,36 @@ function CoverBrowser:addToMainMenu(menu_items)
},
{
text = _("Show number of pages left to read"),
enabled_func = function() return not BookInfoManager:getSetting("hide_page_info") end,
enabled_func = function()
return not BookInfoManager:getSetting("hide_page_info") and fc.display_mode_type == "list"
end,
checked_func = function() return BookInfoManager:getSetting("show_pages_left_in_progress") end,
callback = function()
BookInfoManager:toggleSetting("show_pages_left_in_progress")
fc:updateItems(1, true)
end,
},
{
text = _("Show file properties"),
enabled_func = function()
return fc.display_mode_type == "list"
end,
checked_func = function()
return not BookInfoManager:getSetting("hide_file_info")
end,
callback = function()
BookInfoManager:toggleSetting("hide_file_info")
fc:updateItems(1, true)
end,
separator = true,
},
},
},
{
text = _("Display hints"),
text = _("Visual cues"),
sub_item_table = {
{
text = _("Show hint for books with description"),
text = _("Show visual cue for books with descriptions"),
checked_func = function() return not BookInfoManager:getSetting("no_hint_description") end,
callback = function()
BookInfoManager:toggleSetting("no_hint_description")
@ -351,7 +516,7 @@ function CoverBrowser:addToMainMenu(menu_items)
end,
},
{
text = _("Show hint for book status in history"),
text = _("Show visual cue for open books in history"),
checked_func = function() return BookInfoManager:getSetting("history_hint_opened") end,
callback = function()
BookInfoManager:toggleSetting("history_hint_opened")
@ -359,7 +524,7 @@ function CoverBrowser:addToMainMenu(menu_items)
end,
},
{
text = _("Show hint for book status in collections"),
text = _("Show visual cue for open books in collections"),
checked_func = function() return BookInfoManager:getSetting("collections_hint_opened") end,
callback = function()
BookInfoManager:toggleSetting("collections_hint_opened")
@ -370,9 +535,12 @@ function CoverBrowser:addToMainMenu(menu_items)
},
{
text = _("Series"),
enabled_func = function()
return fc.display_mode_type == "list"
end,
sub_item_table = {
{
text = _("Append series metadata to authors"),
text = _("Show series data next to author name"),
checked_func = function() return series_mode == "append_series_to_authors" end,
callback = function()
if series_mode == "append_series_to_authors" then
@ -385,7 +553,7 @@ function CoverBrowser:addToMainMenu(menu_items)
end,
},
{
text = _("Append series metadata to title"),
text = _("Show series data next to book title"),
checked_func = function() return series_mode == "append_series_to_title" end,
callback = function()
if series_mode == "append_series_to_title" then
@ -398,7 +566,7 @@ function CoverBrowser:addToMainMenu(menu_items)
end,
},
{
text = _("Show series metadata in separate line"),
text = _("Show series data in a separate line"),
checked_func = function() return series_mode == "series_in_separate_line" end,
callback = function()
if series_mode == "series_in_separate_line" then
@ -412,90 +580,6 @@ function CoverBrowser:addToMainMenu(menu_items)
},
},
},
{
text = _("Show file properties"),
checked_func = function()
return not BookInfoManager:getSetting("hide_file_info")
end,
callback = function()
BookInfoManager:toggleSetting("hide_file_info")
fc:updateItems(1, true)
end,
separator = true,
},
{
text = _("Book info cache management"),
sub_item_table = {
{
text_func = function() -- add current db size to menu text
local sstr = BookInfoManager:getDbSize()
return _("Current cache size: ") .. sstr
end,
keep_menu_open = true,
callback = function() end, -- no callback, only for information
},
{
text = _("Prune cache of removed books"),
keep_menu_open = true,
callback = function()
local ConfirmBox = require("ui/widget/confirmbox")
UIManager:close(self.file_dialog)
UIManager:show(ConfirmBox:new{
-- Checking file existences is quite fast, but deleting entries is slow.
text = _("Are you sure that you want to prune cache of removed books?\n(This may take a while.)"),
ok_text = _("Prune cache"),
ok_callback = function()
local InfoMessage = require("ui/widget/infomessage")
local msg = InfoMessage:new{ text = _("Pruning cache of removed books…") }
UIManager:show(msg)
UIManager:nextTick(function()
local summary = BookInfoManager:removeNonExistantEntries()
UIManager:close(msg)
UIManager:show( InfoMessage:new{ text = summary } )
end)
end
})
end,
},
{
text = _("Compact cache database"),
keep_menu_open = true,
callback = function()
local ConfirmBox = require("ui/widget/confirmbox")
UIManager:close(self.file_dialog)
UIManager:show(ConfirmBox:new{
text = _("Are you sure that you want to compact cache database?\n(This may take a while.)"),
ok_text = _("Compact database"),
ok_callback = function()
local InfoMessage = require("ui/widget/infomessage")
local msg = InfoMessage:new{ text = _("Compacting cache database…") }
UIManager:show(msg)
UIManager:nextTick(function()
local summary = BookInfoManager:compactDb()
UIManager:close(msg)
UIManager:show( InfoMessage:new{ text = summary } )
end)
end
})
end,
},
{
text = _("Delete cache database"),
keep_menu_open = true,
callback = function()
local ConfirmBox = require("ui/widget/confirmbox")
UIManager:close(self.file_dialog)
UIManager:show(ConfirmBox:new{
text = _("Are you sure that you want to delete cover and metadata cache?\n(This will also reset your display mode settings.)"),
ok_text = _("Purge"),
ok_callback = function()
BookInfoManager:deleteDb()
end
})
end,
},
},
},
},
})
end

Loading…
Cancel
Save