2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

Misc: Review pass on the previous commits

* Unbreak the Device test
* Rename a few things
* Tweak a few comments
This commit is contained in:
NiLuJe 2023-08-12 03:15:11 +02:00
parent d52d537479
commit be05af284b
9 changed files with 25 additions and 21 deletions

View File

@ -464,9 +464,9 @@ To:
self.menu_items[id] = common_setting self.menu_items[id] = common_setting
end end
-- settings > Navigation; this mostly concerns platform-specific features or physical keys, and applies *everywhere* -- Settings > Navigation; this mostly concerns physical keys, and applies *everywhere*
if Device:hasKeys() then if Device:hasKeys() then
self.menu_items.platform_navigation_features = require("ui/elements/platform_navigation") self.menu_items.physical_buttons_setup = require("ui/elements/physical_buttons")
end end
-- settings tab - Document submenu -- settings tab - Document submenu

View File

@ -240,9 +240,9 @@ function ReaderMenu:setUpdateItemTable()
-- Mostly concern about touch related page turn stuff, which only applies to Reader; ends up in Taps & Gestures -- Mostly concern about touch related page turn stuff, which only applies to Reader; ends up in Taps & Gestures
self.menu_items.page_turns = require("ui/elements/page_turns") self.menu_items.page_turns = require("ui/elements/page_turns")
end end
-- While also related to page turns, this mostly concerns platform-specific features or physical keys, and applies *everywhere* -- Settings > Navigation; while also related to page turns, this mostly concerns physical keys, and applies *everywhere*
if Device:hasKeys() then if Device:hasKeys() then
self.menu_items.platform_navigation_features = require("ui/elements/platform_navigation") self.menu_items.physical_buttons_setup = require("ui/elements/physical_buttons")
end end
-- insert DjVu render mode submenu just before the last entry (show advanced) -- insert DjVu render mode submenu just before the last entry (show advanced)
-- this is a bit of a hack -- this is a bit of a hack

View File

@ -319,13 +319,13 @@ end
function DeviceListener:onToggleKeyRepeat(toggle) function DeviceListener:onToggleKeyRepeat(toggle)
if toggle == true then if toggle == true then
G_reader_settings:makeFalse("input_no_key_repeats") G_reader_settings:makeFalse("input_no_key_repeat")
elseif toggle == false then elseif toggle == false then
G_reader_settings:makeTrue("input_no_key_repeats") G_reader_settings:makeTrue("input_no_key_repeat")
else else
G_reader_settings:flipNilOrFalse("input_no_key_repeats") G_reader_settings:flipNilOrFalse("input_no_key_repeat")
end end
Device:toggleKeyRepeat(G_reader_settings:nilOrFalse("input_no_key_repeats")) Device:toggleKeyRepeat(G_reader_settings:nilOrFalse("input_no_key_repeat"))
end end
function DeviceListener:onRestart() function DeviceListener:onRestart()

View File

@ -525,9 +525,11 @@ function Device:enableCPUCores(amount) end
function Device:getKeyRepeat() end function Device:getKeyRepeat() end
-- Device specific method to disable key repeat -- Device specific method to disable key repeat
function Device:disableKeyRepeat() end function Device:disableKeyRepeat() end
-- Device specific method to restore key repeat -- Device specific method to restore the initial key repeat config
function Device:restoreKeyRepeat() end function Device:restoreKeyRepeat() end
-- Device specific method to toggle key repeat (between off and a hard-coded delay/period combo) -- NOTE: This one is for the user-facing toggle, it *ignores* the stock delay/period combo,
-- opting instead for a hard-coded one (as we can't guarantee that key repeat is actually setup properly or at all).
-- Device specific method to toggle key repeat
function Device:toggleKeyRepeat(toggle) end function Device:toggleKeyRepeat(toggle) end
--[[ --[[

View File

@ -890,8 +890,8 @@ function Kobo:init()
self.hasIRGridSysfsKnob = "/sys/devices/platform/imx-i2c.1/i2c-1/1-0050/neocmd" self.hasIRGridSysfsKnob = "/sys/devices/platform/imx-i2c.1/i2c-1/1-0050/neocmd"
end end
-- Disable key repeats if requested -- Disable key repeat if requested
if G_reader_settings:isTrue("input_no_key_repeats") then if G_reader_settings:isTrue("input_no_key_repeat") then
self:toggleKeyRepeat(false) self:toggleKeyRepeat(false)
end end
@ -901,7 +901,7 @@ function Kobo:init()
end end
function Kobo:exit() function Kobo:exit()
-- Re-enable key repeats on exit, that's the default state -- Re-enable key repeat on exit, that's the default state
self:toggleKeyRepeat(true) self:toggleKeyRepeat(true)
Generic.exit(self) Generic.exit(self)

View File

@ -70,7 +70,7 @@ local order = {
"back_in_reader", "back_in_reader",
"backspace_as_back", "backspace_as_back",
"----------------------------", "----------------------------",
"platform_navigation_features", "physical_buttons_setup",
"----------------------------", "----------------------------",
"android_volume_keys", "android_volume_keys",
"android_haptic_feedback", "android_haptic_feedback",

View File

@ -4,8 +4,8 @@ local UIManager = require("ui/uimanager")
local _ = require("gettext") local _ = require("gettext")
-- This whole menu is hidden behind a hasKeys device cap. -- This whole menu is hidden behind a hasKeys device cap.
local PlatformNav = { local PhysicalButtons = {
text = _("Page turn behavior"), -- Mainly so as to differentiate w/ "Page Turns" when in readermenu... text = _("Physical buttons"), -- Mainly so as to differentiate w/ "Page Turns" when in readermenu...
sub_item_table = { sub_item_table = {
{ {
text = _("Invert page turn buttons"), text = _("Invert page turn buttons"),
@ -20,11 +20,11 @@ local PlatformNav = {
} }
if Device:canKeyRepeat() then if Device:canKeyRepeat() then
table.insert(PlatformNav.sub_item_table, { table.insert(PhysicalButtons.sub_item_table, {
text = _("Disable key repeats"), text = _("Disable key repeat"),
help_text = _("Useful if you don't like the behavior or if your device has faulty switches"), help_text = _("Useful if you don't like the behavior or if your device has faulty switches"),
checked_func = function() checked_func = function()
return G_reader_settings:isTrue("input_no_key_repeats") return G_reader_settings:isTrue("input_no_key_repeat")
end, end,
callback = function() callback = function()
UIManager:broadcastEvent(Event:new("ToggleKeyRepeat")) UIManager:broadcastEvent(Event:new("ToggleKeyRepeat"))
@ -33,4 +33,4 @@ if Device:canKeyRepeat() then
}) })
end end
return PlatformNav return PhysicalButtons

View File

@ -114,7 +114,7 @@ local order = {
"back_in_reader", "back_in_reader",
"backspace_as_back", "backspace_as_back",
"----------------------------", "----------------------------",
"platform_navigation_features", "physical_buttons_setup",
"----------------------------", "----------------------------",
"android_volume_keys", "android_volume_keys",
"android_haptic_feedback", "android_haptic_feedback",

View File

@ -25,6 +25,8 @@ describe("device module", function()
scaleBySize = fb.scaleBySize, scaleBySize = fb.scaleBySize,
setWindowTitle = function() end, setWindowTitle = function() end,
refreshFull = function() end, refreshFull = function() end,
getHWNightmode = function() return false end,
setupDithering = function() end,
} }
end end
} }