Commit Graph

2088 Commits (master)

Author SHA1 Message Date
hius07 01e6593dd4
File popup dialog buttons (#10537) 11 months ago
poire-z 04425b74fc BookMap: add "Overview" mode
Add a restricted but convenient mode showing BookMap like
in initial view, while still allowing chapter levels to be
tweaked. This allows getting back to this view with another
gesture to see the overall progress in the book, while
still having the normal BookMap in flat mode acting as
an alternative ToC.
Available as an action to associate to a gesture, and
with long-press on the "Book map" menu item.
11 months ago
hius07 1944f54aa0
Custom cover: fix (#10513)
Somehow have overlooked in testing.
Closes #10512.
11 months ago
hius07 57f4ff2c68
ReaderHighlight: manage overlapped highlights (#10492) 11 months ago
hius07 6c0bfb1c0a
FileManagerCollection: Fix crash on "Execute shell script" 12 months ago
hius07 919d67656d
readerhighlight: fix translator auto lang (#10469) 12 months ago
hius07 3d5775241d
Exporter: selected files (#10453)
Export highlights for selected files.
Having a button "Select all files in folder", it is easy to export the whole folder.
So, closes #10402.

To keep even number of buttons, added a feature "Show selected files list". May be useful to check selections before an operation. Just a sorted list, no titlebar or popup menu, tapping a file jumps to its folder.
12 months ago
hius07 5f59ee6417
readerhighlight: fix translate (#10451)
Fix translation for books without "language" in properties (it is "", Translator expects nil).
Regression after #10438.
12 months ago
hius07 3dce41269d
Translator: translate current page (#10438) 12 months ago
poire-z fc81c7db24 DictQuickLookup: add button to show list of results
Add a left button to the title bar to show the list
of results as a popup.
Dictionary: tap or long-press on that button give
different view of the results.
Wikipedia: request 30 results instead of 20, so we
can show 15, 10 or 6 of them per page of that popup.
12 months ago
hius07 b4f453eb58
Page overlap: add "Horizontal line" marker (#10401) 1 year ago
Frans de Jonge 46f0bba74b
ReaderLink: fix capitalization typo in "Go Forward" (#10399) 1 year ago
yparitcher de5c872dcb Dispatcher: add `addCurrentLocationToStack`
This is useful when i want to reference something a few pages away while keeping track of my current page
1 year ago
hius07 4f23a6fafa
Custom book covers (#10329) 1 year ago
hius07 9db74f1f01
ConfirmBox: add widgets (#10364) 1 year ago
yparitcher 64b0f5e7cf ReaderFooter: separate ToggleFooterMode from TapFooter
the footer can be toggled by gestures and menu, and should only be locked or skim in flipping mode when the footer is tapped

also allow toggling when only displaying the progress bar

rename to TapFooter to show it is not an event

Fixes: #10355
1 year ago
poire-z 7bae2ed920 Dispatcher: add "Save book metadata" 1 year ago
Frans de Jonge 744f2d185f
[fix] Reintroduce "Start with" default to prevent nil string on startup (#10369)
Regression from #10198.

Fixes #10368.
1 year ago
hius07 99265ba1b7
BookInfo: fix crash on show cover (#10315) 1 year ago
hius07 af45ec75c3
ReaderThumbnails: update cached page thumbnail on bookmark note change (#10303) 1 year ago
hius07 be7d6008d1
Reader: do not apply line spacing out of range (#10307)
* readercoptlistener: fix line spacing out of range

* readerkoptlistener: fix line spacing out of range

* creoptions: fix line spacing limit
1 year ago
zwim 4dbaca180a
PM: Optimize task queue handling around standby (#10203)
Instead of firing on(Enter|Leave)Standby Events, and having every other piece of code that might care about that handle re-scheduling their stuff themselves; simply make the standby implementation (i.e., AutoSuspend's) shift the whole task queue by the amount of time spent in standby to re-sync everything automatically.

(This is necessary in the first place because Linux, as the task queue ticks in CLOCK_MONOTONIC, which does *not* tick during suspend/standby; while we expect most of the tasks scheduled to actually reflect real world clock delays).
1 year ago
hius07 483a005cc2
File browser: show Folder Menu on long-press on Home icon (#10298) 1 year ago
hius07 b01e1c5918
Reader: do not apply font size out of range (#10295) 1 year ago
hius07 34ab0d8ac6
Folder Menu: sign for Home folder (#10288) 1 year ago
hius07 827581ac72
readerbookmark: fix writing pdf annotation (#10287) 1 year ago
hius07 59a0139a60
File browser: add Folder Menu (#10275) 1 year ago
nairyo 983e083a0b
Center pdf manual zoom mode (#10246)
Center PDF content when its width is smaller than the screen

fix #9967
1 year ago
hius07 a3080b042a
BookInfo: add page information (#10255) 1 year ago
hius07 3a37d30ad6
Dispatcher: use translated labels for Zoom Mode actions (#10269) 1 year ago
yparitcher bc5d354225
ReaderLink: allow a forward location stack (#10228)
this allows going back and forth from links (think of undo / redo)

when going back and no forward locations and when we are not on the same page as the last saved location, add the current location to the forward stack, helping if one goes back by mistake they can jump back to their current location

when going back and no forward locations and when we are not on the same page as the last saved location, add the current location to the forward stack, helping if one goes back by mistake they can jump back to thier current location
1 year ago
hius07 4d26650ad6
Filesearcher: add search in book metadata (#10198) 1 year ago
hius07 df9c2bcb7f
History: fix book info buttons disable (#10244) 1 year ago
hius07 c6a7f083c9
readerstyletweak: update profiles on unregistering in dispatcher (#10247) 1 year ago
hius07 aedb713f82
Menu widget: cleanup (#10241) 1 year ago
poire-z f16fbf1d0b Book style tweak: add button with CSS suggestions
Mostly non-standard CSS declarations (so, possibly unknown
to users) that can be useful for solving certain issues.
1 year ago
hius07 1e6b22a60e
Readerzooming: fix use of default settings (#10205)
(1) Fix default direction. Closes #10201. Fixes #9321.
(2) Fix default overlap (unreported bug).
(3) Do not write unused settings to doc_settings.
1 year ago
poire-z 3006348585 PageBrowser: toggle page bookmark with long-press on thumbnail 1 year ago
nairyo 65031ae14f
Dictionary lookup window: use from/to language to determine glyph form (#10184)
For example, to determine whether the Japanese or Chinese form should be shown.

* Dictionaries.lua - use iso3 codes everywhere
readerdictionary.lua - convert iso to bcp tag, to construct ifo_lang
isolanguage.lua - map from iso3 to full language name, map from iso3 to bcp language tag

* Make the full language names translatable

* Store ifo information from dictionaries.lua in downloaded dictionaries
1 year ago
hius07 536d71970f
Bookmark flipping mode fix (#10196)
(1) Changed indicator icon to "bookmark".
(2) Added toggling action to dispatcher.
1 year ago
hius07 a3d42ac344
Classic display mode: add popup file dialog buttons (#10185) 1 year ago
poire-z eeb3c08457 View HTML: add CSS helpers with long-press
Move View html code from ReaderHighlight to a new
dedicated module.
Long-press on an element or its text in the HTML will
show a popup with a list of selectors related to this
element that can be copied to clipboard (to be pasted
in Find or in a Book style tweak).
2 addtional buttons in this popup allow seeing all the
CSS rulesets in all stylesheets that would be matched by
this element, which should make it easier understanding
the publisher stylesheets and using or creating style
tweaks.
1 year ago
Frans de Jonge 5fce41d7d9
[i18n] FileManagerMenu: remove stray newline from translated sting (#10174) 1 year ago
hius07 38bd768d5e
DocSettings: Move book metadata to preferred location (#10149) 1 year ago
NiLuJe 189739ac4c
ReaderFooter: Don't reset session marker on standby (#10167) 1 year ago
hius07 55f1b8c974
UX: a set of minor fixes (#10165)
- AutoFrontlight plugin: update checkmark on toggling
- KeepAlive plugin: update checkmark on toggling
- ReaderPageMap: font size menu entry
- ReaderStatus, common_settings_menu_table: book status "read" -> "finished"
1 year ago
hius07 5c9ba53353
History: update last book access time (#10156) 1 year ago
poire-z b610facfdc
Partial rerendering: really avoid flash on reload (#10155)
Also restore input if ReaderUI crashed.
Also avoid refresh_count management when "Full refresh
rate" is set to "never".
1 year ago
hius07 54b3b5a8cc
ReaderHighlight: minor fixes (#10142)
* readerui: save highlight to pdf requires button press

* readerhighlight: fix select mode confirmbox icon
1 year ago
hius07 15605291c2
DocSettings: add support of centralized sdr storage (#10132) 1 year ago
NiLuJe c5d606a7f4
ProgressWidget: Add an optional marker on the initial position (#10114)
* Enable it on SkimToWidget
* Optional on ReaderFooter (toggle in the progress bar > style submenu)
1 year ago
poire-z 81f2aed086 ReaderRolling: quicker partial rerenderings with EPUBs
Only available with EPUBs containing 2 or more fragments,
and a file size large enough to ensure a cache file is used.
The idea is simply, on any rendering setting change, to
skip the rerendering of the full book and to defer any
rerendering to the moment we draw a DocFragment, and
render only it.
So, on a setting change, only the fragment containing the
current page will be rerendered, and the new fragments we
may cross while turning pages.
When having done so, KOReader is in a degraded state (the
full page count is incorrect, the ToC is invalid...).
So, a full rerendering is needed, and one will happen
in the background, and when the user is idle, we reload
seamlessly and quickly from the cache file it has made.
ReaderFlipping will show some icons in the top left
corner to let it know at which steps in this procress
we are.
1 year ago
poire-z 2f0954fa71 Book style tweak: revamp sample tweak 1 year ago
hius07 91ff6ce2d8
ReaderBookmark: fix comparing positions (#10109) 1 year ago
Melik 881d8ed406 Fix spelling of filemanagerutil.genStatusButtonsRow 1 year ago
Melik 7d6da81233 Compact covermenu addn. to for loop, fix collections bug, further gimp genStatusButton to use upvalues 1 year ago
Melik 0e470aaed9 Remove leftover function, arg 1 year ago
Melik d9b0785a96 Reset button gen to util, collections current file check
- filemanagerutil.resetDocumentSettings()'s doc_settings:close() -> doc_settings:flush()
- Remove current_status from filemanagerutil.getStatusButtonsRow() args, get it inside from file
- Move genStatusButton() inside filemanagerutil.getStatusButtonsRow()
- Move "Reset settings" button generation to filemanagerutil
- Rename "Reset settings" button to "Reset" and update popup box text
- Disable "Reset settings" for file if it's currently open in Collections (same as History)
1 year ago
Melik fb7ec830c6 Create getStatusButtonsRow() for status buttons, hide row if history item deleted 1 year ago
Melik 31cfffc289 Pull genStatusButton() to filemanagerutil 1 year ago
Melik 502bb0ccbf Create genStatusButton() for buttons, use item.dim for deleted in history 1 year ago
Melik 9e7e68beb6 Shorten status button names 1 year ago
Melik c0d0b36f98 Get rid of luacheck warning 1 year ago
Melik 1b2adfd201 Return to callback fudging, fix book info callback replacement 1 year ago
Melik 628cacf1e6 Disable status buttons for deleted files in history 1 year ago
Melik 77b110a987 Add 'Reset settings' button to collections 1 year ago
Melik 8642509f26 Move 'Put on hold' between reading & read 1 year ago
Melik a9313dda1a Add buttons to collections 1 year ago
Melik 57849b3f7c Add buttons to history, use id for button-getting 1 year ago
Melik 086d4622e6 Add buttons to file manager, lay groundwork 1 year ago
NiLuJe 45a4aac3d3
Notification: Fence the *display* update in an attempt to avoid upsetting some boards... (#10083)
Re: https://github.com/koreader/koreader/issues/9806#issuecomment-1416827447

Depends on https://github.com/koreader/koreader-base/pull/1576

Includes assorted cosmetics tweaks related to duplicate `setDirty` calls when instantiating widgets that already have an `onShow` handler doing it. (I left widgets doing it in `update` instead of `init` alone, on the assumption that callers *may* be relying on that behavior when updating widgets at runtime. This might actually never matter, and it certainly didn't for ScreenSaverWidget, which is why I removed it from there ;p).
1 year ago
Sargun Vohra 15fb73384f
EInk: Add a setting to toggle flashing on pages with images (#10049)
With minor code cleanups along the way ;).
1 year ago
NiLuJe 21210800c1
ReaderFooter/Header: Refine autorefresh repaint-or-not checks (#10045)
Use both a whitelist for targeted widget repaints, a blacklist for no repaint at all, and a fallback for a full in-order ReaderUI repaint when unsure.

Use a similar approach in ReaderHeader (i.e., prevent explicit refreshes while ReaderMenu is open).

Re #9979, re #9768
1 year ago
NiLuJe 7863a7ad70
Misc: Natural sorting refactor (#10023)
* Move natural sorting algo to a dedicated sort module to avoid code duplication
* Use a slightly more accurate algorithm, and speed it up by caching intermediary strings
* Calibre: Use natural sorting in metadata search (fix #10009)
1 year ago
NiLuJe 4732bc9aed ReaderView: Recompute page layout when toggling ReaderFooter in
non-reflowable documents.

The code only handled setups with "reclaim bar height" enabled (because
that's my usual workflow, har har), but would have broken in various
more or less obvious ways without it, depending on the exact layout/zoom
settings.
The previous attempts at handling the no-reclaim case were focused
on scroll mode, which is a bit of a nightmare. This approach should
deal as well/badly as the previous one in scroll mode, but actually
handle page mode properly ;).

Re #9979
1 year ago
hius07 d5a4ac14e1
ReaderUI: fix status and history (#9993) 1 year ago
NiLuJe 4ce0058e2d
ReaderLink: Minor logic simplification in onGoToPageLink (#9987)
Abort earlier if the nearest link is too far, instead of computing stuff and creating an object we'll never actually use.

Includes minor logging tweaks to vaguely related codepaths ;p.
1 year ago
zwim f0b007bb31
Footer: avoid footer auto refresh over bottom menu (#9983) 1 year ago
poire-z 7448ad23e7 ReaderDogear: fix no y-offset after load with top status bar 1 year ago
zwim ebaef61536
Make translateable: SystemStat, custom footer (#9945)
Fixes #9942.
1 year ago
NiLuJe 788ccac561
Input/Device: Refactor Gyro events handling (#9935)
* Get rid of the `canToggleGSensor` Device cap, it's now mandatory for `hasGSensor` devices. (This means Kindles can now toggle the gyro, fix #9136).
* This also means that `Device:toggleGSensor` is now implemented by `Generic`.
* Update the Screen & Gyro rotation constants to be clearer (c.f., https://github.com/koreader/koreader-base/pull/1568) (/!\ This might conceivably break some `rotation_map` user-patches).
* Input: Move the platform-specific gyro handling to Device implementations, and let Input only handle a single, custom protocol (`EV_MSC:MSC_GYRO`).
* Input: Refine the `rotation_map` disable method implemented in 43b021d37c. Instead of directly poking at the internal field, use a new method, `disableRotationMap` (/!\ Again, this might break some `rotation_map` user-patches).
* Input: Minor tweaks to event adjust hooks to make them more modular, allowing the Kobo implementation to build and use a single composite hook. API compatibility maintained with wrappers.
1 year ago
hius07 ee75abd4a0
Statistics: show correct number of notes in a book (#9928) 1 year ago
poire-z b1b7773237
TouchMenu: tweak menu search (#9926)
- Cleanup search and animation codes, fix inconsistencies
  between animation/no-animation opening, and refreshes
  glitches on eInk.
- Show menu item on tap, with buttons to either open
  directly, or to walk there (removed earlier "Animation"
  checkbox, so the choice can be decided later).
- Move event handlers into ReaderMenu/FileManagerMenu.
- Avoid duplicated and confusing results from gestures
  and font-family submenus.
1 year ago
melyux a53e9847fa
Footer: some menu items rewording (#9915)
Change footer status bar type setting label from 'Prefix' to 'Item style'.
1 year ago
melyux 6f39f6cb7b
Screensaver: exclude content when excluding cover, random image as fallback (#9912)
Exclude some screensaver option showing book content
(title, page image) when "Exclude this book cover" is checked. 
Random image as fallback, KOReader logo as 2nd-order fallback.
1 year ago
hius07 7719ad04f3
Reader: add open next file in folder to Dispatcher (#9916)
Closes https://www.mobileread.com/forums/showthread.php?t=350683.
1 year ago
NiLuJe b16b215cbb ReaderHighlight: Appease newer versions of LuaCheck
Good to know: it now defaults to assuming that function arguments
prefixed with an underscore would be unused, which is... nice in theory ;).
1 year ago
Roygbyte 3e49cf9a18
ReaderLink: allow buttons to be added to the External link dialog (#9746)
So plugins can register and advertize themselves
as handlers of external links (ie. Wallabag).
1 year ago
Frans de Jonge e1fe897c9b
[i18n] Add a couple of explanatory comments for translators (#9878) 1 year ago
hius07 c53dd55b16
ReaderHighlight: new Select mode icon (#9869) 1 year ago
weijiuqiao 49d8ec2f4f
Cloudsync: dropbox token re-generation (#9862) 1 year ago
hius07 05cd59ebe5
ReaderBookmark: indicate current page with dimmed page numbers after current (#9872) 1 year ago
Frans de Jonge e58a12ba04
TouchMenu: Search menu to search the menu (#9876)
Fixes #9800.
1 year ago
zwim 192a243b4d Add datetime.lua
Move date and time related functions from util.lua
(and the statistics plugin) to a new datetime.lua.
1 year ago
zwim d1cd2a1c8d
Restart KOReader: add a ConfirmBox instead of a plain InfoMessage (#9853) 1 year ago
Steady Quad fa9f0acf5e
cloudstorage: Fix directory listing for some WebDAV servers (#9847)
(sub)folders on some WebDAV servers are not listed in cloudstorage due to strict xml element matching of <d:collection> elements.
1 year ago
hius07 cd56dd2edf
ReaderHighlight: pdf multi-page highlights (#9850) 1 year ago
melyux cc53ceb039
History: remember status filter, show filtered count in title (#9822) 1 year ago
Frans de Jonge 84be6fc226
[i18n] Fix 'Choose new folder to set as home?' can't be translated (#9841)
Reported in <https://www.mobileread.com/forums/showthread.php?p=4276962#post4276962>.
1 year ago
hius07 c35140e8d2
ReaderHighlight: new icon in select mode ConfirmBox (#9830) 1 year ago
hius07 90f6dd178e
CloudStorage: add DropBox starting folder (#9821) 1 year ago
hius07 5b889a0145
Reader style tweaks: register in Dispatcher manually (#9816)
Style tweaks can be applied with a gesture or added to a profile.
1 year ago
zwim 486d7071c7
[StatusBar] Allow status bars to be repainted if they are not covered (#9768) 1 year ago
hius07 d95c692c78
ReaderHighlight: add abort select mode (#9786) 1 year ago
weijiuqiao e481e60aa1 Syncservice: fix not updating services after adding new ones 1 year ago
NiLuJe df890105e4 ReaderMenu: Use a dedicated handler for the Menu key
Piggybacking on the touch gesture handlers implied that the gesture
filter (tap and/or swipe) was still applied, which made no sense.

Also, stop the weird Event roundtrip for events we're actually the only
ones to handle, just call the handler ourselves directly.

Fix #9792
1 year ago
hius07 06cec98d09
Filemanagerutil: let abbreviate manage extra slash (#9785) 1 year ago
hius07 71c65d18f1
Page turns: add backward tap zone width setting (#9772) 2 years ago
poire-z 1fa706a2c5
Fix page stats messed up after rerendering (#9775)
Fix regression introduced by 48eb0231 #9651: on re-rerendering, the new pages count didn't reach the Statistics plugin.
So, if you change font size or margins, the stats for the page read since then were badly accounted, until a change of book or restart... I noticed that in Book map, strange nobody else did over the last 2.5 weeks.
2 years ago
weijiuqiao 8500fdd519
Cloud-based sync for 2 plugins: reading statistics and vocabulary builder (#9709)
This commit adds cross-device sync ability for two plugins: reading statistics and vocabulary builder. It relies on user setting up a Cloud server (DropBox and WebDAV but not FTP though) and designating a path. Behind the curtains sqlite databases are being passed around and updated.

UI-wise, for the statistics plugin, two new menu items Synchronize now and Cloud sync to set it up (might not be the best wording) are added. As for vocabulary builder, a similar Cloud sync button is added to the menu and a shortcut icon button to Synchronize now is pinned at the bottom corner.

CloudStorage new features: WebDAV creating folders and uploading files. And a new widget-like sync server chooser. In the end I decided not to add automatic sync, as the SQL commands part seem a bit much.
2 years ago
hius07 4f3000e882
ReaderHighlight: fix ending fragment check (#9769) 2 years ago
hius07 c3ed51aded
ReaderHighlight: set default long-press action with a gesture (#9723) 2 years ago
NiLuJe 925fd647dc InputContainer/FocusManager: Simplify key_events clearing on unplug
Thanks to @poire-z for the idea, it's indeed much nicer this way ;).
2 years ago
NiLuJe 09498d4bbb ReaderUI: Refresh key_events handlers on keyboard hotplug 2 years ago
NiLuJe e0bfebb0b5 FileManager: Refresh key_events handlers on keyboard hotplug 2 years ago
NiLuJe 8cba303b96 ReaderPanning: Don't crash in the key event handler.
I'm unclear on where this is supposed to do anything, though.
But at least it no longer crashes, so, yay?
2 years ago
NiLuJe 25dce4d1b5 WebDAV: Fix a warning with the latest LuaCheck version
(error-prone negation)
2 years ago
NiLuJe 1e24a1c7a3 ReaderUI: Properly neuter gesture handling from InputContainer modules
None[1] of them actually rely on their own onGesture handler, they
all register their own stuff to ReaderUI's.
Hotfix #9710 revealed that the way this was handled didn't exactly
work as expected ;).

The only thing that consumes ges_events is InputContainer's onGesture
method. All these modules *extend* InputContainer, but none of them
*implement* a custom onGesture, so self.onGesture = nil was just a NOP,
they always access InputContainer's method via inheritance.
If we actively want to neuter it, we *have* to implement it in that
module (with a NOP).

[1] The exception being ReaderZooming, but that only when in flip mode.
2 years ago
yparitcher 4d8e2f0ea1 ges_events must be a table
regression in #9691 b523c2e8b9
2 years ago
NiLuJe b523c2e8b9 InputContainer: Fall cleanup ;).
Get rid of the doc & seqtext fields, as they are not actually used (nor
are they particularly useful, the event handler's name should be pretty
self-explanatory).

Also, tweak the key_events documentation to highlight the quirks of the
API, especially as far as array nesting is involved...

Random drive-by cleanup of the declarations of key_events & ges_events
to re-use the existing instance object (now that we know they're sane
;p) for tables with a single member (less GC pressure).
2 years ago
hius07 a8ff3a6571 readerzoomin: add zoom mode translation, simplify zoom mode validation 2 years ago
hius07 0919c4ef17 readerkoptlistener: simplify zoom mode validation 2 years ago
weijiuqiao e8cd2ba498
WebDAV: fix bugs when start folder starts with "/" (#9688) 2 years ago
zwim d7c63edca6
Random optimizations (#9657) 2 years ago
poire-z 48eb02318d
Dispatcher: avoid multiple cre rerenderings when many settings changed (#9651)
When a gesture/profile was updating multiple cre settings,
each setting handler would emit UpdatePos which each would
force a re-rendering.
When this might be happening, postpone the rerendering
until all are set.
Needs some bit of refactoring to the events at play:
introduce "DocumentRerendered" event, and use it where
we used "UpdatePos" or "UpdateToc" to mean exactly that.
2 years ago
hius07 d1abbbfdd8
Document settings submenu: add Save as default (#9643) 2 years ago
weijiuqiao edf7cc9a61
Vocabulary builder: support extracting context from pdfs (#9622)
Move getSelectedWordContext(), now document specific,
from ReaderHighlight into each document module.
2 years ago
NiLuJe da65ac8b02
Cleanup various varargs shenanigans (#9624)
* Iterate over varargs directly via select if possible
* Use table.pack otherwise (https://github.com/koreader/koreader-base/pull/1535).
* This allows us to simplify a few Logger calls, as logger now handles nil values.
2 years ago
hius07 a728e3b5fa
ReaderStatus: save status summary (#9619) 2 years ago
zwim 4969811c08
Optimization: Use constant folding for divisions not a power of two (#9609) 2 years ago
NiLuJe a62f076e56 DictQuickLookup: The window_list array needs to be a static class member
Also, make sure references are actually dropped,
no matter how the widget is closed, by relying on onCloseWidget ;).

Enable the "long-press-on-close" trick on the actual Close button,
too, instead of only on the title bar's cross.

Fix: https://github.com/koreader/koreader/pull/9586#issuecomment-1272332275
2 years ago
NiLuJe c0dffe2012
Kobo: Add a debug option to turn the charging LED on PM entry failure (#9601)
This should be fairly unintrusive, but still noticeable enough without having to watch the battery gauge like a hawk, or resort to actual monitoring via kernel logs and/or usb meter and/or multimeter...
2 years ago
NiLuJe eef938996f MultiDialog: Fix an extremely nasty API misuse
Stuff was poking at the class object, not the instance's :s.

Fix #9599
2 years ago
NiLuJe fadee1f5dc
Clarify our OOP semantics across the codebase (#9586)
Basically:

* Use `extend` for class definitions
* Use `new` for object instantiations

That includes some minor code cleanups along the way:

* Updated `Widget`'s docs to make the semantics clearer.
* Removed `should_restrict_JIT` (it's been dead code since https://github.com/koreader/android-luajit-launcher/pull/283)
* Minor refactoring of LuaSettings/LuaData/LuaDefaults/DocSettings to behave (mostly, they are instantiated via `open` instead of `new`) like everything else and handle inheritance properly (i.e., DocSettings is now a proper LuaSettings subclass).
* Default to `WidgetContainer` instead of `InputContainer` for stuff that doesn't actually setup key/gesture events.
* Ditto for explicit `*Listener` only classes, make sure they're based on `EventListener` instead of something uselessly fancier.
* Unless absolutely necessary, do not store references in class objects, ever; only values. Instead, always store references in instances, to avoid both sneaky inheritance issues, and sneaky GC pinning of stale references.
  * ReaderUI: Fix one such issue with its `active_widgets` array, with critical implications, as it essentially pinned *all* of ReaderUI's modules, including their reference to the `Document` instance (i.e., that was a big-ass leak).
* Terminal: Make sure the shell is killed on plugin teardown.
* InputText: Fix Home/End/Del physical keys to behave sensibly.
* InputContainer/WidgetContainer: If necessary, compute self.dimen at paintTo time (previously, only InputContainers did, which might have had something to do with random widgets unconcerned about input using it as a baseclass instead of WidgetContainer...).
* OverlapGroup: Compute self.dimen at *init* time, because for some reason it needs to do that, but do it directly in OverlapGroup instead of going through a weird WidgetContainer method that it was the sole user of.
* ReaderCropping: Under no circumstances should a Document instance member (here, self.bbox) risk being `nil`ed!
* Kobo: Minor code cleanups.
2 years ago
hius07 1ea7e16f3e
Cloud storage: add Dropbox short-lived tokens (#9496) 2 years ago
hius07 c5505879c3
ConfigDialog: fix bug in DoubleSpinWidget default values (#9580) 2 years ago
hius07 b0eb0ce0e1
FileManager: add Select button to the file long-press menu (#9571) 2 years ago
poire-z 3bd27c3a76 ReaderFont: add "Font-family fonts" submenu
Allow associating a font to each of the generic
font-family names.

Bump crengine:
- CSS parsing: accept (and ignore) namesspaces
- isImage(): more checks for <object> as it can have inner content
- getFontFileNameAndFaceIndex(): returns if font has math support
- getFontFileNameAndFaceIndex(): returns if font has emojis
- CSS/Fonts: add support for font-family to font name mapping
2 years ago
poire-z 137b39416f ReaderLink:showAsFootnotePopup(): remove some logger.info() 2 years ago
NiLuJe 9bf19d1bb3
Assorted bag'o tweaks & fixes (#9569)
* UIManager: Support more specialized update modes for corner-cases:
  * A2, which we'll use for the VirtualKeyboards keys (they'd... inadvertently switched to UI with the highlight refactor).
  * NO_MERGE variants of ui & partial (for sunxi). Use `[ui]` in ReaderHighlight's popup, because of a Sage kernel bug that could otherwise make it translucent, sometimes completely so (*sigh*).
* UIManager: Assorted code cleanups & simplifications.
* Logger & dbg: Unify logging style, and code cleanups.
* SDL: Unbreak suspend/resume outside of the emulator (fix #9567).
* NetworkMgr: Cache the network status, and allow it to be queried. (Used by AutoSuspend to avoid repeatedly poking the system when computing the standby schedule delay).
* OneTimeMigration: Don't forget about `NETWORK_PROXY` & `STARDICT_DATA_DIR` when migrating `defaults.persistent.lua` (fix #9573)
* WakeupMgr: Workaround an apparent limitation of the RTC found on i.MX5 Kobo devices, where setting a wakealarm further than UINT16_MAX seconds in the future would apparently overflow and wraparound... (fix #8039, many thanks to @yfede for the extensive deep-dive and for actually accurately pinpointing the issue!).
* Kobo: Handle standby transitions at full CPU clock speeds, in order to limit the latency hit.
* UIManager: Properly quit on reboot & exit. This ensures our exit code is preserved, as we exit on our own terms (instead of being killed by the init system). This is important on platforms where exit codes are semantically meaningful (e.g., Kobo).
* UIManager: Speaking of reboot & exit, make sure the Screensaver shows in all circumstances (e.g., autoshutdown, re: #9542)), and that there aren't any extraneous refreshes triggered. (Additionally, fix a minor regression since #9448 about tracking this very transient state on Kobo & Cervantes).
* Kindle: ID the upcoming Scribe.
* Bump base (https://github.com/koreader/koreader-base/pull/1524)
2 years ago
NiLuJe 4d48b6e2fe
Misc: Use the ^ operator instead of math.pow (#9550)
And some minor code simplifications, thanks to @zwim ;).
2 years ago
NiLuJe 62059f8d68
Misc: Get rid of the legacy defaults.lua globals (#9546)
* This removes support for the following deprecated constants: `DTAP_ZONE_FLIPPING`, `DTAP_ZONE_BOOKMARK`, `DCREREADER_CONFIG_DEFAULT_FONT_GAMMA`
* The "Advanced settings" panel now highlights modified values in bold (think about:config in Firefox ;)).
* LuaData: Isolate global table lookup shenanigans, and fix a few issues in unused-in-prod codepaths.
* CodeStyle: Require module locals for Lua/C modules, too.
* ScreenSaver: Actually garbage collect our widget on close (ScreenSaver itself is not an instantiated object).
* DateTimeWidget: Code cleanups to ensure child widgets can be GC'ed.
2 years ago
NiLuJe b0d8919399
ImageViewer: Followup to #9529 (#9544)
* ImageViewer: Minor code cleanups
* GestureDetector: Fix the `distance` field of `two_finger_pan` & `two_finger_swipe` gestures so that it's no longer the double of the actual distance traveled. Get rid of existing workarounds throughout the codebase that had to deal with this quirk.
2 years ago
poire-z a8c81a90c3
ReaderDict: fix use of dicts with ifo with DOS line endings (#9536)
Fixed in upstream sdcv, but we need to also do it in
our parsing of .ifo and picking out dict name.
Also includes minor bump of base/sdcv.
2 years ago
hius07 45e4f38c41
CloudStorage: remove cloudmgr (#9532)
Use downloadmgr instead.
2 years ago
NiLuJe 83a2965d6b
Misc: Unify error logging on network errors (#9523)
Making sure we get the relevant information in the logs, and that the UI feedback (if any), is meaningful and readable.
2 years ago
NiLuJe 2fe2515ace
FontList: Always use the binary cache format (#9519)
Since I never actually needed to look into that data ever until today, let's just get rid of the weird debug-specific behavior.

Instead, just add a dedicated "Developer options" entry that will dump it on demand (and it'll be sorted to boot, which makes it 500% more usable).

Plus, since yesterday's change, the cache format switch between debug or not miiiight actually be crashy, so re-trigger the migration ;p.

* Includes a couple of noteworthy base bumps:

https://github.com/koreader/koreader-base/pull/1516 (update to sdcv 0.5.4 + fixes pending upstream)
https://github.com/koreader/koreader-base/pull/1517 (fix ffiUtil.orderedPairs with keys of mixed types)
2 years ago
NiLuJe 13e8213e0a
A random assortment of fixes (#9513)
* Android: Make sure sdcv can find the STL
* DocCache: Be less greedy when serializing to disk, and only do that for the *current* document ;).
* CanvasContext: Explicitly document API quirks.
* Fontlist: Switch the on-disk Persist format to zstd (it's ever so slightly faster).
* Bump base for https://github.com/koreader/koreader-base/pull/1515 (fix #9506)
2 years ago
hius07 56388aa491
TextViewer: add Find (#9507) 2 years ago
poire-z 76a7d83079 CRE/ImageViewer: get scaled blitbuffer when long-press on SVG
Get a Lua userdata wrapping a crengine LVSvgImageSource object
when long-press on a SVG image, and have crengine/LunaSVG render
it smoothly scaled to the requested size by ImageViewer.
2 years ago
poire-z 087f605fd9 Allow F5 key to reload document 2 years ago
zwim d972b7fcfa
[core] Remove a bunch of superflous semicolons (#9449) 2 years ago
NiLuJe 8e1bb9bafc
GestureDetector: Full refactor for almost-sane(TM) MT gesture handling (#9463)
Should hopefully make two-contact gestures *much* more reliable, among other things.

See the PR for all the details ;).
2 years ago
hius07 f67469bab4
Highlight: add note marker (#9395) 2 years ago
hius07 460d42293a
PathChooser: add creating folder (#9354) 2 years ago
poire-z 5e2ed5ae2a
bump crengine: monospace and fallback fonts tweaks (#9343)
Includes:
- Text: fix possible overflow with "white-space: pre"
- Fonts: getFontFileNameAndFaceIndex(): return family type
- Fonts: account for _bias in Font hash
- epub.css, fb2.css: remove hardcoded monospace font names
- Fonts: allow scaling monospace fonts
- Fonts: allow adjusting fallback font sizes to x-height
- HTML parser: trust xml encoding before html charset

In our list of fonts, show a "M" indicator alongside
monospace fonts, and allow long-press to select the one
to be use for "font-family: monospace".
Add 2 options to Font settings, to scale monospace fonts
by a percentage, and to adjust fallback fonts to their
x-height.
2 years ago
zwim 22fe3933c3
[fix, SDL] Time: fix crash when scrolling in continuous mode (#9314)
Introduced with #8999.

Fixes #9311.
2 years ago
poire-z 10a6ffd927 Style tweaks: fix typos and global tweak conflict
Minor logic fix: allow global_conflicts_with to be not only
a function, but also a string or a table, as documented.
2 years ago
poire-z 6fb266cb71 Style tweaks: handle conflicting/redundant tweaks
Disable redundant or incompatible tweaks when enabling some.
This makes the menu more dynamic to show what's impacted,
save some re-renderings, and may avoid the user trying
combinations that would have no effect.
2 years ago
poire-z e4eb1c61d1 Footnote popup: allow using book font as popup font
Also move footnote popup settings into a submenu.
2 years ago
poire-z 38bd2b4c46 ReaderRolling: fix marker sometimes not removed
Noticed when jump to a footnote and quickly going back.
2 years ago
Martín Fernández b7a27a3db3
Fullscreen refactor (#9237)
Commonize fullscreen code across different devices.

Add fullscreen toggle on SDL desktop targets. 
Expose the toggle to the dispatcher and map it to F11.

Hide touchmenu when resizing.
2 years ago
weijiuqiao cafbf36bb2
Vocabulary builder: store word context, other tweaks and fixes (#9195)
Add a copy button and save word context (off by default), shown
via the three-dot menu of word entries.
Also some db refactoring and minor UI improvements:
- a dedicated book title table in order to shrink db size by storing
  references to title names instead of repeated actual strings,
- alignment of different forms of the "more" button and possible
 clipped words in translations.
- fix plugin name so it can be disabled
2 years ago
zwim e8597c2e0c
Footer: update on network disconnect (#9185) 2 years ago
poire-z b9724f1e93 Text highlighting: extend to include punctuations
When selected text seems to be a "sentence segment"
(that is, when there are punctuations around start
AND end), extend the selection to include the relevant
punctuation.
Do this only when saving highlights and for translation
(but not when dict or wikipedia lookups, or search).
2 years ago
poire-z 141fa98a32 bump crengine: text selection tweaks and helpers
Includes:
- lvtext: fix m_kerning_mode type
- XML: let 'gb2312' (Chinese) encoding be known
- Add ldomXPointer::getChar()
- LVDocView::getNodeByPoint(): tweak for text selection
- Fonts: allow fetching the list of embedded fonts
cre.cpp:
- getTextFromPositions(): use getNodeByPoint(forTextSelection=true)
  to allow panning in margins and get the nearest text instead
  of nothing.
- add extendXPointersToSentenceSegment() to allow extending some
  xpointer range to include punctuations at start or end (with
  for now a quite rudimentory implementation).
- add getEmbeddedFontList() to allow fetching the list of
  embedded fonts in the current EPUB book.
2 years ago
NiLuJe dcb11c2542
Make luacheck >= 0.26 happy (#9174)
Re: https://github.com/koreader/koreader-base/pull/1487
2 years ago
Martín Fdez d644b1a851 android: update doShareText signature 2 years ago
NiLuJe 73b2b38954
AutoSuspend: Make sure we send a LeaveStandby event ASAP (#9173)
Even in corner cases where we're woken up without user input (e.g., rtc alarm).

(Followup to #9124)
2 years ago
poire-z c825d50c8f CRE: add "CJK width scaling" option
The setting is handled like all other bottom menu options
but, as it's really not useful and its target audience is
very limited, make it not shown in the bottom menu, but
available via another button in the (also quite not useful)
Word Expansion fine tuning widget.
2 years ago
poire-z f29ee8475e Style tweaks: add "Tailor widths and text-indent for CJK"
Also add a timeout to the "Changed language for
typography rules" InfoMessages.
2 years ago
weijiuqiao e1b137339c
[feat, plugin] Vocabulary builder (#9132)
Made the old dictionary lookup history into a flashcard-ish vocabulary builder.
2 years ago
zwim 5a033f1221
DateTimeWidget: don't make ":" and "/" translatable (#9145)
* And the ellipsis
2 years ago
NiLuJe ae5b2d68ca
AutoSuspend: Don't send LeaveStandby events from a zombie plugin instance (#9124)
Long story short: the LeaveStandby event is sent via `tickAfterNext`, so if we tear down the plugin right after calling it (in this case, that means that the very input event that wakes the device up from suspend is one that kills ReaderUI or FileManager), what's in UIManager's task queue isn't the actual function, but the anonymous nextTick wrapper constructed by `tickAfterNext` (c.f., 
https://github.com/koreader/koreader/issues/9112#issuecomment-1133999385).

Tweak `UIManager:tickAfterNext` to return a reference to said wrapper, so that we can store it and unschedule that one, too, in `AutoSuspend:onCloseWidget`.

Fix #9112 (many thanks to [@boredhominid](https://github.com/boredhominid) for his help in finding a repro for this ;)).
Re: #8638, as the extra debugging facilities (i.e., ebb81b9845) added during testing might help pinpoint the root issue for that one, too.

Also includes a minor simplification to `UIManager:_checkTasks`, and various other task queue related codepaths (e.g., `WakeupMgr`) ;).
2 years ago
hius07 e336983fd2
Cloudstorage WebDAV: more fix slash in server address (#9128)
Honor server addresses with or without trailing slash.
Regression since #9061. Closes #9125.
2 years ago
zwim d5d5867d4e
DoubleSpinWidget, SpinWidget: add units, make usage more consistent (#9046) 2 years ago
yparitcher 8f316b1e8c
Merge `discardEvents` & `inhibitInput` (#9065)
Rename `discardEvents` to `inhibitInputUntil`
only discard Input events
2 years ago
yparitcher a97dbb05ed
Page turn animations: add to dispatcher (#9123)
xref: https://www.mobileread.com/forums/showthread.php?p=4224443&postcount=1119
2 years ago
hius07 f2c3fd54a1
filemanagershortcuts: fix adding the first shortcut (#9107)
Closes #9105.
2 years ago
zwim 84dd58f9df
Power-savings in readerdevicestatus: Schedule on full minute and fix multiple scheduling. (#9032) 2 years ago
NiLuJe 60b043ebe9
ReaderFooter: Refresh the footer on frontlight state changes issued by the frontlight widget (#9084)
c.f, https://www.mobileread.com/forums/showpost.php?p=4220159&postcount=7
2 years ago
poire-z f286787ff5 ReaderPageMap: fix page labels in 2-columns mode
Page labels on the right page could have some bad y position
(they were never above the last page label on the left page)
2 years ago
Philip Chan d6ff983243
Show TitleBar left and right buttons on non-touch devices (#9041)
Titlebar button navigation in menu, including ListMenu and MosaicMenu in FileManager, History, Favourites and Shortcuts.
Hide show password checkbox in non-touch devices
2 years ago
zwim 9b9cfe29a4
[feat] Replace TimeVal (RIP) with time, fixed point time seconds (#8999) 2 years ago
yparitcher 54ead5fc88 Page turn animations
Kindle PW5 (MTK) with hardware support
Currently only in Crengine
2 years ago
hius07 9de0df81da
Cloudstorage WebDAV: fix leading slash for root folder (#9061) 2 years ago
NiLuJe 86c35ad066
A host of low power states related tweaks (#9036)
* Disable all non power management related input during suspend. (This prevents wonky touch events from being tripped when closing a sleep cover on an already-in-suspend device, among other things).
* Kobo: Use our WakeupMgr instance, not the class.
* WakupMgr: split `removeTask` in two: 
* `removeTask`, which *only* takes a queue index as input, and only removes a single task. Greatly simplifies the function (i.e., it's just a `table.remove`).
* `removeTasks`, which takes an epoch or a cb ref, and removes *every* task that matches.
* Both of these will also *always* re-schedule the next task (if any) on exit, since we can have multiple WakeupMgr tasks queued, but we can only have a single RTC wake alarm set ;).
* `wakeupAction` now takes a `proximity` argument, which it passes on to its `validateWakeupAlarmByProximity` call, allowing call sites to avoir having to duplicate that call themselves when they want to use a custom proximity window.
* `wakeupAction` now re-schedules the next task (if any) on exit.
* Simplify `Kobo:checkUnexpectedWakeup`, by removing the duplicate `WakerupMgr:validateWakeupAlarmByProximity` call, now that we can pass a proximity window to `WakeuoMgr:wakeupAction`.
* The various network activity timeouts are now halved when autostandby is enabled.
* Autostandby: get rid of the dummy deadline_guard task, as it's no longer necessary since #9009.
* UIManager: The previous change allows us to simplify `getNextTaskTimes` into a simpler `getNextTaskTime` variant, getting rid of a table & a loop.
* ReaderFooter & ReaderHeader: Make sure we only perform a single refresh when exiting standby.
* Kobo: Rewrite sysfs writes to use ANSI C via FFI instead of stdio via Lua, as it obscured some common error cases (e.g., EBUSY on /sys/power/state).
* Kobo: Simplify `suspend`, now that we have sane error handling in sysfs writes.
* Kobo.powerd: Change `isCharging` & `isAuxCharging` behavior to match the behavior of the NTX ioctl (i.e., Charging == Plugged-in). This has the added benefit of making the AutoSuspend checks behave sensibly in the "fully-charged but still plugged in" scenario (because being plugged in is enough to break PM on `!canPowerSaveWhileCharging` devices).
* AutoSuspend: Disable our `AllowStandby` handler when auto standby is disabled, so as to not interfere with other modules using `UIManager:allowStandby` (fix #9038).
* PowerD: Allow platforms to implement `isCharged`, indicating that the battery is full while still plugged in to a power source (battery icon becomes a power plug icon).
* Kobo.powerd: Implement `isCharged`, and kill charging LEDs once battery is full.
* Kindle.powerd: Implement `isCharged` on post-Wario devices. (`isCharging` is still true in that state, as it ought to).
2 years ago
hius07 74d0d22a15 readerhighlight: keep highlight for default action 'Translate' 2 years ago
zwim 71f6bd8ba5
ReaderFooter: Make setDirty happy (#9005)
Don't pass a non-window-level widget.
Painting is handled explicitly via widgetRepaint, so passing a widget to setDirty was just plain wrong anyway ;).
2 years ago
Philip Chan 77accf6546
Non-touch: highlight movement improvement and enable page crop (#8947) 2 years ago
poire-z 814f42cce0 UIManager:discardEvents(): use accurate "now"
Instead of UIManager possibly staled _now, which could have
no effect after a long ReaderRolling re-rendering.
Also lower the delay after such ReaderRolling re-rendering,
so we can change settings quicker when comparing renderings.
2 years ago
zwim eaa6e77398
Status bar: fix battery display (threshold with aux battery) (#8959) 2 years ago
zwim d820dd84d6
Readerview: fix checkAutoSaveSettings() with enabled standby (#8961) 2 years ago
zwim 158f4be724
Autosuspend: add autostandby (#8815)
Allows the device to go into standby (if available in `/sys/power/state`) to save power.
Adds an entry in the device menu to tune the timeout for standby.
(Shows total standby- and suspend-time in system statistics.)
2 years ago
lennonhill eb34fbb818
PDF: align page view with target when following internal link (#8907) 2 years ago
zwim 8f3e9a5a61
UserHyph: Scrub and sort user dict (#8863) 2 years ago
Philip Chan 9f755dd202
[NT] Hide "Start content selection" and "Select on text" menu item on touch devices (#8914)
only center hold_pos and highlight indicator position with crengine document which has stable screen position
2 years ago
Frans de Jonge 0fe3a9d19c
[i18n] Add context to book status filter options (#8906)
Fixes #8903.
2 years ago
NiLuJe 217a73f3c0
Initial Kindle PW5 support (#8856)
* Rejig frontlight warmth API to more closely match the existing API, and, hopefully, clarify some of its quirks, and reduce boilerplate and duplicate code in platform implementations.
* Tweak Kindle:setDateTime to prefer using the platform's custom script, as in interacts better with the stock UI. And make the fallbacks handle old busybox versions better.
* Add Kindle PW5 support ;).
* Add warmth support to the Kindle platform.
* Random TextBoxWidget cleanups: make sure we immediately free destroyed instances.
* FrontLightWidget: Refactor to make it slightly less obnoxious to grok and update; i.e., separate layout from update, and properly separate brightness from warmth handling. Move to simpler widgets instead of reinventing the wheel.
* TextBoxWidgets: Implement `setText` to match TextWidget's API, as some callers may be using the two interchangeably (i.e., Button).
* NaturalLightWidget: Make sure we pass a string to InputText
* InputText: Add debug guards to catch bad callers not passing strings ;).
2 years ago
Philip Chan 36fc981b7c
Non-touch: fix crash when expanding ToC (#8892) 2 years ago