Commit Graph

16 Commits (master)

Author SHA1 Message Date
NiLuJe bba48fc1bf
Widgets: Unschedule timeouts on early close (#11126)
Affects Notification, InfoMessage & QRMessage

Includes a drive-by fix for Trapper interactions that have been broken for... a long while ;).
6 months ago
NiLuJe 53e6cf563a
Deal with table.pack corner-cases properly (#10350)
c.f., https://github.com/koreader/koreader-base/pull/1603 for more
details.

Re: #9624
1 year 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
NiLuJe 5c24470ea9
Logger: Use serpent instead of dump (#9588)
* Persist: support serpent, and use by default over dump (as we assume consistency > readability in Persist).
* Logger/Dbg: Use serpent instead of dump to dump tables (it's slightly more compact, honors __tostring, and will tag tables with their ref, which can come in handy when debugging).
* Dbg: Don't duplicate Logger's log function, just use it directly.
* Fontlist/ConfigDialog: Use serpent for the debug dump.
* Call `os.setlocale(C, "numeric")` on startup instead of peppering it around dump calls. It's process-wide, so it didn't make much sense.
* Trapper: Use LuaJIT's serde facilities instead of dump. They're more reliable in the face of funky input, much faster, and in this case, the data never makes it to human eyes, so a human-readable format didn't gain us anything.
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
yparitcher 2fe5ab0e7a
Trapper: fix doc (#8539) 2 years ago
NiLuJe fe10d0bce5
Revamp flash_ui handling, once more, with feeling ;) (#7262)
* Simplify flash_ui handling (by handling the unhighlight pre-callback, c.f., #7262 for more details).
* UIManager: Handle translucent window-level widgets (and those wrapped in a translucent MovableContainer) properly in setDirty directly, making sure what's *underneath* them gets repainted to avoid alpha layering glitches. (This was previously handled via localized hacks).
* Update UIManager's documentation, and format it properly for ldoc parsing, making the HTML docs more useful.
* ReaderView: Reinitialize the various page areas when opening a new document, to prevent poisoning from the previous document.
* Event: Handle nils in an event's arguments.
* CheckButton/RadioButton: Switch to simple inversion to handle highlighting
* CheckButton: Make the highlight span the inner frame's width, instead of just the text's width, if possible.
* AlphaContainer: Fix & simplify, given the UIManager alpha handling.
* MovableContainer: When translucent, cache the canvas bb used for composition.
* Avoid spurious refreshes in a few widgets using various dummy *TextWidgets in order to first compute a text height.
* KeyValuePage: Avoid floats in size computations.
3 years ago
poire-z 6205f26047 Dict, Trapper: prevent dismissal by past events
Add UIManager:discardEvents(), to allow dropping events
for a period of time.
Default duration of 600ms on eInk, 300ms otherwise.
Used when showing the dict result window, so that a tap
happening just when it's being shown won't discard it.
Used with Trapper:confirm()/:info(), to avoid taps made
in a previous processing to dismiss (and so, select the
cancel action) a ConfirmBox not yet painted/visible.
3 years ago
ezdiy fd31bcc5fd
Make UIManager track prevent/allowStandby state. (#6558)
Conversely, Trapper and plugins report standby interruptibility.
4 years ago
Frans de Jonge a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.

Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:

```sh
ldoc --tags todo,fixme *.lua
```

However, whether that particular usage offers any advantage over other search tools is questionable at best.

* and some random beautification
5 years ago
poire-z a82d7832b9 Dict lookups: have them always interruptible
They should be now interruptible when fuzzy search is disabled
and on Android.
5 years ago
poire-z 43a6cf4b2e Add MovableContainer: allow moving some widgets (#3636) 6 years ago
poire-z 0ef948f60d Trapper: adds dismissableRunInSubprocess() + new TrapWidget
New TrapWidget: invisible full screen widget for catching UI events. Can
optionally display a text message at bottom left of screen (ie: "Loading..."),
used by default by Trapper:dismissable functions when no widget provided.
Added Trapper:dismissableRunInSubprocess() to run a lua function in
a sub-process, allowing it to be dismissed, and returns its return
value(s).
6 years ago
poire-z 69ec6c07c5 Wikipedia Save as EPUB: fix some wiki links and speedup download (#3551)
- Fix links to wikipedia pages containing '?oldid=123', that
  wouldn't work when used back thru the API.
- Make external links to other wikipedias with a different langage
  work (they didn't work when non-ascii page titles)
- Speedup download of images by using a newly added 'fast_refresh'
  option to Trapper:info() to bypass UIManager.
6 years ago
poire-z 47139266b2 Dict lookup: allow cancelling with tap
base bumped for ffi/util.getNonBlockingReadSize(luafile)
7 years ago
poire-z de54ef5ae6 Added Trapper module, for simple interaction with UI
This module provides methods for simple interaction with UI, without
the need for explicit callbacks, for use by linear jobs between
their steps.
Uses coroutines, but their usage is hidden by a simple API.
Factored out of Wikipedia:createEpubWithUI().
7 years ago