Commit Graph

2273 Commits

Author SHA1 Message Date
miruka
6df9647b59 Faster switching of rooms from different accounts
Use a single [userId, roomId] property for the chat page.
This gets read of the intermediate state where the userId property has
been updated but the roomId one not yet, which led to the page unloading
and reloading itself until both were properly set.

Side-effect: when starting Mirage after this commit for the first time,
the last saved page will not load and user must click a room or
other page manually.
2020-09-13 16:05:15 -04:00
miruka
32679aa7f8 Abandon fetching offline presence on 400 error
It seems like some servers return a M_UNRECOGNIZED code instead of
M_FORBIDDEN or "offline" when trying to fetch the presence for a user
and it's not available.

Fixes https://github.com/mirukana/mirage/issues/116
2020-09-13 10:34:01 -04:00
miruka
a9c316fcf5 Store read receipts in event model items 2020-09-11 14:50:27 -04:00
miruka
d51d266642 Add ModelItem.notify_change() for list/dicts 2020-09-11 14:50:27 -04:00
miruka
7580ecfd64 Fix missing typing.Tuple import in model.py 2020-09-11 14:50:27 -04:00
miruka
59748c7cc8 EventDelegate: better separationSpacing formatting 2020-09-11 14:50:27 -04:00
miruka
0ccf3d03c9
Merge pull request #125 from vSLG/system-tray
Add a system tray icon
2020-09-11 13:52:20 -04:00
vslg
b10234768b Do not use qFatal on component error loop
Using qFatal will terminate the program when it
prints the first error, so use qCritical to print
all errors and then terminate the program.
2020-09-08 08:48:38 -03:00
vslg
67012d6334 Move tray code to a reasonable place
- Move required properties to top
- Do not use concatenation on qsTr, use .arg()
2020-09-08 08:47:00 -03:00
vslg
ae9f88cae5 Fix show up watcher 2020-09-08 08:47:00 -03:00
vslg
4382edc8b0 Rename drawAttention to restoreFromTray 2020-09-08 08:47:00 -03:00
vslg
438b368be6 Fix typos and improve code
- Do not end log messages with '.'
- Rephrase some messages
- Do not use braces on case statement unless there
  is an assignment
2020-09-08 08:47:00 -03:00
vslg
6f9d983e03 Use settingsFolder instead of configDir 2020-09-08 08:47:00 -03:00
vslg
c41ed5d77d Improve system tray icon click behavior
- Middle click now closes Mirage
- A normal click now toggle window visibility
2020-09-08 08:47:00 -03:00
vslg
a543c79c02 Use Qt.quit() when closing the window
Qt.quit() is used because KDE Plasma will minimize
to tray by default when clicking on X button
2020-09-08 08:47:00 -03:00
vslg
8a04f80602 Use application name instead of hardcoding Mirage 2020-09-08 08:47:00 -03:00
vslg
bde7af8a5a Move system tray icon code to its file 2020-09-08 08:46:40 -03:00
miruka
b12e38f41b Fix emote events (/me) display name display 2020-09-05 09:14:40 -04:00
miruka
5dca7d0a35 Remove leftover debug prints in PageLoader 2020-09-04 20:01:54 -04:00
miruka
d48f96f219 Describe power levels <0 as "muted" in event text 2020-09-04 19:56:31 -04:00
miruka
d5212b0f84 Fix power level reset back to default not seen
Previously, changes in power level events where a key is set back to the
default and absent from the "current levels" dict (e.g. a muted user -1
is unmuted and becomes 0, the room default, thus is only present in the
"previous levels" dict) were taken into account when generating the
event text.
2020-09-04 19:51:27 -04:00
vslg
9ee4b14aa2 Add watcher for .show file in config directory
Draw attention when the .show file is created.
It is created when attempting to open another
instance of Mirage with the same configuration.
2020-09-04 17:43:02 -03:00
vslg
56ad0b9975 Add config option closeMinimizesToTray
Options of the system tray icon:
- Hide/show Mirage
- Quit Mirage

