Commit Graph

3314 Commits (master)

Author SHA1 Message Date
hius07 14de514ae8
filechooser: fix show files in bold (#10296) 1 year ago
poire-z 960671a16c PageBrowser: tweak scrolling behaviour at book start/end
Handle scroll by row or page a bit differently, so we dont
constrain and readjust the focus page when reaching book
start or end: when later scrolling in the other direction,
we'll find exactly the view as it was (this means that
we allow a single thumbnail in the view, but it's less
confusing this way).
1 year ago
poire-z 7c5c7bb9cf Calendar view's day view: thicker separator at 00:00
When using the new option "Daily timeline starts at",
make the separator line between 23:00 and 00:00 thicker.
Also tweak time picker to pick minutes by units of 10,
and remove max hour (06:00) limitation.
1 year ago
hius07 b98fee3dd0
filechooser: fix bug with "unreadable content" (#10283) 1 year ago
hius07 59a0139a60
File browser: add Folder Menu (#10275) 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 aedb713f82
Menu widget: cleanup (#10241) 1 year ago
poire-z fd0759e351 Book map, Page browser: add top left menu
Split original very long help text (which was very
slow to display) into 2 parts: About... and Available
gestures.
Also add -/+ buttons to change things (which can already
and more practically be done with swipes along the edges)
to give a bit of meat to these menus.
1 year ago
poire-z 8036ca0d56 MovableContainer: add support for anchoring initial position
When passing as 'anchor' a Geom object (ie. a widget dimen
or a ges.pos), or a function returning such an object,
a MovableContainer will be initially positionned near this
point/widget, instead of being centered on the screen.
Allow that for ButtonDialog and ButtonDialogTitle, so we
can make them behave as context menus (ie. for a titlebar
top left/right icons).
1 year ago
poire-z 25a7ca9a60 ButtonTable: allow shrinking unneeded width
If buttons and their text would fit in a smaller width,
reduce the whole ButtonTable width.
May be used for properly sized context menus with
ButtonDialog, with the width required depending on
the translations for a language.
1 year ago
poire-z a04244091f ButtonDialog/ButtonDialogTitle: consistent 'width' handling
Make these 2 widget behave similarly, and don't rely on
ButtonTable default width for their own default width.
ButtonDialogTitle: also properly size its title.
1 year ago
poire-z 7d62f639cc ButtonTable: allow buttons to request a fixed width
It is expected some button(s) in a row do not specify
such a width, so they get distributed the remaining
space from the ButtonTable specified width.
1 year ago
poire-z 02d6097dca Button: fix enableDisable when multilines
Also add support for a enabled_func() property, and
ensure its enable/disable state on each repaint.
1 year ago
poire-z e3156c7b25 FrontLightWidget: cleanup buttons layout
Properly compute Button and separator widths,
instead of using magic numbers (which lost their
magic over the years :)
Ensure buttons and progress widgets are properly
aligned on the sides.
Move the optional Warmth "Configure" button in the
middle of Warmth Min and Max.
Fix keyboard navigation layout, which was not working
on devices with Warmth.
1 year ago
poire-z f0122cf457 Button: handle 'width' as the final outer width
All our widgets are considering their provided 'width'
as the outer width, except Button which considered it
as some 'inner width', to which padding/border/margin
were added. Let's have them all consistent.
Some other widgets using Button had tweaks to account
for that odd behaviour: fix and simplify them.
Also fix Button layout when text is left aligned.
1 year ago
Frans de Jonge 1dfb766ff1
[i18n] Fix untranslated "Screensaver message" (#10217)
Reported in <https://www.mobileread.com/forums/showpost.php?p=4306749&postcount=107>.
1 year ago
poire-z 3006348585 PageBrowser: toggle page bookmark with long-press on thumbnail 1 year ago
poire-z 683452fd57 KOpt: switch page_margin to buttonprogress and fine tuning
Allow for larger margins (which may exhibit other issues
that were less noticable with small margins).
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
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
poire-z 945a1cc76f TextViewer: add support for long-press on text
As done in DictQuickLookup (more event handlers are
needed to cohabitate well with MovableContainer).
By default, selected word or text is copied to clipboard.
Also provide indexes to any long-press callback, as we'll
need them for View HTML.
1 year ago
hius07 3640842bc2
BookStatusWidget: relocate status toggle buttons (#10179)
Same order as in the new file dialog status buttons.
1 year ago
hius07 d2ed7402da
FileChooser: fix sorting and getNextFile() issues (#10176)
- Fix sorting folders when collate is "type", "size", "percentage":
  folders are sorted by name now.
- Fix getting next file in folder when collate is "mixed files and
  folders": returned nil when next item was a folder.
1 year ago
zwim efd2df6f05
Version log and (limited) notifications log (#10178)
This PR will close #1257 and #3418.
1 year ago
NiLuJe 825d812f93
Button: don't dump the widget in a debug print (#10171)
Just display its ref.

Re: https://github.com/koreader/koreader/pull/7166#issuecomment-1445177124
1 year ago
hius07 38bd768d5e
DocSettings: Move book metadata to preferred location (#10149) 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
melyux 81c0bc396a
Duration format: Add spaces, remove lead zeros for Letters (#10141)
* Add thinspaces between d/h/m/s
* Remove lead zeros
* Make letter `d` for days translatable
* Make thinspace into hairspace when compact
* Adjust and add unit tests
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
NiLuJe 5330c24b77
Device: Handle network info data gathering ourselves (#10139)
i.e., we now query routes, interfaces, wireless extensions & ping ourselves, dropping the dependency on specific CLI tools altogether.
1 year ago
ichnilatis-gr 0f3aeb7628
Keyboard: some transpositions in el_popup for practical reasons (#10144) 1 year ago
NiLuJe e79f161516 Dictionaries: Update URL for pt_PT
Fix #10134 (sorta ;p)
1 year ago
hius07 d1081fa982
Docsettings: add centralized sdr storage (#10074)
Added an option to choose a new location to save document settings, highlights and bookmarks 
(koreader/docsettings folder).
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 e4b97802a5 ImageWidget: account for alpha in the cache hash 1 year ago
poire-z 8d3cda532b MultiConfirmBox: allow changing icon 1 year ago
poire-z af1de5b6a3 TouchMenu: allow help_text on disabled menu items
Also don't propagate tap/hold on disabled menu items.
(When top and bottom menu displayed at the same time,
tap on a disabled top menu item could active some
bottom toggle change.)
1 year ago
hius07 db9cb542e4
FileChooser: optimize sorting functions (#10091) 1 year ago
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 1 year ago
Hannes Krumbiegel a23c30f862
Add dictionaries for languages with over 1000 entries on Wiktionary (#9767) 1 year ago
Khoi Le 01975366b6
Add Vietnamese dictionaries (#9783) 1 year ago
hius07 80f818e757
Button: fix long wrapped text alignment (#9778) 1 year 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.
1 year ago
hius07 71c65d18f1
Page turns: add backward tap zone width setting (#9772) 1 year ago
NiLuJe c5700b718d Android: Get rid of the Camera key hack
Unnecessary now that we have a standard mechanism to disable touch input
;).
1 year ago
NiLuJe c7f5bfb72a ScreenSaver: Handle Power button presses properly if the screensaver
lock is enabled

Fix #9744
1 year 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
1 year 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