Commit Graph

311 Commits

Author SHA1 Message Date
miruka
4c15b7dc62 Fix SVG uploads, fix entire Upload model deleted 2019-11-06 07:50:31 -04:00
miruka
e45f2c9d2d Fix thumbnail API error when QML gives float sizes 2019-11-06 06:51:55 -04:00
miruka
92d3390106 Fix CryptDict redefined in media_cache.py 2019-11-06 06:30:17 -04:00
miruka
078cf61b7e Show an uploads bar in chats when uploading files 2019-11-06 06:28:48 -04:00
miruka
8f3df28b9d ModelItem: serialize enum members to their values 2019-11-05 18:03:48 -04:00
miruka
7408322fbe Fix/improve image sizes 2019-11-05 09:19:48 -04:00
miruka
82104266fe Encrypt uploads in a thread 2019-11-04 15:18:01 -04:00
miruka
2d682516e8 Support encrypted file reading & caching
Also don't convert palette images to JPEG when creating thumbnails.
2019-11-04 14:37:48 -04:00
miruka
de8d0b5823 Fix image events opened/copied url 2019-11-04 10:46:06 -04:00
miruka
02c6ec4500 Implement Media download 2019-11-04 10:29:18 -04:00
miruka
484eefe86d Fix image URL preview, add Thumbnail.create()
- Make HMxcImage's mxc property work with http too (temporary quick
solution)

- Thumbnail objects can now be initialized with existing bytes and not
  have to download anything.
2019-11-04 07:00:28 -04:00
miruka
337603595a Backend: separate wait_until_(any_?)client_exists() 2019-11-04 06:56:26 -04:00
miruka
e1600389fc Upload 800x600 thumbnails instead of 512x512
Maximum thumbnail size, match Riot's behavior.
2019-11-03 14:08:29 -04:00
miruka
2f19ff493b Rewrite media caching (old image provider)
- Doesn't use pyotherside's image provider feature, for more flexibility
  and simplicity
- Suitable for supporting matrix media events and more later
- Avoid a lot of duplicate files that the old cache created due to
  server not returning what we expect, mistakes in Python/QML code, etc
- Changed file structure
  (e.g. thumbnails/32x32/<mxc id> instead of
   thumbnails/<mxc id>.32.32.crop)

- Backend.wait_until_account_exist: start issuing warnings if the
  function runs for more than 10s, which means in most case a bad user
  ID was passed

- New HMxcImage QML component, used in H(User/Room)Avatar
2019-11-03 13:48:12 -04:00
miruka
b9fbd36661 Restart sync if exception occurs 2019-10-30 11:15:35 -04:00
miruka
ce2a7f1018 Support encrypting uploads
For files and thumbnails.
Also fix the PIL thumbnail() bad argument function call.
2019-10-30 10:34:20 -04:00
miruka
b11c9d5675 Use lanczos filter and optimize saved thumbnail 2019-10-30 05:47:22 -04:00
miruka
adeec71fac Log warning when thumbnailing fails 2019-10-30 05:36:54 -04:00
miruka
48bcc91582 Never upscale images when thumbnailing 2019-10-30 05:34:32 -04:00
miruka
412a86762e Generate thumbnail when uploading images 2019-10-29 16:42:56 -04:00
miruka
7a5a1fc650 Print python exception tracebacks 2019-10-29 13:34:55 -04:00
miruka
001d6eff71 Initial upload implementation 2019-10-28 15:27:36 -04:00
miruka
820cc68373 Rename MatrixClient.send_markdown() to send_text
Because it deals with text command parsing too
2019-10-28 13:51:46 -04:00
miruka
662b60d7a8 Separate _function for local echoing 2019-10-28 13:49:55 -04:00
miruka
09a50f8bc7 Separate _function for general message sending 2019-10-28 13:34:59 -04:00
miruka
6eb3a378bc Proper upload exceptions, handle in QML set avatar 2019-10-28 08:06:22 -04:00
miruka
5894481dc5 Python exceptions can now be handled via QML
callCoro/callBackendCoro can now take onSuccess(result) and
onError(type, args, errorObject) callbacks.
2019-10-28 06:26:02 -04:00
miruka
07e6d74b91 Fix HTML escaping for markdown parsing
Use mistune's escape option instead of `html.escape()` which messes up
links.
2019-10-27 12:06:19 -04:00
miruka
7090ff601f Don't have local echoes stay fixed at the bottom 2019-10-24 10:28:07 -04:00
miruka
986e39cdc2 Fix quotes rendering in inline filtered html
Before:
a
>x
b
>z

