DoubleSpinWidget, SpinWidget: add units, make usage more consistent (#9046)

This commit is contained in:
zwim
2022-05-24 00:25:50 +02:00
committed by GitHub
parent 13274d6212
commit d5d5867d4e
18 changed files with 184 additions and 75 deletions

View File

@@ -630,14 +630,14 @@ function ReaderFooter:set_custom_text(touchmenu_instance)
title = "Enter a custom text",
fields = {
{
text = self.custom_text or "",
text = self.custom_text or "",
description = _("Custom string:"),
input_type = "string",
},
{
text = self.custom_text_repetitions,
description =_("Number of repetitions:"),
input_type = "number",
input_type = "number",
},
},
buttons = {
@@ -1198,7 +1198,7 @@ function ReaderFooter:addToMainMenu(menu_items)
value_max = 36,
default_value = 14,
ok_text = _("Set size"),
title_text = _("Footer font size"),
title_text = _("Footer font size"),
keep_shown_on_apply = true,
callback = function(spin)
self.settings.text_font_size = spin.value
@@ -1251,7 +1251,7 @@ function ReaderFooter:addToMainMenu(menu_items)
value_max = 98,
default_value = DMINIBAR_CONTAINER_HEIGHT,
ok_text = _("Set height"),
title_text = _("Container height"),
title_text = _("Container height"),
keep_shown_on_apply = true,
callback = function(spin)
self.settings.container_height = spin.value
@@ -1277,7 +1277,7 @@ function ReaderFooter:addToMainMenu(menu_items)
value_max = 49,
default_value = 1,
ok_text = _("Set margin"),
title_text = _("Container bottom margin"),
title_text = _("Container bottom margin"),
keep_shown_on_apply = true,
callback = function(spin)
self.settings.container_bottom_padding = spin.value
@@ -1295,7 +1295,7 @@ function ReaderFooter:addToMainMenu(menu_items)
sub_item_table = {
{
text_func = function()
return T(_("Book title: %1%"), self.settings.book_title_max_width_pct)
return T(_("Book title: %1 %"), self.settings.book_title_max_width_pct)
end,
callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget")
@@ -1305,7 +1305,8 @@ function ReaderFooter:addToMainMenu(menu_items)
value_step = 5,
value_hold_step = 20,
value_max = 100,
title_text = _("Maximum width"),
unit = "%",
title_text = _("Maximum width"),
info_text = _("Maximum book title width in percentage of screen width"),
keep_shown_on_apply = true,
callback = function(spin)
@@ -1320,7 +1321,7 @@ function ReaderFooter:addToMainMenu(menu_items)
},
{
text_func = function()
return T(_("Current chapter: %1%"), self.settings.book_chapter_max_width_pct)
return T(_("Current chapter: %1 %"), self.settings.book_chapter_max_width_pct)
end,
callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget")
@@ -1330,7 +1331,8 @@ function ReaderFooter:addToMainMenu(menu_items)
value_step = 5,
value_hold_step = 20,
value_max = 100,
title_text = _("Maximum width"),
unit = "%",
title_text = _("Maximum width"),
info_text = _("Maximum chapter width in percentage of screen width"),
keep_shown_on_apply = true,
callback = function(spin)
@@ -1572,7 +1574,7 @@ With this enabled, the current page is included, so the count goes from n to 1 i
table.insert(sub_items[settings_submenu_num].sub_item_table, 4, {
text_func = function()
if self.settings.battery_hide_threshold <= (Device:hasAuxBattery() and 200 or 100) then
return T(_("Hide battery status if level higher than: %1%"), self.settings.battery_hide_threshold)
return T(_("Hide battery status if level higher than: %1 %"), self.settings.battery_hide_threshold)
else
return _("Hide battery status")
end
@@ -1591,8 +1593,9 @@ With this enabled, the current page is included, so the count goes from n to 1 i
value_min = 0,
value_max = Device:hasAuxBattery() and 200 or 100,
default_value = Device:hasAuxBattery() and 200 or 100,
unit = "%",
value_hold_step = 10,
title_text = _("Hide battery threshold"),
title_text = _("Hide battery threshold"),
callback = function(spin)
self.settings.battery_hide_threshold = spin.value
self:refreshFooter(true, true)
@@ -1747,7 +1750,7 @@ With this enabled, the current page is included, so the count goes from n to 1 i
value_hold_step = 2,
value_max = value_max,
default_value = default_value,
title_text = _("Progress bar size"),
title_text = _("Progress bar size"),
keep_shown_on_apply = true,
callback = function(spin)
if self.settings.progress_style_thin then
@@ -1907,7 +1910,7 @@ With this enabled, the current page is included, so the count goes from n to 1 i
},
{
text_func = function()
return T(_("Minimal width: %1%"), self.settings.progress_bar_min_width_pct)
return T(_("Minimal width: %1 %"), self.settings.progress_bar_min_width_pct)
end,
enabled_func = function()
return self.settings.progress_bar_position == "alongside" and not self.settings.disable_progress_bar
@@ -1921,7 +1924,8 @@ With this enabled, the current page is included, so the count goes from n to 1 i
value_step = 5,
value_hold_step = 20,
value_max = 50,
title_text = _("Minimal width"),
unit = "%",
title_text = _("Minimal width"),
text = _("Minimal progress bar width in percentage of screen width"),
keep_shown_on_apply = true,
callback = function(spin)