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

UI Changes #5508

Merged
merged 41 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
919ce2b
Changed File Browser text
dontcrash Oct 20, 2019
4e5dab7
Changed the File Browser icon in reading mode
dontcrash Oct 20, 2019
08057d3
Remove the "page x of x" if only one page
dontcrash Oct 20, 2019
224a361
Remove the "page x of x" if only one page
dontcrash Oct 20, 2019
bffd512
Renamed ~ to Home
dontcrash Oct 20, 2019
dbaa11b
Added 12 hour time option
dontcrash Oct 20, 2019
e8ab7ff
Rename 12 Hour time to clock
dontcrash Oct 20, 2019
0bffa6e
Bug fix for page numbers
dontcrash Oct 20, 2019
3d9de99
Changed to setText method
dontcrash Oct 20, 2019
1e976c3
Commented code changes
dontcrash Oct 20, 2019
d243867
Revert to previous icon
dontcrash Oct 20, 2019
64f1dac
Added translation to "Home" text
dontcrash Oct 20, 2019
757b161
Changed time seperator
dontcrash Oct 20, 2019
c0cdba6
Change 12 hour clock to 12-hour clock
dontcrash Oct 20, 2019
bcf838d
Added custom home path dialog
dontcrash Oct 20, 2019
73c2b99
Rename page to Page
dontcrash Oct 20, 2019
4f1a157
Grammar
dontcrash Oct 20, 2019
fb850b9
Indentation
dontcrash Oct 20, 2019
220fd9e
Change twelve_hour_time to twelve_hour_clock
dontcrash Oct 21, 2019
a989081
Merge branch 'master' of https://github.com/dontcrash/koreader
dontcrash Oct 21, 2019
e2f37ce
Fixed indentation
dontcrash Oct 21, 2019
7ad1bac
Fixed indentation
dontcrash Oct 21, 2019
650443c
Removed unnecessary comment
dontcrash Oct 21, 2019
3c965cf
Proposed "Home" changes
dontcrash Oct 21, 2019
b1689d9
Remove unused InputDialog import
dontcrash Oct 21, 2019
57e6184
Fixed duplicate import name
dontcrash Oct 21, 2019
7ba3ab6
Rename "page" to "Page" for consistency
dontcrash Oct 21, 2019
e14f4db
Reduce calls to os.date as per poire-z's suggestion
dontcrash Oct 21, 2019
790029b
Reduce chance of desync, style improvement
dontcrash Oct 21, 2019
d40f5df
Change back to _("Home")
dontcrash Oct 21, 2019
42138f6
Removed comments that are unneeded
dontcrash Oct 21, 2019
d21662b
Unneeded comments
dontcrash Oct 21, 2019
a8687e7
Removed variable that was only used once
dontcrash Oct 21, 2019
b715fbc
Remove / from subfolders in home path
dontcrash Oct 21, 2019
a969565
Update touchmenu.lua
dontcrash Oct 21, 2019
a969838
Removed variable that was used only once
dontcrash Oct 21, 2019
2e7692e
Fixed order
dontcrash Oct 21, 2019
babd7da
Merge branch 'master' of https://github.com/dontcrash/koreader
dontcrash Oct 21, 2019
e7d1096
Merge branch 'master' of https://github.com/dontcrash/koreader
dontcrash Oct 21, 2019
447edaf
Moved translators comment to attach to the right line
dontcrash Oct 21, 2019
b420cad
Code optimization, thanks poire-z
dontcrash Oct 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/apps/filemanager/filemanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ local function truncatePath(text)
end

