Commit Graph

462 Commits (master)

Author SHA1 Message Date
Frans de Jonge d64e143297
[i18n] GetText: ignore fuzzy strings (#5807)
Strings are prefilled by msgmerge with closely matching ones to reduce the amount of labor required by the translator. Often the string requires only minor adjustment, making the process faster, and when the string isn't a good match it's no big deal. However, these so-called fuzzy strings shouldn't be treated as if they were actually translated.

Fixes the effect seen in <https://github.com/koreader/koreader/issues/5806>.
4 years ago
NiLuJe 283187efb7
Update fonts & add Noto Sans Devanagari UI (#5803)
* Update fonts

https://github.com/koreader/koreader-fonts/pull/11

* Add Noto Sans Devanagari UI to the UI fallback font list (fix #2895).
4 years ago
Mustafa Ali Mutlu 2736661bfc [fix, plugin] Evernote exporter only writes one documents clippings when txt export used, rest is ignored (#5774)
fixes #3690
4 years ago
Robert 73a0f2f9d1 Remove DSCROLL_MODE and DGLOBALGAMMA (#5754) 4 years ago
Robert 8a0ce98149 [UX] Footer: add option to set font size (#5736) 4 years ago
Robert dd0c6c0bb8 [UX] Footer - add option chapter markers width (#5708) 4 years ago
Robert c3a0bd4def Remove DFULL_SCREEN (#5695) 4 years ago
poire-z f488eb2bb3 util.getFriendlySize(): add option to right align
Left align by default, but allow right alignment by
padding left with spaces.
4 years ago
poire-z 04d9a557aa Use fsync() for more robust setting files saving
Bump base for util.fsyncOpenedFile() and util.fsyncDirectory().

Use these to force flush to storage device when
saving luasetting, docsetting, and history.lua.
Also dont rotate them to .old until they are at least
60 seconds old.
Also make auto_save_paging_count count right.

Also bump crengine: open (as text) small or empty files
4 years ago
poire-z 3d191490d0
Touch zones: fix loss of overrides when re-registering a zone (#5658)
Happens with "Inverse reading order", which re-registers
the Reader tap forward/backward zones and would prevent
tap menu and bookmark from working.
Before, when removing them, we would lose all the override=
set on them by other touch zones (tap menu, bookmarks...),
and so they were no more ensured after re-adding the zone.
So, make sure we don't lose that info.
5 years ago
poire-z 5541d5f5d3 bump crengine: word spacing and hyphenation tweaks
Includes:
- New option to tune word spacing: space width scale percent
- Text: look for hyphenation in more words if needed
- CSS: fix "hyphens:none" should override inherited "hyphens:auto"
- getHtml(): grab dir= and lang= attributes from upper nodes

Replace our Word Gap/Space condensing toggle/setting with
a new Word Spacing toggle/setting, made of 2 values:
- 1st number scales the normal width of spaces in all font
  (100% uses the font space width untouched)
- 2nd number applies after the 1st has been applied, and
  tells how much these spaces can additionally be condensed
  to make more text fit on a line.
5 years ago
Robert b0738960df Dictionary: add menu item to set font size (#5647) 5 years ago
Robert a96114d14a Remove DRCOUNTMAX (#5644) 5 years ago
Robert 830fc790f1 Battery stats plugin: fix and improvements (#5626)
- fix incorrectly shown awake, sleeping, charging and discharging,
- remove unneeded debug mode and logging to external file,
- prevent showing values like inf, -inf, nan in estimated times
  (we now show "n/a"), and values below zero,
- show extra confirm box when we want to reset data,
- show time in format xxhxxm instead of only pure minutes,
- check at initialization that the device was charging when it was
  turned off (battery level larger than at the time of exit).
5 years ago
Robert 2161a76ea8 fix util.secondsToHClock when hmsFormat is true (#5640) 5 years ago
Robert d93206a841 Remove DCREREADER_PROGRESS_BAR (#5641) 5 years ago
NiLuJe d8e0b1759b
Other minor frontend.util cleanups (#5629)
* Resync fixUtf8 w/ upstream
* Fix lastIndexOf desc
* Drop unichar usage, it's a crappier unicodeCodepointToUtf8 ;).
5 years ago
poire-z 4740ab1fdc
bump crengine: round FT metrics, split text drawing by script (#5628)
Includes:
- Fonts: round FT metrics instead of floor'ing them
- Fonts: switch to no hinting when native hinting fails
- Fonts: fix issue with Harfbuzz fallback font drawing
- Text: split measuring and word drawing by unicode script
- Page splitting: fix small memory leak
- Fix "background-color: black" ignored on inline elements
- Fix decoding of recent MOBI files
- Hardcoded elements list: add <font>
base/xtext.cpp: small cleanup, no logic change
5 years ago
yparitcher 6d3e7fcef6 [fix] PDF footer margins (#5620)
closes #5612 

the change in `ReaderView:recalculate()` causes the viewable page size to be calculated by not including the footer, causing the text not to get cut off.

since the page area was not drawing under the footer `ReaderView:drawPageSurround()` had to be fixed to draw the margin under the footer so when tapping the footer off the area should be dran the background color.
5 years ago
poire-z e699a1ee22 TextBoxWidget: use xtext for text shaping
Alternative code to size, split lines and draw text with
the help of the xtext Lua C module.
Enabled by default (can be disabled via an added menu
item in "Developer options").

New properties can be specified by calling widgets, only
used when xtext is used:
- lang: use specified language instead of the UI language
- para_direction_rtl: true/false to override the default
  direction for the UI language
- auto_para_direction: detect direction of each paragraph
  in text
- alignment_strict: prevent the inversion of the specified
  alignment= that is done when a paragraph direction is
  set or detected as RTL.

Also: fix possible memory leak (present even when not using xtext)
by calling :free() in onCloseWidget() like it's done in ImageWidget.
5 years ago
poire-z 22e3e34c45 TextWidget: use xtext for text shaping
Alternative code to size and draw text with the help
of the xtext Lua C module.
Enabled by default (can be disabled via an added menu
item in "Developer options").

New properties can be specified by calling widgets, only
used when xtext is used:
- lang: use specified language instead of the UI language
- para_direction_rtl: true/false to override the default
  direction for the UI language
- auto_para_direction: detect direction of each paragraph
  in text
5 years ago
NiLuJe b21b4c8776
Update nerdfonts symbol codepoints for the updated version with no PUA (#5595)
* Update nerdfonts symbol codepoints for the updated version with no PUA conflicts

Should no longer stomp on Arabic & CJK PUA stuff.
5 years ago
poire-z 6baa2af5fb
cre: use 'best' (Harfbuzz) as the default kerning method (#5553)
It might be slower, but is needed to properly display
books in arabic, indic...
Also bump crengine: use FreeType "light" hinting algorithm,
which hints on the y-axis only (and so avoid messing with
advances and kerning on the x-axis).
5 years ago
NiLuJe 61a8b63757
Minor fixes after #5537 (#5538)
* Restore '+' prefix when charging in the footer w/ letters prefixes

Regression since #5537

* Don't use a full battery icon in the menu entry

Make it clear that one isn't in-sync with the current gauge
5 years ago
NiLuJe 8d281647ae
Unify battery meters look'n feel (#5537)
* Unify battery meters look'n feel

Switch to proper (vertical) battery icons (one per 10% steps).

Fix #5535

* Bump fonts (https://github.com/koreader/koreader-fonts/pull/7)

Because we need the new symbols from nerdfonts ;).
5 years ago
Frans de Jonge b8b6abe4d4
[fix] GetText: Support Arabic plurals (#5517)
Fixes <https://github.com/koreader/koreader/issues/5516>.

Cf. <https://github.com/koreader/koreader/pull/5515>.
5 years ago
NiLuJe f2f2aa6e4d
Minor state handling tweaks when the footer is disabled/invisible (#5494)
* Don't break `doc_pages` updates when it's completely disabled. (c.f., the commit's comment, doing it on every page turn seems a bit overkill, but I get that it's probably done that way because it was easier ;)).
* Detect the empty footerTextGenerator properly in `_updateFooterText` (it's `""`, not `nil`).
* Abort `_updateFooterText` early when the footer is invisible (and has been for a while/ever, i.e., when not requesting a repaint, like a mode switch would).
* Never send `SetBottomPageMargin` events twice.
* Minor tweaks to touchmenu & configdialog to avoid useless repaints (don't redraw the reader/fm unless we absolutely need to).
* Make sure we show the progress bar alone instead of nothing when disabling the last enabled mode in the menu.
5 years ago
Martín Fernández 6082f84e13 remove unused ANDROID_FONT_DIR and update defaults.spec 5 years ago
Robert 5209493ba8 [UX] Option to show progress bar at the bottom of the screen (#5442) 5 years ago
Frans de Jonge 521c4251f6
[spec] Add ToggleSwitch spec stub (#5450)
To protect against issues like #5448.
5 years ago
Frans de Jonge e257c4e45e
[feat, Kobo] Autoshutdown (#5335)
The methods used here will likely work on most embedded devices, which is why I put them in their own WakeupMgr interface/scheduler module, separate from Kobo.

See https://www.mobileread.com/forums/showthread.php?p=3886403#post3886403 for more context.

Fixes #3806.
5 years ago
Frans de Jonge 0dad707e2e
[fix, Kobo] Don't crash trying to sync frontlight with Nickel. (#5361)
When reasonably possible, the program should only crash in debug mode.

Adds a couple of extra unit tests to prevent regressions and adds docs.

Fixes <https://github.com/koreader/koreader/issues/5356>.
5 years ago
Frans de Jonge 621f36b4a9
[fix] GetText: guard against empty strings in translation (#5301)
Fixes <https://github.com/koreader/koreader/issues/5293>.
5 years ago
Frans de Jonge ece884a368
[fix, CI] Forgot to run luacheck (#5261)
My bad.
5 years ago
Frans de Jonge 3ab51b1f85
[spec] Test all gettext codepaths & support language with no plurals (#5260) 5 years ago
Frans de Jonge 2c555830f9
[feat, i18n] Implement ngettext (#5257)
Fixes <https://github.com/koreader/koreader/issues/5249>.

See https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html and https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html for more information.

Usage:
```lua
local T = ffiUtil.template
local _ = require("gettext")
local N_ = _.ngettext

local items_string = T(N_("1 item", "%1 items", num_items), num_items)
```
5 years ago
Frans de Jonge a2dcfe9aec
[doc] Tag @todo, @fixme and @warning (#5244)
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.

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

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

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

* and some random beautification
5 years ago
Robert 5da3312869 More footer options, default to use icons as prefixes (#5203)
- show icons or letters as prefix of items
- various footer separators
- progress percentage format with decimal digits
- time in 12/24 format
- two duration formats (1:30, 1h30')
- move some options into Settings submenu
5 years ago
Frans de Jonge ec6e34cb1e
Change default zoom mode & add warning message for fit page + scroll (#5170)
* [UX] Change default zoom mode to page width

Fixes #5166.

* Warning popup for weird scroll mode combinations
5 years ago
Robert 69ee8c48cc Fix: Status bar hides text with minimal bottom margin (#5135)
With very narrow bottom margin text is sometimes hidden by status bar.
5 years ago
NiLuJe 74518c79d1
Fix Kindle model detection in some corner-cases (#5125)
* Fix Kindle model detection in some corner-cases

We were (currently) unaffected because we don't support the K1.
Still, this should be slightly more robust.
5 years ago
poire-z 9f3c85ed83 cre: toggable enhanced rendering (floats, collapsed margins...)
Adds "Render mode" toggle with 4 modes, to enable some or all
of crengine's new enhanced block rendering features.
Use "legacy" rendering for previously opened books to not mess
with bookmarks, and "web" (all of the new features) for new books.

Also make available the added "HTML5" stylesheet to the Style menu.
5 years ago
Frans de Jonge 9300a59a89
[fix] util.getSafeFilename() maximum extension length (#5067)
Strip HTML and do some semi-intelligent detection of faux extensions (i.e., more than 10 characters probably isn't one).

Fixes #5049.
5 years ago
poire-z 1657c5e412
bump crengine: hyphenation, kerning and epub.css fixes (#5043)
Includes:
- Freetype kerning: fix possible unstable rendering
- Hyphenation: fix one-letter patterns, update French.pattern
- Hyphenation: update French.pattern
- epub.css: add style for empty-line (used on text files)
5 years ago
poire-z eaeb3ec97f bump crengine: cache and text fixes, use utf8proc
Bump crengine:
- Ensure text decoration (underline) is continued over word gaps
- Invalidate TOC page numbers on rendering change
- Ensure reproducible cache files when same rendering settings
- LVBlockWriteStream: workaround to exclude fatal error
- Use utf8proc for string uppercase/lowercase/capitalize

Bump base:
Thirdparty: adds utf8proc 2.3.0 (libutf8proc.so.2)
For use by crengine, for now mostly for more complete and
accurate text-transform: uppercase/lowercase/capitalize.

Also revert test tweak (in 27ddd6f) to workaround an issue with
cre cache that should be solved by this crengine bump.
5 years ago
NiLuJe 888d3591b2
Give more control over CRe margins (#4945)
Without having to resort to weird custom defaults.

* Split the current margins setting in three:
  * Horizontal margins (because you generally want those two to be balanced).
  * Top margin & Bottom margin (because you may want to tweak those separately to deal with quirky status bar/final line shenanigans).

* Also, add a "Reclaim bar height from bottom margin" toggle to the status bar menu, to optionally make sure the status bar won't eat into the bottom margin.

* Includes a free fix to diacritics popup refresh handling in the keyboard ;).
5 years ago
Frans de Jonge 27ddd6f313
[spec] Better insulation (#4972)
Some combination of Travis and/or older Busted necessitated insufficient insulation.

Follow-up to https://github.com/koreader/koreader/pull/4970

Space condensing carried over; reset at the start of readertoc.
5 years ago
Frans de Jonge 4dc116ed6a
[fix, spec] re-enable ReaderView tests (#4970)
It's not clear to me where the value is set as expected when running all tests linearly because it doesn't seem to be ReaderFooter.
5 years ago
Qingping Hou 080c079d01 chore: add test for screen color toggle 5 years ago
NiLuJe 4005bf69aa
Slightly less crappy Nightmode (#4871)
Companion PR to https://github.com/koreader/koreader-base/pull/884
* Basically flags devices known to be stable when using PxP inversion.
* Plus, random fix for #4870 ;).
* A few FrontLight tweaks & cleanups on Kobo:
  * Moved the Kobo-specific startup status insanity to Kobo-specific init
  * Made turnOff/turnOn frontlight do a smooth ramp down/up
  * On Kobo, use turnOff/turnOn for suspend/resume, to get that smooth toggle
  * On Kobo, for NaturalLight w/ a mixer, only set warmth for setWarmth, and only set Brightness for setBrightness, otherwise, it tried to set both with not in-sync values, which made the FL widget jittery.
5 years ago
Frans de Jonge 8466af2c5b
[UX] Gesture manager: corner gestures (#4878)
Adds configuration to the top corners as well as the additional gestures hold and two-finger tap.

Deprecates `DTAP_ZONE_FLIPPING` and `DTAP_ZONE_BOOKMARK`.

Fixes #4877.
5 years ago
poire-z 5f13e68966
bump crengine: line-height: reworked implemenation (#4835)
Includes:
- Revert "line-height: fix handling and inheritance"
- Revert "line-height: switch base from 16 to 256 for more granularity"
- CSS: parse "normal" keyword length
- line-height: reworked implemenation for better conformance
- 2-pages mode: fix middle margin sizing
5 years ago
NiLuJe 645d41eda9
Add more granularity in line-height settings with CRe (#4785)
70 -> 130, in steps of 5 ;).
5 years ago
Qingping Hou 1605409c60 rename runtimectl to document/canvascontext 5 years ago
Qingping Hou 4d8da96177 fix test 5 years ago
Frans de Jonge 614cbb509d
[fix] ReaderFooter: Don't hide progressbar if it's the only ticked option (#4648)
Fixes #3914.

Cf. #3056.
5 years ago
Frans de Jonge ba4bf7243d
[chore] Deprecate TapForward/TapBackward (#4689)
Also fix previous page action in gesture manager.
5 years ago
Frans de Jonge 87b6217696
[fix, spec] readerrolling_spec: rename onDoubleTapForward/Backward to GotoNextChapter/PrevChapter (#4693)
See https://github.com/koreader/koreader/pull/4692#issuecomment-468689490
5 years ago
Frans de Jonge 89fe3e3051 [spec] Fix defaults_spec
Updated for https://github.com/koreader/koreader/pull/4691

Also the assert.is_same() argument order was wrong.
The first argument is expected, the second the real-life result.
Otherwise the error message in case of failure is misleading.
5 years ago
Frans de Jonge cd3ca88316
[spec] Even more TimeVal coverage (#4674) 5 years ago
Frans de Jonge 626d7340f3
[spec] Add more TimeVal tests (#4672)
That should please CodeCov.
5 years ago
Frans de Jonge abba7ba873
[fix] TimeVal: add dbg:guard against incorrect subtraction order (#4669)
In principle, any negative subtraction result should be caused by a logical error.
5 years ago
Frans de Jonge 8abf79b497
[spec] Add GestureDetector stub (#4614)
Cf. #4613.
5 years ago
NiLuJe 011370882f [chore] Some Wi-Fi tweaks (#4564)
* On Kobo, kill WiFi on startup if we detect an inconsistent state...

Untested, not terribly pretty.

The other solution is to slow down the Wi-Fi meny by doing the same
check for the "Wi-Fi connection" checkbox as in the later wifi_status
one...

* Don't enable auto_restore_wifi by default

It's liable to silently murder batteries for no good reason, given that
we prompt to enable WiFi by default when needed, and we otherwise have
no actual need to keep WiFi on in the background.

re #2215 (in particular, this directly contradicts @houqp in
https://github.com/koreader/koreader/pull/2215#discussion_r74696133 ;)).
5 years ago
poire-z f2a9ed0b79
bump crengine: count nb of images drawn & others (#4542)
Includes:
- Update french hyphenation pattern
- epub.css: update style for 'blockquote'
- DrawBuf: count nb of images and surface drawn

Adds Document:getDrawnImagesStatistics() to help deciding
if refresh with (possibly costly) dithering should be used
(on devices with HW dithering capabilities) with CreDocument:
when a page contains enough images to benefit from it.
5 years ago
NiLuJe d113cb9475
A few Kobo input tweaks (#4450)
* Fix the Touch input probe on Trilogy devices that depend on the touch_probe_ev_epoch_time quirk (fix #630)
* Expose a "Pageturn button inversion" feature in the Navigation menu (for all devices with keys) (fix #4446)
* Allow ignoring the accelerometer on the Forma (Screen > Ignore accelerometer rotation events; also available from the Gesture Manager) (fix #4451)
* Fix SleepCover handling on the Forma (fix #4457)
* Make isWifiOn a tiny bit more accurate (check the actual WiFi module instead of sdio_wifi_pwr)
* Move all flash related Screen options to the eInk submenu
5 years ago
poire-z 22b7f17cd8 Fix translator, enable selected text translation
Update translator.lua to use a still working google translate API.
Add a method to show translations (main and alternates) in
a TextViewer.
Re-enable "Translate" button in text selection/highlight buttons
dialog.
Target language can be set with a manually added setting:
    translator_target_language = "fr"
and will fallback to the UI language.
5 years ago
Frans de Jonge 1cba60765b
[feat] MenuSorter: add sorting_hint support (#4399)
By adding a `sorting_hint` to a menu item, the program will put orphaned items in the relevant (sub)menu instead of in the first menu with a NEW prefix.

Fixes #4393.
5 years ago
NiLuJe f020b1264a
A few Kindle fixes (#4394)
* Implement isWifiOn on Kindle (fix #4380)
* Ensure frontlight intensity is properly restored on resume on Kindle. (fix #Fix #4392)
Only actually matters when the frontlight is *off*.
5 years ago
poire-z 98c3f0d366
bump crengine: fix max image height, handle <epub:switch> (#4390)
Includes:
- (Upstream) Fix dangerous compile warnings
- Fix max image height to prevent spurious page breaks
- Hide <epub:case> in <epub:switch>, show only <epub:default>

Adds a style tweak to show <epub:case> and hide <epub:default>
for the curious person.
6 years ago
poire-z ea946d52d6 bump crengine: tables rendering improvements and others
bump crengine, which includes:
- Adds support for symbol fonts (local or embedded)
- Fix some issues when rendering text in constrained width
- Page splitting: fix possible missing blocks
- CSS: adds support for 'auto', ignore % for borders
- Fix right border drawing position
- Fix: adds missing properties in copystyle()
- Adds comments, erm_killed rendering method
- Adds getRenderedWidths(): get node min/max node content width
- Tables rendering: fixes and improvements
- getRenderedWidths: enable min_width to be a single CJK char
- Fix wrong text wrap avoid in some case
- epub.css: add style for 'blockquote'
- Fix rendering issue when line ends with an image

Adds a few style tweaks related to tables.

Enforce table width: 100% in Wikipedia EPUBs to keep
previous look, which feels better with the various kinds
of tables in Wikipedia pages.

Fix unit tests as juliet.epub (full of blockquotes), grew quite
a few pages with the epub.css update.
6 years ago
Frans de Jonge f71627cf1d [spec] Version: slight refactor 6 years ago
Frans de Jonge be32144829 [fix] Version pattern: add two extra numbers for point release
Also see #4303.
6 years ago
Frans de Jonge 42548939bc
[spec] version_spec: forget about rev and commit (#4303)
Stable doesn't have them.
6 years ago
poire-z 233f375af4 Cleanup onSetStatusLine()
Follow up to fa0117bb (#4268), to make things a bit clearer:
Only ReaderRolling get the 'SetStatusLine' event, and tells
crengine about the change, and then send the 'UpdatePos' event.
ReaderFooter now just gets a :setVisible() method.

Now, all the code that calls a self.ui.document:set* method, that
most probably triggers a full re-rendering by crengine, do signal
'UpdatePos' immediately after. This event signals that all page
number, pages count, positions... are no more valid and must be
queried or computed again.
This could also be used if we ever want to cache Page Links or
Screen Boxes: this event will have us dropped these caches.
6 years ago
poire-z fa0117bb2a Fix default not being used for View mode and Progress bar
Default setting set by holding on the bottom config buttons
for "View mode" (scroll/page) and "Progress bar" (full/mini)
were not used.

Also, when switching Progress bar from 'full' to 'mini',
show the mini bar again.
6 years ago
Martín Fernández 717184f1d6 move e-ink related settings to a submenu (#4246) 6 years ago
poire-z d8d0def122
Floating punctuation: change default to disabled (#4101)
It was enabled by default, but it's mostly only needed for CJK users.
Furthermore, when floating punctuation is enabled, some rendering
issues exist (text right alignment, variable margins...) that
only CJK developpers could really fix. So, best to disable it and
avoid these rendering issues for most users.

Also: fix CoverBrowser crash when "Delete cache database"
followed by "Prune cache of removed books".
6 years ago
NiLuJe 8089d916a5
Visual feedback around tar/zsync on Kobo during OTA updates (#4043)
* With a bonus version normalizer fix.
  * And a zsync bump/fix to avoid softlocks with OpenStack HTTP frontends (also, pull those from the OTA mirror list).
6 years ago
sebastien 71ff69ec4f cre word gap: use values from defaults.lua (#4045) 6 years ago
poire-z d8e58a08fd
bump crengine: adds support for dpi-based css units (#4040)
Adds a new toggle to the bottom menu: Zoom (dpi), which
allows for scaling CSS absolute units and image sizes.
6 years ago
Robert f372dd752b Unit tests: word gap - space condensing (#4036) 6 years ago
Robert d29a65b96e cre: add Word Gap setting to bottom config panel (#4026)
Maps to crengine's Space Condensing feature (named Word Gap
as a similar feature is named for PDF)
6 years ago
NiLuJe 2f3d1c80dd
Minimal KOA2 support (#4016)
* Minimal KOA2 support
(Touch, Screen, Battery). Hopefully :).
6 years ago
poire-z b9141897a3
bump crengine: text formatting: fix leading spaces issues (#4008)
Includes:
- text formatting: fix leading spaces issues
- new English US & GB hyph patterns
6 years ago
poire-z 9a0728e421
Style menu cleanup (#3996)
Use epub.css as the main default style, with all file formats
except FB2 (which needs fb2.css).
(epub.css has been cleaned recently to be more conforming to HTML
specs and to not include class name based styles - with conditional
compatiblity styles for previously opened documents. It should be
usable on all HTML based documents, except FB2 which has some
incompatible specs.)

Consider all shipped css files other than "epub.css" and "fb2.css"
obsolete, and put them in a sub-menu (these other css files have
not been updated in the same way, and are kept as-is for when a
previously opened document requests one of them).

Add an icon indicating which style is set as default (like it's
been done for the Font and Style tweaks menus).

Also set the font size of the full status bar (available with
cre documents) when the setting "cre_header_status_font_size"
is present in settings.reader.lua (to add manually).
6 years ago
poire-z 14e77306b7
Fix unit tests after crengine update (#3993) 6 years ago
NiLuJe e3b7524d9c Another round of Kobo Fixes (#3939)
* Trim unneeded stuff from startup script

I was somehow convinced I'd already done that...
While we're there, explain why we need to siphon those specific vars

* Fix a stray eth0

-> $INTERFACE

* Be very very sure we have INTERFACE set in our env

re #3936

* Make getFirmwareVersion less fragile on Kobo

Not that we actually use it right now, but, still. :D

* Use the same syntax as the PRODUCT check

* Actually implement getProductId

Instead of a stray c/p ^^

* Properly identify the Rev2/Mark7 variants of existing devices

Namely, the H2O² and Aura SE
Not that the H2O²r2 support is still broken, this just allows us to
implement it cleanyl without breaking handling of the original H2O²

re #3925

* Tweak sleeps a bit around Kobo WiFi modules...

See if that jog things up (re #3936)

* Try harder not to suspend with WiFi on on Kobos

Because otherwise, things go boom. (re #3936)
6 years ago
poire-z 62630706bb
bump base/crengine: stylesheet handling improvements (#3934)
Includes:
- Fix a few CSS selector issues
- CSS: add support for some pseudo-classes
- Hyphenation: update fr & de patterns
- CSS: Fix non-lowercasing of specific elements names
- Revert parts of recent BR handling fixes
6 years ago
poire-z 8b2253b3e9
bump base: crengine, freetype, libjpeg-turbo (#3928)
Includes:
- [build] FreeType: bump to 2.9.1
- [build] bump libjpeg-turbo to 1.5.3
- bump crengine:
 - Fix CSS selector specificity computation
 - [fix] crengine/src/lvfntman.cpp: improve letter_spacing limit
 - [fix] crengine/src/lvxml.cpp: add all empty HTML elements
 - html head styles: fix styles not being applied
 - Hyphenation: increase MAX_PATTERN_SIZE from 16 to 35
 - html documents: proper handling of <BR> tags
 - Allows requesting old (broken) XML/DOM building code
- cre.cpp: setStyleSheet(): accept filepath and/or css text,
  and added getIntProperty() and getStringProperty()

credocument/readerrolling: request older XML/DOM building code
for books previously opened, to not lose bookmarks and highlights

(unit tests update because of new handling of consecutive BR via css
pushed links down in the book)
6 years ago
Robert 9e67c5a614 CloudStorage: Allow use reserved characters in FTP username and FTP password (#3924)
Depends on RFC 3986 compliant util.urlEncode() and adds unit tests for the new functions.
6 years ago
Frode Austvik f12f317e9d [spec] Replace custom assert[Not]AlmostEquals with assert.is[_not].near (#3885)
Also, change "make static-check" to also check the tests.
6 years ago
poire-z 82b13a64b0
Fix overlap in scroll mode for cre documents (#3870)
Use a setting 'copt_overlap_lines' (default to 1) for the
number of text lines from previous page to show on next
page (instead of a hardcoded and unscaled 20).
Take footer height into account for overlap calculation
and dim area.
Show overlap only when changing pages (not when panning).

Also fix ReaderFooter:getHeight() which was returning
a higher height than the real one since footer refactoring.
6 years ago
Frans de Jonge 2c1178896c
[feat] Add ReaderBack (#3821)
This implements a reasonable facsimile of going back on Android.

The back button first goes back in a history of visited pages.
When there's no history left, it closes the app.

Fixes #3816.
6 years ago
onde2rock 1b91470899 [FocusManager] More intuitive key navigation + spec (#3774)
FocusManager now finds the closest widget on the right or left on inner horizontal border.

See : https://github.com/koreader/koreader/pull/3765#issuecomment-373944897
6 years ago
poire-z c93bbec40d
cre: more constrast settings (#3737)
Use ButtonProgress like it was done for kopt.
6 years ago
Frans de Jonge e15a1ab1b3
[fix, spec] InputText:addChars() unicode handling (#3729)
Also rename from `addChar` to `addChars` for clarity.

Fixes #3703.
6 years ago
Frans de Jonge 8633d4bed1
[spec] Input test stub (#3701) 6 years ago
Frans de Jonge 720fd5d826
[spec] Test all aspects of Math module (#3683) 6 years ago
Frans de Jonge ced9e45d92
[fix] DocumentRegistry: don't create empty sdr and add hasProvider() (#3675)
As suggested by @poire-z https://github.com/koreader/koreader/pull/3653#issuecomment-364663156
6 years ago
poire-z 5357fdde7c
cre full text search: fix inconsistencies (#3656)
Fix various inconsitencies: some occurences not highlighted
on displayed page; different occurences highlighted on same
page wheter we went there searching backward or forward; pages
with occurences simply just skipped when searching in one
direction, and not in the other...
To avoid edge cases, crengine will now give back results on up
to 3 pages, that we need to filter.
Bump base and crengine
6 years ago
Frans de Jonge f6ca1c7c0a
[feat] Open with: choose which engine to use for file (#3653)
Fixes #3345

* Add SVG to MuPDF filetypes
6 years ago
Frans de Jonge d714bd3aea
[feat] DocumentRegistry: add getProviders() and preferred by weight (#3651)
This is step one toward "open with".

References https://github.com/koreader/koreader/issues/3345

* Fix up some mimetypes
* Add XHTML to supported filetypes
* Add a few image files to MuPDF
	* ".bmp",
	* ".gif",
	* ".hdp",
	* ".j2k",
	* ".jp2",
	* ".jpeg",
	* ".jpg",
	* ".jpx",
	* ".jxr",
	* ".pam",
	* ".pbm",
	* ".pgm",
	* ".png",
	* ".pnm",
	* ".ppm",
	* ".tif",
	* ".tiff",
        * ".wdp",
6 years ago
Frans de Jonge 90059221db
[spec] util_spec: tests for util.getFriendlySize() (#3650) 6 years ago
Hzj_jie 65f26cecbb Do not execute background runner if device is suspended (#3608) 6 years ago
Robert 605df50fbd [fix] util.secondsToClock 00:60 should be 01:00 (#3371) 7 years ago
Hzj_jie 7461e396dd [chore] Ignore empty files and tables in DocSettings (#3348) 7 years ago
Frans de Jonge 0fa090ee47 [chore] Rework util spec, rework util.secondsToClock: round seconds to minutes in 00:00 mode + spec
Most of the tests in util_spec were the wrong way around.
It's `assert(expected, given)`.
7 years ago
Frans de Jonge 1508fe27c9 dbg_spec: setVerbose test 7 years ago
Frans de Jonge a394e644b5 Add gettext_spec stub (#3343) 7 years ago
Frans de Jonge 53c0756def CircleCI: finishing touches (#3340)
* junit test results; unfortunately this seems to conflict with the verbose out

* fix deps cache: two files can change independently

* verbose print obsoleted by gtest in upsream busted
7 years ago
Frans de Jonge 5bd288e378 [fix] #nocov on broken scroll mode tests 7 years ago
Frans de Jonge 372967bc65 [fix] MockTime spec 7 years ago
Frans de Jonge a710d2c68a Fix readerfooter_spec (#3326)
My bad, leftover from #3323 but not caught due to some Travis → CircleCI migration birth pains.
7 years ago
Frans de Jonge 6e52e559ae [fix, Android] Don't steal frontlight control on start (#3319)
I believe this should be `if isKobo()`, or better yet that the entire
block should be moved to `KoboPowerD:init()` because afaik that is the
only platform where the system doesn't provide trustworthy frontlight
information. But to be absolutely sure that I don't break anything (and I
don't want to spend any time on this atm) I'm temporarily excluding only
Android where this behavior is known to be problematic.

See discussion in https://github.com/koreader/koreader/issues/3118#issuecomment-334995879

References #3118 (using keyword "references" because phrases like "possibly fixes"
result in GH autoclose).
7 years ago
Frans de Jonge d23d01643e Add LuaData and Dictionary Lookup History (#3161)
* Add dictionary history

Fixes #2033, fixes #2998.

* Add LuaData

* table handling in base settings

* Add LuaData spec
7 years ago
Frans de Jonge 23e2183931 [fix] KOSync plugin server location (#3288)
This is only step one. It remains to be determined why the connection is downgraded to sslv3, which will result in a handshake failure.
7 years ago
Frans de Jonge a6be301695 Added Size module 7 years ago
Frans de Jonge 9eb073a524 [travis] Add protection against unscaled sizes
As pointed out by @poire-z

* [fix, UX] SkimToWidget scaling

* [fix] Button scaling

* [fix, UX] Scale ProgressWidget

* [fix, UX] Scale confirmbox

* [fix, UX] Scale just about everything
7 years ago
poire-z 2c1e7f2a4f Bump base for crengine bump (#3249)
crengine crashes, rendering and selection delay fix by @frankyifei
7 years ago
Frans de Jonge cfaa119c35 [fix, UX] Allow modal widget on top of modal widget (#3170)
Fixes #2653.
7 years ago
Frans de Jonge 829e2fffd8 [fix] MenuSorter: take care of orphaned submenus
See https://github.com/koreader/koreader/pull/3167#issuecomment-326805768
7 years ago
Hzj_jie 1ff46a67b4 SwitchPlugin and BackgroundTaskPlugin with tests (#3137) 7 years ago
Frans de Jonge 4513718a2a [fix] MenuSorter: ignore separator as first item
See https://github.com/koreader/koreader/pull/3107#issuecomment-323581851
7 years ago
Frans de Jonge 7277059176 add unit test 7 years ago
Zijie He 2ba079e3eb Reserve last good docsetting 7 years ago
Frans de Jonge 1fd8989906 [ci] readerlink_spec.lua: #nocov on failing tests 7 years ago
Frans de Jonge 7b12954cad [ci] #nocov on BatteryState
All tests fail while trying to do coverage.
7 years ago
Frans de Jonge e3c17aa6d0 Travis: run luacheck on unit tests (#3059)
* Travis: run luacheck on unit tests
7 years ago
Robert 1bfad22af0 Fix: Footer hides text (#3056)
This patch should resolve issue #2257 (Footer hides text)
Sometimes, depending on an epub style, some text is hidden by the progress bar (the mini one at the bottom).
7 years ago
Hzj_jie a8513c95b6 Several minor fixes (#3057)
1. Android.getScreenBrightness() is used in frontend/device/android/powerd.lua to retrieve the frontlight intensity.
2. kosync.koplugin won't save settings for whisper sync.
3. batterstat.koplugin won't work correctly if several on* events are fired.
7 years ago
Hzj_jie c9a997f42c BackgroundRunner (#3008)
* Use getCapacityHW() to ensure latest battery capacity can be retrieved

* BackgroundRunner

* Start background_runner_spec.lua

* AutofrontLight plugin now uses BackgroundRunner plugin
7 years ago
Hzj_jie d6845d94b1 ReadHistory: support reload (#3003)
Allows ReadHistory to reload according to the modification timestamp of history.lua.
7 years ago
poire-z 17656778b1 Book information: refactored and additional features
- Factored out duplicate code from filemanager.lua and filemanagerhistory.lua
to new filemanagerbookinfo.lua (and other common code to filemanagerutil.lua).
- Uses sidecar files' new doc_props and doc_pages settings, or fallback to
old 'stats' settings, or to opening document.
- Shows filename, filetype and directory.
- Shows description (Hold to see whole truncated text), keywords, and
cover image (tap to extract image from document and display it if available).
- Book information now available from reader menu, to display info about
the currently opened book.
- Convert possibly HTML description to plain text via added
util.htmlToPlainTextIfHtml() (for simple HTML conversion).
7 years ago
Frans de Jonge 9b557ed15a Bump base: crengine update (#2985)
* crengine: return description and keywords metadata
  Only available for EPUB documents for now. @poire-z
* crengine: css related improvements, fix crash, better handling of gif @frankyifei
7 years ago
Hzj_jie 970f2e7306 Several improvements of AutoFrontlight plugin and enable it by default (#2975)
* Force refresh when kindle is out of screensaver or usb is unpluged.

* Improve AutoFrontlight

* More plugins sub menu

* Last brightness should always be updated

* Finish autofrontlight improvement and enable it by default.

* More tets

* onFlushSettings

* MenuSorter can now correctly sort sub menus
7 years ago
Hzj_jie 7d2ed4c3d0 Move kobo auto-suspension logic out of UIManager (#2933) 7 years ago
Hzj_jie 53eb4dee50 AutoFrontlight plugin (#2941)
* Add AutoFrontlight plugin

* Add configuration to control autofrontlight feature
7 years ago
Frans de Jonge ed0ba6737e test: add optmath spec stub (#2950)
* test: add optmath spec stub
7 years ago
Frans de Jonge 2096a27b65 test: add translator spec (#2953) 7 years ago
Hzj_jie 30378eb2a8 Add restart koreader function and ensure FlushSettings event can be delivered to all widgets (#2772) 7 years ago
Qingping Hou 55ec64a859 readermenu(fix): override pan gesture from scrolling 7 years ago
Qingping Hou 72ae80870c quickstart fix (#2804)
* translation text fix

* quickstart(fix): go back to home dir after document close

* quickstart(fix): purge old quick start files

* spec: fix quickstart tests
7 years ago
Frans de Jonge a192178bf6 Version spec: slight improvements 7 years ago
Frans de Jonge 21622b5da8 Spec: Wikipedia stub 7 years ago
Frans de Jonge 89099e2c94 Swipe for menu and quickstart guide (#2761)
* Swipe for menu and quickstart guide

Because swiping for the menu is a big change from what we're used to, this commit includes a new quickstart guide.

Fixes #2608.

* add some dev docs
* add FileConverter spec
* add QuickStart spec
* add Version module
* add Version spec
7 years ago
Hzj_jie 999898fa69 Merge various information into systemstat (#2764)
* Merge various information to systemstat
7 years ago
Frans de Jonge 92b9139294 ReaderFooter (lang): "Show toc markers" to "Show chapter markers"
I think it sounds more natural as chapter than as table of content, which is an implementation detail (i.e., the chapter markers are shown based on what's in the TOC).

Also removed redundant "this" from "Remaining pages in this chapter"
7 years ago
Frans de Jonge 3982170886 MenuSorter: fix findById 7 years ago
Frans de Jonge e9df73f6dc Developer documentation improvements
* Fixed up all of util and added when absent
* Updated widget examples to new coding style
7 years ago
Robert a3c4254809 Added util.fixUtf8 (#2704)
* Remove invalid UTF-8 chars from OPDS
* add unit tests
7 years ago
Hzj_jie ea2de9638b LuaSettings:wrap() / LuaSettings:child() function to create an LuaSettings to represent a sub table of an existing one (#2685) 7 years ago
Frans de Jonge 8b7e18a7d7 MenuSorter: resolve review comments
* simplify user config loop
* simplify unit test for Travis memory use
* remove unused util variable
7 years ago
Frans de Jonge ddf590eb6d MenuSorter: split out menu order configuration 7 years ago
Frans de Jonge 33c848f813 MenuSorter: first unit tests 7 years ago
Frans de Jonge 653ff64438 MenuSorter: handle disabled 7 years ago
Frans de Jonge 8f31a81601 MenuSorter: some documentation
MenuSorter: forgot to add plugin style change

MenuSorter: worked out the final quirks

* Menu always compressed into tables without missing indexes for ipairs compatibility
* Orphans attached
* Separators no longer count as items
7 years ago
Frans de Jonge 56659ddb20 MenuSorter: avoid recursion in findById 7 years ago
Frans de Jonge b7b5950e98 MenuSorter: review comments and various bug fixes
* fixed wrongful retention of submenus variable and added return to MenuSorter:findById
* fixed readerfooter_spec.lua error
* fixed review comments
7 years ago
Qingping Hou 2aa9d5d64e test: add unit tests for docsettings 7 years ago
Qingping Hou 9b7aba3fba fix: override readerhighlight hold in readerfooter
Also fix touch zone dependency graph generation code.

ReaderHighlight has now been migrated to use touch zone

Inputcontainer's touch event handling logic changed to only stop
propagation when handler returns `true`. Previously, it stops
propagation when a handler is found. This is needed to support
both readerhighlight_tap and tap_forward touch zones.
7 years ago
Qingping Hou 0b9c9d6ddb test(chore): remove side effects 7 years ago
Hzj_jie 529d1b3d33 evernote: ReadHistory integration and text file output (#2498) 7 years ago
Qingping Hou 581039aed5 opds(fix): unescape name and value 7 years ago
poire-z a8dd8c6f30 textboxwidget: even better text wrapping
util.isSplitable() accepts now also the previous char to help
decide if a space can be used to split a line.
TextBoxWidget:_splitCharWidthList() : simplified logic
8 years ago
poire-z 5040bfe4c5 textboxwidget and scrolltextwidget enhancements (#2393)
util: made isSplitable() accept an optional next_char
for wiser decision

textboxwidget: speed up rendering, enhanced text wrapping,
allow selection of multiple words with Hold.

scrolltextwidget: allow scrolling with Tap.

Details in #2393
8 years ago
Qingping Hou a6c506dc10 kobolight(refactor): move into plugin & only enable for kobo 8 years ago
Qingping Hou 0c49b915de refactor: add touch zone subsystem to inputcontainer
Touch zone decouples screen size from gesture event registration.

The win here is each individual widget does not need to update
gesture range on screen rotate/resize anymore.

Another advantage is we now have a centralized ordered array to handle
all registered touch event listeners, makes it much easier to resolve
gesture range conflicts between multiple widgets.

This patch also includes the following changes:

* migrate readerpaging to use readerui's touch zone
* migrate readerfooter to use readerui's touch zone
* move inverse read direction setting to touch menu's setting tab
* moved kobolight widget from readerview into readerui
* various dead code cleanups and comments
8 years ago
Hzj_jie 9efc723388 PR #2356 breaks CJK character splitting 8 years ago
Qingping Hou cd24eb82d7 readerpaging(fix): handle edge cases where paging pan will crash the reader 8 years ago
robert00s fc5ba9b862 Fix hyphenation words with unicode character in texboxwidget (#2356) 8 years ago
Qingping Hou efae2ed16f network(fix): automaticallly obtain IP if network is already authenticated 8 years ago
Qingping Hou 558754e9b5 footer(refactor): various bug fixes and optimizations 8 years ago
Qingping Hou abbb72b6d3 readerrolling(fix): do not emit PageUpdate event until document is ready 8 years ago
Hzj_jie f1637ef19b Merge pull request #2268 from Hzj-jie/master
This is the implementation of whisper sync
8 years ago
Hzj_jie fd7ae875c0 Whisper sync feature
Now KOReader supports more sync options, and most of the sync operation can be
executed automatically.
8 years ago
Qingping Hou ebc7055b43 chore: move kobo specific code into kobo/device.lua 8 years ago
Qingping Hou 31470efa3b Merge pull request #2250 from Hzj-jie/master2
Add readhistory_spec / docsettings_spec
8 years ago
Zijie He ced671bc69 Add readhistory_spec / docsettings_spec 8 years ago
Zijie He 125fb6dfc6 unload network manager package to ensure it is initialized correctly. 8 years ago
Zijie He 9b66bf1149 Restore WIFI state when koreader starts. 8 years ago
Hzj_jie da2c57f93a Automatically connect WIFI after Kobo has been resumed (#2215)
* Add bash scripts to control WIFI / IP, so we can share them with frontend/device/kobo/device.lua.

* add test cases
8 years ago
chrox 001433e6bc various test/coverage optimization 8 years ago
chrox 7fd6037bb0 fix #2219
The ABS_PRESSURE ABS code is also detected on some KOBO devices
if ABS_PRESSURE events are feeded to handle orientation those devices
will have a unresponsive screen as described in #2219.

This patch registers an event adjustment handler for Kindle Oasis to
adjust the ABS_PRESSURE code to ABS_OASIS_ORIENTATION code so that
it won't affect event handling on other devices.
8 years ago
chrox 9ab005a1d3 fix unit test of readerlink and readerpaging
and have more confidence with the unit testing framework.

Now `make testfront` won't retry on failure and testing files are
ordered in each run so that it's possible to reproduce testing failure.

And this patch also fix flush settings not working before suspend issue:
at some point the `FlushSettings` event is sent to `UIManager` instead
of `ReaderUI`, but `UIManager` only delegated events to active widgets
and `ReaderUI` is actually not an active widgets thus will miss the event.

This patch also add a verbose debug mode with "-v" as a switch to turn
on this mode. With verbose mode on, event handling will be logged.
8 years ago
Qingping Hou 61b6896391 Merge pull request #2217 from chrox/benchmark_tool
fix k2pdfopt performance degradation
8 years ago
chrox 9afad43a3e refactoring utils to tools as discussed in #2197 8 years ago
chrox 7ea12c0198 fix broken unit tests on Travis CI
1. It turns out that `device_id` is not defined in unit test environment
which makes the `assert(self.kosync_device_id)` fail and somehow makes `luajit` segmentation fault.
2. In the device spec, stubbing `io.open` will make subsquent `require`
all return boolean value and segmentation fault `luajit`.

This patch is a minimum viable change that makes CI work on both my
local box and Travis.
8 years ago
Zijie He 820a39c8f7 Update KOSyncClient 8 years ago
Qingping Hou 1c5543358c readerfooter(fix): avoid setting mini footer to invisible when full progress bar is on
Our previous assumption is user will only choose between full or min
bar. The does not hold anymore as many more info has been added to the
mini bar and sometimes user might want to have both of them on. This
patch makes the reader behavior consistent when both bars are set to be
on for a document.
8 years ago
Qingping Hou f30e487959 readerpaging(fix): set the corrent page number on GoBackLink event 8 years ago
Qingping Hou 3339ed4e5f test(fix): update tests for default scroll mode 8 years ago
Qingping Hou 0d9fc17d7c chore: rename SetDefaults:SaveSettings 8 years ago
Qingping Hou 20eb36a03d feat: add network management UI for kobo 8 years ago
chrox 71bf9efc7c split accient greek words with spacing character
This should fix #1705.
8 years ago
Qingping Hou fadad90447 uimanager(fix): handle stack change in close 8 years ago
Qingping Hou af2f3c30c7 uimanager(fix): handle last widget in broadcast event properly 8 years ago
chrox f5ea29c8d3 fix unit test of defaults since we deleted one global default
I'm afraid this unit test is not maintainable, each time we
change the structure of the defaults.lua we must change this spec
accordingly. We probably will get rid of defaults.lua as well as the
filemanagersetdefaults and this spec.
8 years ago
Qingping Hou ce7ae2dfac uimanager(fix): handle edge case where second widget in stack is ignored 8 years ago
Hzj_jie cf8c0aa81f Add docsettings unittest 8 years ago