Commit Graph

2272 Commits

Author SHA1 Message Date
miruka
47cfd7c7b0 Show nio logging warnings 2021-07-26 04:39:58 -04:00
miruka
ba236e2be3 Remove some unused imports 2021-07-26 04:39:58 -04:00
miruka
42b2a040ec MatrixError: include server response content 2021-07-26 04:39:58 -04:00
miruka
6151444c71 MatrixError: include the server's message 2021-07-26 04:39:58 -04:00
miruka
692faa7142 Rename Daybreak component to DayBreak
QML name conventions
2021-07-26 04:39:58 -04:00
Maze
1d3ec44919 Allow apostrophe in URL regex
Apostrophe is a valid URL character.
Example: https://en.wikipedia.org/wiki/Benford's_law
2021-07-26 04:39:58 -04:00
Maze
884d22938b Add keys to jump to latest/oldest unread (#214)
* Key to jump to latest/oldest unread #186

Latest/oldest unread/highlight.
Default bindings match the bindings for previous/next unread/highlight.

Allows the user to read messages in the order of receiving them.
Or the opposite order, to stay on top of things.

* Clean up code

Use let instead of var, and proper indentation

* Fix case for some variables in RoomList.qml

Some variables were using snake_case instead of camelCase like usually
done in QML code (note that the model items come from python)

Co-authored-by: miruka <miruka@disroot.org>
2021-07-26 04:39:58 -04:00
miruka
888b8b32c1 Fix account saved with incorrect presence on login
Saving account with an echo_ presence resulted in error 400 on /sync due
to the server not understanding the presence we're trying to set
2021-07-26 04:39:58 -04:00
Maze
d32370fc3a Made some animations unaffected by theme
People modify animationDuration because they want a snappy client.
But it also affects a few things that do not contribute to that
and should remain constant speed:
- Busy indicator
- Progress bar animation
- Ping indicator in AddAccount ServerBrowser
- Image rotation button cooldown
2021-07-26 04:39:58 -04:00
miruka
c4a0e73e19 Hide prev status msg for accounts w/out presence 2021-07-26 04:39:58 -04:00
miruka
d4b9fc60a4 Fix invisible presence restoration
When we are invisible and restart the client, set ourself to invisible,
not offline, and correctly keep the status message that should be set
whenever we get back to a visible online.
2021-07-26 04:39:58 -04:00
miruka
22bce261d3 Yet another try at fixing presence endless loop 2021-07-26 04:39:58 -04:00
miruka
86c0cb1bf2 Add Presence.saved_status option
Controls how many previous status to keep saved in account menues,
see previous commit.
2021-07-26 04:39:58 -04:00
miruka
3402a1d5f8 Improve account status msg field & add history
- Up to 5 previously set status are now shown under the field
  for quick access; the history is shared between accounts

- When focusing the field, the text gets auto-selected since most of the
  time we want to set a totally different status, not edit the current one

- Typing in the field will autosuggest any matching history entry

- Keyboard focus now skips the "apply" button, since we can just hit
  enter in the field
2021-07-26 04:39:58 -04:00
miruka
67edd63c5a HComboBox: allow popup and indicator to be null 2021-07-26 04:39:58 -04:00
miruka
c9ee604cf3 Show inviter as subtitle for room list invites
Also fixes the centering of the enveloppe icon for invited rooms with a
subtitle.
2021-07-26 04:39:58 -04:00
miruka
02b4bddce5 Be invisible on startup, not echo_invisible
If our presence is invisible from the first sync, we'll never receive a
presence event telling us so.
The server just knows from the beginning, so show our local presence as
echo instead of echo_invisible (which causes the half-opacity presence orb)
2021-07-26 04:39:58 -04:00
miruka
c1f5605c1c Ignore offline presence updates for our account
If another client becomes invisible/offline or we stop syncing for some
time (due to e.g. connection issue or debugger freeze), the server will
tell us our presence is offline. Following this update would lead to our
our current connection being terminated, so ignore it.

Side-effect: if we become invisible and another client with this behavior
is using the account at the same time, this will result in us becoming
online/unavailable again a few seconds later, since we follow
updates for these status to avoid conflicts
2021-07-26 04:39:58 -04:00
miruka
93505dc44f Rework chat invite/left banners
The banners shown in place of the composer for invited and left rooms
suffered from numerous problems due to being written very long ago and
untouched since then: unflexible components, layout glitching at certain
size, and focus issues.

These elements have been reimplemented as part of the Composer using
standard components, handle lack of space/width much better and
correctly take focus when switching rooms or the room's state changes.

Other note, the inviter's avatar is no longer shown in place of where
the current writing user is currently shown, to maintain consistency and
keep an indication of which account the user is acting as.
The inviter's profile should be available in the right pane, but nio
apparently doesn't give us member events for invited rooms.
2021-07-26 04:39:58 -04:00
miruka
7d546b6565 Room items subtitles: fix redacts HTML escaping
Redaction events displayed as subtitles of left pane rooms were
accidentally double-escaped, leading to e.g. "X's message was removed by
Y" being rendered without the apostrophe
2021-07-26 04:39:58 -04:00
Maze
b6773c724e Add keys for direct room switching (#209)
* Add Keys.Rooms.Direct configuration

Keybinding to jump to specific room id in specific account id, or the
first occurence of specific room id in any account.

* Default binding was a bad idea

This example binding was preventing the user from binding Ctrl+G,Ctrl+M
to something else.

* Use const instead of var

* Use showItemAtIndex for direct room switching

This is a simpler implementation that better fits in the existing
codebase and doesn't really have drawbacks.

* Use existing findIndex

From roomList.model. Instead of reinventing it

* Made example not a real room

Earlier I made it point to the Mirage room

* Add instructions for copying room ID

After noticing that these IDs do not match Matrix room addresses, I felt
it was necessary to explain this here, even if it's already explained in
other parts of the configuration file.

* Use .split(" ") for splitting descriptions

This is a more readable implementation.

* Fix shortcuts breaking on config reload

Wrapping HShortcut in Loader makes it destructible.
See d53978f62bab35cdc7e115c50f0571f736814582

* Cleanup showRoomByDescription method, now showById

- "Room description" is a vague, it sounds like this is about
  the room topic too. Instead of having a function that takes a
  string with a certain format, take explicit arguments for the user and
  room ID, this way we don't need comments to explain what's going on
  either

- Reduce indentations and {} noise to make it simpler to read

* More details for direct room binds config comment

Co-authored-by: miruka <miruka@disroot.org>
2021-07-26 04:39:58 -04:00
miruka
61996400d0 Fix shortcuts in instanciators breaking on reload
When reloading the config file, the HShortcut within Instanciators (e.g.
Rooms.AtIndex) were deleted then recreated.
Except Shortcut happens to be an indestructible object type.
Thus the old HShortcuts left alive were conflicting with the ones
recreated, causing them to be called ambiguously.
Loaders are destructible, so we wrap the shortcuts inside one to fix the
issue.
2021-07-26 04:39:58 -04:00
miruka
3279a1befd Fix missing tail for inline <mx-reply> 2021-07-26 04:39:58 -04:00
miruka
7a33ecdb86 AccountSettings: fix setting display name 2021-07-26 04:39:58 -04:00
miruka
3d350910e7 Fix rendering status msgs with HTML-unsafe chars
Status messages containing characters like ' or <> were stripped out
in the Account and Member delegates
2021-07-26 04:39:58 -04:00
miruka
18f742966e Presence fixes and improvements
- Allow using invisible mode on servers not supporting presence, to
  make use of the prevention of sending typing notifications and read
  marker updates

- For servers not supporting presence, display the account's presence
  orb in the left pane with half opacity

- Indicate in the presence orb tooltip when the presence we set hasn't
  yet been noticed by the server/the server doesn't support presence

- When reconnecting after being offline, if the server doesn't indicate
  we have a status message [set from another client], restore any
  previous message we had set in the current client

- Show our status message striked out when we're invisible or offline to
  indicate that it isn't being broadcasted

- Some code style cleanups

- Try to handle cases where we set a presence, but receive a new
  presence event for our account before the server takes notice of that
  new presence we want, which probably resulted in the "account keeps
  switching between online and unavailable every few sec" glitch
2021-07-26 04:39:58 -04:00
miruka
909756cff7 Raise default tooltips_delay setting to 0.7s 2021-07-26 04:39:57 -04:00
miruka
de7e14f9ca Color reply prefix in room delegate last message 2021-07-26 04:39:57 -04:00
miruka
a208ba3991 Fix applying AccountSettings ignore users field 2021-07-26 04:39:57 -04:00
miruka
49f97d614e Rework UnexpectedErrorPopup to be more practical
- Instead of opening a popup for every single error that occurs,
  combine them into an unique one

- Increase the maximum width, make those tracebacks readable
2021-07-26 04:39:57 -04:00
miruka
2aebab5919 UnexpectedErrorPopup: implement "Report" button
Currently just opens the issue section of the CONTRIBUTING.md
in users's browser.
2021-07-26 04:39:57 -04:00
miruka
4ef8e2f1fb AddChat tab titles: say "group" instead of "room"
Helps users new to Matrix in knowing what to click, as the direct chat
option explicitely creates a 1-to-1 experience, while "create room"
(now "create group") could be also be used as such but asks for more
details and wouldn't mark the room as direct.

The content of the tabs still say "room" as that is the correct general
term for anything that contains one or more user.
2021-07-26 04:39:57 -04:00
miruka
decb12d6ba Tweak room settings checkbox texts
Always use present tense and shorten text length while trying
to be more precise
2021-07-26 04:39:57 -04:00
miruka
93404559b9 Add ignored users list to account settings 2021-07-26 04:39:57 -04:00
miruka
719938d1db JSONize for QML any Collection, not just list/dict 2021-07-26 04:39:57 -04:00
miruka
30919eca7a FieldHelpButton: always show tooltip on click
Rather than toggling display of the tooltip.
Since the tooltip will show up on hover too, the user might quickly
hover then click on the button only to see the tooltip immediatly
disappear.

Closing the tooltip can still be done by moving the cursor away from the
button, or tapping on it/anywhere else.
2021-07-26 04:39:57 -04:00
miruka
e4f3339675 Improve explanation & spacing for alias field help 2021-07-26 04:39:57 -04:00
miruka
dc0ed43f72 Add ignore user options in member context menues 2021-07-26 04:39:57 -04:00
miruka
678a56400a Add ignoring invite sender & fix forgotten rooms
When declining an invite, the popup now offers a checkbox to also add
the sender to the account data m.ignored_user_list event.

This will hide any further invite or message from that user in syncs,
and also immediatly remove the ones we currently have.

As a side-effect, the long-time bug that caused forgotten rooms to
immediatly reappear due to received a "<user> left" event has been
fixed.
2021-07-26 04:39:57 -04:00
miruka
8ea951957d Fix PageLoader.showPrevious when history size < 2
If there was only one entry (the current page) in the page history,
showPrevious() would just reload that page and not return false like
supposed to when no history movement was done.

When forgetting a room in those circumstances, this would also prevent
the switch to the "secret default page" and just leave the user on a
loading spinner for a room that didn't exist anymore.
2021-07-26 04:39:57 -04:00
miruka
3683d7db20 Chat InviteBanner: make decline button spawn popup
Rather than leaving the room as soon as the button is clicked.
This offers the option of also forgetting that room, and will allow
checking a future "ignore inviter" too.
2021-07-26 04:39:57 -04:00
miruka
70ae16a7c1 Merge the Leave and Forget room popups 2021-07-26 04:39:57 -04:00
miruka
b40c43ef2f DirectChat: fix warning from half-leftover line 2021-07-26 04:39:57 -04:00
miruka
fb84ea41c5 Fix forgetting already left room 2021-07-26 04:39:57 -04:00
miruka
7db0e07281 Fix lock_room_position error when forgetting room 2021-07-26 04:39:57 -04:00
miruka
96a1e57f47 LeaveRoomPopup: new text for declining invites 2021-07-26 04:39:57 -04:00
miruka
334065895f Open links keybinds: ignore message mentions
When using the open_links_files(_externally) keybinds on a message,
ignore the URLs that mentions (user ID, username, room ID, room alias)
point to.
2021-07-26 04:39:57 -04:00
miruka
208e08ed2a Shorten reply text for room list last messages
For rooms in the room list, when the last message displayed under the
room name is a reply, change the
"In reply to @foo:example.org: original message... ⏎" text shown
before the actual reply content to just "↩ foo: ".

This lets the user preview the actual interesting part of the message,
instead of a long "In reply to" that takes all the available width.
2021-07-26 04:39:57 -04:00
miruka
20e8a19017 Unify cancel button & escape keybind for pages
AddChat and AccountSettings:

- When clicking the cancel button, if there's no previous back to go
  back to, focus the main pane instead of doing nothing

AccountSettings:

- Always enable the cancel button, not just when the form has been
  modified

AddChat, AccountSettings, ServerBrowser:

- Pressing escape will do the same thing as clicking the cancel button
2021-07-26 04:39:57 -04:00
miruka
01e7a1ac13 Add back button to all pages in thin window mode
In "mobile mode" where main pane is hidden due to application's width:

- Show a back button in the tab bar of the AccountSettings and
  AddChat pages

- Show a back button in the address field (opposite to the "next
  button") of the ServerBrowser, unless there are no accounts added yet
  (application first run) and the main pane would be empty
2021-07-26 04:39:57 -04:00
miruka
46e058f2de Add conveniance HDrawer.normalOrForceCollapse prop 2021-07-26 04:39:57 -04:00
miruka
4925b5a134 Back/FW UI buttons tooltips: shorter & consistency 2021-07-26 04:39:57 -04:00
miruka
fb1de364a6 Change style of "go to ..." arrow icons
Use more pronounced "→" style arrows rather than ">"
2021-07-26 04:39:57 -04:00
miruka
e601a378d8 Workaround Qt's lack of support for HTML <hr>
When processing message HTML for the client from python, turn <hr>
tags into <p>──────...</p> em dash lines
2021-07-26 04:39:57 -04:00
miruka
bcb9ffcf9d Room settings: add room ID text area + copy button
The only way to see a room's ID previously was to right click a room in
the left pane, copy option, and paste it somewhere.
2021-07-26 04:39:57 -04:00
miruka
1d29e47818 Fix warning when quitting before config is loaded 2021-07-26 04:39:57 -04:00
miruka
e36fa4eeda Fix config writing failing if parent dir not exist
Problem introduced in ba3e93e658eb8c536a0dd803c8cb5fabbb68fb8f
2021-07-26 04:39:57 -04:00
miruka
59ef2004e1 Fix reply starting with a >quote not being colored
For a message that was a reply to another, and that that started with
a "> ..." quote, the quote wasn't getting highlighted due to regex not
accounting for cases where one is preceded by a </mx-reply> closing tag.
2021-07-26 04:39:57 -04:00
miruka
c4eef71a83 Fix inline >quote regex for quotes after a <tag>
Example, if a room list item subtitle was ">a \n >b", only ">a" was
wrapped with the "quote" class and colored appropriatly due to <a> being
wrapped in a <span> and the regex failing on that
2021-07-26 04:39:57 -04:00
miruka
57a7b567ca Keys.Account.AtIndex binds: don't focus 1st room
Go to the corresponding account settings instead of trying to focus the
first room of the target account if there is one.

This makes the behavior consistent across expanded and collapsed
accounts, and with the Keys.Account.(previous/next) keybinds that
were changed to work in this way in commit
4f4bc90faa.
2021-07-26 04:39:57 -04:00
miruka
806983db93 Use Instantiator for RoomList AtIndex keybinds
Instantiator is better suited to the task: Repeater is specially
made to load visual components, and that forced us to wrap the
HShortcuts inside empty Items.
2021-07-26 04:39:57 -04:00
miruka
66169e641e Fix history navigation when <2 items in history
On startup, there will be one page in the history, not zero.
Disable history navigation in such cases where the current page will
just get selected again.
2021-07-26 04:39:57 -04:00
miruka
58b4667c31 Navigate page history with mouse back/forward 2021-07-26 04:39:57 -04:00
miruka
b9ea61e133 Utils.qml: fix indentation of an if 2021-07-26 04:39:57 -04:00
Maze
c140d69138 Add visited pages history back/forward keys (#204)
* Add keys for back and forward through history

Move through history of visited rooms without altering it.
Ctrl+H and Ctrl+Y by default.
Deviating from history while in the middle of it
causes a part of history to be discarded.

* Change default history binding to Ctrl+H and Ctrl+Shift+H

* Rename functions and settings

`earlier_page` and `later_page` is consistent naming with `last_page`

* Add option to wrap history

If you press `later_page` while at index 0 (newest), you loop to the end
of recorded history (oldest). If you press `earlier_page` while at at
the end of history (oldest), you loop back to the top (newest).
This can be disabled.

* Add showNthFromHistory

Grouped duplicated code into a new funcion.

* Minor formatting changes

* Move wrap_history setting from to General section

The Keys section is purely for keybindings; this setting should also be
able to control history navigation not done by keyboard such as extra
mouse button bindings.

* Change default bind for later_page and clear_all

Ctrl+H and Ctrl+L are a more intuitive pair than Ctrl+H and Ctrl+Shift+H.
Meanwhile, clear_all does not need the accessible binding Ctrl+L.

Co-authored-by: miruka <miruka@disroot.org>
2021-07-26 04:39:57 -04:00
MRAAGH
f88ab45b94 Add keybinding for quit (#203)
* Add keybinding for quit

* Reorder default settings

The related keybindings are now located closer together.
quit is not commented by default, but instead has an empty list.

* No need for braces for a single instruction
2021-07-26 04:39:57 -04:00
miruka
5828c378be Turn matrix.to links into shorter forms
e.g. if someone posts a message containing
"https://matrix.to/#/@foo:example.org", that link will be turned into a
properly colored "@foo:example.org".
2021-07-26 04:39:57 -04:00
miruka
c8bf607fc2 Fix parsing links with some special characters
Add these characters to the regex allowed list for URL /paths:
non-latin word characters, : ! $ * + ^ @

This also fixes the parsing of matrix.to URLs in messages.
2021-07-26 04:39:57 -04:00
miruka
9fa2816d4b Require a space after # for markdown titles
Lets us types stuff like #room-aliases without having to escape the # or
get a bad surprise
2021-07-26 04:39:57 -04:00
miruka
c948c75d36 Fix ~/qrc: folder created on start in release mode 2021-07-26 04:39:57 -04:00
miruka
2b91fc048c Update mypy dev requirement to 0.812+
Noticable improvement: no longer throws errors when using
aiofiles 0.6+ functions.
2021-07-26 04:39:57 -04:00
miruka
688fdec9d7 Remove callback for nio.UnknownBadEvent
Should this type of event appear, our function to register events won't
find the attributes required to process it that are present on normal
events.
2021-07-26 04:39:57 -04:00
miruka
03349ae33f Add "Add another account" entry to settings menu
To do: replace the bottom-left "add account" button by something else,
move the corresponding keybind code away
2021-07-26 04:39:57 -04:00
miruka
b07dfa1c01 Update changelog and version for 0.7.1 2021-03-04 22:20:05 -04:00
miruka
7848a2014a Fix custom theme not found when compiled with QRC
If the application was compiled with QRC (i.e. CONFIG+=dev), a theme
setting that wasn't one of the default theme would fail to be read.

Originally commit cf463f24786566c5ec04a6823e9917975ba2b265,
accidentally thrown out before release
2021-03-04 16:41:48 -04:00
miruka
3daeae324b Fix homeserver list for aiohttp <3.7.0 2021-03-04 13:42:00 -04:00
miruka
a4f94b6de0 settings.py: comment typo fixes and improvements 2021-03-04 11:24:22 -04:00
miruka
35442389c7 settings.py: fix Notifications.flash_time comment 2021-03-04 11:01:31 -04:00
miruka
6febaeeb1b Support the http_proxy environment variable
Overrides General.proxy setting if set
2021-03-03 17:14:57 -04:00
miruka
f6f0a0c1ee Add General.proxy setting, supports HTTP & SOCKS5 2021-03-03 17:14:57 -04:00
miruka
b0d31af3c0 fetch_homeservers: use nio to make aiohttp session
Use a throwaway nio client to make ourself an aiohttp session with proxy
support, that way we don't have to depend on aiohttp and aiohttp-socks
libraries
2021-03-03 17:14:57 -04:00
miruka
bbe6415336 Have radius only on text fields/areas with borders
Fixes the appearance of the filter room/members fields
2021-03-03 17:14:57 -04:00
miruka
d828312a24 Fix focus problems for submenues in context menues 2021-03-03 17:14:57 -04:00
miruka
902f13ab68 Lock position of the room that's focused in GUI
When the currently shown page is the chat of a certain room,
prevent that room from moving around in the left pane due to new
messages/activity or unread/highlight counters change.

When the user switches to another page/room, the previously held lock is
released and that room completes all the moves it would have done if it
wasn't locked.

This makes navigating a room list with lots of activity easier, and
prevent annoyances like clicking on a room with unread messages and
having it immediatly fly down the list (possibly out of scroll view).
2021-03-03 17:14:57 -04:00
miruka
3f88a2204e errors.py: remove duplicate MatrixBadGateway class 2021-03-03 17:14:56 -04:00
miruka
4bff58c828 model.py: remove leftover debugger call 2021-03-03 17:14:56 -04:00
miruka
a3206501de Fix mypy complaint in MatrixClient.edit_pushrule 2021-03-03 17:14:56 -04:00
miruka
5476cf1e6d Don't pass ModelItem fields starting with _ to QML 2021-03-03 17:14:56 -04:00
miruka
045bce5f9c Remove model item __lt__ docstrings
Duplicate efforts and get outdated when the code better explains
how items are sorted
2021-03-03 17:14:56 -04:00
miruka
d31ee9cd67 Shorten lexical vs by activity room sorting code 2021-03-03 17:14:56 -04:00
miruka
81c460cbaf Revert "Fix the one-line events combining"
This reverts commit 39f159f0a3.

Causes problems when message delegates are reordered, with the
transition animations randomly stopping in the middle and leaving
delegates at odd positions.
2021-03-03 17:14:56 -04:00
miruka
f0d7757f0c Catch simpleaudio playback errors
Because of course sound isn't just gonna work on linux and
especially flatpak. Make sure to not spawn an error popup every time
we try to play a notification. Maybe use mpv in the future for
SFX playback (when we'll have a media player implemented),
since it has support for all these backends out of the box.
2021-03-03 17:14:56 -04:00
miruka
cfce4e1ddc Pre070SettingsDetectedPopup: point to master docs 2021-03-03 17:14:56 -04:00
miruka
c420360602 settings.py: support ~ expansion for sound path 2021-03-03 17:14:56 -04:00
miruka
92c49140e7 Play sound from python/ALSA instead QtMultimedia
GStreamer sucks
2021-03-03 17:14:56 -04:00
miruka
31f6e5320a Improve default notification sound
Quieter by default, shorter and without the annoying clicky noise
2021-03-03 17:14:56 -04:00
miruka
ffcccd38d2 Add documentation link to settings menu
And make mirage x.y.z label no longer open the github page
2021-03-03 17:14:56 -04:00
miruka
f49282ff36 Bump version strings to v0.7.0 2021-03-03 17:14:56 -04:00
miruka
1db8c66759 Hide image event name/time bubbles when kb-focused 2021-03-03 17:14:56 -04:00
miruka
376364afad PushRuleSettingsPopup: add some missing padding 2021-03-03 17:14:56 -04:00