local FileManager = InputContainer:extend{
title = _("KOReader File Browser"),
title = _("KOReader"),
root_path = lfs.currentdir(),
onExit = function() end,

Expand Down
9 changes: 6 additions & 3 deletions frontend/apps/filemanager/filemanagerutil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This module contains miscellaneous helper functions for FileManager
local Device = require("device")
local DocSettings = require("docsettings")
local util = require("ffi/util")
local _ = require("gettext")

local filemanagerutil = {}

Expand All @@ -24,13 +25,15 @@ end

function filemanagerutil.abbreviate(path)
if not path then return "" end
local home_dir_name = G_reader_settings:readSetting("home_dir_display_name")
if home_dir_name ~= nil then
if G_reader_settings:isTrue("shorten_home_dir") then
dontcrash marked this conversation as resolved.
Show resolved Hide resolved
local home_dir = G_reader_settings:readSetting("home_dir") or filemanagerutil.getDefaultDir()
if path == home_dir then
return _("Home")
end
local len = home_dir:len()
local start = path:sub(1, len)
if start == home_dir then
return home_dir_name .. path:sub(len+1)
return path:sub(len+1)
dontcrash marked this conversation as resolved.
Show resolved Hide resolved
end
end
return path
Expand Down
15 changes: 15 additions & 0 deletions frontend/ui/elements/common_settings_menu_table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ if Device:setDateTime() then
common_settings.time = {
text = _("Time and date"),
sub_item_table = {
{
text = _("12-hour clock"),
keep_menu_open = true,
checked_func = function()
return G_reader_settings:isTrue("twelve_hour_clock")
end,
callback = function()
local twelve_hr = G_reader_settings:isTrue("twelve_hour_clock")
dontcrash marked this conversation as resolved.
Show resolved Hide resolved
if G_reader_settings:isTrue("twelve_hour_clock") then
G_reader_settings:flipFalse("twelve_hour_clock")
else
G_reader_settings:flipTrue("twelve_hour_clock")
end
end,
},
{
text = _("Set time"),
keep_menu_open = true,
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/keyvaluepage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ function KeyValuePage:_populateItems()
table.insert(self.main_content,
VerticalSpan:new{ width = self.item_margin })
end
self.page_info_text:setText(T(_("page %1 of %2"), self.show_page, self.pages))
self.page_info_text:setText(T(_("Page %1 of %2"), self.show_page, self.pages))
self.page_info_left_chev:showHide(self.pages > 1)
self.page_info_right_chev:showHide(self.pages > 1)
self.page_info_first_chev:showHide(self.pages > 2)
Expand Down
6 changes: 5 additions & 1 deletion frontend/ui/widget/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,11 @@ function Menu:updatePageInfo(select_number)
self.selected = { x = 1, y = select_number }
end
-- update page information
self.page_info_text:setText(util.template(_("page %1 of %2"), self.page, self.page_num))
if self.page_num > 1 then
self.page_info_text:setText(util.template(_("Page %1 of %2"), self.page, self.page_num))
else
self.page_info_text:setText("");
end
self.page_info_left_chev:showHide(self.page_num > 1)
self.page_info_right_chev:showHide(self.page_num > 1)
self.page_info_first_chev:showHide(self.page_num > 2)
Expand Down
18 changes: 14 additions & 4 deletions frontend/ui/widget/touchmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -594,16 +594,26 @@ function TouchMenu:updateItems()
table.insert(self.item_group, self.footer_top_margin)
table.insert(self.item_group, self.footer)
-- @translators %1 is the current page. %2 is the total number of pages. In some languages a good translation might need to reverse this order, for instance: "Total %2, page %1".
dontcrash marked this conversation as resolved.
Show resolved Hide resolved
self.page_info_text.text = util.template(_("Page %1 of %2"), self.page, self.page_num)
if self.page_num > 1 then
self.page_info_text:setText(util.template(_("Page %1 of %2"), self.page, self.page_num))
else
self.page_info_text:setText("")
end
self.page_info_left_chev:showHide(self.page_num > 1)
self.page_info_right_chev:showHide(self.page_num > 1)
self.page_info_left_chev:enableDisable(self.page > 1)
self.page_info_right_chev:enableDisable(self.page < self.page_num)
local time_info_txt = os.date("%H:%M").." @ "

local time_info_txt
if G_reader_settings:isTrue("twelve_hour_clock") then
time_info_txt = os.date("%I:%M %p")
else
time_info_txt = os.date("%H:%M")
end
time_info_txt = " – " .. time_info_txt..Device:getPowerDevice():getCapacity().."%"
dontcrash marked this conversation as resolved.
Show resolved Hide resolved
if Device:getPowerDevice():isCharging() then
time_info_txt = time_info_txt.."+"
time_info_txt = time_info_txt .. " ⚡"
end
time_info_txt = time_info_txt..Device:getPowerDevice():getCapacity().."%"
self.time_info:setText(time_info_txt)

-- recalculate dimen based on new layout
Expand Down
2 changes: 1 addition & 1 deletion plugins/coverbrowser.koplugin/listmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ function ListMenuItem:update()
elseif percent_finished then
if pages then
if BookInfoManager:getSetting("show_pages_read_as_progress") then
pages_str = T(_("page %1 of %2"), Math.round(percent_finished*pages), pages)
pages_str = T(_("Page %1 of %2"), Math.round(percent_finished*pages), pages)
else
pages_str = T(_("%1 % of %2 pages"), math.floor(100*percent_finished), pages)
end
Expand Down
11 changes: 5 additions & 6 deletions plugins/coverbrowser.koplugin/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ function CoverBrowser:addToMainMenu(menu_items)
separator = true,
},
{
text = _("Shorten home directory to ~"),
text = _("Shorten home directory"),
checked_func = function() return G_reader_settings:readSetting("home_dir_display_name") end,
callback = function()
if G_reader_settings:readSetting("home_dir_display_name") then
G_reader_settings:delSetting("home_dir_display_name")
if FileManager.instance then FileManager.instance:reinit() end
if G_reader_settings:isTrue("shorten_home_dir") then
G_reader_settings:flipFalse("shorten_home_dir")
else
G_reader_settings:saveSetting("home_dir_display_name", "~")
if FileManager.instance then FileManager.instance:reinit() end
G_reader_settings:flipTrue("shorten_home_dir")
end
if FileManager.instance then FileManager.instance:reinit() end
end,
},
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/goodreads.koplugin/doublekeyvaluepage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ function DoubleKeyValuePage:_populateItems()
table.insert(self.main_content,
VerticalSpan:new{ width = self.item_margin })
end
self.page_info_text:setText(T(_("page %1 of %2"), self.show_page, self.pages))
self.page_info_text:setText(T(_("Page %1 of %2"), self.show_page, self.pages))
self.page_info_left_chev:showHide(self.pages > 1)
self.page_info_right_chev:showHide(self.pages > 1)
self.page_info_left_chev:enableDisable(self.show_page > 1)
Expand Down