Draw attention to Mirage when clicking on the icon
2020-09-04 17:30:12 -03:00
vslg
6061b2f061 Add simple lock file per configuration
Make use of lock files in configuration directory
for preventing multiple instances of Mirage from
being running at the same time, at least for a
single configuration.
Running multiple instances of Mirage is known to
cause encryption errors in one or more instances.
2020-09-04 17:30:12 -03:00
vslg
bbcdcde53f Add simple system tray 2020-09-04 17:30:12 -03:00
miruka
acb1367f11 Fix warnings when uploading to non-E2E room
Fix these:

    <Unknown File>: media_crypt_dict is undefined.
    Adding an object with a undefined member does not create a role for it.
2020-09-04 14:57:09 -04:00
miruka
56f676e35d "X removed this event": say "message" instead
That's what was supposed to happen for non-media message events
since redactions were implemented, but seems like nio doesn't
properly keep the original event type.
2020-09-04 14:52:10 -04:00
miruka
ebfc3d3ee2 Fix redacted media events keeping their thumbnails 2020-09-04 14:47:47 -04:00
miruka
65a1324eb0 Fix initial and non-initial sync filters reversed
Issue introduced in 758edd8a6a (0.6.1)
The filter for the first sync was passed as the filter for later
syncs and vice-versa, which caused problems like redaction events never
arriving.
2020-09-04 14:40:00 -04:00
miruka
89f8cf25d3 Show login page if current was for logged out acc. 2020-09-04 14:05:07 -04:00
miruka
8376d85961 Fix possible segfault when EventDelegate destroyed 2020-09-04 12:57:46 -04:00
miruka
7b6478f514 Correctly handle account with invalid access token
Show a popup saying the session was signed out and cleanup
the models data, instead of spamming the users with
never-ending errors.
2020-09-04 11:25:29 -04:00
miruka
3c9895b0b2 Fix EventHandlers.onModelCleared callback 2020-09-04 10:58:04 -04:00
miruka
1c306f421a Fix PageLoader initial page when no account 2020-09-04 10:51:33 -04:00
miruka
99ae075bb4 Reset composer when recycling chat page 2020-09-03 18:30:36 -04:00
miruka
82bcc29475 Field/area: insertAtCursor() when restoring text
Instead of assigning to `text` directly, which kills editing history and
has worse performance.
2020-09-03 18:27:31 -04:00
miruka
2545ba6c00 Reset room pane state when recycling chat page
Side effect: the members filter field's text is no longer saved to disk
2020-09-03 18:09:50 -04:00
miruka
601b42a503 Rename PageLoader.showPage() → PageLoader.show() 2020-09-03 17:33:19 -04:00
miruka
90929691c6 PageLoader: remove unused proporties 2020-09-03 17:31:33 -04:00
miruka
0704144576 Update INSTALL.md to reflect error changes
The previous commit 180e995f33 got rid of
the generic "Component is not ready" error and provide more details
on what actually happened.
2020-09-03 12:55:56 -04:00
vslg
180e995f33 Print Window.qml component creation errors 2020-09-03 12:26:19 -04:00
miruka
2b45c07819 Fix starting Mirage when initial page isn't a chat 2020-09-03 11:08:31 -04:00
miruka
462d3972ff Small window: close main pane when recycling page 2020-09-03 11:06:45 -04:00
miruka
f5c6a2627b Improve pageLoader animation 2020-09-03 10:49:15 -04:00
miruka
3f339b7bb9 Add global baseGIFSpeed property to DebugConsole
for great debugging
2020-09-02 15:56:13 -04:00
miruka
bed19eb117 Play appearAnimation when recycling page 2020-09-02 15:25:02 -04:00
miruka
e947fe7695 Refactor PageLoader show methods
Also lets the chat page recycling work with showPrevious() (ctrl+tab)
2020-09-02 15:19:27 -04:00
miruka
a4bbbfee87 Recycle chat pages if possible when switching room
The chat page is complex and slow to create, which creates a visible lag
when user switches room.

Instead of throwing the pre-switch one away and
making a new one from scratch, keep the same page and update its user &
room ID for a big improvement in responsiveness. The rest is automatic
thanks to QML property bindings.
2020-09-02 15:19:21 -04:00
miruka
509c4a0871 Add defaultCurrentIndex to H(List/Grid)View
When the model of a view changes, Qt automatically sets the
currentIndex to 0.
Reset it back to the set default (usually -1) instead.
2020-09-02 14:40:06 -04:00
miruka
3fb64dbef5 Fix EventContextMenu errs if timeline has 0 events 2020-09-02 14:02:12 -04:00