Skip to content

File list: new display options#12954

Merged
hius07 merged 7 commits into
koreader:masterfrom
hius07:display-options
Jan 5, 2025
Merged

File list: new display options#12954
hius07 merged 7 commits into
koreader:masterfrom
hius07:display-options

Conversation

@hius07

@hius07 hius07 commented Dec 29, 2024

Copy link
Copy Markdown
Member

(1) Option to show/hide collection mark.
(Now I have all my books in one flat collection. "Collections search" allows to build a collection for, say, a certain author quickly.)

01

(2) Option to have fixed font size in List display mode, taken from #9094 (comment).

02

(3) Radio buttons in the "Series" submenu. To avoid confusion comparing to adjacent "Progress" and "Display hints" menues.

03


This change is Reviewable

Comment on lines +91 to +92
function ReadCollection:isFileInCollections(file, ignore_show_mark_setting)
if ignore_show_mark_setting or G_reader_settings:nilOrTrue("collection_show_mark") then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment as #12940 (comment) :)
But I don't see in this PR any isFileInCollections() call with this added second parameter (?).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Currently it is called to check whether to draw the mark only, without the second arg.
Added the second arg for future possible calls.

Comment thread plugins/coverbrowser.koplugin/main.lua Outdated
Comment on lines +158 to +160
local function genSeriesSubMenuItem(text_, value_)
return {
text = text_,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to use text_ and value_ (with a trailing underscore) ?
(It surprised me, so I don't think we anywhere use such naming, even to avoid conflict with upper scoped variables if there really were some.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Several times before, I encountered conflicts in naming the standard args (like text, file etc) in local function.
So I prefer to not think about it and just give unique names.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

local function doAction(action_, page_, item_, content_)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, I'd rather like you to think a bit and see such naming is not needed in such an obvious context :) and so we don't start a new trend and future developers think this is the thing to do :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good unique names, I believe.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A single trailing underscore seems relatively error-prone at first glance, though ;).

(As in, it's an easy target for hard-to-spot typos)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

function ReaderHighlight:writePdfAnnotation(action, item, content)
if self.ui.rolling or not self.highlight_write_into_pdf then
return
end
logger.dbg("write to pdf document", action, item)
local function doAction(action_, page_, item_, content_)

Can you advise 3 good unique names? Wasting time.

@poire-z poire-z Jan 1, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In this context, there are item and content upper values - and it's just fine and perfect to use item_, content_ : it avoids the conflict, and we know what these are by using the readable and same kind of name.

In the context of your 2 PRs, there are no upper text and value - so they have the unique names you like, and don't need any appended _. And there is no risk of hard-to-spot typo.

keep_menu_open = true,
callback = function()
local ConfirmBox = require("ui/widget/confirmbox")
UIManager:close(self.file_dialog)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why these are not needed ? The file_dialog auto-closes when button pressed ? Or you want to keep them open?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

They're the main menu items. What is file_dialog?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dunno, don't want to have to look at the code and where these comes from :) So, you're telling me that there is self.file_dialog, and they probably come from some old copy&paste ? Trusting you.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's the upper menu, not popup dialog.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, you're telling me that there is no self.file_dialog, and they probably come from some old copy&paste ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't know, erroneous lines from 2017.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yup, looks like an old c/p thinko at a quick glance.

@hius07 hius07 merged commit f0a3e1c into koreader:master Jan 5, 2025
@hius07 hius07 deleted the display-options branch January 5, 2025 16:59
@hius07 hius07 added this to the 2025.01 milestone Jan 5, 2025
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants