Commit Graph

639 Commits (9f097da4f0c9f5b1e695e61fd556b31f9030d8bc)

Author SHA1 Message Date
hius07 2fe8c3c41b
"Book description": more consistent wording (#7789) 3 years ago
hius07 0ddba3bcb6
OPDS browser: adjust book information font size (#7783)
Use the the same font size as the list of books.
3 years ago
Frans de Jonge 039947886f
Revert "Hyphenation: add custom hyphenation rules (#7746)" (#7785)
This reverts commit f25da5d0d5.
3 years ago
hius07 e66d294bce
SSH server: redesign menu; add to dispatcher (#7765) 3 years ago
zwim f25da5d0d5
Hyphenation: add custom hyphenation rules (#7746)
The hyphenation of a word can be changed from its default
by long pressing for 3 seconds and selecting 'Hyphenate'.
These overrides are stored in a per-language file, i.e:
koreader/settings/user-German.hyph.
3 years ago
hius07 d5a2df3c04
OPDS: Add a button to display an entry's content block in the download popup (#7767) 3 years ago
NiLuJe c2c20199cd
OPDSParser: Attempt to preserve data from content tags *without* breaking luxl (#7768)
Tackle the content blocks issue differently, in order to
preserve the data, which is now useful since #7767
3 years ago
NiLuJe 2c4cbd12a2 DocumentRegistry: Downgrade refcount warnings to debug logging.
It can happen in perfectly sane contexts.

CReDocument: Don't destroy internal engine data when Document just
decreased the refcount (as opposed to actually tore down the document
userdata if it were the last ref).

PdfDocument: Only write edited documents if the Doc instance was torn
down.

PicDocument: Silence some DocumentRegistry related warnings
3 years ago
NiLuJe a7f23efa65
Double tap: Update default tap zones (#7711)
Make 'em match backward & forward.
Now that we have working overrides and the gesture manager, trying to fit them in a weird superset of the top corner tapzones in a vain attempt to avoid bad interactions doesn't make much sense anymore, and just makes the Gesture Manager UI confusing.

Also make sure the corner zones override the L/R ones for double taps, like it's the case with other gestures.

Fix #7710
3 years ago
poire-z 4b6b12b799 Remove unused "pan_delayed_interval" support 3 years ago
poire-z d0165f8bd1 Fix scrolling, add inertial scroll on non-eInk devices
Add a new reader module: ReaderScrolling, that exposes
some Scrolling options to the menu (which are to be used
by and implemented in ReaderPaging and ReaderRolling
themselves) and implement some inertial scrolling logic
used by both of them.
Default to "Classic scrolling" which is the expected
behaviour on phones and tablets.
The old CreDocument buggy behaviour is available as
"Turbo scrolling" for both Paging and Rolling documents.
Added a "On release scrolling" option that might be
useful on eInk to avoid dynamic pan/scrolling.

Try to avoid bad interactions between pan and swipe,
cancelling unwanted panning if we ended up doing a
swipe or multiswipe.
3 years ago
NiLuJe a665901c51 ZSync: Flag this plugin as deprecated.
It's somewhat non-trivial, and has been unmaintained for years.
3 years ago
NiLuJe a31d944684 TextEditor: Disable on non-Touch devices
"fix" #7356
3 years ago
NiLuJe 94f708b53b BookInfoManager: Actually close the document after extraction
DocumentRegistry just decreases a ref, it doesn't close anything.

Plug the same Document leak in a few other places, and document this.
3 years ago
zwim 31e6294315
[plugin] CoverImage: Use blksize for size of cached files (#7705) 3 years ago
Frans de Jonge 0ec74612db
Fix stupid typo (#7678)
I was still thinking about 341d6ac660 I suppose.

Hat tip to @yparitcher.
3 years ago
Frans de Jonge a3575134af
Fix docs (#7674)
See https://github.com/koreader/koreader/pull/7668#issuecomment-840404170
3 years ago
Frans de Jonge 341d6ac660
[plugin] Wallabag: different timeouts for API calls vs file downloads (#7668)
Fixes <https://github.com/koreader/koreader/issues/7650>.
3 years ago
NiLuJe de6f2e84a3
FileManager/ReaderUI: Clarify the current instance accessor (#7658)
* FileManager/ReaderUI: Clarify the current instance accessor

Make it clearer that we actually store it in a *module/class* member, not an *instance* member.

Also, warn if there's a close/open mismatch.
3 years ago
NiLuJe 2635593890 Cache: Some more tweaks after #7624
* Allow doing away with CacheItem
  Now that we have working FFI finalizers on BBs, it's mostly useless overhead.
  We only keep it for DocCache, because it's slightly larger, and memory pressure might put us in a do or die situation where waiting for the GC might mean an OOM kill.
* Expose's LRU slot-only mode
  And use it for CatalogCache, which doesn't care about storage space
* Make GlyphCache slots only (storage space is insignificant here, it was
  always going to be evicted by running out of slots).
* More informative warning when we chop the cache in half
3 years ago
hius07 170629c921
[plugin] Text editor: new 'Clean text editor history' etc. (#7635) 3 years ago
hius07 752ec49c6f
FM: Make "Refresh content" an actual Event/Gesture (#7592)
* And enable it by default in the FM as the "hold on top-right corner" Gesture, instead of the onHold handler of the "+" button.
3 years ago
NiLuJe 7cb480c0fc Calibre: Invalidate the Search cache after a Wireless session
xref: https://www.mobileread.com/forums/showthread.php?t=338810
3 years ago
NiLuJe 06a273b48d Port ffiUtil.getTimestamp users to TimeVal:now()
They were all using it to compute durations,
something which is going to be more sensible
from a monotonic clock source.
3 years ago
NiLuJe 21b067792d Cache: Rewrite based on lua-lru
Ought to be faster than our naive array-based approach.
Especially for the glyph cache, which has a solid amount of elements,
and is mostly cache hits.
(There are few things worse for performance in Lua than
table.remove @ !tail and table.insert @ !tail, which this was full of :/).

DocCache: New module that's now an actual Cache instance instead of a
weird hack. Replaces "Cache" (the instance) as used across Document &
co.
Only Cache instance with on-disk persistence.

ImageCache: Update to new Cache.

GlyphCache: Update to new Cache.
Also, actually free glyph bbs on eviction.
3 years ago
NiLuJe ce624be8b8 Cache: Fix a whole lot of things.
* Minor updates to the min & max cache sizes (16 & 64MB). Mostly to satisfy my power-of-two OCD.
  * Purge broken on-disk cache files
  * Optimize free RAM computations
  * Start dropping LRU items when running low on memory before pre-rendring (hinting) pages in non-reflowable documents.
  * Make serialize dump the most recently *displayed* page, as the actual MRU item is the most recently *hinted* page, not the current one.
  * Use more accurate item size estimations across the whole codebase.

TileCacheItem:

  * Drop lua-serialize in favor of Persist.

KoptInterface:

  * Drop lua-serialize in favor of Persist.
  * Make KOPTContext caching actually work by ensuring its hash is stable.
3 years ago
NiLuJe e7acec1526 ReaderUI: Saner FM/RD lifecycle
* Ensure that going from one to the other tears down the former and
    its plugins before instantiating the latter and its plugins.

UIManager: Unify Event sending & broadcasting
  * Make the two behave the same way (walk the widget stack from top to
    bottom), and properly handle the window stack shrinking shrinking
    *and* growing.
    Previously, broadcasting happened bottom-to-top and didn't really
    handle the list shrinking/growing, while sending only handled the list
    shrinking by a single element, and hopefully that element being the one
    the event was just sent to.

These two items combined allowed us to optimize suboptimal
refresh behavior with Menu and other Menu classes when
opening/closing a document.
e.g., the "opening document" Notification is now properly regional,
and the "open last doc" option no longer flashes like a crazy person
anymore.

Plugins: Allow optimizing Menu refresh with custom menus, too.

Requires moving Menu's close_callback *after* onMenuSelect, which, eh,
probably makes sense, and is probably harmless in the grand scheme of
things.
3 years ago
NiLuJe 47cc7bb1a6 AutoTurn: Get rid of the weird settings_id hack, and use sane
schedule/unschedule pairs, like AutoSuspend.
3 years ago
NiLuJe 03d85bbf99 Terminal: Read settings at instantiation time, not loading time 3 years ago
NiLuJe b0cc940776 AutoSuspend: Unbreak scheduling & settings across instances
Plugins are loaded *once*, but torn-down/instantiated multiple times,
and sometimes in the reverse order.

As such, if we use a public function member as the scheduled task, we're
always pointing to the same function, and going from FM to RD
effectively *un*schedules it.

Instead, use an instance-specific closure, so that each instance
schedules & unschedules don't affect each other.

In the same vein, settings ought to be read at instantiation, not at
loading, otherwise, changing a setting in the FM, then switching to the
reader will not pick up the changes.
3 years ago
zwim 0d6be41c75
Better strings (#7611) 3 years ago
NiLuJe 22da527ff5
Kindle: Enable AutoSuspend plugin (#7612)
Kindles are not flagged canPowerOff, although that's technically not
entirely warranted, but sorta makes sense.

The Plugin already handles that sanely, and will only expose/honor the
suspend timer.
3 years ago
hius07 3845424808
Gestures menu optimization (#7609) 3 years ago
zwim fafc0bc678
Missed translatable (#7603) 3 years ago
zwim c8d5330631
Typo (#7601) 3 years ago
zwim 5ed272a786
Fix translation template (#7591) 3 years ago
Frans de Jonge e107aad42e
[fix] Use template 3 years ago
Frans de Jonge b81b8cfb2f
[chore] Fix typo 3 years ago
Frans de Jonge 36b40e02e7
[chore] Directory to folder (#7584) 3 years ago
zwim e4c9409f97
[plugin] Add a caching mechanism for CoverImage (#7510) 3 years ago
NiLuJe 97b81a7eb6 Menu: Don't share the `dimen` object across Menu instances (!)
The object was never re-assigned, so closing a smaller menu (e.g.,
Calibre metadata search) made the underlying one (e.g., CoverBrowser's
ListMenu) inherit the smaller dimensions...

Instead of creating the object in the Class constructor, create it in the
instance constructor (i.e., :init).

Similar cleanups in other Menu* related classes.
3 years ago
NiLuJe 3274183466 Minor Input & TimeVal cleanups
* Input: Don't create a new TimeVal object for input frame timestamps, just promote our existing table by assigning it the `TimeVal` metatable.
* TimeVal: Export (const) `zero` & `huge` TimeVal objects, because they're common enough in our codebase. (NOTE: not actually const, that's a Lua 5.4 feature ;p).
* GestureDetector: Explain the behavior of the `last_tevs` & `first_tevs` tables, and why one needs a new object and not the other.
* Speaking of, simplify the copy method for `first_tevs`, because it doesn't need to create a new TimeVal object, we can just reference the original, it's unique and re-assigned for each frame.
3 years ago
NiLuJe ea3fa5c2c7
Calibre: More QoL tweaks (#7545)
* Wireless: Optimize memory usage in StreamMessageQueue (use an array of string ropes, that we only concatenate once). Allowed to relax the throttling, making transfers that much faster.
* Persist: Add a "zstd" codec, that uses the "luajit" codec, but compressed via zstd. Since both of those are very fast, it pretty much trounces everything in terms of speed and size ;).
* Persist: Implemented a "writes_to_file" framework, much like the existing "reads_from_file" one. And use it in the zstd codec to avoid useless temporary string interning.
* Metadata: Switch to the zstd codec.
3 years ago
NiLuJe 47c59e0e5a
Persist: Add the new native LuaJIT serializer to the list of supported codecs (#7543)
And swap the Calibre metadata cache to it.
3 years ago
NiLuJe 22b9396696
Centralize one time migration code after updates (#7531)
There have been a couple of these this month, and keeping stuff that should only ever run once piling up in their respective module was getting ugly, especially when it's usually simple stuff (settings, files).

So, move everything to a dedicated module, run by reader.lua on startup, and that will actually only do things once, when necessary.
3 years ago
NiLuJe b8d0cc4c35
Calibre: Minor QoL fixes (#7528)
* CalibreMetadata: Get rid of the now useless NULL-hunt: here, this was basically looking for `rapidjson.null` to replace them with... `rapidjson.null` :?. IIRC, that's a remnant of a quirk of the previous JSON parser (possibly even the previous, *previous* JSON parser ^^).
* CalibreSearch: Update the actually relevant NULL-hunt to make it explicit: replace JSON NULLs with Lua nils, instead of relying on an implementation detail of Lua-RapidJSON, because that detail just changed data type ;).
* UIManager: Make sure tasks scheduled during the final ZMQ callback are honored. e.g., the Calibre "Disconnect" handler. This happened to mostly work purely by chance before the event loop rework.
* Calibre: Restore a proper receiveCallback handler after receiving a book, in order not to break the "Disconnect" handler's state (and, well, get a working Disconnect handler, period ^^).
* Calibre: Unbreak metadata cache when it's initialized by a search (regression since #7159).
* Calibre: Handle UTC <-> local time conversions when checking the cache's timestamp against the Calibre metadata timestamp.
* Bump base (Unbreak CRe on Android, update RapidJSON)
3 years ago
Glen Sawyer 75661abd59
Calibre - pull files from device (#7492)
Add a proper implementation of `GET_BOOK_FILE_SEGMENT`, so calibre is now able to pull files from the device.
3 years ago
NiLuJe 732ab56104 OPDS: Fix Search when the server's template is a relative path
Fix #7482
3 years ago
NiLuJe 03e9fac156
Input: Process input events in batches (#7483)
Requires https://github.com/koreader/koreader-base/pull/1344 & https://github.com/koreader/koreader-base/pull/1346 (fix #7485)

Assorted input fixes:

* Actually handle errors in the "there's a callback timer" input polling loop.
* Don't break timerfd when the clock probe was inconclusive.

Not directly related, but noticed because of duplicate onInputEvent handlers:

* HookContainer: Fix deregistration to actually deregister properly. "Regression" extant since its inception in #2933 (!).
* Made sure the three plugins (basically the trio of AutoThingies ;p) that were using HookContainer actually unschedule their task on teardown.
3 years ago
hius07 052e19ead5
Standardize search/find to search (#7398)
* Change 'Find a file' to 'File search' for consistency

There is 'File search' in the Gesture manager already.
There is 'Fulltext search' in the readermenu.
Some help text added.
3 years ago