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

UI Changes #5508

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 file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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,

@@ -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 = {}

@@ -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
This conversation was marked as resolved by dontcrash

This comment has been minimized.

Copy link
@Frenzie

Frenzie Oct 21, 2019

Member

Do we keep this off by default?

This comment has been minimized.

Copy link
@poire-z

poire-z Oct 21, 2019

Contributor

I think it was off by default.
I guess most people have enabled it (well, I don't really know :), but as the setting name changed, they won't have it enabled. I don't think it's worth handling a migration.
So, dunno, may be it should indeed be on by default.

This comment has been minimized.

Copy link
@dontcrash

dontcrash Oct 21, 2019

Author Contributor

Unsure of what to do here

This comment has been minimized.

Copy link
@Frenzie

Frenzie Oct 21, 2019

Member

Isn't there an isNilOrTrue or something?

This comment has been minimized.

Copy link
@dontcrash

dontcrash Oct 21, 2019

Author Contributor

Solved

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)
This conversation was marked as resolved by dontcrash

This comment has been minimized.

Copy link
@poire-z

poire-z Oct 21, 2019

Contributor

You didn't need the len+2 from my sample code to remove the leading / ?
(We need to remove it, to distinguish shortened paths inside home_dir from full path outside home_dir.)

This comment has been minimized.

Copy link
@dontcrash

dontcrash Oct 21, 2019

Author Contributor

Oops, missed this earlier, implemented now

end
end
return path
@@ -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")
This conversation was marked as resolved by dontcrash

This comment has been minimized.

Copy link
@Frenzie

Frenzie Oct 21, 2019

Member

Sorry, the GH suggestion diff thing is a bit difficult to work with multiple lines (if it's possible at all) but of course this line should go too.

Suggested change
local twelve_hr = G_reader_settings:isTrue("twelve_hour_clock")

This comment has been minimized.

Copy link
@dontcrash

dontcrash Oct 21, 2019

Author Contributor

Resolved already, spotted that one as well just then!

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,
@@ -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)
@@ -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)
@@ -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".
This conversation was marked as resolved by dontcrash

This comment has been minimized.

Copy link
@Frenzie

Frenzie Oct 21, 2019

Member

The comment should remain attached to the string for clarity within the code. (I think xgettext won't care and apply it to the first following string.)

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().."%"
This conversation was marked as resolved by dontcrash

This comment has been minimized.

Copy link
@Frenzie

Frenzie Oct 21, 2019

Member

I might be mistaken but shouldn't that be the other way around?

Suggested change
time_info_txt = "" .. time_info_txt..Device:getPowerDevice():getCapacity().."%"
time_info_txt = time_info_txt .. "" .. Device:getPowerDevice():getCapacity() .. "%"
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
@@ -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
@@ -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,
},
{
@@ -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)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.