mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Footer: add Warmth as footer item (#8060)
This commit is contained in:
@@ -43,6 +43,7 @@ local MODE = {
|
||||
book_chapter = 13,
|
||||
bookmark_count = 14,
|
||||
chapter_progress = 15,
|
||||
frontlight_warmth = 16,
|
||||
}
|
||||
|
||||
local symbol_prefix = {
|
||||
@@ -62,6 +63,8 @@ local symbol_prefix = {
|
||||
chapter_time_to_read = C_("FooterLetterPrefix", "TC:"),
|
||||
-- @translators This is the footer letter prefix for frontlight level.
|
||||
frontlight = C_("FooterLetterPrefix", "L:"),
|
||||
-- @translators This is the footer letter prefix for frontlight warmth (redshift).
|
||||
frontlight_warmth = C_("FooterLetterPrefix", "R:"),
|
||||
-- @translators This is the footer letter prefix for memory usage.
|
||||
mem_usage = C_("FooterLetterPrefix", "M:"),
|
||||
-- @translators This is the footer letter prefix for Wi-Fi status.
|
||||
@@ -77,6 +80,7 @@ local symbol_prefix = {
|
||||
book_time_to_read = "⏳",
|
||||
chapter_time_to_read = BD.mirroredUILayout() and "⥖" or "⤻",
|
||||
frontlight = "☼",
|
||||
frontlight_warmth = "💡",
|
||||
mem_usage = "",
|
||||
wifi_status = "",
|
||||
wifi_status_off = "",
|
||||
@@ -144,6 +148,23 @@ local footerTextGeneratorMap = {
|
||||
end
|
||||
end
|
||||
end,
|
||||
frontlight_warmth = function(footer)
|
||||
local symbol_type = footer.settings.item_prefix
|
||||
local prefix = symbol_prefix[symbol_type].frontlight_warmth
|
||||
local powerd = Device:getPowerDevice()
|
||||
if powerd:isFrontlightOn() then
|
||||
local warmth = powerd:getWarmth()
|
||||
if warmth then
|
||||
return (prefix .. " %d%%"):format(warmth)
|
||||
end
|
||||
else
|
||||
if footer.settings.all_at_once and footer.settings.hide_empty_generators then
|
||||
return ""
|
||||
else
|
||||
return T(_("%1 Off"), prefix)
|
||||
end
|
||||
end
|
||||
end,
|
||||
battery = function(footer)
|
||||
local symbol_type = footer.settings.item_prefix
|
||||
local prefix = symbol_prefix[symbol_type].battery
|
||||
@@ -869,6 +890,7 @@ function ReaderFooter:textOptionTitles(option)
|
||||
and T(_("Book time to read (%1)"),symbol_prefix[symbol].book_time_to_read) or _("Book time to read"),
|
||||
chapter_time_to_read = T(_("Chapter time to read (%1)"), symbol_prefix[symbol].chapter_time_to_read),
|
||||
frontlight = T(_("Frontlight level (%1)"), symbol_prefix[symbol].frontlight),
|
||||
frontlight_warmth = T(_("Frontlight warmth (%1)"), symbol_prefix[symbol].frontlight_warmth),
|
||||
mem_usage = T(_("KOReader memory usage (%1)"), symbol_prefix[symbol].mem_usage),
|
||||
wifi_status = T(_("Wi-Fi status (%1)"), symbol_prefix[symbol].wifi_status),
|
||||
book_title = _("Book title"),
|
||||
@@ -1788,6 +1810,9 @@ With this enabled, the current page is included, so the count goes from n to 1 i
|
||||
if Device:hasFrontlight() then
|
||||
table.insert(sub_items, getMinibarOption("frontlight"))
|
||||
end
|
||||
if Device:hasNaturalLight() then
|
||||
table.insert(sub_items, getMinibarOption("frontlight_warmth"))
|
||||
end
|
||||
table.insert(sub_items, getMinibarOption("mem_usage"))
|
||||
if Device:hasFastWifiStatusQuery() then
|
||||
table.insert(sub_items, getMinibarOption("wifi_status"))
|
||||
|
||||
Reference in New Issue
Block a user