This message would have been shown all gray in the client due to it not
beginning with a >. Now, the colors are properly shown for both quotes
and the non-quote text in between.
2019-10-24 09:43:40 -04:00
miruka
39b4706c75 Have return symbols in inline filtered html
Before: "foo\nbar" was rendered as "foobar"
Now: "foo\nbar" is rendered as "foo ⏎ bar" (U+23CE unicode).
2019-10-24 09:08:10 -04:00
miruka
5522de5165 html_filter: don't remove \n in <pre> content 2019-10-24 08:06:50 -04:00
miruka
c4b05befa4 html_filter: html escape markdown before filtering
Fixes the problem where a user sends e.g. "hi <test>" and the "<test>" is
removed because it's seen as a bad html tag.
2019-10-24 07:27:13 -04:00
miruka
d20ab5a348 Refactor EventContent
Use proper layouts and get rid of multiple annoyances/bugs like
text-wrapping randomly happening in the middle of words, background
rectangles being too large, a certain binding loop, etc
2019-09-19 15:49:29 -04:00
miruka
f19d337817 Move hover preview height from settings to theme 2019-09-17 16:39:45 -04:00
miruka
692749e72f Support video events, new media player 2019-09-17 16:30:04 -04:00
miruka
451038641e Display RoomMessageImage events 2019-09-14 00:46:54 -04:00
miruka
0db34cc3c8 Add EventMediaLoader
Handles loading of URL previews and will handle all
matrix media messages types.
2019-09-14 00:36:19 -04:00
miruka
8ad13b033d Event: optional (inline_)content, auto-gen inline 2019-09-13 23:02:11 -04:00
miruka
a5095274ba MatrixClient: RoomMessageMedia support 2019-09-13 22:48:33 -04:00
miruka
a2ab7b3090 Add event callback for RoomUnknownMessage 2019-09-13 19:58:45 -04:00
miruka
d3a02deb46 Update version to 0.2.3 2019-09-12 20:59:12 -04:00
miruka
0b60b2b5bc Add autoplay GIF setting 2019-09-12 17:32:48 -04:00
miruka
f8811f4e0c Disable underscore emphasis syntaxes for markdown 2019-09-11 17:25:50 -04:00
miruka
0e6b6c830d Support inline HTML/links for room topic 2019-09-11 16:01:37 -04:00
miruka
72bcb9bbe3 Update version to v0.2.2 2019-09-10 22:07:41 -04:00
miruka
60663ed040 Leave non-image links out from Event.previe_links
normal links preview isn't implemented yet, which caused any message
with a link to take at least 256px due to the preview repeater.
2019-09-10 22:07:06 -04:00
miruka
7797b0e1eb HtmlFilter: Remove excess newlines
To avoid additional blank lines with HTML/CSS using `white-space: pre`
2019-09-10 21:22:42 -04:00
miruka
b3135601ed Stop supporting starting without pyotherside 2019-09-10 20:49:01 -04:00
miruka
d6b8fae30a matrix_client: leave room before forgetting it 2019-09-10 01:34:01 -04:00
miruka
988ab94772 Fix ForgetRoomPopup destruction/callback 2019-09-09 20:56:10 -04:00
miruka
7c0bed79a9 ImportKeys/ExportKeys separate dialog componants 2019-09-09 14:42:58 -04:00
miruka
6b26aa6d0b load_past_events: Catch RoomMessagesError 2019-09-09 08:26:09 -04:00
miruka
aefb314999 Fix exporting key to a path that doesn't exist yet 2019-09-08 12:17:08 -04:00
miruka
e93c251624 Add clear messages shortcut 2019-09-08 11:51:03 -04:00
miruka
db0de237e6 Add message context menu entry to clear events 2019-09-08 11:40:39 -04:00
miruka
405573bb2d Fix room subtitle quotes: second+ quote not green 2019-09-08 10:48:58 -04:00
miruka
916f6d8327 Update version to v0.2.1 2019-09-07 23:14:31 -04:00
miruka
a87f98fae0 Add key exporting to account settings 2019-09-07 19:17:32 -04:00
miruka
11486ab51d Add homeserver URL field to login screen 2019-09-07 17:24:58 -04:00
miruka
134543728e Add escape to exit and clear room filter field 2019-09-07 16:48:23 -04:00
miruka
a15fba92cb Add clearRoomFilterOnEnter setting, default true 2019-09-07 16:39:14 -04:00
miruka
fd543f3204 Re-fix quote parsing 2019-09-07 02:22:42 -04:00
miruka
9f8bdfc6fb Fix html quote regex
Also allow quoting in title, e.g. "# > blah blah blah"
2019-09-07 01:44:51 -04:00
miruka
07fb63aa1e rstrip excess \n from html filter output
Caused the event time to be incorrectly shown on its own on a new line
for messages that were ~600px
2019-09-07 00:19:36 -04:00
miruka
6e40f29ebe Consider preview thumbnails to calculate msg width
Also move thumbnails width setting from settings.json to the theme
2019-09-06 23:36:37 -04:00
miruka
5674d0c7b7 Use a component to display image link previews 2019-09-06 23:34:40 -04:00
miruka
b867584784 Make qrc path aliases the same as filesystem ones 2019-09-06 15:07:19 -04:00
miruka
ddd1587b7d Update version to v0.2.0 2019-09-06 15:07:19 -04:00
miruka
aaaff814a1 Update version to v0.1.3 2019-09-06 15:04:19 -04:00
miruka
fd0cd35152 Enable logging of nio errors 2019-09-06 14:05:47 -04:00
miruka
58d491a2b3 Add basic JS/QML debug console 2019-09-05 15:43:00 -04:00
miruka
eab6d1c2ee Fix linkify regex to allow # characters 2019-09-04 05:10:53 -04:00
miruka
175caba2e9 Ignore member events where prev_content == content 2019-09-02 13:21:46 -04:00
miruka
11dbd1e457 Force model sync when receiving remote echo
Forcing model sync on local and remote echo make our own messages
appearing and the loading icon disappearing both feel faster.
2019-08-31 16:18:27 -04:00
miruka
69ed35d4dd Trigger model sync ASAP when creating local echoes 2019-08-31 16:14:14 -04:00
miruka
28d8721fe2 Fix HShortcutHandler not processing shortcuts 2019-08-31 15:34:05 -04:00
miruka
0bbc61fd64 Remove pdb call 2019-08-30 20:40:09 -04:00
miruka
ca2ecc75bb Make uvloop dependency optional 2019-08-30 20:24:13 -04:00
miruka
cc4a33bb04 Write to disk merged base + user config files 2019-08-30 19:43:58 -04:00
miruka
70b82b7b59 Add scroll to top/bottom keybinds 2019-08-30 13:40:56 -04:00
miruka
6a540f6397 Add keybinds to scroll page up/down 2019-08-30 13:06:54 -04:00
miruka
927323909d Rename "greentext" to "quote" 2019-08-30 12:29:01 -04:00
miruka
720eb78fe8 Fix displaying local echo html formatting 2019-08-30 11:53:55 -04:00
miruka
498bee2e20 Improve image path matching regex for html_filter 2019-08-30 10:37:13 -04:00
miruka
10a53d7afb Fix room past events loading in some cases 2019-08-30 10:28:53 -04:00
miruka
a987cf48e6 Don't add profile events to the timeline (for now) 2019-08-30 10:09:09 -04:00
miruka
19cbfc9cfe Fix html_filter.py for html_sanitizer 1.7.3 2019-08-30 00:07:41 -04:00
miruka
552a4b53fb Use the now fixed nio.MatrixRoom.display_name
The property behaves according to the Matrix standard starting from nio
0.5, no need to generate the room display name ourself anymore.
2019-08-29 16:47:07 -04:00
miruka
4ff3ebe255 Fix room subtitle for local echoes 2019-08-28 13:29:49 -04:00
miruka
f8a392883b Retry decrypting megolm events after a key import 2019-08-28 13:23:12 -04:00
miruka
ce3404a516 Show import keys error in the UI 2019-08-28 11:42:52 -04:00
miruka
7d2cbae26f Show key import progression 2019-08-28 03:54:53 -04:00
miruka
f65c0176ba Better error handling and fixes for key import 2019-08-27 23:51:38 -04:00
miruka
ebfebbeae1 Improve import keys password popup 2019-08-27 22:43:57 -04:00
miruka
05b248e31a Make config file reloading work again 2019-08-27 20:06:58 -04:00
miruka
6cb7589cca Loading icon for accounts until synced 2019-08-27 15:00:50 -04:00
miruka
b457f46247 Close HTTP session when logging in fails
Avoids "Unclosed client session" error messages in the terminal
2019-08-27 14:23:09 -04:00
miruka
7eda87217c Add keybind to add new account 2019-08-23 11:03:18 -04:00
miruka
8de26c11a1 HShortcutHandler & HShortcut components
Provide more powerful shortcuts handling than what's available with
QML's Shortcut component, notably being able to react differently to key
presses, releases and auto-repeats.
2019-08-22 13:03:26 -04:00
miruka
b8d43ecfec Add account logout feature via context menu 2019-08-21 17:45:05 -04:00
miruka
fea2178461 Make linkify regex work with port in URL 2019-08-21 14:22:34 -04:00
miruka
d2938f8730 Don't linkify image links for outgoing html 2019-08-21 14:14:44 -04:00
miruka
c865de6dc7 Fix wrong collapse keybind: Alt+Shift+(R → L) 2019-08-20 13:01:22 -04:00
miruka
c841a7a841 Add keybind to toggle collapsing account 2019-08-19 14:28:12 -04:00
miruka
314b2c30ad Add keybind to clear room filter 2019-08-19 14:05:59 -04:00
miruka
af14038909 Rename filterRooms keybind to FocusSidePane 2019-08-19 13:58:31 -04:00
miruka
36dd6457ea Change focus filter rooms keybind to (Alt/Ctrl)+S 2019-08-19 13:18:45 -04:00
miruka
5e5a658173 Add keybinds to go to previous/next room 2019-08-19 13:09:05 -04:00
miruka
6ec193d554 obj.__dict__ calls → obj.serialized or vars(obj) 2019-08-19 11:52:52 -04:00
miruka
4349643345 filter_string is now a class property
- Support serializing class properties instead of just dataclass fields
- filter_string is now a property that's always up-to-date
- Account display names matching the current SidePane filter are shown
2019-08-19 11:34:51 -04:00
miruka
d1eec2ee6b Set client max timeout retry wait time to 10s 2019-08-19 10:31:53 -04:00
miruka
165c1b797e Repair room filter, performance improvements
Chnaging delegate heights is a terrible idea that leads to graphic bugs.
Handle filtering (both room and accounts) and collapsing from a function
that sets the JsonListModel source.
2019-08-19 10:28:49 -04:00
miruka
2865d86d19 Refactor SidePane ListView in a flat way
Also adjust some colors (accentBackground)

