[UX] SDL2: set window title (#3784)

This initial implementation only sets the title for FileManager and ReaderUI.

Fixes #3713.
pull/3788/head
Frans de Jonge 6 years ago committed by GitHub
parent 8b9c83a5ed
commit 65a63d244b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 441221ec9ac52863dba9485a657c4694b3c593f8
Subproject commit 3fed4dfae7f1494ee249da424c9251c06f48c770

@ -46,6 +46,7 @@ local Screenshoter = require("ui/widget/screenshoter")
local UIManager = require("ui/uimanager")
local lfs = require("libs/libkoreader-lfs")
local logger = require("logger")
local util = require("util")
local _ = require("gettext")
local Screen = require("device").screen
local T = require("ffi/util").template
@ -187,7 +188,7 @@ function ReaderUI:init()
ui = self
})
end
-- configuable controller
-- configurable controller
if self.document.info.configurable then
-- config panel controller
self:registerModule("config", ReaderConfig:new{
@ -470,6 +471,16 @@ function ReaderUI:doShowReader(file, provider)
covers_fullscreen = true, -- hint for UIManager:_repaint()
document = document,
}
local title = reader.document:getProps().title
if title ~= "" then
Screen:setWindowTitle(title)
else
local _, filename = util.splitFilePathName(file)
Screen:setWindowTitle(filename)
end
UIManager:show(reader)
_running_instance = reader
end

@ -261,6 +261,10 @@ end
function FileChooser:refreshPath()
local itemmatch = nil
local _, folder_name = require("util").splitFilePathName(self.path)
Screen:setWindowTitle(folder_name)
if self.focused_path then
itemmatch = {path = self.focused_path}
-- We use focused_path only once, but remember it
@ -268,15 +272,18 @@ function FileChooser:refreshPath()
self.prev_focused_path = self.focused_path
self.focused_path = nil
end
self:switchItemTable(nil, self:genItemTableFromPath(self.path), self.path_items[self.path], itemmatch)
end
function FileChooser:changeToPath(path, focused_path)
path = util.realpath(path)
self.path = path
if focused_path then
self.focused_path = focused_path
end
self:refreshPath()
self:onPathChanged(path)
end

Loading…
Cancel
Save