Merge pull request #1091 from chrox/fix_1016

add user defined event map
This commit is contained in:
Qingping Hou
2014-11-06 03:37:13 -05:00
2 changed files with 35 additions and 27 deletions

View File

@@ -126,6 +126,15 @@ function Input:init()
self.event_map[10001] = "OutOfSS" -- go out of screen saver
self.event_map[10020] = "Charging"
self.event_map[10021] = "NotCharging"
-- user custom event map
local ok, custom_event_map = pcall(dofile, "custom.event.map.lua")
if ok then
DEBUG("custom event map", custom_event_map)
for key, value in pairs(custom_event_map) do
self.event_map[key] = value
end
end
end
--[[

View File

@@ -17,8 +17,6 @@ end
local DocSettings = require("docsettings")
local _ = require("gettext")
local util = require("ffi/util")
-- read settings and check for language override
-- has to be done before requiring other files because
-- they might call gettext on load
@@ -28,31 +26,6 @@ if lang_locale then
_.changeLang(lang_locale)
end
local lfs = require("libs/libkoreader-lfs")
local UIManager = require("ui/uimanager")
local Device = require("device")
local Screen = require("device").screen
local input = require("ffi/input")
local DEBUG = require("dbg")
local Profiler = nil
local function exitReader()
local ReaderActivityIndicator = require("apps/reader/modules/readeractivityindicator")
G_reader_settings:close()
-- Close lipc handles
ReaderActivityIndicator:coda()
-- shutdown hardware abstraction
Device:exit()
if Profiler then Profiler.stop() end
os.exit(0)
end
-- option parsing:
local longopts = {
debug = "d",
@@ -78,6 +51,11 @@ local function showusage()
return
end
-- should check DEBUG option in arg and turn on DEBUG before loading other
-- modules, otherwise DEBUG in some modules may not be printed.
local DEBUG = require("dbg")
local Profiler = nil
local ARGV = arg
local argidx = 1
while argidx <= #ARGV do
@@ -104,6 +82,12 @@ while argidx <= #ARGV do
end
end
local lfs = require("libs/libkoreader-lfs")
local UIManager = require("ui/uimanager")
local Device = require("device")
local Screen = require("device").screen
local Font = require("ui/font")
-- read some global reader setting here:
-- font
local fontmap = G_reader_settings:readSetting("fontmap")
@@ -160,4 +144,19 @@ else
return showusage()
end
local function exitReader()
local ReaderActivityIndicator = require("apps/reader/modules/readeractivityindicator")
G_reader_settings:close()
-- Close lipc handles
ReaderActivityIndicator:coda()
-- shutdown hardware abstraction
Device:exit()
if Profiler then Profiler.stop() end
os.exit(0)
end
exitReader()