mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Reorganize menus
* Replace "home" (exit) menu with hamburger * Discard pokeball and put items in hamburger * Introduce search menu in reader Cf. #2562
This commit is contained in:
committed by
Qingping Hou
parent
7fb2dc8d5c
commit
d1785e1863
@@ -20,8 +20,8 @@ function FileManagerHistory:init()
|
||||
end
|
||||
|
||||
function FileManagerHistory:addToMainMenu(tab_item_table)
|
||||
-- insert table to info tab of filemanager menu
|
||||
table.insert(tab_item_table.info, {
|
||||
-- insert table to main tab of filemanager menu
|
||||
table.insert(tab_item_table.main, {
|
||||
text = self.hist_menu_title,
|
||||
callback = function()
|
||||
self:onShowHist()
|
||||
|
||||
@@ -24,31 +24,14 @@ function FileManagerMenu:init()
|
||||
setting = {
|
||||
icon = "resources/icons/appbar.settings.png",
|
||||
},
|
||||
info = {
|
||||
icon = "resources/icons/appbar.pokeball.png",
|
||||
},
|
||||
tools = {
|
||||
icon = "resources/icons/appbar.tools.png",
|
||||
},
|
||||
search = {
|
||||
icon = "resources/icons/appbar.magnify.browse.png",
|
||||
},
|
||||
home = {
|
||||
icon = "resources/icons/appbar.home.png",
|
||||
callback = function()
|
||||
if SetDefaults.settings_changed then
|
||||
SetDefaults.settings_changed = false
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("You have unsaved default settings. Save them now?"),
|
||||
ok_callback = function()
|
||||
SetDefaults:saveSettings()
|
||||
end,
|
||||
})
|
||||
else
|
||||
UIManager:close(self.menu_container)
|
||||
self.ui:onClose()
|
||||
end
|
||||
end,
|
||||
main = {
|
||||
icon = "resources/icons/menu-icon.png",
|
||||
},
|
||||
}
|
||||
-- For backward compatibility, plugins look for plugins tab, which should be tools tab in file
|
||||
@@ -172,28 +155,6 @@ function FileManagerMenu:setUpdateItemTable()
|
||||
table.insert(self.tab_item_table.setting, common_setting)
|
||||
end
|
||||
|
||||
-- info tab
|
||||
-- insert common info
|
||||
table.insert(self.tab_item_table.info, {
|
||||
text = _("Open last document"),
|
||||
callback = function()
|
||||
local last_file = G_reader_settings:readSetting("lastfile")
|
||||
if not last_file or lfs.attributes(last_file, "mode") ~= "file" then
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Cannot open last document"),
|
||||
})
|
||||
return
|
||||
end
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
ReaderUI:showReader(last_file)
|
||||
self:onCloseFileManagerMenu()
|
||||
end
|
||||
})
|
||||
for i, common_setting in ipairs(require("ui/elements/common_info_menu_table")) do
|
||||
table.insert(self.tab_item_table.info, common_setting)
|
||||
end
|
||||
|
||||
-- tools tab
|
||||
table.insert(self.tab_item_table.tools, {
|
||||
text = _("Advanced settings"),
|
||||
@@ -274,13 +235,43 @@ function FileManagerMenu:setUpdateItemTable()
|
||||
end
|
||||
})
|
||||
|
||||
-- home tab
|
||||
table.insert(self.tab_item_table.home, {
|
||||
-- main menu tab
|
||||
-- insert common info
|
||||
table.insert(self.tab_item_table.main, {
|
||||
text = _("Open last document"),
|
||||
callback = function()
|
||||
local last_file = G_reader_settings:readSetting("lastfile")
|
||||
if not last_file or lfs.attributes(last_file, "mode") ~= "file" then
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Cannot open last document"),
|
||||
})
|
||||
return
|
||||
end
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
ReaderUI:showReader(last_file)
|
||||
self:onCloseFileManagerMenu()
|
||||
end
|
||||
})
|
||||
for i, common_setting in ipairs(require("ui/elements/common_info_menu_table")) do
|
||||
table.insert(self.tab_item_table.main, common_setting)
|
||||
end
|
||||
table.insert(self.tab_item_table.main, {
|
||||
text = _("Exit"),
|
||||
callback = function()
|
||||
UIManager:close(self.menu_container)
|
||||
self.ui:onClose()
|
||||
end
|
||||
if SetDefaults.settings_changed then
|
||||
SetDefaults.settings_changed = false
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("You have unsaved default settings. Save them now?"),
|
||||
ok_callback = function()
|
||||
SetDefaults:saveSettings()
|
||||
end,
|
||||
})
|
||||
else
|
||||
UIManager:close(self.menu_container)
|
||||
self.ui:onClose()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -303,10 +294,9 @@ function FileManagerMenu:onShowMenu()
|
||||
last_index = tab_index,
|
||||
tab_item_table = {
|
||||
self.tab_item_table.setting,
|
||||
self.tab_item_table.info,
|
||||
self.tab_item_table.tools,
|
||||
self.tab_item_table.search,
|
||||
self.tab_item_table.home,
|
||||
self.tab_item_table.main,
|
||||
},
|
||||
show_parent = menu_container,
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ function ReaderDictionary:init()
|
||||
end
|
||||
|
||||
function ReaderDictionary:addToMainMenu(tab_item_table)
|
||||
table.insert(tab_item_table.plugins, {
|
||||
table.insert(tab_item_table.search, {
|
||||
text = _("Dictionary lookup"),
|
||||
tap_input = {
|
||||
title = _("Enter a word to look up"),
|
||||
|
||||
@@ -23,12 +23,12 @@ function ReaderMenu:init()
|
||||
setting = {
|
||||
icon = "resources/icons/appbar.settings.png",
|
||||
},
|
||||
info = {
|
||||
icon = "resources/icons/appbar.pokeball.png",
|
||||
},
|
||||
plugins = {
|
||||
icon = "resources/icons/appbar.tools.png",
|
||||
},
|
||||
search = {
|
||||
icon = "resources/icons/appbar.magnify.browse.png",
|
||||
},
|
||||
filemanager = {
|
||||
icon = "resources/icons/appbar.cabinet.files.png",
|
||||
remember = false,
|
||||
@@ -48,17 +48,8 @@ function ReaderMenu:init()
|
||||
end
|
||||
end,
|
||||
},
|
||||
home = {
|
||||
icon = "resources/icons/appbar.home.png",
|
||||
remember = false,
|
||||
callback = function()
|
||||
self:onTapCloseMenu()
|
||||
UIManager:scheduleIn(0.1, function() self.ui:onClose() end)
|
||||
local FileManager = require("apps/filemanager/filemanager")
|
||||
if FileManager.instance then
|
||||
FileManager.instance:onClose()
|
||||
end
|
||||
end,
|
||||
main = {
|
||||
icon = "resources/icons/menu-icon.png",
|
||||
},
|
||||
}
|
||||
self.registered_widgets = {}
|
||||
@@ -114,12 +105,6 @@ function ReaderMenu:setUpdateItemTable()
|
||||
self.view:getRenderModeMenuTable())
|
||||
end
|
||||
|
||||
-- info tab
|
||||
-- insert common info
|
||||
for i, common_setting in ipairs(require("ui/elements/common_info_menu_table")) do
|
||||
table.insert(self.tab_item_table.info, common_setting)
|
||||
end
|
||||
|
||||
if Device:isKobo() and Screensaver:isUsingBookCover() then
|
||||
local excluded = function()
|
||||
return self.ui.doc_settings:readSetting("exclude_screensaver") or false
|
||||
@@ -158,6 +143,25 @@ function ReaderMenu:setUpdateItemTable()
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- main menu tab
|
||||
-- insert common info
|
||||
for i, common_setting in ipairs(require("ui/elements/common_info_menu_table")) do
|
||||
table.insert(self.tab_item_table.main, common_setting)
|
||||
end
|
||||
|
||||
table.insert(self.tab_item_table.main, {
|
||||
text = _("Exit"),
|
||||
callback = function()
|
||||
self:onTapCloseMenu()
|
||||
UIManager:scheduleIn(0.1, function() self.ui:onClose() end)
|
||||
local FileManager = require("apps/filemanager/filemanager")
|
||||
if FileManager.instance then
|
||||
FileManager.instance:onClose()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
function ReaderMenu:onShowReaderMenu()
|
||||
@@ -180,10 +184,10 @@ function ReaderMenu:onShowReaderMenu()
|
||||
self.tab_item_table.navi,
|
||||
self.tab_item_table.typeset,
|
||||
self.tab_item_table.setting,
|
||||
self.tab_item_table.info,
|
||||
self.tab_item_table.plugins,
|
||||
self.tab_item_table.search,
|
||||
self.tab_item_table.filemanager,
|
||||
self.tab_item_table.home,
|
||||
self.tab_item_table.main,
|
||||
},
|
||||
show_parent = menu_container,
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ function ReaderSearch:init()
|
||||
end
|
||||
|
||||
function ReaderSearch:addToMainMenu(tab_item_table)
|
||||
table.insert(tab_item_table.plugins, {
|
||||
table.insert(tab_item_table.search, {
|
||||
text = _("Fulltext search"),
|
||||
tap_input = {
|
||||
title = _("Input text to search for"),
|
||||
|
||||
@@ -33,7 +33,7 @@ function ReaderStatus:init()
|
||||
end
|
||||
|
||||
function ReaderStatus:addToMainMenu(tab_item_table)
|
||||
table.insert(tab_item_table.info, {
|
||||
table.insert(tab_item_table.main, {
|
||||
text = _("Book status"),
|
||||
callback = function()
|
||||
self:showStatus()
|
||||
|
||||
@@ -49,7 +49,7 @@ function ReaderWikipedia:lookupInput()
|
||||
end
|
||||
|
||||
function ReaderWikipedia:addToMainMenu(tab_item_table)
|
||||
table.insert(tab_item_table.plugins, {
|
||||
table.insert(tab_item_table.search, {
|
||||
text = _("Wikipedia lookup"),
|
||||
callback = function()
|
||||
if NetworkMgr:isOnline() then
|
||||
|
||||
@@ -244,6 +244,11 @@ function TouchMenuBar:init()
|
||||
end
|
||||
|
||||
function TouchMenuBar:switchToTab(index)
|
||||
-- a little safety check
|
||||
-- don't auto-activate a non-existent index
|
||||
if index > #self.icon_buttons then
|
||||
index = 1
|
||||
end
|
||||
self.icon_buttons[index].callback()
|
||||
end
|
||||
|
||||
|
||||
BIN
resources/icons/menu-icon.png
Normal file
BIN
resources/icons/menu-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 772 B |
3
resources/icons/src/menu-icon-license.txt
Normal file
3
resources/icons/src/menu-icon-license.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Creative Commons Zero 1.0 Public Domain License
|
||||
|
||||
Based on: https://openclipart.org/detail/221605/hamburger-menu-icon
|
||||
136
resources/icons/src/menu-icon.svg
Normal file
136
resources/icons/src/menu-icon.svg
Normal file
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="64"
|
||||
height="64"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.92.0 r15299"
|
||||
sodipodi:docname="menu-icon.svg"
|
||||
viewBox="0 0 60.000002 60"
|
||||
inkscape:export-filename="/home/frans/src/kobo/koreader/resources/icons/menu-icon.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<title
|
||||
id="title3842">Hamburger (Menu) Icon</title>
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="12.218805"
|
||||
inkscape:cx="19.669545"
|
||||
inkscape:cy="34.938988"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
showborder="true"
|
||||
inkscape:showpageshadow="false"
|
||||
fit-margin-top="5"
|
||||
fit-margin-right="5"
|
||||
fit-margin-bottom="5"
|
||||
fit-margin-left="5"
|
||||
inkscape:window-width="2396"
|
||||
inkscape:window-height="1586"
|
||||
inkscape:window-x="658"
|
||||
inkscape:window-y="347"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Hamburger (Menu) Icon</dc:title>
|
||||
<dc:date>2015-06-29</dc:date>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Daniel Fowler</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>Public Domain</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title>openclipart.org</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:language>en-GB</dc:language>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>icon</rdf:li>
|
||||
<rdf:li>menu</rdf:li>
|
||||
<rdf:li>hamburger</rdf:li>
|
||||
<rdf:li>basic</rdf:li>
|
||||
<rdf:li>simple</rdf:li>
|
||||
<rdf:li>black</rdf:li>
|
||||
<rdf:li>white</rdf:li>
|
||||
<rdf:li>lines</rdf:li>
|
||||
<rdf:li>rounded</rdf:li>
|
||||
<rdf:li>open</rdf:li>
|
||||
<rdf:li>close</rdf:li>
|
||||
<rdf:li>norm</rdf:li>
|
||||
<rdf:li>cox</rdf:li>
|
||||
<rdf:li>star</rdf:li>
|
||||
<rdf:li>xerox</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" />
|
||||
<dc:description>A simple and basic hamburger (menu) icon. It originates from Xerox "Star" workstations of the 1980's but is now popular to hide/show menus on mobile devices.</dc:description>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>Norm Cox</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/publicdomain/zero/1.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(10.015625,-1002.375)">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:7.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
|
||||
d="m -1.496787,1032.375 h 42.962325 v 0"
|
||||
id="path3785-0-9"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:7.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
|
||||
d="M -1.4967861,1017.375 H 41.465537 v 0"
|
||||
id="path3785-0-9-3"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:7.50000012;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
|
||||
d="m -1.496786,1047.375 h 42.962323 v 0"
|
||||
id="path3785-0-9-6"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
Reference in New Issue
Block a user