Commit Graph

193 Commits (e7acec15261927eb5380813d85786b7b3108fc12)

Author SHA1 Message Date
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 9f835156d1
PluginLoader: Allow querying whether a specific plugin is loaded (#7607)
* PluginLoader: Allow querying whether a specific plugin is loaded (instantiated, actually).

Re #7598

* PluginLoader: Add a method to access a specific Plugin's instance
(Besides `self.ui[plugin_name]`, that is).

Requires some nastiness to avoid pinning stale references in memory :s.

* PluginLoader:  Tweak genPluginManagerSubItem to keep from rebuilding `self.all_plugins`, it's using `loadPlugins`, which is cached, so it made no sense to re-compute this one.
3 years ago
hius07 3cb9508185
Filemanager: enhance file operations dialogs (#7582) 3 years ago
NiLuJe 14f9f9d3fc
FileManager: Tweak #7564 (#7571)
Tweak the goHome handler directly, instead of only the Home button.
Also, limit it to when it's actually needed, as changeToPath already
does it.
3 years ago
gbyl 915c5c7755
FileManager: Also refresh content when tapping the "Home" button (#7564)
Co-authored-by: gbyl <gbyl@users.noreply.github.com>
3 years ago
hius07 7b169dfa5e
FileManager: Hold the "+" button to refresh content (#7559) 3 years ago
NiLuJe d31dc1e450 FileManager modules: Slightly less hackish onSetRotationMode handlers...
And, also, rotate the parent widget (i.e., FM/RV) to avoid leaving the
user with a broken layout when they exit in a different orientation ;).
3 years ago
hius07 91262f9647
File manager: some broken actions for parent folder (#7475)
For parent folder (..):
disabled `Copy`, `Cut`, `Delete`, `Rename`.
enabled `Paste`, `Set as HOME folder`.
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
NiLuJe 32b070f3ac
Dispatcher: nil guard against access to a document instance (#7389)
Also:
* Properly update *all* the touch zones when rotating the FM
* Unbreak (Reader) rotation labels in Dispatcher
Regression since #7306
3 years ago
Frans de Jonge 1bd4636a03
Standardize directory/folder to folder (#7328)
Closes <https://github.com/koreader/koreader/issues/7157>.
3 years ago
poire-z 3b89e32069 [UX] Add ToC/Bookmarks settings
- Menu widget: allow specifying the number of items per
  page and the item font size, so we can use other values
  than the default File browser ones
- Menu: fix setDirty when a border is used
- ToC: add item per page and font size settings, make
  Alternative ToC more visible (was previously
  available on long-press on Table of contents)
- Bookmarks: add item per page, font size, size reduction
- Progress bars (Skim widget and footer): allow selecting
  ToC depths from which ticks are made.
3 years ago
yparitcher 1c9c40fb95
Save rotation across restarts (#7096) 3 years ago
NiLuJe 642978c97c
FileManager: Make reinit slightly less hackish (#7006)
Much like #6958 did for plugins, registering listener twice was also a
big boo-boo.

Revamp the whole thing to make it slightly less hackish.
3 years ago
poire-z 24424e505e Update UI layout code to use new SVG icons
- Add IconWidget, use it for icons instead of ImageWidget.
  Specify icons by name only, look for them (with either
  .svg or .png suffixes) in multiple directories (including
  koreader/settings/icons/ to allow customizing them).
  Don't crash when icon name not found, shown a black
  background warning icon instead.
- Don't trust the icons' native sizes: replace
  scale_for_dpi=true with width/height=DGENERIC_ICON_SIZE,
  so all icons get the same (tunable) size - except in
  a few specific use cases.
- Top and bottom menu bars: normalize, and have icons
  properly centered in them, extend vertical line
  separators up to the edges.
- TOC: adjust expand/collapse icons size to items size
3 years ago
yparitcher b0a1077756
FileManager: fix Plus menu override (#6957)
manage it in FM not in gestures, as  #6918 made the menu tap zone the entire width so the tap is not passed through to the gesture plugin
3 years ago
jperon 53a7067c24
FileManager: don't load already loaded plugins (#6958)
FileManager:init is called by FileManager:reinit, which caused duplicate
loads. Those can't be useful, (for example to re-load a modified plugin
on runtime), as PluginLoader:loadPlugins memoizes loaded plugins.
3 years ago
Martín Fdez be2bcac28e switch between internal and external sdcard 3 years ago
yparitcher 7fb20f2c55
Dispatcher: add Screenshot action (#6858) 4 years ago
poire-z 8403154d4d
Reader: rationalize "Back" key/action handling (#6840)
Have ReaderBack be the sole handler of onBack.
Add 4 mutually exclusive options for the Back key,
to avoid ReaderLink and ReaderBack location stacks
from interfering (ReaderBack's stack being always a
superset of ReaderLink's stack).
So, remove "Enable back history", which is replaced
by Back option "Go to previous read page".
Fix a few possible crashes and inconsistencies (when
zoom, scroll or reflow have changed) with ReaderPaging
and ReaderView when restoring previous page/view.
4 years ago
Galunid 39faa8b860
Move numeric sort up, so it looks better (#6777) 4 years ago
NiLuJe 99045b4311
Minor util & ffi/util cleanups (#6657) 4 years ago
poire-z 85a16d0064 Open with: add Text Editor plugin 4 years ago
poire-z 69d11ebfd9 Start with: add Favorites 4 years ago
yparitcher b9311a1772
FM: rotation flush setting before reinit (#6532)
when rotation was caused by a gesture the gesture settings were not flushed leading to weird state when the FM reinit reloaded the gestures plugin

discovered in #6530 caused by #6309
4 years ago
yparitcher 2a99b014a2 initial refactor of ReaderGesture into Gestures plugin 4 years ago
Galunid 62daa7b783
Implement numeric collator (natural sorting) in file manager (#6378) 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 509ee7bb86
Allow locking the gyro to the current screen mode (#6347)
* Allow locking the gyro to the current screen mode (i.e., orientation).
* Tweak the "sticky rota" option to work both ways
* More rotation constant usage instead of magic numbers
4 years ago
yparitcher 8f2399caa9
[fix] Allow default FM rotation on init when `Keep FM rotation` is disabled (#6348) 4 years ago
yparitcher f7d538b108
Landscape FM / Refactor rotation (#6309)
* landscape FM / Refactor rotation

refactor and simplify the orientation handling code. the user generally cares about the rotation (what direction the device is facing) and not about if koreader is displaying in portrait or landscape mode

* bump base

update luasocket, libjpeg-turbo, curl
add logging to evernote-sdk-lua
update framebuffer for proper rotation
4 years ago
zwim 43693c9fe9
Add the possibility run shell scripts from filemanager on android (#6288) 4 years ago
Martín Fernández 83cde64bcc
unified calibre plugin (#6177)
joins calibre metadata search and calibre wireless connections into a single plugin

search metadata changes:

- search directly into calibre metadata files.
- search can be performed on more than one library (configurable from a menu)
- device scans now find all calibre libraries under a given root
- search options can be configured from a menu. (case sensitive, find by title, author and path)
- removed legacy global variables.
- *option* to search from the reader
- *option* to generate a cache of books for faster searches.

calibre wireless connection changes:

- keep track of books in a library (includes prunning books from calibre metadata if the file was deleted locally)
- remove files on device from calibre
- support password protected connections
- FM integration: if we're in the inbox dir it will be updated each time a book is added or deleted.
- disconnect when requested by calibre, available on newer calibre versions (+4.17)
- remove unused opcodes.
- better report of client name, version and device id
- free disk space checks for all calibre versions
- bump supported extensions to match what KOReader can handle. Users can override this with their own list of extensions (or from calibre, by configuring the wireless device).
4 years ago
Martín Fernández 2e731dd4dd
[chore] Device abstraction (#6280)
* generic Device:info() function which returns the model

* add Device:canSuspend() and make it true in all devices that have suspend routines and the emulator

* also enable fake poweroff/reboot on the emulator

* add Device.home_dir

* add Device:hasExitOptions() and update menus & comments
4 years ago
poire-z 46221985a6
Delegate "lastfile" management to ReadHistory (#6128)
Simplify (and avoid edge cases) in other code by having
ReadHistory manage the "lastfile" setting on add, remove,
rename...
Fixed a few other cases of things not updated.
4 years ago
mwoz123 ce3bf473da
Add move to archive plugin (#6101) 4 years ago
poire-z 41aad475ce File browser: sane fallback when home_dir invalid or missing 4 years ago
poire-z c2a5d3f3f3
FileManager: tell plugins to save settings on close (#5872)
So that Statistics settings modified while in FileManager
are saved.
Also allows resetting statistics when in FileManager
(where there is no current book id to exclude).
4 years ago
Frans de Jonge 44c69dadb6
[chore] Replace ... with … (ellipsis) (#5815)
Follow-up to <https://github.com/koreader/koreader/pull/5804>.
4 years ago
NiLuJe 5499d85cbc
Allow running shell scripts from the FileManager/Favorites (#5804)
* Allow running Shell/Python scripts from the FM

* Show an InfoMessage before/after running the script

Since we're blocking the UI ;).

* Allow running scripts from the favorites menu, too.
4 years ago
NiLuJe f44b031702
Make Inverted Portrait a first-class citizen (#5783)
* Don't store stale screen/rotation modes in book's settings!

Gyro events *may* entirely bypass the local copy...
In any case, using a local copy was essentially asking for trouble...

Actually fix #5772

(because the issue was indeed that a Gyro swap from Portrait to Inverted
Portrait wasn't stored properly).

* Allow showing ScreenSavers in Inverted Portrait.

That works just fine, and won't lead to the confusing situation where a
lefty might pick up the device as a righty because the ScreenSaver
happens to be shown that way, only to have it rotate back to its lefty
orientation on wakeup...
4 years ago
poire-z 0599c440cc [RTL UI] Bidi-wrap filenames, paths, urls, metadata
bidi.lua:
- Revert "Alias everything to Bidi.nowrap() when in LTR UI,
  as using LTR isolates seems uneeded when already LTR" (part
  of a628714f) which was a wrong assumption: we need proper
  wrappers for all things paths. Enhance some of these wrappers.
- Fix GetText RTL wrapping which was losing empty lines and
  trailing \n.

- Wrap all paths, directories, filenames in the code with
  these wrappers.
- Wrap all book metadata (title, authors...) with BD.auto(),
  as it helps fixing some edge cases (like open/close quotation
  marks which are not considered as bracket types by FriBiDi).
  (Needed some minor logic changes in CoverBrowser.)

- Tweak hyphenation menu text
- Update forgotten SortWidget for UI mirroring
- KoptConfig: update "justification" index for RTL re-ordering,
  following the recent addition of the page_gap_height option.
4 years ago
Martín Fernández 25e80358dc android: import files from Storage Access Framework 4 years ago
poire-z 7952fa2c09 [RTL UI] update widgets and apps for UI mirroring
Small tweaks all around to handle UI mirroring:
- swap existing symbols like arrows, or use alternative ones
- rotate some images, like chevrons and dogear icons
- flip some left and right swipe handling
- flip some geometry arithmetic like tap on left or right
  side of page or dict window
- use new ProgressWidget:getPercentageFromPosition() instead
  of geometry arithmetic
- BD.wrap() some concatenated string bits, like in reader
  and menu footers
- flip inverse_reading_order when UI is mirrored

More specific tweaks:
- ReaderGesture: reset some specific gestures when UI direction
  has changed (tap on top/bottom left/right corners, for
  bookmarks and FileManager "Plus menu").
- ReaderRolling: show markers on the correct side of page,
  in single or dual page mode.
- KoptOptions: swap left and right icons in Alignment toggle
- CheckMark: proper rendering in all 4 mirroring/rtl combinations.
- VirtualKeyboard: forbid any mirroring
- Move util.getMenuText into Menu.lua
4 years ago
poire-z d6d49a64a7 [RTL UI] use auto or LTR text direction in some specific cases
Allow TextBoxWidget new text direction/lang parameters to be
set on upper widgets, and propagate them all the way to it
(ScrollTextWidget, InputText, InputDialog, TextViewer).

Use specific non-default ones in some specific cases:
- Force LTR text direction when showing HTML and CSS, and
  configuration files (in some plugins).
- Use Wikipedia server language and text direction when
  showing an article.
- Use auto with Dictionary results, as we don't know the
  dictionary language, and they may contain mixed content.
- Force LTR when showing some paths (still needs more of them)

TextEditor plugin: add 2 new options "Auto paragraph direction"
and "Force paragraph direction LTR".

Footnotes popup: grab HTML direction, and forward it
to MuPDF for proper display.
4 years ago
Robert 371e3336a5 [feat] Favorites: organize book into collections (#5527)
View, add, remove, sort, open book to/from collections.
For now, only one collection named Favorites.
5 years ago
yparitcher 6c68df42ec [feat] Open unsupported documents as text (#5497) 5 years ago
poire-z f05e62c1fb
TextWidget: small refactoring, better handle max_width (#5503)
Lots of code was doing some renderText calls to get the size
of some text string, and truncate it to some width if needed,
with or without an added ellipsis, before instantiating
a TextWidget with that tweaked text string.

This PR fixes/adds some properties and methods to TextWidget
so all that can be done by it. It makes the calling code
simpler, as they don't need to use RenderText directly.
(Additionally, when we go at using Harfbuzz for text rendering,
we'll just have to update or replace textwidget.lua without
the need to update any higher level code.)

Also:
- RenderText: removed the space added by truncateTextByWidth
  after the ellipsis, as it doesn't feel needed, and break
  right alignment of the ellipsis with other texts.
- KeyValuePage: fix some subtle size and alignment issues.
- NumberPickerWidget: fix font size (provided font size was
  not used)
5 years ago
Nick ef22e85469 UI Changes (#5508)
* Changed File Browser text

KOReader looks nicer than KOReader File Browser,

* Remove the "page x of x" if only one page

Removes it from the bottom of the file browser

* Remove the "page x of x" if only one page

Removes it from the top menu, if there is only one page, why show page 1 of 1

* Renamed ~ to Home

Since the file browser can be considered "Home"

* Added 12 hour time option

Also tweaked the charging icon,  looks nicer than +, tweaked seperator between time and battery, - instead of @
5 years ago
Martín Fernández 87334801ea android: fix ko paths when primary storage is a SD card 5 years ago