Commit Graph

136 Commits (23cd7e24bb0d1ed63592411abec9749d222eb589)

Author SHA1 Message Date
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.
2 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
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 de543b3484
Statistics: Properly initialize default settings. (#7471)
* Statistics: Properly initialize default settings.

Regression since #7371
Fix #7470
3 years ago
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).
3 years ago
poire-z b5de2b2a60 Reading statistics: tweak book stats views
Make "Current statistics" and previsouly opened book
statistics display missing info that the other view
has, mostly:
- Pages read: nb (pct%)
- Current page/Total pages: num/total (pct%)
3 years ago
poire-z 8a0d798e9e KeyValuePage: configurable items per page
Tweak building to start from items per page instead of
a fixed item height.
Guess the best font size that fit.
Update separator specification from using a "----" to
the now generic separator=true (this allows not wasting
a slot for each separator in the page and not have
only 12 items and 2 small lines in a 14 items page).
3 years ago
Frans de Jonge 5c9dc850e8
Address assorted Weblate comments (#7154)
* Fix typo in dropbox

Reported by @lescheck

* Rephrase text justification explanation more elegantly

* CoverBrowser: fix up some plurals

* Statistics: remove random use of template function

* Use ngettext for minute/minutes and second/seconds

* Change KB/MB/GB to kB/MB/GB SI units
3 years ago
poire-z 1f2447dc06 Statistics plugin: change some logger.info() to dbg() 3 years ago
poire-z 2e95bc7a71 Statistics plugin: reorder Reset menu items 3 years ago
NiLuJe 0685eecdad
Simplify db migration toasts (#7063)
xref https://www.mobileread.com/forums/showpost.php?p=4073920&postcount=17
3 years ago
NiLuJe bba8b31e1d
AutoSave: Delay I/O until after the pageturn (#6917)
nextTick was too early ;).

Prevents small hitches when turning the page for the page where this
triggers.

Apply the same trickery to the Stats DB insert, even if that one probably
had a much smaller impact.
4 years ago
NiLuJe 982702fdc1
Statistics: Don't blow up when annotating/highlighting stuff with the plugin loaded, but disabled (#6829)
Re #6825
Re #6827
4 years ago
NiLuJe 42b866cd7f
Statistics: Handle DB migration to 20201022 (#6812)
* Add a few IF (NOT) EXISTS guards to DB schema stuff

* Chunk DB migrations into each specific schema revision

And bump to 20201022 to pickup the changes from #6807

Always VACUUM at the end of a (set of) migration.
4 years ago
poire-z b40331085a
Statistics: speed up Calendar view (#6807)
Just by tweaking the SQL queries, and adding an index
on page_stat_data(start_time).
Also, in the hourly histogram, show at least a 1px bar
when there was any reading this hour.
4 years ago
NiLuJe 9fc87e3b85
Address some DB migration concerns (#6804)
* Don't overwrite an existing DB backup during DB migrations

* Try to be gentler with wonky DBs during migration
4 years ago
NiLuJe 0406be3319
Random nano optimizations (#6801)
* Don't call Screen:afterPaint if nothing was actually painted

* Stupid micro-optimization (os.)time! (pun intended :D)
4 years ago
NiLuJe 11aeef7483
Don't shadow gettext (#6799)
(Fixes the "current book" stats page)
4 years ago
ezdiy 5e231d759a
Bump base for sqlite. (#6796)
& make CI happy.
4 years ago
NiLuJe dfe3502b91
ReaderStatistics: Data collection improvements (#6778)
* Update the data collection format & handler to make it much less tortuous
* Update the pagecount & resync the stats on document layout changes
* Update the database schema to allow doing most queries against a SQL view that rescales the collected data to be accurate regardless of document layout (thanks to @marek-g for the SQL magic ;)).
* Add a "reset stats for current book" entry in the list of reset options, one that won't horribly break stats in said book ;).
* Fixed a couple of resource (SQL connection) leaks (in ReaderStatistics:getCurrentBookStats & ReaderStatistics:getCurrentBookStats).
* Flush stats to the DB on periodical metadata saves.
* Minor cosmetic tweaks to the code
4 years ago
Marek Gibek 6b90239e7c
Statistics plugin: fix in-memory statistics. (#6759) 4 years ago
NiLuJe ec3ec8dc21
Show full ToC entry on hold (#6729)
Fix #6728
4 years ago
NiLuJe 99045b4311
Minor util & ffi/util cleanups (#6657) 4 years ago
Frans de Jonge e23f68e5f7
[fix] Statistics: allow for proper translation of plural (#6437)
Reported by @leschek
4 years ago
Frans de Jonge da507f8607
[chore] Update MD5 calls with new sha2 library (#6411)
Depends on <https://github.com/koreader/koreader-base/pull/1149>.
4 years ago
yparitcher 70f89c4df1
ReaderGesture: cleanup (#6292)
convert all gesture actions to use events for better modularity
add network event handlers and device event handlers
4 years ago
NiLuJe 1f994f8ede
Floor dimension computations (mul/div). (#6264)
* floor most every dimension computations involving MUL or DIV
Should avoid passing nonsensical floating point coordinates/dimensions
to the UI code.

* Update base

* https://github.com/koreader/koreader-base/pull/1113
* https://github.com/koreader/koreader-base/pull/1114
* https://github.com/koreader/koreader-base/pull/1115

* Bump android-luajit-launcher

https://github.com/koreader/android-luajit-launcher/pull/230
https://github.com/koreader/android-luajit-launcher/pull/231
4 years ago
poire-z c65c33d75f
Statistics: some fixes, reordering and rewording (#6194)
- Fix wrong values for books opened (or first opened)
  from April 14th to May 20th: highlights and notes
  possibly being NULL was preventing nb of pages and
  last_open from being fetched.
- Re-order current book and all books stat items to some
  hopefully more sensible order.
- Some rewording for clarity.

KeyValuePage:
- Have value_overflow_align="right" only align right
  when value overflows 1/2 screen width, but not
  when only key overflows that.
- Show truncated text also on Tap when there is no
  callback.
4 years ago
poire-z 39345704ec
Statistics: fix number of highlights (#6173)
This number might have been leaking from a previously opened
book, and can be innacurate.
Reset it from the number of highlights stored in settings.
Note that the number of "Notes" shown does not mean much.
4 years ago
poire-z e5206922c6 [UX] Normalize SpinWidget and DoubleSpinWidget
- Use same names for options;
- Have them both movable
- Add option to keep widget shown on Apply (and use that
  when appropriate: when the value may have an immediate
  visual effect, so one can tweak it without having to
  go thru menus to re-open it again).
4 years ago
poire-z ba4e175ee6
Statistics: fix md5 leaking between newly opened books (#6052)
Which could cause a same book appearing multiple times
as different entries in statistics.
4 years ago
poire-z 635f784dfd [UX] Gestures: add action "Statistics calendar view"
Also flush current stats when showing calendar view.
4 years ago
yparitcher e9d0c7a96e
[fix] don't crash when enabling statistics on new book (#5971) 4 years ago
yparitcher 08359ee1b6
[UX] Next/Previous Bookmark Gestures (#5968)
Fixes #5965
4 years ago