[UX] Navigation settings for all devices (#4680)

Before multiswipes and the gesture manager this was impractical on touch-only devices, but no more!

Also includes some minor textual clarifications on some of the settings.
pull/4686/head
Frans de Jonge 5 years ago committed by GitHub
parent 060902534d
commit 96823df503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,6 +24,7 @@ local action_strings = {
page_jmp_fwd_10 = _("Forward 10 pages"), page_jmp_fwd_10 = _("Forward 10 pages"),
page_jmp_fwd_1 = _("Next page"), page_jmp_fwd_1 = _("Next page"),
skim = _("Skim"), skim = _("Skim"),
back = _("Back"),
previous_location = _("Back to previous location"), previous_location = _("Back to previous location"),
latest_bookmark = _("Go to latest bookmark"), latest_bookmark = _("Go to latest bookmark"),
@ -101,6 +102,7 @@ function ReaderGesture:init()
multiswipe_east_north = "history", multiswipe_east_north = "history",
multiswipe_south_north = "skim", multiswipe_south_north = "skim",
multiswipe_south_west = "show_frontlight_dialog", multiswipe_south_west = "show_frontlight_dialog",
multiswipe_west_south = "back",
multiswipe_west_east_west = "open_previous_document", multiswipe_west_east_west = "open_previous_document",
multiswipe_east_north_west = "zoom_contentwidth", multiswipe_east_north_west = "zoom_contentwidth",
multiswipe_south_east_north = "zoom_contentheight", multiswipe_south_east_north = "zoom_contentheight",
@ -242,6 +244,7 @@ function ReaderGesture:buildMenu(ges, default)
{"page_jmp_fwd_10", not self.is_docless}, {"page_jmp_fwd_10", not self.is_docless},
{"page_jmp_fwd_1", not self.is_docless}, {"page_jmp_fwd_1", not self.is_docless},
{"skim", not self.is_docless}, {"skim", not self.is_docless},
{"back", true},
{"previous_location", not self.is_docless}, {"previous_location", not self.is_docless},
{"latest_bookmark", not self.is_docless, true}, {"latest_bookmark", not self.is_docless, true},
@ -506,6 +509,8 @@ function ReaderGesture:gestureAction(action)
self:pageUpdate(-1) self:pageUpdate(-1)
elseif action == "skim" then elseif action == "skim" then
self.ui:handleEvent(Event:new("ShowSkimtoDialog")) self.ui:handleEvent(Event:new("ShowSkimtoDialog"))
elseif action == "back" then
self.ui:handleEvent(Event:new("Back"))
elseif action == "previous_location" then elseif action == "previous_location" then
self.ui:handleEvent(Event:new("GoBackLink")) self.ui:handleEvent(Event:new("GoBackLink"))
elseif action == "latest_bookmark" then elseif action == "latest_bookmark" then

@ -165,15 +165,23 @@ if Device:isTouchDevice() then
} }
end end
if Device:hasKeys() then common_settings.navigation = {
common_settings.navigation = {
text = _("Navigation"), text = _("Navigation"),
}
local back_to_exit_str = {
prompt = {_("Prompt"), _("prompt")},
always = {_("Always"), _("always")},
disable ={_("Disable"), _("disable")},
}
common_settings.back_to_exit = {
text_func = function()
local back_to_exit = G_reader_settings:readSetting("back_to_exit") or "prompt"
return T(_("Back to exit (%1)"),
back_to_exit_str[back_to_exit][2])
end,
sub_item_table = { sub_item_table = {
{ {
text = _("Back key to exit KOReader"), text = back_to_exit_str.prompt[1],
sub_item_table = {
{
text = _("Prompt"),
checked_func = function() checked_func = function()
local setting = G_reader_settings:readSetting("back_to_exit") local setting = G_reader_settings:readSetting("back_to_exit")
return setting == "prompt" or setting == nil return setting == "prompt" or setting == nil
@ -183,7 +191,7 @@ if Device:hasKeys() then
end, end,
}, },
{ {
text = _("Always"), text = back_to_exit_str.always[1],
checked_func = function() checked_func = function()
return G_reader_settings:readSetting("back_to_exit") return G_reader_settings:readSetting("back_to_exit")
== "always" == "always"
@ -193,7 +201,7 @@ if Device:hasKeys() then
end, end,
}, },
{ {
text = _("Disable"), text = back_to_exit_str.disable[1],
checked_func = function() checked_func = function()
return G_reader_settings:readSetting("back_to_exit") return G_reader_settings:readSetting("back_to_exit")
== "disable" == "disable"
@ -203,15 +211,19 @@ if Device:hasKeys() then
end, end,
}, },
}, },
}, }
{ common_settings.back_in_filemanager = {
text = _("Back key in file browser"), text = _("Back in file browser"),
sub_item_table = { sub_item_table = {
{ {
text = _("Default"), text_func = function()
local back_to_exit = G_reader_settings:readSetting("back_to_exit") or "prompt"
return T(_("Back to exit (%1)"),
back_to_exit_str[back_to_exit][2])
end,
checked_func = function() checked_func = function()
return G_reader_settings:readSetting("back_in_filemanager") local back_in_filemanager = G_reader_settings:readSetting("back_in_filemanager")
== "default" return back_in_filemanager == nil or back_in_filemanager == "default"
end, end,
callback = function() callback = function()
G_reader_settings:saveSetting("back_in_filemanager", "default") G_reader_settings:saveSetting("back_in_filemanager", "default")
@ -228,8 +240,8 @@ if Device:hasKeys() then
end, end,
}, },
}, },
}, }
{ common_settings.enable_back_history = {
text = _("Enable back history"), text = _("Enable back history"),
checked_func = function() checked_func = function()
return G_reader_settings:nilOrTrue("enable_back_history") return G_reader_settings:nilOrTrue("enable_back_history")
@ -237,8 +249,9 @@ if Device:hasKeys() then
callback = function() callback = function()
G_reader_settings:flipNilOrTrue("enable_back_history") G_reader_settings:flipNilOrTrue("enable_back_history")
end, end,
}, }
{ if Device:hasKeys() then
common_settings.invert_page_turn_buttons = {
text = _("Invert page turn buttons"), text = _("Invert page turn buttons"),
checked_func = function() checked_func = function()
return G_reader_settings:isTrue("input_invert_page_turn_keys") return G_reader_settings:isTrue("input_invert_page_turn_keys")
@ -247,10 +260,9 @@ if Device:hasKeys() then
G_reader_settings:flipNilOrFalse("input_invert_page_turn_keys") G_reader_settings:flipNilOrFalse("input_invert_page_turn_keys")
Device:invertButtons() Device:invertButtons()
end, end,
},
}
} }
end end
common_settings.document = { common_settings.document = {
text = _("Document"), text = _("Document"),
sub_item_table = { sub_item_table = {

@ -41,6 +41,13 @@ local order = {
"battery", "battery",
"mass_storage_settings", "mass_storage_settings",
}, },
navigation = {
"back_to_exit",
"back_in_filemanager",
"enable_back_history",
"----------------------------",
"invert_page_turn_buttons",
},
network = { network = {
"network_wifi", "network_wifi",
"network_proxy", "network_proxy",

@ -61,6 +61,13 @@ local order = {
"battery", "battery",
"mass_storage_settings", "mass_storage_settings",
}, },
navigation = {
"back_to_exit",
"back_in_filemanager",
"enable_back_history",
"----------------------------",
"invert_page_turn_buttons",
},
network = { network = {
"network_wifi", "network_wifi",
"network_proxy", "network_proxy",

Loading…
Cancel
Save