Commit Graph
42 Commits
Author SHA1 Message Date
Tomáš Janoušek df0b3ead5b coverimage: only update on rotation if rotate image enabled (#15179)
Creating the cover image delays rotation a little bit (half a second,
even if cached), although it could be several seconds on some PocketBook
devices since #14985 which synchronously invokes `sync` after creating
the cover.

To work around this, skip creating the image in the onSetRotationMode
event hook if "Rotate image" is disabled as the resulting image would be
exactly the same. The speedup is noticeable even if the cover cache gets
hit.

(The issue with synchronous `sync` taking several seconds will be fixed
later once we figure out whether any PocketBook devices actually need
the `sync` or not.)

Related: https://github.com/koreader/koreader/issues/15177
Related: https://github.com/koreader/koreader/pull/14985
2026-03-25 06:58:45 +01:00
Min S. Kim ccd0a8004c fix(coverimage): fix operator precedence and parameter usage in cache functions (#15032)
Fix two bugs in the coverimage plugin:

1. cleanCache(): Fix operator precedence in while loop condition. In Lua,
   `and` has higher precedence than `or`, so the bounds check `index <= #files`
   was only applied to the cache size condition, not the file count condition.
   Added parentheses to ensure the bounds check applies to both conditions.

2. getCacheFiles(): Use the function parameters `cache_path` and `cache_prefix`
   consistently instead of mixing them with `self.cover_image_cache_path` and
   `self.cover_image_cache_prefix`.
2026-02-23 22:49:02 +01:00
Min S. Kim 2932a4a6a2 CoverImage: fix inconsistent vertical alignment of cover image (#14987)
Center the scaled cover image on both axes unconditionally instead
of branching on which dimension is the limiting factor. The branch
was susceptible to floating point rounding in math.floor causing
scaled_w to be 1 pixel less than s_w, flipping the alignment from
vertically centered to top-aligned depending on the cover's pixel
dimensions.

Fixes #14986.
2026-02-16 11:20:15 +01:00
Florian Snow 17281b2f1f Properly set bootlogo on PocketBook (#14985)
* CoverImage: call iv2sh to update PocketBook startup logo on cover change

After the cover image file is written or reset, invoke PocketBook's
iv2sh WriteStartupLogo command so the device's boot logo is actually
updated. The command runs in the background to avoid blocking KOReader.

* CoverImage: use correct screen dimensions on PocketBook for boot logo

For PocketBook devices, Screen:getWidth/getHeight returns
dimensions that iv2sh will not accept. In that case, we should call
Screen:getScreenWidth and Screen:getScreenHeight instead so the
generated boot logo has the correct size.
2026-02-15 19:27:30 +01:00
hius07 29bbc84de2 Touchmenu: fix menu refreshing on check (#13996) 2025-07-01 21:43:51 +03:00
apgrc c3024387ec [CoverImage] Add rotate image option (#13604)
New option to disable image rotation in cover image plugin.

Fix #12308
2025-04-21 21:12:48 +02:00
mergen3107 f8446538c0 Fix KOReader spelling in the code (#12670) 2024-10-24 10:46:46 +02:00
zwim bf58723af1 [CoverImage] Honor rotation after opening of a book (#11752)
If rotation changes, create a new cache entry and use that if necessary.

Fixes #11713.
2024-05-06 22:53:13 +02:00
hius07 fc7181419f CoverImage: custom cover support (#10553) 2023-06-09 10:36:34 +03:00
zwim 180cebe7ee [CoverImage] use units in SpinWidget (#9938) 2022-12-30 07:26:36 +01:00
greatyingziandgreatyingzi 61364ffc33 [chore] CoverImage: unified call method for Device.screen (#9839)
Co-authored-by: greatyingzi <greatyingzi@github.com>
2022-11-28 13:24:05 +01:00
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.
2022-10-06 02:14:48 +02:00
zwim 0548eaa95b CoverImage: fix translatable (#9301)
This PR fixes #9299
2022-07-06 17:15:47 +02:00
Philip Chan 107156c0a8 [feat] Non-touch improvements (#8859)
FocusManager: fix round x use y layout
FocusManager: add tab and shift tab focus navigation support
FocusManager: handle Press key by default
FocusManager: make sure selected in instance level
FocusManager: add hold event support
FocusManager: Half move instead of edge move
FocusManager: add keymap override support
FocusManager: refocusWidget will delegate to parent FocusManager
Focusmanager: refocusWidget can execute on next tick
inputtext: can move out of focus on back
inputtext: fix cannot exit for non-touch device
inputtext: fix cannot input text with kindle dx physical keyboard
fontlightwidget: add non-touch support
datetimewidget: add non-touch support
datetimewidget: fix set date failed in kindle DX, fix datetimewidget month range to 1~23 by default
datetimewidget: make hour max value to 23
multiinputdialog: add non-touch support
checkbox: focusable and focus style
virtualkeyboard: no need to press two back to unfocus inputtext
virtualkeyboard: collect FocusManager event key names to let VirtualKeyboard disable them
openwithdialog: add non-touch support
inputdialog: can close via back button
enable all InputDialog and MultiInputDialog can be close by back
keyboardlayoutdialog: non-touch support
readertoc: non touch device can expand/collapse in toc
bookstatuswidget: non touch support
keyvaluepage: non-touch support
calendarview: non-touch support
2022-03-04 21:20:00 +01:00
zwim befc0d9c83 [Coverimage, plugin] Clean up, typo (#8565)
SizeSpinner: "Set" is disabled if the value has not changed, so no need to check this in the callback function.

Corrected typo.

Optimized code.
2021-12-25 11:29:57 +01:00
zwim eb4e958303 [Coverimage, plugin] Colons in menus; unlock sizespinner (#8430) 2021-11-09 20:09:05 +01:00
hius07 1e47cd7e5f SpinWidget: similar size in portrait and landscape (#8226) 2021-09-25 10:40:04 +02:00
hius07 684fd6c12d Standardize select/choose to choose (#8128)
Closes #8105.
2021-08-24 22:19:07 +02:00
zwim 1a526a33c2 CoverImage plugin: allow writing grayscale BMPs (#8054) 2021-08-16 02:11:54 +02:00
zwim 31e6294315 [plugin] CoverImage: Use blksize for size of cached files (#7705) 2021-05-18 11:52:15 +02:00
Frans de Jonge 0ec74612db Fix stupid typo (#7678)
I was still thinking about 341d6ac660 I suppose.

Hat tip to @yparitcher.
2021-05-13 17:58:11 +02:00
Frans de Jonge a3575134af Fix docs (#7674)
See https://github.com/koreader/koreader/pull/7668#issuecomment-840404170
2021-05-13 12:58:37 +02:00
zwim 0d6be41c75 Better strings (#7611) 2021-04-30 21:24:04 +02:00
zwim fafc0bc678 Missed translatable (#7603) 2021-04-26 13:35:07 +02:00
zwim c8d5330631 Typo (#7601) 2021-04-26 10:25:07 +02:00
zwim 5ed272a786 Fix translation template (#7591) 2021-04-24 14:00:38 +02:00
Frans de Jonge e107aad42e [fix] Use template 2021-04-22 22:32:07 +02:00
Frans de Jonge b81b8cfb2f [chore] Fix typo 2021-04-22 22:30:46 +02:00
Frans de Jonge 36b40e02e7 [chore] Directory to folder (#7584) 2021-04-22 22:28:10 +02:00
zwim e4c9409f97 [plugin] Add a caching mechanism for CoverImage (#7510) 2021-04-22 08:38:49 +02:00
hius07 17129915f9 Standardize directory/folder to folder (#7410)
Follow-up to https://github.com/koreader/koreader/pull/7328
2021-03-28 13:35:56 +02:00
NiLuJe bf6c0cdd6c LuaSettings: Add a method to initialize a setting properly (#7371)
* LuaSettings/DocSettings: Updated readSetting API to allow proper initialization to default.
Use it to initialize tables, e.g., fixing corner-cases in readerFooter that could prevent settings from being saved.
(Fixes an issue reported on Gitter).
* LuaSettings/DocSettings: Add simpler API than the the flip* ones to toggle boolean settings.
* Update LuaSettings/DocSettigns usage throughout the codebase to use the dedicated boolean methods wher appropriate, and clean up some of the more mind-bending uses.
* FileChooser: Implement an extended default exclusion list (fix #2360)
* ScreenSaver: Refactor to avoid the pile of kludges this was threatening to become. Code should be easier to follow and use, and fallbacks now behave as expected (fix #4418).
2021-03-06 22:44:18 +01:00
gbyl 10f65a16e7 CoverImage plugin: adjust wording (#7309) 2021-02-21 00:17:42 +01:00
zwim 6c0345de17 CoverImage: Alternative image fit (#7221) 2021-01-31 21:34:37 +01:00
Frans de Jonge 582807f971 [chore, plugins] CoverImage: move newline outside translated string (#6985) 2020-12-12 21:04:58 +01:00
zwim 0a6ef6e351 CoverImage plugin: allow saving covers as JPG (#6924) 2020-12-05 23:54:06 +01:00
zwim 52f66a89d2 CoverImage plugin: enable on Remarkable and PocketBook (#6906) 2020-11-28 13:58:44 +01:00
zwim 3137f5a158 CoverImage plugin: allow saving covers as BMP (#6904) 2020-11-28 13:57:33 +01:00
zwim 2785f0d113 Remove leftover and correct info message on empty fallback (#6897)
Cf. https://github.com/koreader/koreader/pull/6813#discussion_r527459959
2020-11-20 10:33:47 +01:00
zwim 31fe3b87c3 CoverImage plugin: add "Size and background" options (#6884) 2020-11-18 21:30:22 +01:00
zwim bab55bfa0d Typo in Text (#6871) 2020-11-12 21:54:42 +01:00
zwim 926e7dd402 coverimage plugin (#6813)
* Plugin for saving the cover image to file. Useful in some e-ink android devices.
2020-11-10 15:00:56 +01:00