TODO: Repair Filter rooms field
2019-08-18 03:35:28 -04:00
miruka
4067d8c4ab Get flat SidePane data on Account/Room models sync
QML: Get the data from Python and print it (for now)

Also:
- Remove useless Model.sortable field, all models/items are sortable
- Change SyncId type hint for less mypy complaints
- Remove ModelItem.main_key class attributes, useless since last big
  refactor
2019-08-17 22:46:54 -04:00
miruka
4e14828004 Fix Room inviter_avatar getting set to None 2019-08-17 18:17:14 -04:00
miruka
2e89dcae9e Add shortcut to focus filter rooms field 2019-08-17 15:58:32 -04:00
miruka
ec17e36911 Better plain text to html conversion
Replace \n and space characters instead of just wrapping the whole text
in pre and having to set a css style
2019-08-17 15:05:05 -04:00
miruka
d98b215c0f Fix plain text messages newlines being ignored 2019-08-17 14:51:04 -04:00
miruka
c7adb5b02f Show error messages on login screen 2019-08-16 16:30:18 -04:00
miruka
e920299db4 Update JSON config file if it lacks keys 2019-08-16 15:12:14 -04:00
miruka
be18a5db41 Make alert show for time set in cfg (default 4s) 2019-08-16 15:07:30 -04:00
miruka
1061498160 Alert (set urgency hint) on new messages 2019-08-16 14:27:25 -04:00
miruka
656dbbdf4a Make room filter field consider room's last event 2019-08-16 13:31:53 -04:00
miruka
cf8ae13eae Set local echoes as room last events 2019-08-16 12:23:34 -04:00
miruka
9ca66b6044 Sort rooms by last event date again 2019-08-16 12:19:43 -04:00
miruka
c76ebe4fe2 Improve some texts 2019-08-16 09:47:44 -04:00
miruka
564ad4fa8f Fix invited/left rooms sorting 2019-08-16 03:01:40 -04:00
miruka
653934be71 Fix declining invitation being ignored 2019-08-16 02:12:37 -04:00
miruka
8baf336cf9 Room subtitle: show member but not profile events
Instead of not showing any kind of RoomMemberEvent.
2019-08-16 01:51:42 -04:00
miruka
6a7376d498 Update LeftBanner, fix forget button crash 2019-08-15 13:00:15 -04:00
miruka
3270c6dd19 Have inviter display name and avatar for rooms 2019-08-15 12:13:41 -04:00
miruka
2ac484b8f5 Remove now broken "don't read user theme if debug" 2019-08-15 12:08:43 -04:00
miruka
34edf923d0 Fix past events loading error for invited room 2019-08-15 11:46:40 -04:00
miruka
710a5c0914 Keep filter bars from different sidePanes in sync 2019-08-15 11:30:22 -04:00
miruka
24ea8fa673 Register invited rooms 2019-08-15 10:51:37 -04:00
miruka
e027c56047 Add/improve ModelStore and Model __str__ 2019-08-15 09:57:58 -04:00
miruka
3c35616eaa Remove copyright headers in code 2019-08-11 08:34:36 -04:00
miruka
67dde68126 Big performance refactoring & various improvements
Instead of passing all sorts of events for the JS to handle and manually
add to different data models, we now handle everything we can in Python.

