Merge pull request #1473 from chrox/swipe_go_back

Add option to disable swipe to go back and various other fixes
pull/1483/head v2015.04.07-nightly
Qingping Hou 9 years ago
commit ded6b89f4c

@ -70,6 +70,7 @@ To get and compile the source you must have `patch`, `wget`, `unzip`, `git`, `au
`subversion` and `cmake` installed, as well as a version of `autoconf` greater than 2.64. `subversion` and `cmake` installed, as well as a version of `autoconf` greater than 2.64.
You also need `nasm` and of course a compiler like `gcc` or `clang`. If you want to You also need `nasm` and of course a compiler like `gcc` or `clang`. If you want to
cross-compile for other architectures, you need a proper cross-compile toolchain. cross-compile for other architectures, you need a proper cross-compile toolchain.
Your GCC should be at least of version 4.7 for both native and cross compiling.
Users of Debian and Ubuntu can install the required packages using: Users of Debian and Ubuntu can install the required packages using:
``` ```

@ -54,17 +54,42 @@ function ReaderLink:initGesListener()
end end
end end
local function is_follow_links_on()
return G_reader_settings:readSetting("follow_links") ~= false
end
local function swipe_to_go_back()
return G_reader_settings:readSetting("swipe_to_go_back") ~= false
end
function ReaderLink:addToMainMenu(tab_item_table) function ReaderLink:addToMainMenu(tab_item_table)
-- insert table to main reader menu -- insert table to main reader menu
table.insert(tab_item_table.navi, { table.insert(tab_item_table.navi, {
text = _("Follow links"), text = _("Follow links"),
checked_func = function() sub_item_table = {
return G_reader_settings:readSetting("follow_links") == true {
end, text_func = function()
callback = function() return is_follow_links_on() and _("Disable") or _("Enable")
local follow_links = G_reader_settings:readSetting("follow_links") end,
G_reader_settings:saveSetting("follow_links", not follow_links) callback = function()
end G_reader_settings:saveSetting("follow_links",
not is_follow_links_on())
end
},
{
text = _("Go back"),
enabled_func = function() return #self.link_states > 0 end,
callback = function() self:onGoBackLink() end,
},
{
text = _("Swipe to go back"),
checked_func = function() return swipe_to_go_back() end,
callback = function()
G_reader_settings:saveSetting("swipe_to_go_back",
not swipe_to_go_back())
end,
},
}
}) })
end end
@ -76,7 +101,7 @@ function ReaderLink:onSetDimensions(dimen)
end end
function ReaderLink:onTap(arg, ges) function ReaderLink:onTap(arg, ges)
if G_reader_settings:readSetting("follow_links") ~= true then return end if not is_follow_links_on() then return end
if self.ui.document.info.has_pages then if self.ui.document.info.has_pages then
local pos = self.view:screenToPageTransform(ges.pos) local pos = self.view:screenToPageTransform(ges.pos)
if pos then if pos then
@ -115,21 +140,18 @@ function ReaderLink:onGotoLink(link)
return true return true
end end
function ReaderLink:onGoBackLink()
local last_page_or_xp = table.remove(self.link_states)
if last_page_or_xp then
local event = self.ui.document.info.has_pages and "GotoPage" or "GotoXPointer"
self.ui:handleEvent(Event:new(event, last_page_or_xp))
return true
end
end
function ReaderLink:onSwipe(arg, ges) function ReaderLink:onSwipe(arg, ges)
if ges.direction == "east" then if ges.direction == "east" and swipe_to_go_back() then
if self.ui.document.info.has_pages then return self:onGoBackLink()
local last_page = table.remove(self.link_states)
if last_page then
self.ui:handleEvent(Event:new("GotoPage", last_page))
return true
end
else
local last_xp = table.remove(self.link_states)
if last_xp then
self.ui:handleEvent(Event:new("GotoXPointer", last_xp))
return true
end
end
end end
end end

@ -2,8 +2,8 @@ Installation instructions for Kobo:
Newer installation based on Start Menu: Newer installation based on Start Menu:
- Install "Start Menu" (http://www.mobileread.com/forums/showthread.php?t=233259) - Install "Start Menu" (http://www.mobileread.com/forums/showthread.php?t=255978)
- Extract the koreader folder of the zip into the ".kobo" directory (both KoboRoot.tgz and the koreader.png file are only needed for the older installation based on Filemonitor. See below.). - Extract the koreader folder of the zip into the ".adds" directory (both KoboRoot.tgz and the koreader.png file are only needed for the older installation based on Filemonitor. See below.).
Select koreader from the Start Menu to start. Select koreader from the Start Menu to start.
@ -11,7 +11,7 @@ Select koreader from the Start Menu to start.
Older installation based on Filemonitor: Older installation based on Filemonitor:
- Put the image included in the zip (called "koreader.png") in the main folder of your kobo and disconnect it from your computer. Open the image on the reader, go back to the home and then, just to be extra-safe, reboot it. - Put the image included in the zip (called "koreader.png") in the main folder of your kobo and disconnect it from your computer. Open the image on the reader, go back to the home and then, just to be extra-safe, reboot it.
- Install "Files Monitor" (http://www.mobileread.com/forums/showthread.php?t=218283). - Install "Files Monitor" (http://www.mobileread.com/forums/showthread.php?t=218283).
- Extract the remaining content of the zip into the ".kobo" directory (both KoboRoot.tgz and the koreader folder). - Extract the remaining content of the zip into the ".kobo" directory (both KoboRoot.tgz and the koreader folder).
Selecting the KOReader icon in your home, you will be able to launch KOReader. Simple enough, isn't it? Just be sure to process the image properly (follow those steps carefully) if it's the first time you install koreader, if you made a factory reset or if you deleted it in some way, otherwise you could end up launching koreader automatically at every boot, being unable to exit it without a factory reset. Selecting the KOReader icon in your home, you will be able to launch KOReader. Simple enough, isn't it? Just be sure to process the image properly (follow those steps carefully) if it's the first time you install koreader, if you made a factory reset or if you deleted it in some way, otherwise you could end up launching koreader automatically at every boot, being unable to exit it without a factory reset.

Loading…
Cancel
Save