mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
37
reader.lua
37
reader.lua
@@ -8,12 +8,13 @@ require "ui/readerui"
|
||||
require "document/document"
|
||||
require "settings"
|
||||
require "dbg"
|
||||
require "gettext"
|
||||
|
||||
|
||||
HomeMenu = InputContainer:new{
|
||||
item_table = {},
|
||||
key_events = {
|
||||
TapShowMenu = { {"Home"}, doc = "Show Home Menu"},
|
||||
TapShowMenu = { {_("Home")}, doc = _("Show Home Menu")},
|
||||
},
|
||||
ges_events = {
|
||||
TapShowMenu = {
|
||||
@@ -44,14 +45,14 @@ function exitReader()
|
||||
local dev = Device:getTouchInputDev()
|
||||
if dev then
|
||||
local width, height = Screen:getWidth(), Screen:getHeight()
|
||||
input.fakeTapInput(dev,
|
||||
input.fakeTapInput(dev,
|
||||
math.min(width, height)/2,
|
||||
math.max(width, height)-30
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
@@ -78,12 +79,12 @@ function HomeMenu:setUpdateItemTable()
|
||||
})
|
||||
end
|
||||
table.insert(self.item_table, {
|
||||
text = "Last documents",
|
||||
text = _("Last documents"),
|
||||
sub_item_table = hist_sub_item_table,
|
||||
})
|
||||
|
||||
table.insert(self.item_table, {
|
||||
text = "Exit",
|
||||
text = _("Exit"),
|
||||
callback = function()
|
||||
exitReader()
|
||||
end
|
||||
@@ -101,7 +102,7 @@ function HomeMenu:onTapShowMenu()
|
||||
|
||||
local home_menu = Menu:new{
|
||||
show_parent = menu_container,
|
||||
title = "Home menu",
|
||||
title = _("Home menu"),
|
||||
item_table = self.item_table,
|
||||
width = Screen:getWidth() - 100,
|
||||
}
|
||||
@@ -121,7 +122,9 @@ end
|
||||
function showReader(file, pass)
|
||||
local document = DocumentRegistry:openDocument(file)
|
||||
if not document then
|
||||
UIManager:show(InfoMessage:new{ text = "No reader engine for this file" })
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("No reader engine for this file")
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
@@ -143,7 +146,7 @@ function showHomePage(path)
|
||||
|
||||
local FileManager = FileChooser:new{
|
||||
show_parent = HomePage,
|
||||
title = "FileManager",
|
||||
title = _("FileManager"),
|
||||
path = path,
|
||||
width = Screen:getWidth(),
|
||||
height = Screen:getHeight(),
|
||||
@@ -188,19 +191,19 @@ longopts = {
|
||||
}
|
||||
|
||||
function showusage()
|
||||
print("usage: ./reader.lua [OPTION] ... path")
|
||||
print("Read all the books on your E-Ink reader")
|
||||
print(_("usage: ./reader.lua [OPTION] ... path"))
|
||||
print(_("Read all the books on your E-Ink reader"))
|
||||
print("")
|
||||
print("-d start in debug mode")
|
||||
print("-h show this usage help")
|
||||
print(_("-d start in debug mode"))
|
||||
print(_("-h show this usage help"))
|
||||
print("")
|
||||
print("If you give the name of a directory instead of a file path, a file")
|
||||
print("chooser will show up and let you select a file")
|
||||
print(_("If you give the name of a directory instead of a file path, a file"))
|
||||
print(_("chooser will show up and let you select a file"))
|
||||
print("")
|
||||
print("If you don't pass any path, the last viewed document will be opened")
|
||||
print(_("If you don't pass any path, the last viewed document will be opened"))
|
||||
print("")
|
||||
print("This software is licensed under the GPLv3.")
|
||||
print("See http://github.com/koreader/kindlepdfviewer for more info.")
|
||||
print(_("This software is licensed under the GPLv3."))
|
||||
print(_("See http://github.com/koreader/kindlepdfviewer for more info."))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user