Commit Graph

3323 Commits (master)

Author SHA1 Message Date
melyux 8b99c50b2d
Duration format: add "Letters" format (1h30m10s) (#9924) 1 year ago
Melik 9e7e68beb6 Shorten status button names 1 year ago
NiLuJe 96850c23a0
NetworkMgr: Refine isConnected check (#10098)
Much easier to deal with thanks to the cleanup work done in #10062 ;).

* `carrier` is set to 1 as soon as the device is *administratively* up (in practice, as soon as we run `ifconfig up`). This is perfectly fine for `isWifiOn`, but absolutely not for `isConnected`, because we are not, actually, connected to *anything*, no attempt at associating has even been made at that point. Besides being semantically wrong, in practice, this will horribly break the connectivity check, because it expects that `isConnected` means we can talk to at least the LAN.
* Delving into the Linux docs reveals that `operstate` looks like a better candidate, as it reflects *operational status*; for Wi-Fi, that means associated and successfully authenticated. That's... closer, but still not it, because we still don't have an IP, so we technically can't talk to anything other than the AP.
* So, I've brought out the big guns (`getifaddrs`), and replicated a bit of code that I already use in the USBNetwork hack on Kindle, to detect whether we actually have an IP assigned. (Other approaches, like `/proc/net/route`, may not be entirely fool-proof, and/or get complicated when IPv6 enters the fray (which it does, on Kobo, Mk. 8+ devices are IPv6-enabled)).

TL;DR: Bunch of C via ffi, and `isConnected` now returns true only when the device is operationally up *and* we have an IP assigned.

Pulls in https://github.com/koreader/koreader-base/pull/1579 & https://github.com/koreader/lj-wpaclient/pull/10
1 year ago
hius07 03454a89d8
Screensaver: correct access to doc settings (#10105) 1 year ago
yparitcher d60c75e00d network: Allow auto_wifi_off on kindle & remarkable
They expose a network sysfs entry so we can track usage

Works for me on kindle, but i stop the amazon framework
1 year ago
yparitcher 0e53631f48 NetworkManager: isWifiOn isConnected consistent usage.
cervantes kindle kobo remarkable: use sysfs carrier file to determine connection state

cleanup hasWifiManager checks

gateway check: use ip if available

Fixes: #10087
Closes: #10092
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
zwim 4e944dc918 patch management
Use texteditor if available

Auto disable if patches folder doesnt exist

And show a restart message after file edit

Sort menu entries in execution order

Warning sign for failing patches
1 year ago
zwim c5997a6246
[Document] Consistent menu entries in auto-save menu (#9995) 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
Frans de Jonge 1faf0a1786 OTAManager: pick the right binaries on Android x86_64 1 year ago
Frans de Jonge c713df1dc7 OTAManager: pick the right binaries on Android aarch64 (arm64) 1 year ago
NiLuJe 92ebed577b OTAManager: Pick the right binaries on Kindles running on the Bellatrix
platform

Re: https://github.com/koreader/koreader/pull/4539#issuecomment-1411707712
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
yparitcher 747c3eaf9d
Kindle: NetworkMgr: isWifiOn isConnected (#10059)
isWifiOn for kindle currently returns if the interface is connected, change this to doing what is says isWifiOn the file is only present if the wireless interface is up.

isConnected pings the gateway, rely on the kernel for a more reliable check.

Whan connecting to my android phone's wifi hotspot to remote debug from my phone, the network is connected yet the phone(gateway) does not respond to pings leading koreader to shut down the connection thinking it is unsuccessful
1 year ago
Mnkach 730857fc5e
Keyboard: add Ukrainian virtual keyboard (#10037) 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 bb900aa9a7
WakeupMgr: Explicitly invalidate the current alarm in unsetWakeupAlarm (#10032)
Apparently, toggling the rtc interrupt doesn't quite work on some boards? (fix #10031)

(Drive-by tweak to UIManager: Less confusing logging when quit gets tripped both via quit
and _gated_quit (i.e., on poweroff))
1 year ago
Frans de Jonge 1699711a0b
[i18n] Enable Farsi (#10017)
Cf. <https://github.com/koreader/koreader/discussions/10016>.
1 year ago
poire-z abbcd4ddbe
Exit menu: restore long-press to exit directly (#10000)
Unwillingly removed by 8ef426d79.
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
hius07 a8b333e4f9
Dictionaries: add Ukrainian explanatory dictionary (#9982) 1 year ago
poire-z bbbcdffd3b ButtonTable: reset MovableContainer state on button tap
Prevent any later hold_release event from being handled
by MovableContainer as a moving touch+hold_release.
This issue was noticable when closing DictQuickLookup
with long-press on close, resulting in the movable
highlight actions ButtonTable moving to where the
long-press happened.
1 year ago
georgeto cbe7775bc8
CheckMark: Fix on tap toggling of checkmarks in SortWidget (#9941)
The x and y coordinates of SortItemWidget's checkmark widgets were not updated, thus remained at their initial value 0.
Consequently the intersectWith check in SortItemWidget:onTap always evaluated to false, resulting in taps on checkmarks in the sort widget not being recognized.

Co-authored-by: NiLuJe <ninuje@gmail.com>
1 year ago
NiLuJe 554520463d ScreenSaver: Get rid of gratuitous complexity
Screensaver isn't instantiated, so we don't really have any reason to go
through fancy class trickery to do this (as cool as it looked ;p)...
1 year ago
NiLuJe 9eac47e0df ScreenSaver: Refactor gesture lock to behave regardless of configuration
Go through a dedicated sticky invisible widget instead of piggybacking
on ScreenSaverWidget, so that we behave if there are other InputContainers
in ScreenSaverWidget, or if there isn't any ScreenSaverWidget at all.

Fix #9911, fix #9955
1 year ago
hius07 6e1683e313
KOSync: use MultiInputDialog instead of LoginDialog (#9962) 1 year ago
weijiuqiao 89af6d9385
KVPage: fix crash from empty page due to item deletion (#9974)
Fixes #9972.
1 year ago
zwim 54a105c24f
TouchMenu: simplify/remove enabled_func in some cases (#9966) 1 year ago
NiLuJe d6ec148548 CenterContainer: Use an elseif instead of two ifs checking the same
variable
1 year ago
NiLuJe 78a21a0ecc WidgetContainer: Nitty cosmetic tweak 1 year ago
NiLuJe 3743229ffe TextWidget: Feed Geom a full-size table in getSize()
Might save a realloc down the line.
1 year ago
NiLuJe 04c8bc903e IconButton: Fix RTL highlighting
I'm not *quite* sure what's responsible for inverting the padding
values, since the only Widget I can see doing that is FrameContainer,
and I can't find any in that Widget chain, but, oh, well.

Easily reproducible with the FileManager's TitleBar left/right buttons
(i.e., Home & Plus).
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
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
NiLuJe f6421abab0
Calibre: Log errors on wireless connection failures (#9914)
Also, get rid of the weird and clunky `failed_connect_callback` thingy, because it makes no sense?

Re: #9908
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
melyux e3f6404eb2
Screensaver: tweak "Screensaver message" description text (#9909) 1 year ago
NiLuJe 649af0be59 Startup: Unbreak last_file when the file is missing
Fix #9887, likely a regression since #9669
1 year ago
melyux 6c2d5c66da
Add linear flow wisdom to screensaver message magic variables (#9905)
If there are hidden flows, this calculates the current page, total pages, percent, time left in chapter, and time left in the magic variables used in screensaver message only for the current flow. If there are no hidden flows, the behavior is the same as before.
1 year ago
hius07 05cd59ebe5
ReaderBookmark: indicate current page with dimmed page numbers after current (#9872) 1 year ago
Frans de Jonge e026598f72
TouchMenu: menu search without patterns (#9884)
See <https://github.com/koreader/koreader/pull/9876#issuecomment-1340090208>.
1 year ago
Frans de Jonge e58a12ba04
TouchMenu: Search menu to search the menu (#9876)
Fixes #9800.
1 year ago
zwim 57ef9e6a55 TouchMenu: Button for date&time and battery 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
Frans de Jonge b5e7ade880
[i18n] Fix Arabic translations (#9857)
They were still on the old ar_AA, notified in <https://github.com/koreader/koreader/pull/9822#issuecomment-1335439759>.
1 year ago
weijiuqiao 02c9f26f6c
Keyboard: add Chinese pinyin input-method (#9843) 1 year ago
hius07 c35140e8d2
ReaderHighlight: new icon in select mode ConfirmBox (#9830) 1 year ago
melyux 38797498da
ScreenSaver: allow battery % in screensaver message (#9810) 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
weijiuqiao efb335e195 KeyValuePage: fix key value too close when keys are short and values are long 2 years ago
Hannes Krumbiegel a23c30f862
Add dictionaries for languages with over 1000 entries on Wiktionary (#9767) 2 years ago
Khoi Le 01975366b6
Add Vietnamese dictionaries (#9783) 2 years ago
hius07 80f818e757
Button: fix long wrapped text alignment (#9778) 2 years ago
weijiuqiao 77e0ac57de
Vocabulary builder: make a word's book title changeable (#9776)
Adds the ability to re-assign which book a word belongs to
and change the name of an existing book. It can be used as
a way to regroup words and hide/show them by book.
2 years ago
hius07 71c65d18f1
Page turns: add backward tap zone width setting (#9772) 2 years ago
NiLuJe c5700b718d Android: Get rid of the Camera key hack
Unnecessary now that we have a standard mechanism to disable touch input
;).
2 years ago
NiLuJe c7f5bfb72a ScreenSaver: Handle Power button presses properly if the screensaver
lock is enabled

Fix #9744
2 years ago
NiLuJe 1ec6fb5fcf InputContainer/Dispatcher: Allow toggling touch input
This is made easier by the fact that only a single method in a single
widget actually handles Gesture, and that we barely ever overload it.
So, apply a bit of monkey-patching trickery to handle the magic :).

Fix #9695
2 years ago
zwim 48a1f53d21
[doc] RadioButtonWidget (#9733) 2 years ago
zwim 07748b0999
[UIManager] Reverse order of _task_queue (#9706) 2 years ago
NiLuJe 8e31bc8a68 ExternalKeyboard: Simplify the menu shenanigans
checked_func implies keep_menu_open anyway
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 e0bfebb0b5 FileManager: Refresh key_events handlers on keyboard hotplug 2 years ago
NiLuJe 9863a9c0bb ExternalKeyboard: Use the evdev number passed along by base to avoid sweeping the full list of input devices
This required some... creative thinking to avoid complexifying common
Input/UIManager codepaths ;p.
2 years ago
hius07 e3f134da78
KeyValuePage: enhance TitleBar (#9713)
Add left button.
Allow title centering (may be useful with the left button).
2 years ago
zwim 94d3d3b487
[timeval] RIP on All Saints Day (#9686) 2 years ago
poire-z f10ea7d339
TextViewer: allow close on any multiswipe (#9720)
Similar to most fullscreen widgets.
2 years ago
weijiuqiao 42d4056f8f
Virtual keyboard: auto releasable Shift and keypopups (#9659)
Long-press on Shift to keep it non-auto-released.
2 years ago
NiLuJe f58d1c0449
Cleanup: Track color constant name change (#9716)
* Bump base

https://github.com/koreader/koreader-base/pull/1547
https://github.com/koreader/koreader-base/pull/1548
2 years ago
Roygbyte cf643c453b
KeyValuePage: Handle nil/empty kvp arrays (#9705) 2 years ago
NiLuJe 0382e0d4c2 OTM: Handle syntax errors at *both* stages when migrating
defaults.persistent.lua

We were pcall'ing the parsing, but not the execution...
The funky Lua syntax quirks means that it is possible to pass the former
but not the latter ;).

Fix #9700, de-facto regression since #9546
2 years ago
NiLuJe dbc559c0e0 USBMS: Add a human-readable log message when entering USBMS
Because apparently people are confused by the UIManager:quit ones...
2 years ago
NiLuJe cac37ad018 Kobo: Flag all the boards similar to the Libra 2 as unreliable (Clara 2E
& Nia).

And also disable the jump marker on those, like we did for the Libra 2.
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
Borys Lykah 9b2201a438
Initial hotpluggable keyboard handling (#9540)
* Added a new plugin external-keyboard. It listens to USB events. When keyboard is plugged in or plugged out, it updates device and input configuration accordingly.
* Added new fake events UsbDevicePlugIn and UsbDevicePlugOut that are emitted when a device is connected to a book reader that plays the role of USB host. The usage of the existing events UsbPlugIn and UsbPlugOut has not changed - they are used when a reader is connected to a host. The koreader-base has a related PR for those events.
* Did a small refactoring of initialization for the modules FocusManager and InputText. They check device keyboard capabilities on their when the module is first loaded and store it. Some of the initialization code has been extracted into functions, so that we can re-initialize them when keyboard is (dis)connected.
* Initial implementation centered around text input, and tested with USB keyboards on devices with OTG support.
* Said OTG shenanigans are so far supported on devices with debugfs & the chipidea driver, or sunxi devices.
2 years ago
zwim d7c63edca6
Random optimizations (#9657) 2 years ago
zwim 31b16ba3e1
UIManager: get rid of self._running and self._run_forever (#9669) 2 years ago
weijiuqiao ad89742e9b
Keyvaluepage: better alignment (#9672) 2 years ago
hius07 1d9c81de6e
ScrollableContainer: fix 'argc' (#9680) 2 years ago
Roygbyte 724db87755
ButtonDialog: add documentation about layout (#9505) 2 years ago
sonix-github eb56948fac
Keyboard: add Slovak virtual keyboard (#9656) 2 years ago
hius07 d1abbbfdd8
Document settings submenu: add Save as default (#9643) 2 years ago
weijiuqiao 58613d66e7
UI font fallbacks: use bold fonts if present for bold (#9621) 2 years ago
NiLuJe 82b5f64178 time: Fix another subtle FP issue in split_s_us
The us part wasn't actually truncated properly.
2 years ago
NiLuJe 318d0e0ff0 UIManager: Modernize commented out debugging code
If you've ever enabled the main loop debugging, you'll know that
actually dumping the full window stack was *hilarious*.
Just print table counts, it's often good enough to debug what's
happening in the exceedingly rare cases you need this ;).
Also, it'll actually be readable, unlike the previous insanity ^^.
2 years ago
NiLuJe 390c875c80 Fix: key_events cannot be nil anymore since #9586 2 years ago
NiLuJe d2ac2ca6e7 Cleanup: Remove unused onAnyKeyPressed handlers
And simplify the few we do catch by using aliases instead of duplicated
functions;).
2 years ago
NiLuJe 78381c3afa ScreenSaverWidget: Actually enable the onAnyKeyPressed handler
Which allows us to exit the screensaver on, well, any key press ;o).
2 years ago
poire-z 3dbcccb1a8
TextViewer: correct keyboard layout after long-press on Find (#9668) 2 years ago
hius07 e3fd612518
ConfigDialog: fix a bug with default values (#9666) 2 years ago
hius07 60a16c7e00
configdialog: fix bug with default values (#9662) 2 years ago
weijiuqiao bb03cf7310
Chinese keyboard: fix harmless typo (#9633) 2 years ago
weijiuqiao effddbc1ee
zh_keyboard: make number pad symbol mode (#9654)
This PR makes zh_keyboard's number pad symbol mode instead of shift mode, so that numbers are shown when the keyboard is called expecting numeral input.
2 years ago
NiLuJe 23c410344b
UIManager: Minor code cleanup (#9641)
* Remove a check made redundant by #9617
* Bump base (https://github.com/koreader/koreader-base/pull/1538)
2 years ago
NiLuJe d9eb6e9717
Kobo: Always use open/write/close for sysfs writes (#9635)
Also simplifies a few UIManager log messages (re: https://github.com/koreader/koreader-base/pull/1537)
2 years ago
hius07 2a354912f4
buttondialogtitle: align upper borders (#9631) 2 years ago
weijiuqiao ae8156ff9e Vietnamese keyboard: TELEX method backed by generic_ime 2 years ago
weijiuqiao 6a5a13dfc8 Generic keyboard IME bump: supports auto seperation when code is unique 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
weijiuqiao 8508689cea
[feat] Add Thai keyboard (#9620)
This PR adds support for a Thai keyboard. Layout mostly copied from my phone, with difference in diacritics placements: phone has only one key for all of them, while here we have a couple more. Swipe in different directions needed for inputing them.
2 years ago
zwim 4969811c08
Optimization: Use constant folding for divisions not a power of two (#9609) 2 years ago
zwim a24548ed3f
UIManager: Optimize binary insert (#9600)
* Optimiz
2 years ago
NiLuJe 68dcc4f36c
Bump base (#9618)
* Bump base (https://github.com/koreader/koreader-base/pull/1534)
* And some fixups following #9617
2 years ago
NiLuJe 6ac7a0cd40
UIManager: Fix handling of toast widgets in sendEvent (#9617)
The ultimate goal is for toast widgets (i.e., Notification when flagged as such) to:
  * Not stop event propagation
  * Close themselves when the event was emitted by user input.

Instead of doing event filtering in UIManager, we simply overload the onGesture & onKey* handlers in Notification to do just that, and just make sure UIManager will *send* those events to toasts, but without affecting the usual semantics of top widget selection and event propagation (which is as simple as just calling handleEvent on them unchecked ;p).

Thanks to @poire-z for the brainstorming in https://github.com/koreader/koreader/issues/9594 ;).

This also happens to fix a bug in which we might have looped on the top widget twice, because of an array vs. hash mishap ;).
2 years ago
NiLuJe 2e1b40c997 ScreenSaver: When adding an overlay message to a top message, position
it *below* the top message, instead of *over* ;).
2 years ago
NiLuJe 5e6b783d27 ScreenSaver: Never inhibit the event message (reboot/poweroff), unless
specifically requested.

Using a custom message would effectively prevent the event message from
showing up, which is... bad.

(In fact, I'm half of the mind to get rid of the option to hide the
event messages, because it's a goddamned terrible idea).
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 93ae341823
UIManager: Don't lose track of the original rotation on reboot/poweroff (#9606)
And, actually, stop enforcing Portrait; Screensaver already handles
rotation as necessary depending on the exact screensaver mode.

Fix https://www.mobileread.com/forums/showthread.php?t=349522
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 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 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
NiLuJe 68b26c3a36
Keyboards/Menu: Lazy-load the layout-specific menu (#9584)
And do so only for the active layouts.

This prevents loading a potentially large amount of data without even having navigated to said menu (or having the layout enabled).
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 defd9d1e02 TouchMenu: add support for checkmark_callback
Allows having a toggable checkmark on menu items
leading to a sub-menu.
2 years ago
weijiuqiao 24edbe162f Vocabulary builder: support manually adding words to vocabulary builder 2 years ago
weijiuqiao 91e5123ff0 Chinese keyboard: character level deletion apply to the last 2 chars 2 years ago
zwim 82d1381d49
Documentation: Fix documentation of infomessage (#9577) 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
weijiuqiao 05aba404b7
Keyboard: add Chinese stroke-based layout (#9572)
Basically it uses 5 keys for 5 basic stroke types and
inputs characters by their stroke order.
See https://en.wikipedia.org/wiki/Stroke_count_method
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
hius07 46f729c248
ConfigDialog: show button with default values in spinwidgets (#9558) 2 years ago
hius07 46cdf8ed78
TextViewer: add navigation buttons (#9539) 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
hius07 45e4f38c41
CloudStorage: remove cloudmgr (#9532)
Use downloadmgr instead.
2 years ago
NiLuJe 38919c22eb
ImageViewer: Clamp zoom factor to sane values (#9529)
Should avoid egregious values that would potentially alloc insanely large buffers (and likely fail to do so).

In the process, tweak the scale_factor computations when zooming so as to produce slightly less annoying behavior.
2 years ago
hius07 b81a407690
Profiles: add QuickMenu (#9526) 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
Hannes Krumbiegel 29985c9c5c
Add Russian Wiktionary dictionary (#9517)
This adds a Russian-Russian dictionary that I created, extracted from Wiktionary.
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 e89d856ad9
textboxwidget: add math.floor (#9516) 2 years ago
hius07 56388aa491
TextViewer: add Find (#9507) 2 years ago
poire-z c3cd88e019 Wikipedia EPUBs: keep math SVG images 2 years ago
poire-z 8ff55b9c94 RenderImage: use crengine to render SVG image data
Mostly only used when rendering cover and wikipedia images.
Our SVG icons are still rendered with renderSVGImageFile()
and libkoreader-nnsvg.so (NanoSVG).
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
zwim 6f5c229c90
[UIManager] Outsource device specific event handlers (was: some nits) (#9448) 2 years ago
zwim d972b7fcfa
[core] Remove a bunch of superflous semicolons (#9449) 2 years ago
NiLuJe 96930f230f
Add "Invert page turn buttons" to Dispatcher (#9494)
Fix #9492
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
Alex Cabal 39b0ca2f36
Update Standard Ebooks OPDS URLs to new URL (#9371) 2 years ago
Hannes Krumbiegel e7ec729adb
Update Czech-English Dictonary with inflections (#9370) 2 years ago
NiLuJe e3228abb19 ScreenSaver: On race-y platforms, only force a refresh on close if the
widget was actually closed *immediately*.

If it's delayed (by time, tap or gesture), leave it alone.

Fix #9285
2 years ago
poire-z 9cba1904ee
CRe, MuPDF, PicDocument: add support for WebP images (#9402)
Bump base, includes:
- thirdparty/luasec 1.2.0
- Bump NanoSVG: various small fixes
- Add thirdparty/libwebp and ffi/webp.lua wrapper
- MuPDF: add support for webp images
- bump crengine: add support for webp images
- thirdparty/harfbuzz 5.1.0
RenderImage:renderImageData(): render webp images
with ffi/webp.lua.
2 years ago
poire-z d352579d06
BookMap: allow tap on ToC titles and outside page slots (#9400)
This helps jumping to page when ToC chapters are short
and the bookmap page rows narrow.
Also fix crash when invoking BookMap and PageBrowser
on a PicDocument (considered DocLess by Statistics).
2 years ago
weijiuqiao 30915546f0
vocabbuilder.koplugin: always show more button, add book filtering (#9393)
Always show more button instead of delete regardless of review count per #9383.
Adds book filtering per #9256 (from menu or by swiping up).
2 years ago
zwim 70642ba040
Bottom Menu: fix contrast has no units (#9392)
This should fix https://github.com/koreader/koreader/pull/9205#issuecomment-1200130686
2 years ago
hius07 460d42293a
PathChooser: add creating folder (#9354) 2 years ago
hius07 bff1e8deb7
InputText: fix 'number' hint (#9362)
When input_type == "number" convert the hint to "string" type.
Closes #9359.
2 years ago
poire-z b6f951e523
Screensaver: add option to require a gesture after resume (#9316) 2 years ago
poire-z 3fd550bd50 TouchMenu: don't allow swipe south to close menu
This is mostly needed because opening the menu with swipe
is actually done by handling a pan south event, and so the
final swipe event is another event, that is then handled
by TouchMenu, which would straight away close itself.
2 years ago
poire-z eb883b8a94 TouchMenu: add swipe south to go back to parent menu 2 years ago
poire-z 937dfc682d Style tweaks: add In-page footnote font size and fix-up tweaks
Should help fixing many footnotes text size and layout issues
without having to hack a Book style tweak.
2 years ago
poire-z c782d66c18 Style tweaks: add "Reset main text font size" 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 94b76097aa Style tweaks: reorganize menu items
Make them a bit more logically grouped by topic.
Update a few priorities.
2 years ago
Frans de Jonge 3ffa65d24f
[chore] NumberPickerWidget: remove stray newline in string (#9302) 2 years ago
zwim 16d35f61aa
NumberPickerWidget: add method to avoid min-max checks and input math expressions. (#9182) 2 years ago
zwim 2c952eca4d
BottomMenu: show real sizes for margins and font size (#9205) 2 years ago
yparitcher 926223c192 Kindle: enable WakeupMgr & RTC support
This is acomplished through listening for the wakeupFromSuspend
& readyToSuspend powerd events to set the RTC via lipc at the
correct time.
2 years ago
NiLuJe c506d8b0ac
AutoSuspend: Some more fixes & cleanups (#9263)
* AutoSuspend: Use the canSuspend devcap check instead of reinventing the wheel.
* Device & UIManager: Cleanup canSuspend devcap check related stuff to avoid boilerplate code.
  (It also now defaults to no, and is explicitly set by device implementations where supported).
* AutoSuspend: Re-engage suspend/shutdown timers when fully charged.
  This restores the existing behavior pre #9036
  (c.f., https://github.com/koreader/koreader/pull/9258#issuecomment-1167672356)
* SDL: Unbreak the fake suspend behavior so that it actually works.
  Tweak the default screensaver message to remind users that Power is bound to F2.
  (Fix #9262)
* AutoSuspend: Re-engage suspend/shutdown timers on unplug.
  This matters on Kobo, because the unexpected wakeup guard might have stopped the suspend timer.
2 years ago
zwim 41e78b6ed3
userpatch: allow monkey-patching KOReader (#9104)
Supersede old android-only patch.lua.
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
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
NiLuJe 6ea292ef13 ImageWidget: Always return a bb, even on decoding failure.
(In which case we return a checkerboard pattern).

ScreenSaver: Make sure the choose image/folder/document settings
report what the code actually does on empty settings...
2 years ago
NiLuJe 35c33d5308 RenderImage: Always pcall C/FFI stuff, and return nil on error 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 def02846ec
AutoDim: Don't update footer if not necessary (#9192) 2 years ago
NiLuJe 2e681353d7 UIManager: Simplify setPMInputTimeout (from #9173)
This was originally designed for finer-grainbed control (specifically,
to correct by the amount of time spent in standby), but the final fix
only ever sets this to 0.

Simplify and rename (consumeInputEarlyAfterPM) to avoid useless computations.
2 years ago
NiLuJe 299c34a49c ScreenSaver: Ignore macOS resource forks when choosing a random image
Might help w/ https://www.mobileread.com/forums/showthread.php?t=343622
2 years ago
poire-z cc185bae4e Embedded fonts toggle: disabled if no embedded font
Have the enabled/disabled state of the toggle show the
presence or not of embedded fonts in the current book.
Also show the names of the embedded fonts in the
help_text InfoMessage.
2 years ago
NiLuJe dcb11c2542
Make luacheck >= 0.26 happy (#9174)
Re: https://github.com/koreader/koreader-base/pull/1487
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
zwim 05d51997f1
SpinWidget, DoubleSpinWidget: add units to bottom menu (#9126)
* Units to bottom menu

* add ¹’¹ to 96dpi
2 years ago
zwim f3df8923fa
Move autodim menu position (#9158) 2 years ago
zwim 84c7e33606
AutoDim: Allow to dim the frontlight on idle (#9028) 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 e1ac3c4853
Minor Input:inhibitInput followup to #9065 (#9139)
* GestureDetector: Downgrade probeClockSource log messages to debug

We're seeing a bit more of 'em between autostandby and inhibitInput now,
and the whole thing was implemented long enough ago that it's no longer
critical to see this in random non-debug logs ;).

* Input: Reset gesture state in inhibitInput

Should prevent bogus gestures when re-enabling the handlers if we were
called in the middle of gesture detection.
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
zwim d5d5867d4e
DoubleSpinWidget, SpinWidget: add units, make usage more consistent (#9046) 2 years ago
zwim 13274d6212
datetimewidget: simpler usage, allows 2 to 6 numberpickers for date and time (#9070) 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
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
zwim 617bb896f9
OTAManager: Check for update -> immediately show hourglass (#9083) 2 years ago
Frans de Jonge d09579586d
[i18n] Enable more languages (#9082)
Croatian (hr)
Finnish
Lithuanian

Georgian (ka)
Hindi
Serbian

Follow-up to <https://github.com/koreader/koreader/pull/9079>.

Croatian is 46% done, the others mostly 10-20%.
2 years ago
Frans de Jonge 8da18d403b
[i18n] Enable Latvian translation (#9079)
Cf. <https://github.com/koreader/koreader/issues/8225#issuecomment-1120181554>.
2 years ago
NiLuJe 2de2a8ab76
NetworkManager: Make sure we show an IM at the *start* of a Wi-Fi toggle action (#9064)
Ensures the worst-case scenario has minimal visual feedback.
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
yparitcher ca423f2887
Network: ToggleWiFi: check `isWifiOn` instead of `isConnected` (#9067)
Rationale from: https://github.com/koreader/koreader/pull/9064#issuecomment-1116485065

>While we are dealing with WiFi, a slight hijack, on my kindle when the WiFi is on but not connected the ToggleWiFi gesture tries to connect so i have no way of turning it off. For eample I use the gesture to turn it on, then leave the range I can't use it to turn off. I think the more direct approach would be to toggle On -> Off states so if i am disconnected and want to reconnect i can always go Off then On, but I am able to turn it off.

>TLDR: the tooglewifi gesture should check for iswififup not isconnected
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
NiLuJe 5ac9463c09
AutoSuspend: Unbreak cohabitation between standby & suspend (#9009)
* Make sure AutoStandby cohabitates nicely with AutoSuspend (regression since #8985), specifically:
* Disable standby during suspend.
* Ensure that leaving standby restores the scheduled suspend properly, with the appropriate remaining amount of time based on the last user input.
* Handle devices with an auxiliary battery better when scheduling suspend (assume it's only charging when the aux battery is charging, not the ereader's).
* Tweak debug logging to be able to remote debug corner-cases more easily without requiring code changes.
* Fix erroneous behavior when awoken from standby by something that doesn't trigger an InputEvent Event (e.g., rtc alarm, gyro, or random bullshit).
2 years ago
hius07 b4314acb2c translator: clear highlight on close if needed 2 years ago
hius07 428edf90bd textviewer: add close_callback 2 years ago
zwim af1251d83e
Manu: Fix menu entry, when no keyboards are activated (#9008) 2 years ago
Tesseract Cat e38a82453a
ImageViewer: allow browsing images list with keys (#8927) 2 years ago
Philip Chan 77accf6546
Non-touch: highlight movement improvement and enable page crop (#8947) 2 years ago
NiLuJe bd17119d07
Kobo: Disable key repeat during suspend (#8987)
Might help avoiding evdev queue overflow on misbehaving covers (#8964).

At the very least shaves a fair bit of stupid from debug logs ;o).
2 years ago
poire-z 658991ed5e SpinWidgets: keep movable position/alpha after Apply
Since eda8379e8c, on Apply, the widget is fully rebuild,
and was repositionned at its initial position (centered)
and fully opaque.
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 0808560532
getElapsedTimeSinceBoot: Honor times in suspend, too (#8983) 2 years ago
NiLuJe 61cafab0e5
AutoSuspend: Avoid unbalanced prevent/allow Suspend calls (#8970)
This prevents crashing interactions with other prevent/allow callers when the feature is disabled.
2 years ago
NiLuJe 930fa9ac1f Make sure InputText has a consistent API, regardless of hasDPad
Fix #8967
Regression since #8859
2 years ago
zwim d820dd84d6
Readerview: fix checkAutoSaveSettings() with enabled standby (#8961) 2 years ago
NiLuJe 2aa310a931
ScreenSaver: Minor refactor to avoid code duplication and weird rotation shenanigans (#8943)
* Handle said rotation shenanigans inside ScreenSaver & ScreenSaverWidget, which allows a more targeted approach; and prevents said rotation from affecting other widgets. (Also, gets rid of duplicated code).
* Handle the corner-case or exiting early from a "keep on screen for n sec" screensaver better, by unscheduling the extra refresh, since an early tap took care of that already.
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
NiLuJe 23bce343bb
ButtonProgressWidget: Make hold_callback optional (#8940)
We don't need one in FrontLightWidget ;).

Fix https://github.com/koreader/koreader/issues/8913#issuecomment-1074915143
2 years ago
NiLuJe d761b62076
FrontLightWidget: Unbreak warmth on full-granularity devices (#8935)
Fix #8913
Regression since #8856

Change tacks, to allow full granularity with the +/- buttons.
2 years ago
NiLuJe 23cd7e24bb
Minor Lua I/O cleanups (#8921)
Mostly making sure we always explicitly close io handles.
2 years ago
Utsob Roy 357bc65217
Keyboard: add Bengali Probhat layout (#8887)
Add keyboard with Bengali Probhat layout.
Bump koreader-fonts for added Noto Sans Bengali UI,
and include it among our fallback fonts.
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 4f849c23ab
Non-touch: highlight support (#8877)
readerhighlight: non-touch support
focusmanager: fix same type container share same selected field
radiobuttonwidget: non touch support
sortwidget: non touch support
openwithdialog: fix layout contains textinput, checkboxes added to layout twice
2 years ago
hius07 a6d6ba3606
Menu widget: fix no items (#8838)
Avoid showing "Page 0 of 0" in non-classic dispaly modes.
2 years ago
poire-z 831488b9e9
Bidi: keep invert() generic, handle settings in ReaderView (#8876)
Follow up to 42dd5aad. Handle settings only in
ReaderView:shouldInvertBiDiLayoutMirroring().
2 years ago
Philip Chan 107156c0a8
[feat] Non-touch improvements (#8859)
FocusManager: fix round x use y layout
FocusManager: add tab and shift tab focus navigation support
FocusManager: handle Press key by default
FocusManager: make sure selected in instance level
FocusManager: add hold event support
FocusManager: Half move instead of edge move
FocusManager: add keymap override support
FocusManager: refocusWidget will delegate to parent FocusManager
Focusmanager: refocusWidget can execute on next tick
inputtext: can move out of focus on back
inputtext: fix cannot exit for non-touch device
inputtext: fix cannot input text with kindle dx physical keyboard
fontlightwidget: add non-touch support
datetimewidget: add non-touch support
datetimewidget: fix set date failed in kindle DX, fix datetimewidget month range to 1~23 by default
datetimewidget: make hour max value to 23
multiinputdialog: add non-touch support
checkbox: focusable and focus style
virtualkeyboard: no need to press two back to unfocus inputtext
virtualkeyboard: collect FocusManager event key names to let VirtualKeyboard disable them
openwithdialog: add non-touch support
inputdialog: can close via back button
enable all InputDialog and MultiInputDialog can be close by back
keyboardlayoutdialog: non-touch support
readertoc: non touch device can expand/collapse in toc
bookstatuswidget: non touch support
keyvaluepage: non-touch support
calendarview: non-touch support
2 years ago
NiLuJe d2ee9d8d4e
TimeVal: Do a runtime check for CLOCK_BOOTTIME support (#8832)
And create a few aliases with an automatic fallback to another clock source.
2 years ago
Frans de Jonge 836a886099
[fix, i18n] Add gettext() to info text about UI fallback fonts (#8849)
Fixes #8810.
2 years ago
yparitcher 59a63c11b1
RadioButtonTable: CheckButton does not have onFocus (#8847)
Fixes #8841
2 years ago
hius07 ee593e6b17 naturallightwidget: revert movable 2 years ago
hius07 ed4290089b frontlightwidget: revert movable 2 years ago
yparitcher 73bb76f92d menu: separate indentation from text 2 years ago
yparitcher 60f68023d8 BD invert: enable for TOC BookMap & PageBrowser 2 years ago
yparitcher 42dd5aadca Bidi: add Bidi.invert() 2 years ago
yparitcher 62c6c757cc _mirroredUI do not set at require time 2 years ago
hius07 e167388e52
End of document action menu: radiomark (#8812) 2 years ago
hius07 8bb08b503a
Cloud storage: enhance download dialog, fix Dropbox uploading (#8809)
(1) ButtonDialogTitle: new method setTitle()

(2) OPDSbrowser
-use setTitle() instead of open/close ButtonDialogTitle (no visual changes to the download dialog)
-reduce logger.info output to avoid flooding crash.log

(3) CloudStorage
-enhance download dialog (similar to OPDS), much optimized code of downloadFile
-fix a bug: cannot create new folder or upload files to the root of the Dropbox storage
2 years ago
NiLuJe 35776f1f87 "Simplify" HW/SW dithering checks
Make it a real Document property, updated at init & toggle time.

Also, simplify a bunch of redundant nested lookups in ReaderView
(self.ui.view is self, self.ui.document is self.document).
2 years ago
NiLuJe afe1dc9681 Don't show SW dither toggle on devices w/ HW dithering 2 years ago
NiLuJe 3122bcd9bc KOptOptions: Allow toggling SW dithering
Fix #8748
2 years ago
NiLuJe b2ef81527b Kobo: Disable the jump marker on the Libra 2
Temporary (?) workaround for the Libra 2 EPDC race issues,
since we haven't really found any better solution,
and so far, newer kernels haven't really helped...

Re #8414
2 years ago
hius07 c7666221ec Pathchooser: add folder shortcuts 2 years ago
hius07 b02ffa7c10 RadioButtonTable: RadioButton replaced with CheckButton with RadioMark 2 years ago
hius07 e7b3952fa2 CheckButton: insert RadioMark 2 years ago
hius07 aaa3a980f3 NaturalLightWidget: insert TitleBar, movable 2 years ago
hius07 fe19ca2478 FrontLightWidget: insert TitleBar, movable 2 years ago
poire-z 5e224d541f
PageBrowser: allow changing nb of chapter levels shown (#8772)
Instead of using the depth configured in Book map, start
with max depth, and allow decreasing (and reseting when
at 0) with long-press on the (i) top left icon.
2 years ago
hius07 12344261f0
RadioMark: down shift (#8771) 2 years ago
hius07 cb7e670c4a
MultiInputDialog: do not refresh full screen on show (#8760)
Fix ugly full screen flashing on show.
2 years ago
hius07 99edc53919 BookStatusWidget: insert TitleBar 2 years ago
NiLuJe 035b24bb81 UIManager: Give more time to the kernel to figure out if we're actually
plugged in...
2 years ago
NiLuJe 0408816a54 ReaderFooter: Take the PowerCover into account in the battery level
widget

Since we only use a single icon, we have to take a few shortcuts:

* The icon itself is computed based on the average of both batteries.
* The actual value is the sum of both batteries.
* Much like everywhere else, charging means the *aux* battery charging
  (i.e., connected to a power source).

Re #8741, which does the same for ReaderHeader.
2 years ago
hius07 c1c89dd611
TouchMenu: use radio buttons for single choice menu items (#8757) 2 years ago
poire-z f764a61b69 KeyValuePage: allow for more fancy callbacks
Add support for hold_callback.
Provides kv_page and kv_item to callbacks.
Allow for item removal and refresh.
2 years ago
hius07 1c863f76aa
Bookmarks: start Add note with empty text, add some buttons (#8738)
- New button Go to bookmark in Bookmark details dialog.
- New button Latest bookmark in the popup menu.
- Empty input box for new note, new button Paste to
  paste highlighted text (auto-text).
- Allow duplicated bookmarks to avoid orphaned highlights.
- TextBoxWidget: fix enabled up-arrow on empty box in InputDialog.
2 years ago
Philip Chan 978aa2006a
FocusManager:focusTopLeftWidget(): only if hasDPad (#8737)
Focusing (highlighting/inverting) widgets should not
happen on touch devices withoud DPad.
2 years ago
zwim f2557a7aa6
Terminal emulator: full rewrite, real vt52 emulator (#8636)
New real terminal emulator, replacing the old plugin.
The emulator is basically a vt52 terminal (enriched with
some ANSI-sequences, as ash, vi and mksh don't behave well
on a vt52 term).
So far working: ash, mksh, bash, nano, vi, busybox, watch...
The input supports: tab-completion; cursor movement;
backspace; start of line, end of line (long press);
page up, page down (long press).
User scripts may be placed in the koterm.koplugin/scripts/
folder, aliases can be put in the file aliases and startup
command in the file profile.user in that folder.
2 years ago
poire-z eb5e0f9be2 BookMap: long-press on (i) to switch current/initial views 2 years ago
poire-z 95b35ec669 Allow any multiswipe to close some fullscreen widgets
For consistency with BookMap and PageBrowser widgets
where swipe south (the usual gesture to quick close)
can't be used for closing and we had to use any
multiswipe instead, allow any multiswipe to close
these other fullscreen widgets too:
Menu (ToC, Bookmarks), KeyValuePage, ImageViewer,
BookStatusWidget, ReaderProgress, CalendarView.
2 years ago
Philip Chan 3af268dd7a
Non-Touch: improve bottom menu usability (#8712)
- FocusManager: allow managing sub widgets by merging their
  "layout" in the main one; make "press" support simpler by
  handling it as a fake tap event at the center of the
  focused widget.
- Setup gestures on non-touch devices for new focus manager.
- ToggleSwitch: use child layout.
- ButtonProgressWidget: use child layout.
- SpinWidget and DoubleSpinWidget: add keyboard navigation.
2 years ago
poire-z 21932c24a2
UI font fallbacks: allow using more "Noto Sans xyz" (#8722)
Add a submenu allowing users to add Noto Sans fonts
to be used as UI fallback fonts.
Lots of them are alrady there on Android, but can be
downloaded (manually) and side-loaded by the user
on other platforms.
2 years ago
hius07 a7842d134c ja_keyboard spinwidget: no default value in description 2 years ago
hius07 2e49b780bd InputText clipboard: disable Paste if empty 2 years ago
hius07 0cdbe91e2a KeyboardLayoutDialog: insert TitleBar 2 years ago
hius07 a3e901dcd3 OpenWithDialog: movable, addWidget 2 years ago
poire-z 16e3b2f0ac Allow Backspace to work as back button 2 years ago
John Beard ccc49036aa Handle arrow keys and enter in emulator text fields 2 years ago
NiLuJe e39ee325f9 Cleverer UIManager <-> PowerD circular dependency handling
Thanks to @poire-z ;).
2 years ago
NiLuJe 2462c1c5c1 PowerD: Make sure we immediately display accurate battery capacity on
resume.

(MONOTONIC doesn't trick during suspend, so we could happily display the
pre-suspend capacity for a while).
2 years ago
poire-z 402b0cf895 Wikipedia: tweak EPUB css and footnote styletweaks
EPUB: have pages with footnotes marked as non-linear
so they can be hidden with "Hide non-linear flows".
In-page footnotes: keep the footnote number near the
left margin (a recent crengine renders them near the
text by default).
2 years ago
comphilip f468f873bd
Support non-touch device to choose file or folder (#8696)
## Background
`pathchooser.lua` does not support non-touch device to choose file or folder due to those device cannot generate long press event.

## Choose File
Non-touch device can select file in list, it is good enough to choose file without long press to confirm.

## Choose Folder
`pathchooser.lua` changes the label of current directory `.` to `Long-press to choose a folder`. It is user friendly, while for non-device, it is a very good place to let user tell the system I want the current folder to be chosen without extra long press.
2 years ago
hius07 7783d9c8e3
InputDialog: insert TitleBar (#8695)
into InputDialog, MultiInputDialog, OpenWithDialog, LoginDialog widgets.
2 years ago
NiLuJe eb0c2bfc93 Kobo: Handle a few PowerCover quirks...
* The first few capacity reads after connecting to the cover may fail

* The PowerCover may trigger spurious move/add usb_plug uevent,
which translate into Charging events for us.
Instead of blindly lighting up the charging LED on those,
check if the device is actually charging, first.
2 years ago
NiLuJe 5e3790677e OPDS: Add standard ebooks feed to existing installs
c.f., https://github.com/koreader/koreader/pull/8606#issuecomment-1008327687
2 years ago
NiLuJe dc98384177 PowerD: Add a framework to report the status of auxiliary batteries
Implement it on the Kobo Sage, for the PowerCover

TouchMenu: Display auxiliary battery status

Kobo: More accurately report the PowerCover's charging status

i.e., try to actually figure out if the auxiliary battery is charging
instead of just checking the reader's battery (because that one will
often swap between the charging and discharging state as it drains the
aux battery...).

PowerD: Use a cached timestamp when doing battery pull checks
2 years ago
poire-z 0216493c43 Wikipedia: rework wiki languages internal handling
Fix various issues with stacked Wikipedia lookup results,
and follow up lookups when invoked from Wikipedia lookup
history (where going to a search for language LL would
not use language LL when hitting "Full wikipedia").
2 years ago
poire-z dccd0da4cc Fix hold duration in text/html box widgets
Fix very-long-press in DictQuickLookup that should allow
doing the query to the other domain (dict/wiki) instead
of the current one.
Similar to 7dea979.
2 years ago
hius07 ca6d82e668
More widgets: insert TitleBar (#8683)
SpinWidget, DoubleSpinWidget, DateTimeWidget, RadioButtonWidget got new TitleBar.
2 years ago
hius07 2a244278e3
Translator: copy translation to clipboard or save to note (#8669) 2 years ago
hius07 958077364a
Filemanager: insert TitleBar (#8648) 2 years ago
hius07 5c39c19a73
[chore] Remove leftover: cface (#8659)
Ancient menu widget had it.

Not used anymore.
2 years ago
hius07 1bfb49c6a5
PathChooser: add left Home button (#8646) 2 years ago
hius07 55532b1397
Menu widget: insert TitileBar (#8639) 2 years ago
poire-z 6fd4805bd1 ImageViewer: update to TitleBar widget
Rewrite widget layout building and update logic.
2 years ago
poire-z 2d7d6fe088 TitleBar: new options for subtitle and icon rotation 2 years ago
poire-z a6b09c2981 BookMap, PageBrowser: make help_text translatable
Minor wording update.
Add a larger and thicker info.svg for their top left icon.
2 years ago
poire-z ad0454dcdf KeyValuePage, Sortwidget: fix RTL mirrored layout 2 years ago
poire-z 9e1f1f19cc Style tweaks: add "Ignore publisher line-break restrictions" 2 years ago
hius07 9f6355e0ed
SortWidget: insert TitleBar (#8627) 2 years ago
hius07 1bd7b4f088
TextViewer: insert TitleBar (#8625) 2 years ago
poire-z a1cbc3bb9e KeyValuePage: update to TitleBar widget 2 years ago
poire-z 48ca7e820c DictQuickLookup: update to TitleBar widget
Also tweak ReaderHighlight:onHoldRelease() to avoid
doing its stuff when onHold() is clearing highlight
(previous CheckButton was closing/clearing on hold
release, new TitleBar close button does that on hold).
2 years ago
poire-z 4546d826ee TitleBar: new options, dedicated close button
- Fix hold callback name
- Add options to handle long titles (truncated by default):
  "title_multines" and "title_shrink_font_to_fit" (allowing
  setTitle() with them makes the code a bit more complex).
- Add options to set bottom line color and horizontal padding.
- Use an added close.svg (based on exit.svg, tweaked to have
  similar size and baseline as other icons) for close button.

IconButton:
- handle hold/hold_release similar to Button.
- new option allow_flash to allow disabling flashing.
2 years ago
ichnilatis-gr 7163a392a8
Update el_keyboard.lua (#8622)
Adding some combinations with accents and breathings.
2 years ago
poire-z bc16b32395 Add Book map and Page browser features
- Book map: shows a map of content, including TOC,
  boomarks, read pages, non-linear flows...
- Page browser: shows thumbnails of pages.

- ReaderThumbnail: new Reader module that provides
  a service for generating thumbnails of book pages.
  It makes available these 2 new fullscreen widgets.
- ReaderBookmark, ReaderLink, Statistics: add methods
  to return new views of bookmarks, previous locations
  and read pages, that are needed by BookMapWidget.
- ReaderToc: compute TOC max_depth.
- ReaderBookmark, ReaderHighlight: send events on
  bookmark add/update/remove so thumbnails of the
  pages impacted can be trashed.
2 years ago
poire-z 2530e954a2 Add TitleBar widget
Existing widgets building their own title bar with help
of CloseButton should progressively be updated to use
this, for clarity, consistency, and less code duplication.
2 years ago
hius07 9bb096484a
FileChooser: show nb of files and subdirs in folders (#8598)
On folders, instead of "5 items", show "2 dirs 3 files"
separately (using symbols for "dirs" and "files").
Also fix: if files filtering is enabled, PathChooser did
show the full number of files in subfolders, instead
of the number of filtered files.
2 years ago
zwim 6c9e222d33
Screensaver: allow limiting stretch of covers and images (#8570)
ImageWidget: adds stretch_limit_percentage parameter.
Add support for screensaver on the emulator, for easier testing.
2 years ago
hius07 da7ef64773
Menu widget: title bar resize (#8603) 2 years ago
poire-z b35c28e8b4
[Non-Touch] Don't add touch-related menu items (#8608)
They were ending up orphaned as "New:" in the top menu first tab.
2 years ago
Frans de Jonge 6bf85483a8
Style tweaks: add in-page classic classname Polish footnotes (#8587)
See <https://www.mobileread.com/forums/showthread.php?p=4183244#post4183244> for discussion.
2 years ago
Frans de Jonge 1622822931
[chore, CI] Remove unused logger require (#8588) 2 years ago