Commit Graph

175 Commits

Author SHA1 Message Date
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
miruka
ab2a73dbfc Set html style for code 2019-07-21 18:17:51 -04:00
miruka
843d40ca26 Fix > parsing and local echo 2019-07-21 17:41:43 -04:00
miruka
459880903d Message stylesheet; turn "> ..." into greentext 2019-07-21 16:53:34 -04:00
miruka
6e65376612 markdown: don't parse "> ..." as blockquote 2019-07-21 16:08:40 -04:00
miruka
3287888a5c JSON configs read(): Merge default and user data 2019-07-21 09:24:11 -04:00
miruka
daa2c36af1 Save/load sidePane manually-set width 2019-07-21 09:08:22 -04:00
miruka
c0b51b574c ui-settings: Rename write_aliases to writeAliases 2019-07-21 08:57:17 -04:00
miruka
246058e647 Make Chat show spinner until ready
Like EditAccount, instead of crashing if the room isn't loaded yet.
2019-07-21 08:38:49 -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
71f78feec6 Define UIState config file 2019-07-21 06:05:01 -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
93bc2ff5a9 Add multiaccount write-as alias account setting 2019-07-18 21:58:21 -04:00
miruka
329c34cf94 Limit concurrent thumbnail downloads to 8 2019-07-18 20:49:47 -04:00
miruka
9decd58992 Use aiofiles for image provider file writes 2019-07-18 20:44:17 -04:00
miruka
d597e1dda8 Refactor Backend and config file operations 2019-07-18 20:30:41 -04:00
miruka
31184071db call(Client)Coro: support nested.getattr.retrieval 2019-07-18 20:24:59 -04:00
miruka
a842981406 Improve README 2019-07-18 18:35:47 -04:00
miruka
ea02ce2316 ES5 → 7: Use enhanced object properties
http://es6-features.org/#PropertyShorthand

Instead of doing {"foo": foo, "bar": bar, ...}, we can just do
{foo, bar} now.

The function parameters of EventHandlers have all been renamed to
camelCase to make use of this, as the JS style conventions intend.
Other functions will follow in a later commit.
2019-07-18 04:17:35 -04:00
miruka
4c0b947d1a Handle nio.ThumbnailError cases
Return a 1x1 transparent PNG for now.
2019-07-18 02:08:01 -04:00
miruka
62056b6124 Avatar change working 2019-07-15 16:14:08 -04:00
miruka
751a27157c Add account settings page
Display name change working
2019-07-13 20:15:20 -04:00
miruka
58ebe6475e Use uvloop to make asyncio faster 2019-07-10 00:05:42 -04:00
miruka
d091f3bcb6 Propagate mouse click events on avatars 2019-07-09 23:49:59 -04:00
miruka
2ced310ce1 Add initial support for user avatar thumbnails 2019-07-09 21:46:21 -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
8dccfffc8b Drop kwargs support for callCoro/callClientCoro 2019-07-07 23:38:37 -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
735707bade Add members to room updates 2019-07-07 05:12:17 -04:00
miruka
2923d440d0 Fix html filter autolink regex
Two links in the text like "http://foo.org ... http://bar.org"
were seen as a single match.
2019-07-07 03:19:51 -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
78663df09e Always linkify <img> tags, no matter the src 2019-07-04 23:21: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
63645b73a5 RoomDelegate subtitle, take only 1 arg for getUser 2019-07-04 00:28:13 -04:00
miruka
5fa2892fda Move various functions in QML code to new utils.js 2019-07-03 22:31:29 -04:00
miruka
8ac731149d Sending messages and local echo 2019-07-03 21:20:49 -04:00
miruka
1f73f634e8 Strip leading/trailing \n from html filter output 2019-07-03 18:36:03 -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