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

Save current document settings as default settings #9643

Merged
merged 5 commits into from
Oct 25, 2022

Conversation

hius07
Copy link
Member

@hius07 hius07 commented Oct 16, 2022

One of the most frequent questions asked by the new users is why my current settings are not applied to all books.
After they understand why, they must go through all the settings once more. This will help.

01

02

03


This change is Reviewable

@@ -305,6 +328,48 @@ dbg:guard(ReaderMenu, 'setUpdateItemTable',
end
end)

function ReaderMenu:saveDocumentSettingsAsDefault()
if self.ui.rolling then
Copy link
Member

@NiLuJe NiLuJe Oct 16, 2022

Choose a reason for hiding this comment

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

Do we have a way to pull those from the doc's configurable instance automatically? (with a "blacklist" like the reset option does, if necessary).

(This would mean less maintenance burden in case they ever change, and would handle the kopt/cre swap automagically).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll think of this

Copy link
Contributor

Choose a reason for hiding this comment

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

This big listing of saveSetting does not really have place in a ReaderMenu.
I would put it in a new module that you would just use here - with resetDocumentSettings() which also has quite nothing to do with FilemanagerUtil :)
require("apps/filemanager/filemanagerutil").resetDocumentSettings(current_file)

Copy link
Member Author

Choose a reason for hiding this comment

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

This big listing of saveSetting does not really have place in a ReaderMenu.

It is rather short now, maybe keep it here?

Copy link
Contributor

Choose a reason for hiding this comment

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

As you prefer.
Still, resetDocumentSettings() which is only used in ReaderMenu may probably be moved where the new saveDocumentSettingsAsDefault() is.

Copy link
Member Author

Choose a reason for hiding this comment

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

resetDocumentSettings() is near purgeSettings(), they have similar structures and goals.
I agree that ReaderMenu should be just a frame but cannot find better place for these "doc settings" functions.

@Frenzie Frenzie added this to the 2022.11 milestone Oct 16, 2022
@hius07
Copy link
Member Author

hius07 commented Oct 17, 2022

Just for reference: configurable structure.

CRE

{
    b_page_margin = 5,
    block_rendering_mode = 3,
    cjk_width_scaling = 100,
    embedded_css = 1,
    embedded_fonts = 1,
    font_base_weight = 0,
    font_gamma = 26,
    font_hinting = 0,
    font_kerning = 3,
    font_size = 23,
    h_page_margins = {
        30,
        30,
    },
    line_spacing = 130,
    nightmode_images = 1,
    render_dpi = 96,
    rotation_mode = 0,
    smooth_scaling = 0,
    status_line = 1,
    sync_t_b_page_margins = 0,
    t_page_margin = 10,
    view_mode = 0,
    visible_pages = 1,
    word_expansion = 0,
    word_spacing = {
        75,
        50,
    },
}

PDF

{
    auto_straighten = 0,
    contrast = 1,
    defect_size = 1,
    detect_indent = 1,
    doc_language = "eng",
    font_fine_tune = 0.050000000000000003,
    font_size = 1,
    forced_ocr = 0,
    full_screen = 1,
    hw_dithering = 0,
    justification = 3,
    line_spacing = 1.2,
    max_columns = 3,
    page_gap_height = 8,
    page_margin = 0.10000000000000001,
    page_opt = 0,
    page_scroll = 0,
    quality = 1,
    rotation_mode = 0,
    sw_dithering = 0,
    text_wrap = 0,
    trim_page = 1,
    word_spacing = -0.20000000000000001,
    writing_direction = 0,
    zoom_direction = 7,
    zoom_factor = 1.5,
    zoom_mode_genus = 4,
    zoom_mode_type = 1,
    zoom_overlap_h = 36,
    zoom_overlap_v = 36,
    zoom_range_number = 2,
}

@poire-z poire-z merged commit d1abbbf into koreader:master Oct 25, 2022
@hius07 hius07 deleted the docsettings-as-default branch October 25, 2022 12:18
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