For any change, the python models send a sync event with their
contents (no more than 4 times per second) to JS, and the QSyncable
library's JsonListModel takes care of converting it to a QML ListModel
and sending the appropriate signals.

The SortFilterProxyModel library is not used anymore, the only case
where we need to filter/sort something now is when the user interacts
with the "Filter rooms" or "Filter members" fields. These cases are
handled by a simple JS function.

We now keep separated room and timeline models for different accounts,
the previous approach of sharing all the data we could between accounts
created a lot of complications (local echoes, decrypted messages
replacing others, etc).

The users's own account profile changes are now hidden in the timeline.
On startup, if all events for a room were only own profile changes, more
events will be loaded.

Any kind of image format supported by Qt is now handled by the
pyotherside image provider, instead of just PNG/JPG.
SVGs which previously caused errors are supported as well.

The typing members bar paddings/margins are fixed.

The behavior of the avatar/"upload a profile picture" overlay is fixed.

Config files read from disk are now cached (TODO: make them reloadable
again).

Pylint is not used anymore because of all its annoying false warnings
and lack of understanding for dataclasses, it is replaced by flake8 with
a custom config and various plugins.

Debug mode is now considered on if the program was compiled with
the right option, instead of taking an argument from CLI.
When on, C++ will set a flag in the Window QML component.

