Commit Graph

168 Commits (2ed2c2c23da15b9335f7a664fa5cf35f55b1523b)

Author SHA1 Message Date
hius07 2ed2c2c23d
md5: centralize and deduplicate (#11003)
Document partial md5 hash is calculated by util.partialMD5() and stored in doc_settings as "partial_md5_checksum" on the first document opening.
7 months ago
NiLuJe d039aa5f3a Statistics: Minor style-nit followup to #10968
Too late to avoid the whitespace diff churn, unfortunately ;).
7 months ago
hius07 517731dbbb
Finished books: freeze history timestamp and statistics (#10968) 7 months ago
poire-z f78a8c5315
Custom metadata: update Statistics db on metadata change (#10894) 8 months ago
hius07 1ef7821b66
getProps: centralize 2 (#10837)
Centralize and optimize handling document properties.
9 months ago
weijiuqiao 416237e526
Statistics: Attempt to prevent rampant replication of null id_books (#10749)
And add an OTM block to do a cleanup pass on existing DBs (which might take a while if you're severely affected, because we've seen reports of DBs north of 2GB).
10 months ago
Frans de Jonge b8af326836
[i18n,plugin]Statistics: differentiate different types of 'reset' (#10621)
References <https://github.com/koreader/koreader/discussions/10479>.
11 months ago
Glen Sawyer 128f205324
[plugin] Statistics: fix sync caused by semicolon in SQL comment (#10503)
Follow-up to <https://github.com/koreader/koreader/pull/10498>.
12 months ago
Glen Sawyer 2aa11b13ad
[plugin] Statistics: sync the `last_open` field (#10498) 12 months ago
weijiuqiao 34c2dab54b
statistic.koplugin: fix today's timeline showing next day when within custom offset (#10299)
Continuing https://github.com/koreader/koreader/pull/10254#issuecomment-1494697269
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
Piotrek Marciniak 2e630286df
Sync book statistics: add to dispatcher (#10285) 1 year ago
weijiuqiao 5648c942c1
Calendar view: add options to change start time of days (#10254)
Can be set for example to 04:00 to see after-midnight readings
with those of the previous evening in day timeline.
Also fix possible shifts in day start when crossing DST changes
with prev/next.
Also fix sorting (by reverse reading duration) of books at top
1 year ago
melyux 55259846a8
Fix N_() usages, rearrange a SQL select (#10146)
Fix some of my early blunders in using the `N_()` gettext function. Mini-PR from https://github.com/koreader/koreader/pull/9924#discussion_r1104298501 (@Frenzie).

There was also one line for generating this same `%1 (%2 pages)` text that confusingly uses different ordering in the SQL query output; switched the two SELECT arguments around to make it match the other 5 usages. Works the same as before
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
melyux 8b99c50b2d
Duration format: add "Letters" format (1h30m10s) (#9924) 1 year ago
hius07 ee75abd4a0
Statistics: show correct number of notes in a book (#9928) 1 year ago
Glen Sawyer 932ed44a9f
[plugin] Statistics: do not increment db sequences unnecessarily during cloud sync (#9921)
When you do an insert using either ON CONFLICT [...] DO NOTHING or INSERT OR IGNORE to prevent duplicate rows, sqlite still increments the sequence counter for each of the duplicate rows that it did not insert.
The only way around that is to explicitly write the SQL statement so that it doesn't try to insert the duplicates in the first place.
1 year ago
melyux b1bbd590db
Statistics: cleanup and tweaks (#9904)
Many tweaks (alignment, dates...), reordering and
rewording in "Current statistics", per-book stats,
and Reading progress.
1 year ago
poire-z 24a3c722c8
Calendar view: properly use datetime module (#9893)
No need to pass the translations from main.lua
to calendarview.lua.
Also use datetime translations in ReaderProgress.
1 year ago
weijiuqiao 49d8ec2f4f
Cloudsync: dropbox token re-generation (#9862) 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
poire-z b1f77ac085
Calendar view's day view: tweak SQL data extraction (#9834)
Ensure any reading at 0h00 or 23h59 looks like it
continues from previous or to next page if DB data
seems to indicate so.
1 year ago
poire-z 3ef2811e59
Calendar view's day view: visual tweaks (#9832)
- Add vertical lines every 10mn
- If today, show an arrow indicator at current time
- Add "Today's timeline" to menu
- Rename badly named self.hour_width, which is a height
2 years ago
weijiuqiao 1c42641733
Calendar view: fancier day details with timeline (#9813) 2 years ago
weijiuqiao 81b2f22b04
ReaderStatistics: fix sync sql command (#9811)
Fixes sync sql command that uses left join instead of
inner join, which adds unnecessary comparisons and
might result in incorrect mapping between databases.
2 years ago
weijiuqiao 8500fdd519
Cloud-based sync for 2 plugins: reading statistics and vocabulary builder (#9709)
This commit adds cross-device sync ability for two plugins: reading statistics and vocabulary builder. It relies on user setting up a Cloud server (DropBox and WebDAV but not FTP though) and designating a path. Behind the curtains sqlite databases are being passed around and updated.

UI-wise, for the statistics plugin, two new menu items Synchronize now and Cloud sync to set it up (might not be the best wording) are added. As for vocabulary builder, a similar Cloud sync button is added to the menu and a shortcut icon button to Synchronize now is pinned at the bottom corner.

CloudStorage new features: WebDAV creating folders and uploading files. And a new widget-like sync server chooser. In the end I decided not to add automatic sync, as the SQL commands part seem a bit much.
2 years ago
poire-z 48eb02318d
Dispatcher: avoid multiple cre rerenderings when many settings changed (#9651)
When a gesture/profile was updating multiple cre settings,
each setting handler would emit UpdatePos which each would
force a re-rendering.
When this might be happening, postpone the rerendering
until all are set.
Needs some bit of refactoring to the events at play:
introduce "DocumentRerendered" event, and use it where
we used "UpdatePos" or "UpdateToc" to mean exactly that.
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
hius07 c5505879c3
ConfigDialog: fix bug in DoubleSpinWidget default values (#9580) 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
zwim d5d5867d4e
DoubleSpinWidget, SpinWidget: add units, make usage more consistent (#9046) 2 years ago
NiLuJe 23cd7e24bb
Minor Lua I/O cleanups (#8921)
Mostly making sure we always explicitly close io handles.
2 years ago
poire-z c627dfd63f ReaderStatistics: avoid self.kv leaking after close 2 years ago
poire-z 83172d62ae ReaderStatistics: reset stack/link on showing first widget
Reset self.kv stack/link on showing first widget.
This avoids return arrow to possibly show previously
displayed old and unrelated KeyValuePage.
Note: when closing a leaf KeyValuePage, the previous
one will leak as self.kv.
2 years ago
poire-z 67b17d0845 ReaderStatistics: allow reset statistics per period per book 2 years ago
poire-z f764a61b69 KeyValuePage: allow for more fancy callbacks
Add support for hold_callback.
Provides kv_page and kv_item to callbacks.
Allow for item removal and refresh.
2 years ago
poire-z 516c3d3225 ReaderStatistics: fix current page stats on close/suspend
Fixes current page statistics (duration) ignored when
document closed, or when suspending and resuming.
On suspend/resume, update the page start ts by the
time spent sleeping, so its duration will be the time
spent on it not sleeping.
2 years ago
poire-z 3a5dbe3420 ReaderStatistics: remove id_book parameter to insertDB()
As it should always just work on the current book.
Also remove uneeded getCalendarView().
2 years ago
poire-z bc16b32395 Add Book map and Page browser features
- Book map: shows a map of content, including TOC,
  boomarks, read pages, non-linear flows...
- Page browser: shows thumbnails of pages.

- ReaderThumbnail: new Reader module that provides
  a service for generating thumbnails of book pages.
  It makes available these 2 new fullscreen widgets.
- ReaderBookmark, ReaderLink, Statistics: add methods
  to return new views of bookmarks, previous locations
  and read pages, that are needed by BookMapWidget.
- ReaderToc: compute TOC max_depth.
- ReaderBookmark, ReaderHighlight: send events on
  bookmark add/update/remove so thumbnails of the
  pages impacted can be trashed.
2 years ago
hius07 ad09411c3f
DoubleSpinWidget buttons move (#8490)
Move Default and extra buttons above Cancel/OK.
Default values shown in the default button.
Precisions can be set for both values separately.
Minor geometry fix for consistence with SpinWidget.
3 years ago
Galunid d4628666c9
Statistics: Read page duration limits: allow min=0s (#8273)
Allow for always counting page as read, regardless of time spent.
3 years ago
hius07 1e47cd7e5f
SpinWidget: similar size in portrait and landscape (#8226) 3 years ago
yparitcher f5dc7b4539 Dispatcher: Revamp sections and item order 3 years ago
NiLuJe 9a7450ea5f Statistics: Guard against ReaderView's state.page being nil
For... whatever reason? I can't really see that happening, but, oh,
well.

Screensaver already guards against it, so, who knows.

Fix #8201
3 years ago
yparitcher 3b6f521e26 Statistics: move dispatcher items to plugin 3 years ago
Brian Hughes ba65dc155b
Adds time left for chapter and document to the screensaver message options (#7897) 3 years ago
NiLuJe c7232af8eb Statistics: Don't try to store a nil in a TEXT field
Fix #7867
3 years ago
NiLuJe 522aa49e63 Statistics: Re-enable in FM
Fix #7844
Regression since #7728
3 years ago
NiLuJe 2c4cbd12a2 DocumentRegistry: Downgrade refcount warnings to debug logging.
It can happen in perfectly sane contexts.

CReDocument: Don't destroy internal engine data when Document just
decreased the refcount (as opposed to actually tore down the document
userdata if it were the last ref).

PdfDocument: Only write edited documents if the Doc instance was torn
down.

PicDocument: Silence some DocumentRegistry related warnings
3 years ago