Conflicts:
	koreader_kobo.sh
pull/204/head
Paulo Matias 11 years ago
commit 667378d64a

@ -10,6 +10,7 @@ VERSION=$(shell git describe HEAD)
# subdirectory we use to build the installation bundle
INSTALL_DIR=koreader
INSTALL_DIR_KOBO=mnt/onboard/.kobo/koreader
# subdirectory we use to setup emulation environment
EMU_DIR=emu
@ -90,6 +91,40 @@ customupdate: all
rm -rf $(INSTALL_DIR)
# @TODO write an installation script for KUAL (houqp)
koboupdate: all
# ensure that the binaries were built for ARM
file $(KOR_BASE)/koreader-base | grep ARM || exit 1
file $(KOR_BASE)/extr | grep ARM || exit 1
# remove old package and dir if any
rm -f koreader-kobo-$(VERSION).zip
rm -rf $(INSTALL_DIR_KOBO)
# create new dir for package
mkdir -p $(INSTALL_DIR_KOBO)/{history,screenshots,clipboard,libs}
cp -p README.md COPYING $(KOR_BASE)/{koreader-base,extr,sdcv} koreader.sh koreader_kobo.sh $(LUA_FILES) $(INSTALL_DIR_KOBO)
$(STRIP) --strip-unneeded $(INSTALL_DIR_KOBO)/koreader-base $(INSTALL_DIR_KOBO)/extr $(INSTALL_DIR_KOBO)/sdcv
mkdir $(INSTALL_DIR_KOBO)/data $(INSTALL_DIR_KOBO)/data/dict $(INSTALL_DIR_KOBO)/data/tessdata
cp -L koreader-base/$(DJVULIB) $(KOR_BASE)/$(CRELIB) \
$(KOR_BASE)/$(LUALIB) $(KOR_BASE)/$(K2PDFOPTLIB) \
$(KOR_BASE)/$(LEPTONICALIB) $(KOR_BASE)/$(TESSERACTLIB) \
$(INSTALL_DIR_KOBO)/libs
$(STRIP) --strip-unneeded $(INSTALL_DIR_KOBO)/libs/*
cp -rpL $(KOR_BASE)/data/*.css $(INSTALL_DIR_KOBO)/data
cp -rpL $(KOR_BASE)/data/hyph $(INSTALL_DIR_KOBO)/data/hyph
cp -rpL $(KOR_BASE)/fonts $(INSTALL_DIR_KOBO)
cp -rp $(MO_DIR) $(INSTALL_DIR_KOBO)
rm $(INSTALL_DIR_KOBO)/fonts/droid/DroidSansFallbackFull.ttf
echo $(VERSION) > git-rev
cp -r git-rev resources $(INSTALL_DIR_KOBO)
rm -r $(INSTALL_DIR_KOBO)/resources/fonts
cp -rpL frontend $(INSTALL_DIR_KOBO)
cp defaults.lua $(INSTALL_DIR_KOBO)
mkdir $(INSTALL_DIR_KOBO)/fonts/host
cp -rpL fmon $(INSTALL_DIR_KOBO)/..
cp -p resources/koreader.png $(INSTALL_DIR_KOBO)/../..
tar -zcvf KoboRoot.tgz mnt/
zip -9 -r koreader-kobo-$(VERSION).zip KoboRoot.tgz
rm KoboRoot.tgz
rm -rf mnt/
pot:
$(XGETTEXT_BIN) reader.lua `find frontend -iname "*.lua"` \

@ -0,0 +1 @@
$root/.kobo/fmon/fmon $root/koreader.png $root/.kobo/koreader/koreader_kobo.sh &

@ -105,6 +105,13 @@ function Device:isTouchDevice()
return (self.model == "KindlePaperWhite") or (self.model == "KindleTouch") or self:isKobo() or util.isEmulated()
end
function Device:hasFrontlight()
if not self.model then
self.model = self:getModel()
end
return (self.model == "KindlePaperWhite") or (self.model == "Kobo_dragon") or (self.model == "Kobo_kraken") or (self.model == "Kobo_phoenix") or util.isEmulated()
end
function Device:setTouchInputDev(dev)
self.touch_dev = dev
end

@ -1,7 +1,10 @@
require "ui/widget/container"
require "ui/widget/inputdialog"
require "ui/device"
ReaderFrontLight = InputContainer:new{
fldial_menu_title = ("Frontlight Settings"),
fl_dialog_title = ("Frontlight Level"),
steps = {0,1,2,3,4,5,6,7,8,9,10},
intensity = nil,
fl = nil,
@ -31,7 +34,11 @@ function ReaderFrontLight:init()
end
if Device:isKobo() then
self.fl = kobolight.open()
self.intensity = 20
self.intensity = G_reader_settings:readSetting("frontlight_intensity")
if not self.intensity then
self.intensity = 20
end
self:setIntensity(self.intensity, "Set intensity")
end
end
@ -54,7 +61,7 @@ function ReaderFrontLight:onAdjust(arg, ges)
end
function ReaderFrontLight:setIntensity(intensity, msg)
if self.lipc_handle then
if self.lipc_handle then
intensity = intensity < 0 and 0 or intensity
intensity = intensity > 24 and 24 or intensity
self.intensity = intensity
@ -65,6 +72,8 @@ function ReaderFrontLight:setIntensity(intensity, msg)
})
end
if Device:isKobo() then
intensity = intensity < 1 and 1 or intensity
intensity = intensity > 100 and 100 or intensity
if self.fl == nil then
ReaderFrontLight:init()
end
@ -87,3 +96,60 @@ function ReaderFrontLight:toggle()
end
return true
end
function ReaderFrontLight:addToMainMenu(tab_item_table)
-- insert fldial command to main reader menu
table.insert(tab_item_table.main, {
text = self.fldial_menu_title,
callback = function()
self:onShowFlDialog()
end,
})
end
function ReaderFrontLight:onShowFlDialog()
DEBUG("show fldial dialog")
self.fl_dialog = InputDialog:new{
title = self.fl_dialog_title,
input_hint = "(1 - 100)",
buttons = {
{
{
text = _("Apply"),
enabled = true,
callback = function()
self:fldialIntensity()
end,
},
{
text = _("OK"),
enabled = true,
callback = function()
self:fldialIntensity()
self:close()
end,
},
},
},
input_type = "number",
width = Screen:getWidth() * 0.8,
height = Screen:getHeight() * 0.2,
}
self.fl_dialog:onShowKeyboard()
UIManager:show(self.fl_dialog)
end
function ReaderFrontLight:close()
self.fl_dialog:onClose()
G_reader_settings:saveSetting("frontlight_intensity", self.intensity)
UIManager:close(self.fl_dialog)
end
function ReaderFrontLight:fldialIntensity()
local number = tonumber(self.fl_dialog:getInputText())
if number then
self:setIntensity(number, "Set intensity")
end
return true
end

@ -56,7 +56,14 @@ function ReaderMenu:setUpdateItemTable()
for _, widget in pairs(self.registered_widgets) do
widget:addToMainMenu(self.tab_item_table)
end
if Device:hasFrontlight() then
table.insert(self.tab_item_table.main, {
text = _("Frontlight settings"),
callback = function()
ReaderFrontLight:onShowFlDialog()
end
})
end
table.insert(self.tab_item_table.main, {
text = _("Help"),
callback = function()

@ -129,14 +129,14 @@ function ReaderUI:init()
view = self[1],
ui = self
}
table.insert(self.active_widgets, reader_ss)
-- frontlight controller
local reader_fl = ReaderFrontLight:new{
dialog = self.dialog,
view = self[1],
ui = self
}
table.insert(self.active_widgets, reader_ss)
table.insert(self.active_widgets, reader_fl)
table.insert(self, reader_fl)
if self.document.info.has_pages then
-- for page specific controller

@ -1,6 +1,7 @@
require "ui/widget/container"
require "ui/widget/focusmanager"
require "ui/widget/infomessage"
require "ui/widget/frontlight"
require "ui/widget/button"
require "ui/widget/text"
require "ui/widget/group"

@ -1 +1 @@
Subproject commit 698fb1764ffc0eafbd5cdb2dcc6d8165cca8d8f0
Subproject commit b5625d48e91016b9ac33bf15c9d662d7bcb17bcd

@ -14,7 +14,7 @@ export STARDICT_DATA_DIR="data/dict"
killall nickel
# finally call reader
./reader.lua /mnt/onboard 2> crash.log
./reader.lua /mnt/onboard 2> crash.log
# continue with nickel

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Loading…
Cancel
Save