2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
Commit Graph

4108 Commits

Author SHA1 Message Date
poire-z
aedab2d695 Dict/Wiki lookup: less text cleanup on manual input
Don't cleanup input text as much when entered manually
(or when it's sane) than when coming from book text
selection.
This may allow looking up words like "-suffix", or
do more precise Wikipedia queries.
2021-01-02 11:50:32 +01:00
NiLuJe
5756f1f43e
LuaJIT on Android fixes (#7094)
* Don't flag Android as should_restrict_JIT

And allow disabling the C blitter, to put the workaround to the test...

* Add a -d, --debug flag to the log function

Catches KOReader's debug, as well as (our) dlopen & luajit logging

* Bump android-luajit-launcher

https://github.com/koreader/android-luajit-launcher/pull/283
https://github.com/koreader/android-luajit-launcher/pull/282

* Bump base

(https://github.com/koreader/koreader-base/pull/1279)
2021-01-02 03:00:39 +01:00
NiLuJe
a5468ba385 Fix opacity of the dictionary window
Brainfart from 6162c287e8

Forgot to zap the original UIManager:show(), so we were stacking two
identical widgets on top of each other, which obviously affected alpha.

Re #7029
2021-01-01 13:35:10 +01:00
Jason Benwell
32b28c0b80
Footer: add "Pages left in book" as footer item (#7047) 2020-12-31 23:48:16 +01:00
poire-z
f96585ece8
htmlToPlainText(): tweak format paragraphs with indentation (#7095)
Rework dafaf966, with a tabulation instead of multiple
  to ensure a constant indentation when text
is justified.
2020-12-31 23:23:05 +01:00
poire-z
c98dfef7fc DictQuickLookup: various tweaks
- Rework widget layout to avoid implicit (and wrong)
  sizing, using proper padding/margins and correct
  measurements of components.
- Adjust lookup word font size so it's not smaller
  than the definition.
- Tweak small window positionning: keep it centered
  if possible, only move it to keep the highlighted
  word shown when we can.
- Large window: adjust to screen size correctly,
  leaving room for footer.
- Always have a "Close" button at bottom right.
  Former always displayed button "Follow link" will
  be added as a 3rd row in the rare case we select
  a word in a link.
- Replace "tap on lookup word to edit and redo the
  query" with an icon on the right: tap on it to
  edit the queries word, long-press to edit the
  current result word. Only close the current dict
  window when lookup is launched.
- Remove feature "tap on title to set current dict
  as the default dict for this document", as it didn't
  really work, and it was bad UX.
2020-12-31 13:28:08 +01:00
poire-z
b66d0be3f9 ReaderDictionary: show nothing if interrupted quickly
If interrupted quickly just after lookup launch, don't
display anything (this might help avoiding refreshes
and the need to dismiss after accidental long-press
when manipulating the device).
2020-12-31 13:28:08 +01:00
poire-z
cac7db1a1c InfoMessage: allows being drawn only after a delay
- InfoMessage: add an option show_delay.
- MovableContainer: avoid possible crash when
  not yet painted.
- ReaderDictionary: use show_delay=0.5 instead of
  scheduleIn(0.5n...) (a5b133da) as we need the
  InfoWidget to be known to UIManager to catch tap
  and allow interrupting lookups properly.
- ReaderDictionary: rework handling of no_refresh_on_close
  (6162c287) with proper regions comparisons
2020-12-31 13:28:08 +01:00
poire-z
dd74194e0a cre.getWordFromPosition(): fix a few issues
Drop the use of crengine's getWordFromPosition() which
is a bit unreliable: it may returns wrong coordinates,
or words from far away in the book (ie. when holding
in the margins).
Rely only on the robust getTextFromPositions() that
we already use for multi words selection.
Having good coordinates allows refreshing a smaller region
(the higlighted word, or the 2 lines if hyphenated).
2020-12-31 13:28:08 +01:00
John Beard
0e494169f2
Keyboard input in InputText (#7037)
For text input, use the SDL events, which contain the decoded
strings.

Still handle keypresses for non-text input.
2020-12-30 22:26:40 +01:00
John Beard
fca87b5b3a
UI: Clicking menu icon returns to top of menu (#7074)
Fixes: #6940
2020-12-29 23:08:49 +01:00
Glen Sawyer
3bd3493014
Fix double-pressing reMarkable 2 power button twice to wake up (#7065) 2020-12-28 19:09:10 +01:00
Glen Sawyer
578f92e424
Time-adjust on all reMarkable events, not just EV_ABS (#7066) 2020-12-28 19:08:28 +01:00
gbyl
d2379fc6e6
remarkable: poweroff.png ghosting fix (#7051) 2020-12-27 14:13:23 +01:00
Frans de Jonge
a96181d74f
Fix typo in "remove bookmark?" (#7062) 2020-12-27 14:10:43 +01:00
John Beard
12d1604a75
UI: Make button radius match default window radius (#7054) 2020-12-26 22:49:57 +01:00
NiLuJe
f1f439d08b
More Android trickery (#7059)
* Modernize jit syntax

It's built-in, no need for a require anymore.

* Flag Android should_restrict_JIT again

It's mildly helpful at putting off the inevitable.
(very, very, very, very mildly).

* Bump android-luajit-launcher

https://github.com/koreader/android-luajit-launcher/pull/281
2020-12-26 20:23:51 +01:00
Frans de Jonge
b8bed49a61
Pass dict_path to dictionary fix_html_func (#7057)
That way images can be made to work in a more generic, portable manner, such as:

```
return function(html, dict_path)
    html = html:gsub('<rref[^>]*>([^<]*%.jpg)</rref>', '<img src="'..dict_path..'res/%1">')
    return html
end
```

Cf. <https://github.com/koreader/koreader/issues/6056>.
2020-12-26 18:30:19 +01:00
yparitcher
4548ced866
Quickstart: add long press sets default (#7048)
add wiki reference
2020-12-26 12:46:14 +01:00
Frans de Jonge
53909db687
Close Lua state on all os.exit() calls (#7050)
Cf. <https://github.com/koreader/koreader/pull/7044>.
2020-12-25 16:19:16 +01:00
NiLuJe
21af9144ab
Don't paint invisible background-colored rounded corners (#7046)
* Don't paint invisible background-colored rounded corners

Made obvious when testing #7042

* Only enforce a highlight radius on buttons that don't already set a
custom one ;).

(Mostly, square buttons with a 0 radius ^^).

ffi/blitbuffer already handles radius being nil, which suits us just fine
:)
2020-12-25 00:39:13 +01:00
Frans de Jonge
dafaf966e4
htmlToPlainText(): Format paragraphs with indentation (#7027)
Cf. <https://www.mobileread.com/forums/showthread.php?p=4072308#post4072308>.
2020-12-24 15:38:18 +01:00
Frans de Jonge
ad08ce9849
OPDS: Inform and warn about downgrade attack (#7032)
Fixes <https://github.com/koreader/koreader/issues/7007>.
2020-12-24 15:37:19 +01:00
Galunid
d5103bddc3
Add fall back to text selection option to panel zoom (#6960)
* Add fall back to text selection option to panel zoom
* Add functions to allow per extension settings
2020-12-24 09:07:27 +01:00
yparitcher
b2b9b49859 ReaderActivityIndicator: fix isStub()
it was being overridden by the EventListener:new

caused by #7002

c.f. https://www.mobileread.com/forums/showthread.php?t=335886
2020-12-23 23:49:53 -05:00
yparitcher
405c48b6ea Show only 1 End Document Dialog at a time
if scrolling past the end of a document the EndOfBook event get fired once per scroll (a lot)
2020-12-23 23:43:54 -05:00
yparitcher
c3fd6ae38b Margins: allow direct input (more_options) 2020-12-23 23:42:34 -05:00
NiLuJe
d845741b15
Android: Don't mark the platform as should_restrict_JIT (#7024)
* Android: Don't mark the platform as should_restrict_JIT

And see how much stuff breaks \o/

* Prevent Android users from disabling the C blitter, regardless of the
restrict flag

* Update android-luajit-launcher

https://github.com/koreader/android-luajit-launcher/pull/278
https://github.com/koreader/android-luajit-launcher/pull/275
2020-12-24 02:37:03 +01:00
NiLuJe
09c1f35191
rM: Unbreak PowerEvents (#7043)
Most of this is scheduled with delays for reasons, so this was a stupid
idea, my bad ;).

Fix #7033
2020-12-24 02:36:05 +01:00
NiLuJe
7df60ba0e4
OPDSBrowser: Update the title during navigation (#7034)
* OPDSBrowser: Update the title during navigation

Fix #7030
2020-12-23 14:35:54 +01:00
NiLuJe
b78d9c1576
Menu: Clear path history on close (#7028)
Move the the paths table outside of the class, make it per instance instead
2020-12-23 00:24:16 +01:00
Frans de Jonge
d355e6482d
Revert ManyBooks and Flibusta to HTTP (#7031)
Cf. <https://github.com/koreader/koreader/issues/7007>.
2020-12-22 21:47:26 +01:00
NiLuJe
a15106fcc6
NetworkManager: Slightly more accurate wifi strength icons (#7020)
* Update lj-wpaclient to get more consistent link quality values out of it
* Simplify wifi strength icon selection
2020-12-21 18:48:33 +01:00
NiLuJe
f5a7541dbb
[UX] Use a full-width plus for buttons paired with a unicode minus (#7018)
U+FF0B vs. U+002B

Because otherwise it is not, in fact, the same width as the minus, which looks weird in buttons ;).

Re #3840 & #6939
2020-12-20 20:47:40 +01:00
poire-z
9f25dc75a0
IconWidget: fix user icons directory path (#7019)
Should be `DataStorage:getDataDir()` instead of `DataStorage:getSettingsDir()`.
(`koreader/icons/` instead of `koreader/settings/icons/`) https://github.com/koreader/koreader/pull/6977#discussion_r546375434
2020-12-20 20:45:55 +01:00
NiLuJe
f4e2878a3c
Implement proper alpha-blending of SVG icons (#7011)
* Implement proper alpha-blending of SVG icons

Also, instead of doing that every time, cache a pre-composited version
that matches the screen's BB type.
This is faster, and also has the advantage of making icon highlights
behave.

Jot down a few notes about corner-cases or future improvements, e.g.,
dimming icons on non-white backgrounds, and nightmode with color icons.
2020-12-19 22:34:16 +01:00
Frans de Jonge
a5b133dadc
[UX] Wait 0.5s before showing "searching for" dialog (#7012)
Fixes <https://github.com/koreader/koreader/issues/3030>.

Cross-ref to <https://github.com/koreader/koreader/pull/6998>.
2020-12-19 20:02:09 +01:00
NiLuJe
642978c97c
FileManager: Make reinit slightly less hackish (#7006)
Much like #6958 did for plugins, registering listener twice was also a
big boo-boo.

Revamp the whole thing to make it slightly less hackish.
2020-12-19 16:27:53 +01:00
poire-z
24424e505e Update UI layout code to use new SVG icons
- Add IconWidget, use it for icons instead of ImageWidget.
  Specify icons by name only, look for them (with either
  .svg or .png suffixes) in multiple directories (including
  koreader/settings/icons/ to allow customizing them).
  Don't crash when icon name not found, shown a black
  background warning icon instead.
- Don't trust the icons' native sizes: replace
  scale_for_dpi=true with width/height=DGENERIC_ICON_SIZE,
  so all icons get the same (tunable) size - except in
  a few specific use cases.
- Top and bottom menu bars: normalize, and have icons
  properly centered in them, extend vertical line
  separators up to the edges.
- TOC: adjust expand/collapse icons size to items size
2020-12-19 14:49:18 +01:00
John Beard
3b1b9fe7cb
Radius corners of more boxes (#6997)
This gives a more uniform look than having some boxes rectangular and some
with radiused corners
2020-12-19 08:25:00 +01:00
NiLuJe
9cda84ef2f Prevent Busted from blowing up on cdata finalizers by properly closing
opened documents...
2020-12-19 06:40:00 +01:00
NiLuJe
c0981a55d9 Make sure KindlePowerD's __gc metamethod will actually be called
* Via the newproxy hack.
2020-12-19 04:16:51 +01:00
NiLuJe
e2dd68bd13 RenderImage: Fix __gc handling for GifDocument
* Via ffi/__gc, as this is a plain table.
2020-12-19 04:16:51 +01:00
NiLuJe
7f6bc28eca BookInfoManager: Convert thumbnail compression to ZSTD
* Avoid the Lua string copies when compressing/uncompressing the bb
  thumbs
* Delay the statement reset so that the pointer returned by the BLOB
  query is actually usable ;).
* Re-use a ZSTD decompression context
* Store date & mtime for successfully extracted documents
  c.f., 10477501f9 (r44914917)
* Switch to user_version pragma to handle DB schema versioning
* Update file size/date on *each* extraction attempt.
  @poirez-z raised a good point, this ought to be useful to deem a file
  re-parseable after an update.
* Remove xutil
  Functionality has been moved to ffi/zlib & ffi/zstd
* Preserve settings when migrating the BookInfo DB
* Warn via InfoMessage that the DB was updated
* Only store the series name in series, and move the index in series_index
  (Column names chosen to match Calibre's).
* Handle the new series_index column in BookInfo consumers
* This allows us to get rid of the code that stripped empty decimals
  from series index in *most* places, since it's now a real Lua
  number, and the string formatting library does that magic on its
  own.
2020-12-19 04:16:44 +01:00
NiLuJe
c1496e943b util: Simplify splitFile* util functions
* Use a single match call instead of two gsubs
2020-12-19 01:54:43 +01:00
NiLuJe
d80d6dc562 Handle the BlitBuffer struct changes
* stride is now a size_t
  On some platforms, that's 64 bits, which means it's no longer
  automatically converted to a Lua number to avoid precision loss.
  Do that ourselves, because lua-serialize doesn't know how to handle an
  uint64_t cdata ;).
2020-12-19 01:54:43 +01:00
Frans de Jonge
db9b485e2d
[chore] Minor formatting fixes (#7009)
Cf. <https://github.com/koreader/koreader/pull/6992>.
2020-12-18 23:28:39 +01:00
ddvk
77ac32d4ac
remarkable2 support (#6992)
Fixes https://github.com/koreader/koreader/issues/6792
2020-12-18 23:12:34 +01:00
NiLuJe
17356bbb2a
Kindle: Make ReaderActivityIndicator a stub (#7002)
And only actually flesh it out and register it in the very few cases
where it can actually do something (i.e., old FW 5.x with KPV).
2020-12-18 18:26:58 +01:00
Frans de Jonge
608cc04622
Fix docs (#6999)
Follow-up to <https://github.com/koreader/koreader/pull/6973>
2020-12-16 07:40:57 +01:00