mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Replace checkboxes with radio buttons where appropriate (#14431)
This commit is contained in:
@@ -951,6 +951,7 @@ function FileManagerMenu:getSortingMenuTable()
|
||||
callback = function()
|
||||
self.ui:onSetSortBy(k)
|
||||
end,
|
||||
radio = true,
|
||||
})
|
||||
end
|
||||
table.sort(sub_item_table, function(a, b) return a.menu_order < b.menu_order end)
|
||||
@@ -981,6 +982,7 @@ function FileManagerMenu:getStartWithMenuTable()
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("start_with", v[2])
|
||||
end,
|
||||
radio = true,
|
||||
})
|
||||
end
|
||||
return {
|
||||
|
||||
@@ -127,6 +127,7 @@ function ReaderFont:setupFaceMenuTable()
|
||||
hold_callback = function(touchmenu_instance)
|
||||
self:makeDefault(v, is_monospace, touchmenu_instance)
|
||||
end,
|
||||
radio = true,
|
||||
checked_func = function()
|
||||
return v == self.font_face
|
||||
end,
|
||||
@@ -577,6 +578,7 @@ Enabling this will ignore such font names and make sure your preferred family fo
|
||||
self:updateFontFamilyFonts()
|
||||
if touchmenu_instance then touchmenu_instance:updateItems() end
|
||||
end,
|
||||
radio = true,
|
||||
checked_func = function()
|
||||
if self.font_family_fonts[family_tag] == false then
|
||||
return true
|
||||
@@ -644,6 +646,7 @@ Enabling this will ignore such font names and make sure your preferred family fo
|
||||
self:updateFontFamilyFonts()
|
||||
if touchmenu_instance then touchmenu_instance:updateItems() end
|
||||
end,
|
||||
radio = true,
|
||||
checked_func = function()
|
||||
if self.font_family_fonts[family_tag] then
|
||||
return self.font_family_fonts[family_tag] == v
|
||||
|
||||
@@ -1211,6 +1211,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return not self.settings.progress_style_thin
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.settings.progress_style_thin = nil
|
||||
local bar_height = self.settings.progress_style_thick_height
|
||||
@@ -1224,6 +1225,7 @@ function ReaderFooter:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return self.settings.progress_style_thin
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.settings.progress_style_thin = true
|
||||
local bar_height = self.settings.progress_style_thin_height
|
||||
@@ -1762,6 +1764,7 @@ function ReaderFooter:genProgressBarPositionMenuItems(value)
|
||||
checked_func = function()
|
||||
return self.settings.progress_bar_position == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
if value == "alongside" then
|
||||
-- Text alignment is disabled in this mode
|
||||
@@ -1787,6 +1790,7 @@ function ReaderFooter:genProgressBarChapterMarkerWidthMenuItems(value)
|
||||
checked_func = function()
|
||||
return self.settings.toc_markers_width == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.settings.toc_markers_width = value -- unscaled_size_check: ignore
|
||||
self:setTocMarkers()
|
||||
@@ -1820,6 +1824,7 @@ function ReaderFooter:genProgressPercentageFormatMenuItems(value)
|
||||
checked_func = function()
|
||||
return self.settings.progress_pct_format == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.settings.progress_pct_format = value
|
||||
self:refreshFooter(true)
|
||||
@@ -1847,6 +1852,7 @@ function ReaderFooter:genItemSymbolsMenuItems(value)
|
||||
checked_func = function()
|
||||
return self.settings.item_prefix == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.settings.item_prefix = value
|
||||
if self.settings.items_separator == "none" then
|
||||
@@ -1872,6 +1878,7 @@ function ReaderFooter:genItemSeparatorMenuItems(value)
|
||||
checked_func = function()
|
||||
return self.settings.items_separator == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.settings.items_separator = value
|
||||
self.separator_width = nil
|
||||
@@ -1923,6 +1930,7 @@ function ReaderFooter:genAlignmentMenuItems(value)
|
||||
checked_func = function()
|
||||
return self.settings.align == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self.settings.align = value
|
||||
self:refreshFooter(true)
|
||||
|
||||
@@ -732,6 +732,7 @@ If you wish your highlights to be saved in the document, just move it to a writa
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("highlight_dialog_position", "center") == v[2]
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("highlight_dialog_position", v[2])
|
||||
end,
|
||||
|
||||
@@ -130,6 +130,7 @@ function ReaderWikipedia:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting(setting, default) == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting(setting, value)
|
||||
end,
|
||||
|
||||
@@ -1001,6 +1001,7 @@ function Dispatcher:addSubMenu(caller, menu, location, settings)
|
||||
return location[settings] ~= nil and Dispatcher:_itemsCount(location[settings]) == 0
|
||||
end,
|
||||
check_callback_updates_menu = true,
|
||||
radio = true,
|
||||
callback = function(touchmenu_instance)
|
||||
local function do_remove()
|
||||
local actions = location[settings]
|
||||
|
||||
@@ -400,13 +400,13 @@ local back_to_exit_str = {
|
||||
always = {_("Always"), _("always")},
|
||||
disable ={_("Disable"), _("disable")},
|
||||
}
|
||||
local function genGenericMenuEntry(title, setting, value, default, radiomark)
|
||||
local function genGenericMenuEntry(title, setting, value, default)
|
||||
return {
|
||||
text = title,
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting(setting, default) == value
|
||||
end,
|
||||
radio = radiomark,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting(setting, value)
|
||||
end,
|
||||
@@ -443,6 +443,7 @@ common_settings.back_in_filemanager = {
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_in_filemanager", "default") == "default"
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_in_filemanager", "default")
|
||||
end,
|
||||
@@ -475,6 +476,7 @@ common_settings.back_in_reader = {
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_in_reader") == "default"
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_in_reader", "default")
|
||||
end,
|
||||
@@ -560,6 +562,7 @@ local function genAutoSaveMenuItem(value)
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting(setting_name) == value
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting(setting_name, value)
|
||||
end,
|
||||
@@ -699,10 +702,10 @@ common_settings.document_end_action = {
|
||||
end,
|
||||
separator = true,
|
||||
},
|
||||
genGenericMenuEntry(_("Ask with popup dialog"), "end_document_action", "pop-up", "pop-up", true),
|
||||
genGenericMenuEntry(_("Do nothing"), "end_document_action", "nothing", nil, true),
|
||||
genGenericMenuEntry(_("Book status"), "end_document_action", "book_status", nil, true),
|
||||
genGenericMenuEntry(_("Delete file"), "end_document_action", "delete_file", nil, true),
|
||||
genGenericMenuEntry(_("Ask with popup dialog"), "end_document_action", "pop-up", "pop-up"),
|
||||
genGenericMenuEntry(_("Do nothing"), "end_document_action", "nothing", nil),
|
||||
genGenericMenuEntry(_("Book status"), "end_document_action", "book_status", nil),
|
||||
genGenericMenuEntry(_("Delete file"), "end_document_action", "delete_file", nil),
|
||||
{
|
||||
text = _("Open next file"),
|
||||
enabled_func = function()
|
||||
@@ -717,10 +720,10 @@ common_settings.document_end_action = {
|
||||
G_reader_settings:saveSetting("end_document_action", "next_file")
|
||||
end,
|
||||
},
|
||||
genGenericMenuEntry(_("Go to beginning"), "end_document_action", "goto_beginning", nil, true),
|
||||
genGenericMenuEntry(_("Return to file browser"), "end_document_action", "file_browser", nil, true),
|
||||
genGenericMenuEntry(_("Mark book as finished"), "end_document_action", "mark_read", nil, true),
|
||||
genGenericMenuEntry(_("Book status and return to file browser"), "end_document_action", "book_status_file_browser", nil, true),
|
||||
genGenericMenuEntry(_("Go to beginning"), "end_document_action", "goto_beginning", nil),
|
||||
genGenericMenuEntry(_("Return to file browser"), "end_document_action", "file_browser", nil),
|
||||
genGenericMenuEntry(_("Mark book as finished"), "end_document_action", "mark_read", nil),
|
||||
genGenericMenuEntry(_("Book status and return to file browser"), "end_document_action", "book_status_file_browser", nil),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,9 +759,9 @@ common_settings.units = {
|
||||
end,
|
||||
separator = true,
|
||||
},
|
||||
genGenericMenuEntry(_("Metric system"), "dimension_units", "mm", nil, true),
|
||||
genGenericMenuEntry(_("Imperial system"), "dimension_units", "in", nil, true),
|
||||
genGenericMenuEntry(_("Pixels"), "dimension_units", "px", nil, true),
|
||||
genGenericMenuEntry(_("Metric system"), "dimension_units", "mm", nil),
|
||||
genGenericMenuEntry(_("Imperial system"), "dimension_units", "in", nil),
|
||||
genGenericMenuEntry(_("Pixels"), "dimension_units", "px", nil),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ local function genTapZonesMenu(tap_zones_type)
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("page_turns_tap_zones", "default") == tap_zones_type
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("page_turns_tap_zones", tap_zones_type)
|
||||
ReaderUI.instance.view:setupTouchZones()
|
||||
|
||||
@@ -55,6 +55,7 @@ return {
|
||||
text = dpi_auto and T(_("Auto DPI (%1)"), dpi_auto) or _("Auto DPI"),
|
||||
help_text = _("The DPI of your screen is automatically detected so items can be drawn with the right amount of pixels. This will usually display at (roughly) the same size on different devices, while remaining sharp. Increasing the DPI setting will result in larger text and icons, while a lower DPI setting will look smaller on the screen."),
|
||||
checked_func = isAutoDPI,
|
||||
radio = true,
|
||||
callback = function() setDPI() end
|
||||
},
|
||||
{
|
||||
@@ -64,6 +65,7 @@ return {
|
||||
local _dpi, _custom = dpi(), custom()
|
||||
return _dpi and _dpi <= 140 and _dpi ~= _custom
|
||||
end,
|
||||
radio = true,
|
||||
callback = function() setDPI(dpi_small) end
|
||||
},
|
||||
{
|
||||
@@ -73,6 +75,7 @@ return {
|
||||
local _dpi, _custom = dpi(), custom()
|
||||
return _dpi and _dpi > 140 and _dpi <= 200 and _dpi ~= _custom
|
||||
end,
|
||||
radio = true,
|
||||
callback = function() setDPI(dpi_medium) end
|
||||
},
|
||||
{
|
||||
@@ -82,6 +85,7 @@ return {
|
||||
local _dpi, _custom = dpi(), custom()
|
||||
return _dpi and _dpi > 200 and _dpi <= 280 and _dpi ~= _custom
|
||||
end,
|
||||
radio = true,
|
||||
callback = function() setDPI(dpi_large) end
|
||||
},
|
||||
{
|
||||
@@ -91,6 +95,7 @@ return {
|
||||
local _dpi, _custom = dpi(), custom()
|
||||
return _dpi and _dpi > 280 and _dpi <= 400 and _dpi ~= _custom
|
||||
end,
|
||||
radio = true,
|
||||
callback = function() setDPI(dpi_xlarge) end
|
||||
},
|
||||
{
|
||||
@@ -100,6 +105,7 @@ return {
|
||||
local _dpi, _custom = dpi(), custom()
|
||||
return _dpi and _dpi > 400 and _dpi <= 560 and _dpi ~= _custom
|
||||
end,
|
||||
radio = true,
|
||||
callback = function() setDPI(dpi_xxlarge) end
|
||||
},
|
||||
{
|
||||
@@ -109,6 +115,7 @@ return {
|
||||
local _dpi, _custom = dpi(), custom()
|
||||
return _dpi and _dpi > 560 and _dpi ~= _custom
|
||||
end,
|
||||
radio = true,
|
||||
callback = function() setDPI(dpi_xxxlarge) end
|
||||
},
|
||||
{
|
||||
@@ -125,6 +132,7 @@ return {
|
||||
local _dpi, _custom = dpi(), custom()
|
||||
return _custom and _dpi == _custom
|
||||
end,
|
||||
radio = true,
|
||||
callback = function(touchmenu_instance)
|
||||
if custom() then
|
||||
setDPI(custom() or dpi_auto)
|
||||
|
||||
@@ -105,6 +105,7 @@ function Language:genLanguageSubItem(lang_locale)
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("language") == lang_locale
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self:changeLanguage(lang_locale)
|
||||
end
|
||||
|
||||
@@ -965,6 +965,7 @@ function NetworkMgr:getBeforeWifiActionMenuTable()
|
||||
checked_func = function()
|
||||
return wifi_enable_action_setting == wifi_enable_action
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
wifi_enable_action_setting = wifi_enable_action
|
||||
G_reader_settings:saveSetting("wifi_enable_action", wifi_enable_action)
|
||||
@@ -1003,6 +1004,7 @@ function NetworkMgr:getAfterWifiActionMenuTable()
|
||||
checked_func = function()
|
||||
return wifi_disable_action_setting == wifi_disable_action
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
wifi_disable_action_setting = wifi_disable_action
|
||||
G_reader_settings:saveSetting("wifi_disable_action", wifi_disable_action)
|
||||
|
||||
@@ -354,6 +354,7 @@ function Translator:genSettingsMenu()
|
||||
checked_func = function()
|
||||
return lang_key == (G_reader_settings:readSetting(setting_name) or default_checked_item)
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting(setting_name, lang_key)
|
||||
end,
|
||||
|
||||
@@ -294,6 +294,7 @@ function Calibre:getWirelessMenuTable()
|
||||
checked_func = function()
|
||||
return G_reader_settings:hasNot("calibre_wireless_url")
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
G_reader_settings:delSetting("calibre_wireless_url")
|
||||
end,
|
||||
@@ -304,6 +305,7 @@ function Calibre:getWirelessMenuTable()
|
||||
return G_reader_settings:has("calibre_wireless_url")
|
||||
end,
|
||||
check_callback_updates_menu = true,
|
||||
radio = true,
|
||||
callback = function(touchmenu_instance)
|
||||
local MultiInputDialog = require("ui/widget/multiinputdialog")
|
||||
local url_dialog
|
||||
@@ -393,6 +395,7 @@ function Calibre:getWirelessMenuTable()
|
||||
end
|
||||
return false
|
||||
end
|
||||
submenu[i+1].radio = true
|
||||
submenu[i+1].callback = function()
|
||||
if type(v) == "string" and v ~= CalibreExtensions.default_output then
|
||||
CalibreExtensions.default_output = v
|
||||
|
||||
@@ -112,6 +112,7 @@ function CoverBrowser:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return mode == curr_display_modes["filemanager"]
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
self:setDisplayMode(mode)
|
||||
end,
|
||||
@@ -121,6 +122,7 @@ function CoverBrowser:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return mode == curr_display_modes["history"]
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
CoverBrowser.setupWidgetDisplayMode("history", mode)
|
||||
end,
|
||||
@@ -130,6 +132,7 @@ function CoverBrowser:addToMainMenu(menu_items)
|
||||
checked_func = function()
|
||||
return mode == curr_display_modes["collections"]
|
||||
end,
|
||||
radio = true,
|
||||
callback = function()
|
||||
CoverBrowser.setupWidgetDisplayMode("collections", mode)
|
||||
end,
|
||||
|
||||
@@ -299,6 +299,7 @@ function Gestures:genMenu(ges)
|
||||
return util.tableEquals(self.gestures[ges], self.defaults[ges])
|
||||
end,
|
||||
check_callback_updates_menu = true,
|
||||
radio = true,
|
||||
callback = function(touchmenu_instance)
|
||||
local function do_remove()
|
||||
self.gestures[ges] = util.tableDeepCopy(self.defaults[ges])
|
||||
@@ -316,6 +317,7 @@ function Gestures:genMenu(ges)
|
||||
return self.gestures[ges] == nil
|
||||
end,
|
||||
check_callback_updates_menu = true,
|
||||
radio = true,
|
||||
callback = function(touchmenu_instance)
|
||||
local function do_remove()
|
||||
self.gestures[ges] = nil
|
||||
|
||||
@@ -196,6 +196,7 @@ function HotKeys:genMenu(hotkey)
|
||||
return util.tableEquals(self.hotkeys[hotkey], self.defaults[hotkey])
|
||||
end,
|
||||
check_callback_updates_menu = true,
|
||||
radio = true,
|
||||
callback = function(touchmenu_instance)
|
||||
local function do_remove()
|
||||
self.hotkeys[hotkey] = util.tableDeepCopy(self.defaults[hotkey])
|
||||
@@ -212,6 +213,7 @@ function HotKeys:genMenu(hotkey)
|
||||
return self.hotkeys[hotkey] == nil or next(self.hotkeys[hotkey]) == nil
|
||||
end,
|
||||
check_callback_updates_menu = true,
|
||||
radio = true,
|
||||
callback = function(touchmenu_instance)
|
||||
local function do_remove()
|
||||
self.hotkeys[hotkey] = nil
|
||||
|
||||
@@ -1116,21 +1116,25 @@ The max value ensures a page you stay on for a long time (because you fell aslee
|
||||
{ -- Friday (Bangladesh and Maldives)
|
||||
text = datetime.shortDayOfWeekToLongTranslation[datetime.weekDays[6]],
|
||||
checked_func = function() return self.settings.calendar_start_day_of_week == 6 end,
|
||||
radio = true,
|
||||
callback = function() self.settings.calendar_start_day_of_week = 6 end
|
||||
},
|
||||
{ -- Saturday (some Middle East countries)
|
||||
text = datetime.shortDayOfWeekToLongTranslation[datetime.weekDays[7]],
|
||||
checked_func = function() return self.settings.calendar_start_day_of_week == 7 end,
|
||||
radio = true,
|
||||
callback = function() self.settings.calendar_start_day_of_week = 7 end
|
||||
},
|
||||
{ -- Sunday
|
||||
text = datetime.shortDayOfWeekToLongTranslation[datetime.weekDays[1]],
|
||||
checked_func = function() return self.settings.calendar_start_day_of_week == 1 end,
|
||||
radio = true,
|
||||
callback = function() self.settings.calendar_start_day_of_week = 1 end
|
||||
},
|
||||
{ -- Monday
|
||||
text = datetime.shortDayOfWeekToLongTranslation[datetime.weekDays[2]],
|
||||
checked_func = function() return self.settings.calendar_start_day_of_week == 2 end,
|
||||
radio = true,
|
||||
callback = function() self.settings.calendar_start_day_of_week = 2 end
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user