mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
mod: use settings module to save font configuration
This commit is contained in:
13
reader.lua
13
reader.lua
@@ -20,6 +20,7 @@
|
||||
require "alt_getopt"
|
||||
require "pdfreader"
|
||||
require "filechooser"
|
||||
require "settings"
|
||||
|
||||
-- option parsing:
|
||||
longopts = {
|
||||
@@ -82,6 +83,14 @@ end
|
||||
fb = einkfb.open("/dev/fb0")
|
||||
width, height = fb:getSize()
|
||||
|
||||
-- set up reader's setting: font
|
||||
reader_settings = DocSettings:open(".reader")
|
||||
r_cfont = reader_settings:readsetting("cfont")
|
||||
if r_cfont ~=nil then
|
||||
FontChooser.cfont = r_cfont
|
||||
end
|
||||
|
||||
|
||||
if lfs.attributes(ARGV[optind], "mode") == "directory" then
|
||||
local running = true
|
||||
FileChooser:setPath(ARGV[optind])
|
||||
@@ -102,5 +111,9 @@ else
|
||||
PDFReader:inputloop()
|
||||
end
|
||||
|
||||
-- save reader settings
|
||||
reader_settings:savesetting("cfont", FontChooser.cfont)
|
||||
reader_settings:close()
|
||||
|
||||
input.closeAll()
|
||||
os.execute('test -e /proc/keypad && echo "send '..KEY_HOME..'" > /proc/keypad ')
|
||||
|
||||
Reference in New Issue
Block a user