Commit Graph

145 Commits

Author SHA1 Message Date
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
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
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
451038641e Display RoomMessageImage events 2019-09-14 00:46:54 -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
0e6b6c830d Support inline HTML/links for room topic 2019-09-11 16:01:37 -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
a87f98fae0 Add key exporting to account settings 2019-09-07 19:17:32 -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
0bbc61fd64 Remove pdb call 2019-08-30 20:40:09 -04:00
miruka
720eb78fe8 Fix displaying local echo html formatting 2019-08-30 11:53:55 -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
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
6cb7589cca Loading icon for accounts until synced 2019-08-27 15:00:50 -04:00
miruka
b8d43ecfec Add account logout feature via context menu 2019-08-21 17:45: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
4e14828004 Fix Room inviter_avatar getting set to None 2019-08-17 18:17:14 -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
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
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
34edf923d0 Fix past events loading error for invited room 2019-08-15 11:46:40 -04:00
miruka
24ea8fa673 Register invited rooms 2019-08-15 10:51:37 -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
99c3cc7d9f Put nio encryption files in an encryption subdir 2019-07-24 20:00:01 -04:00
miruka
345b17b21f Catch ErrorResponse json.dumps error 2019-07-23 14:48:37 -04:00
miruka
843d40ca26 Fix > parsing and local echo 2019-07-21 17:41:43 -04:00
miruka
853bb350b4 Make EditAccount show a spinner until ready
Instead of crashing if userInfo is not yet available.

statusMessage is removed for now from UserUpdated events,
and the users model items will have a "loading" property.
2019-07-21 07:14:16 -04:00
miruka
cea586120e Rework how messages and events are handled
- No more translatable, content_type, show_name_line attrs for
  TimelineEventReceived.
  Since they are UI concerns, they are handled directly in QML.

- Refactor the EventDelegate and get rid of errors when new items
  are added to the timeline

- Messages, events and emotes all combine correctly.

- No more 28px wide avatars for events, to make them uniform with
  messages.
2019-07-20 01:30:58 -04:00
miruka
ecc2c099f1 Add /me command 2019-07-19 20:55:52 -04:00
miruka
58079a4ac2 Support RoomMessageEmote events 2019-07-19 19:19:43 -04:00
miruka
a10a395e0b Only send a formatted_body if it's truly needed 2019-07-19 18:13:04 -04:00
miruka
a842981406 Improve README 2019-07-18 18:35:47 -04:00
miruka
62056b6124 Avatar change working 2019-07-15 16:14:08 -04:00
miruka
faccc7ba90 Fix decrypted events replaced by encrypted ones 2019-07-08 13:29:05 -04:00
miruka
861347ce64 Fix "tarfindId" sed rename mistakes 2019-07-08 13:24:05 -04:00
miruka
4472d44320 Enable encryption 2019-07-08 13:08:46 -04:00
miruka
4314767ac2 Fix creating UserUpdated events from nio rooms 2019-07-08 12:28:49 -04:00
miruka
0f6474532b Add LGPL license headers 2019-07-07 23:53:08 -04:00
miruka
f64a2c68e9 Fix undefined profile being requested 2019-07-07 22:36:12 -04:00
miruka
b02fc11903 Remove forgotten rooms from the view 2019-07-07 22:19:45 -04:00
miruka
ea600a1450 Reintroduce RoomSidePane with members list 2019-07-07 05:15:18 -04:00
miruka
472b8fe993 Fix "joined room" event shown as "declined invite" 2019-07-07 02:48:28 -04:00
miruka
a47e6b5c07 When room changes category, affect the Chat too 2019-07-07 02:35:22 -04:00
miruka
be152c3acf Fix getUser binding loops & coro race conditions 2019-07-07 01:37:13 -04:00
miruka
03d9079d63 Show LeftBanner with a generic left text 2019-07-06 23:43:51 -04:00
miruka
3ff0e1bd70 Use nio RoomMemberEvent new attrs 2019-07-06 22:38:56 -04:00
miruka
cf04f8ad2f Display Left rooms, shorter onSyncResponse func 2019-07-06 22:35:42 -04:00
miruka
556749aa35 LimitExceededError → ErrorResponse 2019-07-06 17:29:00 -04:00
miruka
4c4603691f Working typing users bar 2019-07-05 19:54:16 -04:00
miruka
ee4e6470a9 Invite banner (callbacks not implemented yet) 2019-07-05 16:48:30 -04:00
miruka
c70c7d555d Load only 25 past events at once until lag solved 2019-07-05 03:18:24 -04:00
miruka
ecba7c47ec Past events loading (with two bugs) 2019-07-05 03:12:27 -04:00
miruka
1db406d9af Add LimitExceededError nio callback 2019-07-04 22:49:37 -04:00
miruka
55e14e96bc Ensure msgs are sent in right order, fix echo bug
bug: only one local echo message delegate could be seen because all
echo eventId were the same
2019-07-04 21:37:20 -04:00
miruka
634796b7d9 Don't put our own profile changes in the timeline 2019-07-04 19:11:22 -04:00
miruka
07438150db Optimize model upsert, ensure right type for roles 2019-07-04 18:41:08 -04:00
miruka
8ac731149d Sending messages and local echo 2019-07-03 21:20:49 -04:00
miruka
9d5701da19 Add support for non-message room events 2019-07-02 22:24:21 -04:00
miruka
a6653179e5 nio.AsyncClient can now have event callbacks 2019-07-02 15:06:45 -04:00
miruka
06c823aa67 Build system, messages support and more 2019-07-02 13:59:52 -04:00