desktop: disable battery on touch menu and reader footer

isDesktop and isEmulator are now different entities
reviewable/pr6047/r1
Martín Fdez 4 years ago committed by Martín Fernández
parent 2ae796eb2a
commit 8e831eb756

@ -51,7 +51,7 @@ function ReaderFont:init()
end end
-- build face_table for menu -- build face_table for menu
self.face_table = {} self.face_table = {}
if Device:isAndroid() or Device:isDesktop() then if Device:isAndroid() or Device:isDesktop() or Device:isEmulator() then
table.insert(self.face_table, require("ui/elements/font_settings"):getMenuTable()) table.insert(self.face_table, require("ui/elements/font_settings"):getMenuTable())
end end
local face_list = cre.getFontFaces() local face_list = cre.getFontFaces()

@ -336,6 +336,9 @@ function ReaderFooter:init()
if not Device:hasFrontlight() then if not Device:hasFrontlight() then
MODE.frontlight = nil MODE.frontlight = nil
end end
if Device:isDesktop() then
MODE.battery = nil
end
for k, v in pairs(MODE) do for k, v in pairs(MODE) do
mode_tbl[v] = k mode_tbl[v] = k
end end

@ -74,7 +74,6 @@ local Emulator = Device:new{
hasFrontlight = yes, hasFrontlight = yes,
hasWifiToggle = yes, hasWifiToggle = yes,
hasWifiManager = yes, hasWifiManager = yes,
isDesktop = yes,
} }
local Linux = Device:new{ local Linux = Device:new{

@ -38,6 +38,7 @@ function CanvasContext:init(device)
self.screen = device.screen self.screen = device.screen
self.isAndroid = device.isAndroid self.isAndroid = device.isAndroid
self.isDesktop = device.isDesktop self.isDesktop = device.isDesktop
self.isEmulator = device.isEmulator
self.isKindle = device.isKindle self.isKindle = device.isKindle
self.should_restrict_JIT = device.should_restrict_JIT self.should_restrict_JIT = device.should_restrict_JIT
self:setColorRenderingEnabled(device.screen.isColorEnabled()) self:setColorRenderingEnabled(device.screen.isColorEnabled())

@ -84,7 +84,7 @@ local function isInFontsBlacklist(f)
end end
local function getExternalFontDir() local function getExternalFontDir()
if CanvasContext.isAndroid() or CanvasContext.isDesktop() then if CanvasContext.isAndroid() or CanvasContext.isDesktop() or CanvasContext.isEmulator() then
return require("frontend/ui/elements/font_settings"):getPath() return require("frontend/ui/elements/font_settings"):getPath()
else else
return os.getenv("EXT_FONT_DIR") return os.getenv("EXT_FONT_DIR")

@ -26,7 +26,7 @@ end
-- user font path, should be rw. On linux/mac it goes under $HOME. -- user font path, should be rw. On linux/mac it goes under $HOME.
-- on Android it goes in the primary storage (internal/sd) -- on Android it goes in the primary storage (internal/sd)
local function getUserDir() local function getUserDir()
if Device:isDesktop() then if Device:isDesktop() or Device:isEmulator() then
local home = os.getenv("HOME") local home = os.getenv("HOME")
if home then return home..DESKTOP_USER_FONT_DIR end if home then return home..DESKTOP_USER_FONT_DIR end
elseif Device:isAndroid() then elseif Device:isAndroid() then
@ -37,7 +37,7 @@ end
-- system (ttf) fonts are available on linux and android but not on mac -- system (ttf) fonts are available on linux and android but not on mac
local function getSystemDir() local function getSystemDir()
if Device:isDesktop() then if Device:isDesktop() or Device:isEmulator() then
if util.pathExists(LINUX_SYSTEM_FONT_DIR) then if util.pathExists(LINUX_SYSTEM_FONT_DIR) then
return LINUX_SYSTEM_FONT_DIR return LINUX_SYSTEM_FONT_DIR
else return nil end else return nil end
@ -91,7 +91,7 @@ function FontSettings:getMenuTable()
end, end,
}} }}
if Device:isDesktop() then table.insert(t, 2, { if Device:isDesktop() or Device:isEmulator() then table.insert(t, 2, {
text = _("Open fonts folder"), text = _("Open fonts folder"),
keep_menu_open = true, keep_menu_open = true,
callback = openFontDir, callback = openFontDir,

@ -660,7 +660,9 @@ function TouchMenu:updateItems()
batt_symbol = "" batt_symbol = ""
end end
end end
time_info_txt = BD.wrap(time_info_txt) .. " " .. BD.wrap("") .. BD.wrap(batt_symbol) .. BD.wrap(batt_lvl .. "%") if not Device:isDesktop() then
time_info_txt = BD.wrap(time_info_txt) .. " " .. BD.wrap("") .. BD.wrap(batt_symbol) .. BD.wrap(batt_lvl .. "%")
end
self.time_info:setText(time_info_txt) self.time_info:setText(time_info_txt)
-- recalculate dimen based on new layout -- recalculate dimen based on new layout

Loading…
Cancel
Save