Status bar sort items: dim inactive items (#13682)
Some checks failed
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Has been cancelled
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Has been cancelled

This commit is contained in:
hius07
2025-04-26 19:56:23 +03:00
committed by GitHub
parent 043588cfbd
commit 48d50f76cf
2 changed files with 16 additions and 16 deletions

View File

@@ -1375,47 +1375,45 @@ function ReaderFooter:addToMainMenu(menu_items)
-- configure footer_items
table.insert(sub_items, {
separator = true,
text = _("Configure items"),
separator = true,
sub_item_table = {
{
text = _("Arrange items in status bar"),
separator = true,
keep_menu_open = true,
enabled_func = function()
-- count enabled items
local enabled_count = 0
for _, m in ipairs(self.mode_index) do
if self.settings[m] then
enabled_count = enabled_count + 1
if enabled_count > 1 then
break
if enabled_count == 1 then
return true
end
enabled_count = enabled_count + 1
end
end
return enabled_count > 1
return false
end,
callback = function()
local item_table = {}
for i=1, #self.mode_index do
table.insert(item_table, {text = self:textOptionTitles(self.mode_index[i]), label = self.mode_index[i]})
for i, item in ipairs(self.mode_index) do
item_table[i] = { text = self:textOptionTitles(item), label = item, dim = not self.settings[item] }
end
local SortWidget = require("ui/widget/sortwidget")
local sort_item
sort_item = SortWidget:new{
UIManager:show(SortWidget:new{
title = _("Arrange items"),
height = Screen:getHeight() - self:getHeight() - Size.padding.large,
item_table = item_table,
callback = function()
for i=1, #sort_item.item_table do
self.mode_index[i] = sort_item.item_table[i].label
for i, item in ipairs(item_table) do
self.mode_index[i] = item.label
end
self.settings.order = self.mode_index
self:updateFooterTextGenerator()
self:onUpdateFooter()
self:onUpdateFooter(true)
UIManager:setDirty(nil, "ui")
end
}
UIManager:show(sort_item)
end,
})
end,
},
getMinibarOption("all_at_once", self.updateFooterTextGenerator),

View File

@@ -89,6 +89,7 @@ function SortItemWidget:init()
text = self.item.text,
max_width = text_max_width,
face = self.item.face or self.face,
fgcolor = self.item.dim and Blitbuffer.COLOR_DARK_GRAY or nil,
},
self.show_parent.underscore_checked_item and item_checked and LineWidget:new{
dimen = Geom:new{ w = text_max_width, h = Size.line.thick },
@@ -288,6 +289,7 @@ function SortWidget:init()
local vertical_footer = VerticalGroup:new{
bottom_line,
self.page_info,
self.dimen.h < Screen:getHeight() and bottom_line or nil,
}
local footer = BottomContainer:new{
dimen = self.dimen:copy(),