mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Profiles: add "on rotation" auto-execute event (#12612)
This commit is contained in:
@@ -90,11 +90,11 @@ local CreOptions = {
|
||||
end
|
||||
end,
|
||||
-- For Dispatcher & onMakeDefault's sake
|
||||
labels = {C_("Rotation", "⤹ 90°"), C_("Rotation", "↑ 0°"), C_("Rotation", "⤸ 90°"), C_("Rotation", "↓ 180°")},
|
||||
labels = optionsutil.rotation_labels,
|
||||
alternate = false,
|
||||
values = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
values = optionsutil.rotation_modes,
|
||||
default_value = Screen.DEVICE_ROTATED_UPRIGHT,
|
||||
args = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
args = optionsutil.rotation_modes,
|
||||
current_func = function() return Screen:getRotationMode() end,
|
||||
event = "SetRotationMode",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
|
||||
@@ -76,11 +76,11 @@ local KoptOptions = {
|
||||
end
|
||||
end,
|
||||
-- For Dispatcher & onMakeDefault's sake
|
||||
labels = {C_("Rotation", "⤹ 90°"), C_("Rotation", "↑ 0°"), C_("Rotation", "⤸ 90°"), C_("Rotation", "↓ 180°")},
|
||||
labels = optionsutil.rotation_labels,
|
||||
alternate = false,
|
||||
values = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
values = optionsutil.rotation_modes,
|
||||
default_value = Screen.DEVICE_ROTATED_UPRIGHT,
|
||||
args = {Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, Screen.DEVICE_ROTATED_UPRIGHT, Screen.DEVICE_ROTATED_CLOCKWISE, Screen.DEVICE_ROTATED_UPSIDE_DOWN},
|
||||
args = optionsutil.rotation_modes,
|
||||
current_func = function() return Screen:getRotationMode() end,
|
||||
event = "SetRotationMode",
|
||||
name_text_hold_callback = optionsutil.showValues,
|
||||
|
||||
@@ -11,7 +11,20 @@ local T = require("ffi/util").template
|
||||
local logger = require("logger")
|
||||
local Screen = Device.screen
|
||||
|
||||
local optionsutil = {}
|
||||
local optionsutil = {
|
||||
rotation_labels = {
|
||||
C_("Rotation", "⤹ 90°"),
|
||||
C_("Rotation", "↑ 0°"),
|
||||
C_("Rotation", "⤸ 90°"),
|
||||
C_("Rotation", "↓ 180°"),
|
||||
},
|
||||
rotation_modes = {
|
||||
Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE, -- 3
|
||||
Screen.DEVICE_ROTATED_UPRIGHT, -- 0
|
||||
Screen.DEVICE_ROTATED_CLOCKWISE, -- 1
|
||||
Screen.DEVICE_ROTATED_UPSIDE_DOWN, -- 2
|
||||
},
|
||||
}
|
||||
|
||||
function optionsutil.enableIfEquals(configurable, option, value)
|
||||
return configurable[option] == value
|
||||
|
||||
Reference in New Issue
Block a user