Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few minor fixes after #4847 #4850

Merged
merged 10 commits into from Mar 29, 2019
23 changes: 23 additions & 0 deletions frontend/apps/filemanager/filemanagermenu.lua
Expand Up @@ -260,6 +260,29 @@ function FileManagerMenu:setUpdateItemTable()
end,
callback = function()
G_reader_settings:flipNilOrFalse("dev_startup_no_fbdepth")
local InfoMessage = require("ui/widget/infomessage")
UIManager:show(InfoMessage:new{
text = _("This will take effect on next restart."),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well write something more specific, like The new bit depth will take effect after restarting KOReader. or KOReader will need to restart to enable the new bit depth.

Copy link
Member

@Frenzie Frenzie Mar 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incidentally, I've been thinking that messages of this type could also consider using a ConfirmBox or something instead, with the cancel/OK buttons reading Restart later and Restart now.

Edit: although that might be slightly more problematic with platforms where restarting can only be manual. Just a generic thinking aloud, nothing to fix before merging. ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mainly went with that generic wording because it's already used elsewhere, so, already translated ;).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. On the flipside, the previous translation will show up as an xx % match so it can be more easily adapted than starting from scratch. Since it's a more advanced config section I suppose we should just leave it then. :-)

})
end,
})
end
if not Device.should_restrict_JIT then
table.insert(self.menu_items.developer_options.sub_item_table, {
text = _("Disable C blitter"),
enabled_func = function()
local lfs = require("libs/libkoreader-lfs")
return lfs.attributes("libs/libblitbuffer.so", "mode") == "file"
end,
checked_func = function()
return G_reader_settings:isTrue("dev_no_c_blitter")
end,
callback = function()
G_reader_settings:flipNilOrFalse("dev_no_c_blitter")
local InfoMessage = require("ui/widget/infomessage")
UIManager:show(InfoMessage:new{
text = _("This will take effect on next restart."),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Something like The new blitter will take effect after restarting KOReader. or KOReader will need to restart to enable the new blitter.

})
end,
})
end
Expand Down
20 changes: 16 additions & 4 deletions frontend/apps/reader/modules/readerfooter.lua
Expand Up @@ -560,16 +560,19 @@ end

-- only call this function after document is fully loaded
function ReaderFooter:_updateFooterText(force_repaint)
self.footer_text:setText(self:genFooterText())
local text = self:genFooterText()
if text then
self.footer_text:setText(self:genFooterText())
end
if self.settings.disable_progress_bar then
if self.has_no_mode then
if self.has_no_mode or not text then
self.text_width = 0
else
self.text_width = self.footer_text:getSize().w
end
self.progress_bar.width = 0
else
if self.has_no_mode then
if self.has_no_mode or not text then
self.text_width = 0
else
self.text_width = self.footer_text:getSize().w + self.text_left_margin
Expand Down Expand Up @@ -637,7 +640,16 @@ function ReaderFooter:applyFooterMode(mode)
-- 10 for wifi status
if mode ~= nil then self.mode = mode end
self.view.footer_visible = (self.mode ~= MODE.off)
if not self.view.footer_visible or self.settings.all_at_once then return end

-- If all-at-once is enabled, just hide, but the text will keep being processed...
if self.settings.all_at_once then
return
end
-- We're not in all-at-once mode, disable text generation entirely when we're hidden
if not self.view.footer_visible then
self.genFooterText = footerTextGeneratorMap.empty
return
end

local mode_name = MODE_INDEX[self.mode]
if not self.settings[mode_name] or self.has_no_mode then
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/fixedtextwidget.lua
Expand Up @@ -10,7 +10,7 @@ local FixedTextWidget = TextWidget:new{}

function FixedTextWidget:getSize()
local tsize = RenderText:sizeUtf8Text(0, Screen:getWidth(), self.face, self.text, true, self.bold)
if not tsize then
if tsize.x == 0 then
return Geom:new{}
end
self._length = tsize.x
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/textwidget.lua
Expand Up @@ -43,7 +43,7 @@ local TextWidget = Widget:new{

function TextWidget:updateSize()
local tsize = RenderText:sizeUtf8Text(0, self.max_width and self.max_width or Screen:getWidth(), self.face, self.text, true, self.bold)
if not tsize then
if tsize.x == 0 then
self._length = 0
else
-- As text length includes last glyph pen "advance" (for positionning
Expand Down
7 changes: 2 additions & 5 deletions platform/android/llapp_main.lua
Expand Up @@ -3,11 +3,8 @@ A.dl.library_path = A.dl.library_path .. ":" .. A.dir .. "/libs"
A.log_name = 'KOReader'

local ffi = require("ffi")
local dummy = require("ffi/posix_h")
local C = ffi.C
ffi.cdef[[
char *getenv(const char *name);
int putenv(const char *envvar);
]]

-- check uri of the intent that starts this application
local file = A.getIntent()
Expand All @@ -26,7 +23,7 @@ A.execute("chmod", "755", "./tar")
A.execute("chmod", "755", "./zsync")

-- set TESSDATA_PREFIX env var
C.putenv("TESSDATA_PREFIX=/sdcard/koreader/data")
C.setenv("TESSDATA_PREFIX", "/sdcard/koreader/data", 1)

-- create fake command-line arguments
arg = {"-d", file or "/sdcard"}
Expand Down
2 changes: 1 addition & 1 deletion platform/kobo/nickel.sh
Expand Up @@ -9,7 +9,7 @@ export LD_LIBRARY_PATH="/usr/local/Kobo"
# Reset PWD, and clear up our own custom stuff from the env while we're there, otherwise, USBMS may become very wonky on newer FW...
# shellcheck disable=SC2164
cd /
unset OLDPWD EXT_FONT_DIR TESSDATA_PREFIX FROM_NICKEL STARDICT_DATA_DIR LC_ALL
unset OLDPWD EXT_FONT_DIR TESSDATA_PREFIX FROM_NICKEL STARDICT_DATA_DIR LC_ALL KO_NO_CBB

# Ensures fmon will restart. Note that we don't have to worry about reaping this, nickel kills on-animator.sh on start.
(
Expand Down
18 changes: 18 additions & 0 deletions reader.lua
Expand Up @@ -34,6 +34,24 @@ if lang_locale then
_.changeLang(lang_locale)
end

-- Make the C blitter optional (ffi/blitbuffer.lua will check that env var)
local ffi = require("ffi")
local dummy = require("ffi/posix_h")
local C = ffi.C
if G_reader_settings:isTrue("dev_no_c_blitter") then
if ffi.os == "Windows" then
C._putenv("KO_NO_CBB=true")
else
C.setenv("KO_NO_CBB", "true", 1)
end
else
if ffi.os == "Windows" then
C._putenv("KO_NO_CBB=false")
else
C.unsetenv("KO_NO_CBB")
end
end

local Device = require("device")
local dpi_override = G_reader_settings:readSetting("screen_dpi")
if dpi_override ~= nil then
Expand Down
9 changes: 3 additions & 6 deletions setupkoenv.lua
Expand Up @@ -8,13 +8,10 @@ package.cpath =

-- set search path for 'ffi.load()'
local ffi = require("ffi")
ffi.cdef[[
char *getenv(const char *name);
int putenv(const char *envvar);
int _putenv(const char *envvar);
]]
local dummy = require("ffi/posix_h")
local C = ffi.C
if ffi.os == "Windows" then
ffi.C._putenv("PATH=libs;common;")
C._putenv("PATH=libs;common;")
end
local ffi_load = ffi.load
-- patch ffi.load for thirdparty luajit libraries
Expand Down