Commit Graph

63 Commits (master)

Author SHA1 Message Date
hius07 f4a5a2b60a
TextViewer: add dialog to set font size and justify text (#11210) 5 months ago
hius07 684fc22ffc
TextViewer: font size (#10911) 8 months ago
hius07 b33971b92d
OPDS fixes (#10657) 10 months ago
hius07 3eee5dd14c
OPDS: view book cover (#10555)
(1) New "Book cover" button in the download dialog.
(2) Detect book that can be borrowed only (Internet Archive).
There is no support for borrowing, just showing a disabled button.
(3) Fixed some libraries, all of them work except Gallica.
11 months ago
hius07 4f23a6fafa
Custom book covers (#10329) 1 year ago
hius07 aedb713f82
Menu widget: cleanup (#10241) 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
Frans de Jonge e1fe897c9b
[i18n] Add a couple of explanatory comments for translators (#9878) 1 year ago
hius07 905d5610ba
OPDSbrowser: accept catalogs without header in response (#9829)
Such catalogs are not cached.
Closes #6088.
1 year ago
Dylan Calvin c5cd87f09a
(OPDS) Progess Sync Support for Kavita & Various Refactor Fixes (#9750) 1 year ago
hius07 e1a52b5881
OPDSbrowser: fix uninitialized calibre (#9718) 2 years ago
hius07 c36a2929ac
OPDSbrowser refactoring (#9703)
Refactoring:
-removed duplicated code
-removed passing of username/password through all the modules
-logical order of the methods
-some optimizing and drying
-comments

New features:
-subcatalog link can be saved to the list of servers (eg: direct link to the catalog of books by an author)
-more book information can be fetched and shown (Book information)
-fixed access to the Standard library (by @KGKopli, closes #9372)
2 years ago
Dylan Calvin 07be320722
[plugin] OPDS: Add stream from page (#9681) 2 years ago
bigdale123 cda419dd7a
OPDS-PS: Fix hardcoded namespace in count (#9650)
Turns out the namespace is dynamic, so, just look for ':count' and hope there won't be any conflicts ;).
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
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 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 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
Alex Cabal 39b0ca2f36
Update Standard Ebooks OPDS URLs to new URL (#9371) 2 years ago
NiLuJe a4f6693919 OPDSBrowser: Handle renderImageData failure in streamPages 2 years ago
Tesseract Cat d4bbd74208
Add OPDS PSE 1.0 support (#8919)
This PR adds support for the unofficial page streaming extension for OPDS. See: https://anansi-project.github.io/docs/opds-pse/specs/v1.0. This is useful for streaming comics from a remote server.

Addresses #7500.
2 years ago
Philip Chan 107156c0a8
[feat] Non-touch improvements (#8859)
FocusManager: fix round x use y layout
FocusManager: add tab and shift tab focus navigation support
FocusManager: handle Press key by default
FocusManager: make sure selected in instance level
FocusManager: add hold event support
FocusManager: Half move instead of edge move
FocusManager: add keymap override support
FocusManager: refocusWidget will delegate to parent FocusManager
Focusmanager: refocusWidget can execute on next tick
inputtext: can move out of focus on back
inputtext: fix cannot exit for non-touch device
inputtext: fix cannot input text with kindle dx physical keyboard
fontlightwidget: add non-touch support
datetimewidget: add non-touch support
datetimewidget: fix set date failed in kindle DX, fix datetimewidget month range to 1~23 by default
datetimewidget: make hour max value to 23
multiinputdialog: add non-touch support
checkbox: focusable and focus style
virtualkeyboard: no need to press two back to unfocus inputtext
virtualkeyboard: collect FocusManager event key names to let VirtualKeyboard disable them
openwithdialog: add non-touch support
inputdialog: can close via back button
enable all InputDialog and MultiInputDialog can be close by back
keyboardlayoutdialog: non-touch support
readertoc: non touch device can expand/collapse in toc
bookstatuswidget: non touch support
keyvaluepage: non-touch support
calendarview: non-touch support
2 years ago
hius07 8bb08b503a
Cloud storage: enhance download dialog, fix Dropbox uploading (#8809)
(1) ButtonDialogTitle: new method setTitle()

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

(3) CloudStorage
-enhance download dialog (similar to OPDS), much optimized code of downloadFile
-fix a bug: cannot create new folder or upload files to the root of the Dropbox storage
2 years ago
hius07 c9b4e43bf9 OPDSbrowser: bookinfo multiline title 2 years ago
hius07 334a913b0e
OPDS catalog: add title Plus/Home button (#8660) 2 years ago
QJKX 71af6c9382
OPDS: add Standard Ebooks server (#8606)
Standard Ebooks is roughly a small subset of
Project Gutenberg with better formatting.
2 years ago
hius07 1df6ab751b
ButtonDialogTitle: no bold font in the title by default (#8557) 2 years ago
hius07 02ddd41b38
OPDS: rename a book before downloading (#8520) 2 years ago
Dylan Garrett 26ec5bafe3
[plugin] Display OPDS download titles if available (#8441)
I've found that some OPDS catalogs have multiple downloads of the same filetype, but optimized or formatted in different ways. The Title of the download is much more descriptive in this case, so I thought it would be better to display the title if available.

The OPDS catalog at https://standardebooks.org/opds is a good example. Note how entries in https://standardebooks.org/opds/new-releases have three different epub downloads, titled "Recommended compatible epub", "Advanced epub", and "Kobo Kepub epub".
3 years ago
hius07 859327dea5
Input dialogs: keep size in rotation (#8223) 3 years ago
roygbyte 024fd52781
Fix OPDS plugin bug wherein Arxiv PDF document acquisition URLs are not given a callback to download (#8210)
* Add comments to a few functions

* Fix bug associated with arxiv catalog.

See comments in genItemTableFromCatalog. Basically, though, the bug
was related to the checking of the acquisition urls. Arxiv only has
PDFs available to download, and the block wasn't catching these with
its existing logic. By adding another clause to look for PDF link
types, and fixing href values that were missing the PDF suffix, we can
successfully download PDFs from Arxiv.
3 years ago
hius07 684fd6c12d
Standardize select/choose to choose (#8128)
Closes #8105.
3 years ago
Frans de Jonge a558376471
[plugin] Change OPDS filetype algorithm to extension first, mimetype second (#8115)
Fixes <https://github.com/koreader/koreader/issues/7995>.
3 years ago
Frans de Jonge 04d1d23c2f
[plugin] OPDS: prevent crash if link.type is nil (#8111)
It can happen… somewhere, while clicking around http://arxiv.maplepop.com/catalog a bit. (The magical crash/bug finder from <https://github.com/koreader/koreader/issues/3023>.)
3 years ago
hius07 db60ba48b7
OPDS catalog, Cloud storage: hold return arrow to go to top (#7845) 3 years ago
NiLuJe dde732c17f
OPDS: Also handle self-closing dc: tags (#7900)
Fix #7899
3 years ago
hius07 dccd49b652
[fix] OPDS catalog invoked from reader: crash KOReader on close (#7825)
OPDS catalog can be invoked from reader with gesture.
Then on closing OPDS catalog, KOReader crashes.
Let's jump to the download folder instead.
Closes #7784.
3 years ago
hius07 0ddba3bcb6
OPDS browser: adjust book information font size (#7783)
Use the the same font size as the list of books.
3 years ago
Frans de Jonge 039947886f
Revert "Hyphenation: add custom hyphenation rules (#7746)" (#7785)
This reverts commit f25da5d0d5.
3 years ago
zwim f25da5d0d5
Hyphenation: add custom hyphenation rules (#7746)
The hyphenation of a word can be changed from its default
by long pressing for 3 seconds and selecting 'Hyphenate'.
These overrides are stored in a per-language file, i.e:
koreader/settings/user-German.hyph.
3 years ago
hius07 d5a2df3c04
OPDS: Add a button to display an entry's content block in the download popup (#7767) 3 years ago
NiLuJe c2c20199cd
OPDSParser: Attempt to preserve data from content tags *without* breaking luxl (#7768)
Tackle the content blocks issue differently, in order to
preserve the data, which is now useful since #7767
3 years ago
NiLuJe de6f2e84a3
FileManager/ReaderUI: Clarify the current instance accessor (#7658)
* FileManager/ReaderUI: Clarify the current instance accessor

Make it clearer that we actually store it in a *module/class* member, not an *instance* member.

Also, warn if there's a close/open mismatch.
3 years ago
NiLuJe 2635593890 Cache: Some more tweaks after #7624
* Allow doing away with CacheItem
  Now that we have working FFI finalizers on BBs, it's mostly useless overhead.
  We only keep it for DocCache, because it's slightly larger, and memory pressure might put us in a do or die situation where waiting for the GC might mean an OOM kill.
* Expose's LRU slot-only mode
  And use it for CatalogCache, which doesn't care about storage space
* Make GlyphCache slots only (storage space is insignificant here, it was
  always going to be evicted by running out of slots).
* More informative warning when we chop the cache in half
3 years ago
NiLuJe 21b067792d Cache: Rewrite based on lua-lru
Ought to be faster than our naive array-based approach.
Especially for the glyph cache, which has a solid amount of elements,
and is mostly cache hits.
(There are few things worse for performance in Lua than
table.remove @ !tail and table.insert @ !tail, which this was full of :/).

DocCache: New module that's now an actual Cache instance instead of a
weird hack. Replaces "Cache" (the instance) as used across Document &
co.
Only Cache instance with on-disk persistence.

ImageCache: Update to new Cache.

GlyphCache: Update to new Cache.
Also, actually free glyph bbs on eviction.
3 years ago
NiLuJe ce624be8b8 Cache: Fix a whole lot of things.
* Minor updates to the min & max cache sizes (16 & 64MB). Mostly to satisfy my power-of-two OCD.
  * Purge broken on-disk cache files
  * Optimize free RAM computations
  * Start dropping LRU items when running low on memory before pre-rendring (hinting) pages in non-reflowable documents.
  * Make serialize dump the most recently *displayed* page, as the actual MRU item is the most recently *hinted* page, not the current one.
  * Use more accurate item size estimations across the whole codebase.

TileCacheItem:

  * Drop lua-serialize in favor of Persist.

KoptInterface:

  * Drop lua-serialize in favor of Persist.
  * Make KOPTContext caching actually work by ensuring its hash is stable.
3 years ago
NiLuJe e7acec1526 ReaderUI: Saner FM/RD lifecycle
* Ensure that going from one to the other tears down the former and
    its plugins before instantiating the latter and its plugins.

UIManager: Unify Event sending & broadcasting
  * Make the two behave the same way (walk the widget stack from top to
    bottom), and properly handle the window stack shrinking shrinking
    *and* growing.
    Previously, broadcasting happened bottom-to-top and didn't really
    handle the list shrinking/growing, while sending only handled the list
    shrinking by a single element, and hopefully that element being the one
    the event was just sent to.

These two items combined allowed us to optimize suboptimal
refresh behavior with Menu and other Menu classes when
opening/closing a document.
e.g., the "opening document" Notification is now properly regional,
and the "open last doc" option no longer flashes like a crazy person
anymore.

Plugins: Allow optimizing Menu refresh with custom menus, too.

Requires moving Menu's close_callback *after* onMenuSelect, which, eh,
probably makes sense, and is probably harmless in the grand scheme of
things.
3 years ago
NiLuJe 22b9396696
Centralize one time migration code after updates (#7531)
There have been a couple of these this month, and keeping stuff that should only ever run once piling up in their respective module was getting ugly, especially when it's usually simple stuff (settings, files).

So, move everything to a dedicated module, run by reader.lua on startup, and that will actually only do things once, when necessary.
3 years ago
NiLuJe 732ab56104 OPDS: Fix Search when the server's template is a relative path
Fix #7482
3 years ago
hius07 052e19ead5
Standardize search/find to search (#7398)
* Change 'Find a file' to 'File search' for consistency

There is 'File search' in the Gesture manager already.
There is 'Fulltext search' in the readermenu.
Some help text added.
3 years ago