The loading screen is now unloaded after the UI is ready, where
previously it just stayed in the background invisible and wasted CPU.

The overall refactoring and improvements make us now able to handle
rooms with thousand of members and no lazy-loading, where previously
everything would freeze and simply scrolling up to load past events
in any room would block the UI for a few seconds.
2019-08-11 08:27:53 -04:00
miruka
f5aa2c194a "ui-settings.json", "ui-state.json": no ui- prefix 2019-07-24 20:02:31 -04:00
miruka
99c3cc7d9f Put nio encryption files in an encryption subdir 2019-07-24 20:00:01 -04:00
miruka
504644e641 Fix JSONConfigFile read() when no file exists 2019-07-24 19:56:23 -04:00
miruka
a2469bd994 Don't use user theme in debug mode 2019-07-24 18:46:13 -04:00
miruka
de11b53c4e Copy default theme to user data dir if not exist 2019-07-24 18:14:43 -04:00
miruka
eb97f08d6a Add keybind to reload config file (default Alt+R) 2019-07-24 17:26:40 -04:00
miruka
cf5d76dd10 Recursively merge default and user config 2019-07-24 17:20:21 -04:00
miruka
efa4ad0ae0 Add keybinds to config file 2019-07-24 17:05:27 -04:00
miruka
ec27ecf498 Initial themes implementation, new default theme 2019-07-24 02:14:34 -04:00
miruka
345b17b21f Catch ErrorResponse json.dumps error 2019-07-23 14:48:37 -04:00
miruka
9397687122 Parse theme from a custom simpler format 2019-07-23 03:14:02 -04:00