Commit Graph

2247 Commits

Author SHA1 Message Date
miruka
5dfe700880 Fix toggle compact keybind not working immediatly 2021-03-03 17:14:55 -04:00
miruka
fd2d9d2c31 Fix image events read counter being underlined
caused by 2ca01c69d8e56e903e346b604842cf0664583f0d
2021-03-03 17:14:55 -04:00
miruka
2d3553531d Better explain XDG vs default locations in docs 2021-03-03 17:14:55 -04:00
miruka
4070b75544 RoomHeader: add message selection info and actions
When messages are selected in the timeline, change the chat header's
mode to show how many messages are selected and offer copy, remove and
deselect buttons.
2021-03-03 17:14:55 -04:00
miruka
426faa2673 Improve RedactPopup multi-sender warning
Give reason why we can't delete all the selected messages when
selection contains a mix of own and other user messages and we don't
permission to remove them.
2021-03-03 17:14:55 -04:00
miruka
c59d54877a Add Keys.Messages.seen_tooltips keybind
Toggle display of the focused message's seen counter tooltip,
which shows which user have this message as their last seen
and when did they send that information.
When this mode is active, you can move the focus
to other messages  and the tooltip will update itself.
If a message doesn't have a counter, it won't have a tooltip.
2021-03-03 17:14:55 -04:00
miruka
f22758ea89 Add tooltips to the message "read by" indicator
Hovered the read by counter on timeline events now shows who read said
event and when.
2021-03-03 17:14:55 -04:00
miruka
6184f1cfa5 Add utils.commaAndJoin() for "a, b and c" strings 2021-03-03 17:14:55 -04:00
miruka
661ca47430 Fix Keys.Messages.debug keybind 2021-03-03 17:14:55 -04:00
miruka
626a43b7b0 Replace pprintpp usage by devtools.debug 2021-03-03 17:14:55 -04:00
miruka
0dadf7de97 Have split python_(remote_)debugger keybinds
python_debugger (shift+F1) will now always start pdb, and
python_remote_debugger will always start remote_pdb.
Since the new autoreload.py script doesn't break stdin like entr with
live-reload.sh did, we can now use pdb if the app is connected to a
terminal.
2021-03-03 17:14:55 -04:00
miruka
e4959f503c Reimplement swipe to exit sidepane via DragHandler 2021-03-03 17:14:55 -04:00
miruka
7029148c87 Fix some chat right pane issues
- Remove the default Qt dragMargin: when the right pane was
  hidden/collapsed in the interface, accidentally clicking on this
  invisible 10 pixel-wide zone to the right edge of the window
  would interfere with any button under it, e.g. the button to
  expand the pane

- Fix expand pane button failing to bring back pane (due to dragMargin)
  and turning the chat page header invisible

- Disable swiping to exit panes, interferes with buttons and tiles
2021-03-03 17:14:55 -04:00
miruka
01adc71646 Catch error when sending dbus notification fails 2021-03-03 17:14:55 -04:00
miruka
98b6a7b74e Add detail tooltips in server browser stability %
When hovering on stability percentages in the server browser, a tooltip
now shows the total downtime in the past 30 days, number of incidents,
their average length and the longest's duration.
2021-03-03 17:14:55 -04:00
miruka
ae4bcffa06 settings.py: add Chat.Composer.TypingNotifications 2021-03-03 17:14:55 -04:00
miruka
fda5bc0039 Add CLI arguments parsing + --start-in-tray
- Loading a QML file in place of src/gui/UI.qml is now possible via
  -l / --load-qml instead of taking the first positional argument

- New option to start application in tray without showing a window

- --help and --version
2021-03-03 17:14:55 -04:00
miruka
50d4aae188 Remove unused ExitRequested pyotherside event 2021-03-03 17:14:55 -04:00
miruka
ddc5b8b933 Replace live-reload.sh by autoreload.py
entr is a glitchy mess that keeps restarting for no reason and prevents
pdb usage due to stdin takeover, use a python script instead that
doesn't need external utilities.
2021-03-03 17:14:55 -04:00
miruka
8175bbde0e Fix keyboard scrolling when kinetic is disabled 2021-03-03 17:14:55 -04:00
miruka
69a338f610 Fix handling errors in config files on startup 2021-03-03 17:14:55 -04:00
miruka
199ec7646b Watch files included from PCN files (auto-reload) 2021-03-03 17:14:55 -04:00
miruka
1a101d9888 Disable new theme test code for now 2021-03-03 17:14:55 -04:00
miruka
8db275ab37 Fix DebugConsole up/down with word-wrapped lines
Fix these issues:

- When the cursor was on the last soft-line of a word-wrapped line,
  pressing down wouldn't go to the next history entry

- When the cursor was after the first soft-line of a word-wrapped line
  and that line was the first of the text area, pressing up would
  go to the previous history entry instead of moving the cursor to the
  first soft-line
2021-03-03 17:14:55 -04:00
miruka
8d4e67d6a4 Fix EventList stuff depending on scroll position
Add visibleStart/End properties to HListView that take into account the
ListView's originX/Y, and not just contentX/Y which can be largely
offset.

Use those new properties in EventList for message focusing (fix
ctrl+up/down sometimes incorrectly focusing the message at the middle of
the screen even when we're scrolled at the bottom), and detection of
when we can update the read marker (fix cases when we're scrolled at the
bottom but the read marker never updates).
2021-03-03 17:14:55 -04:00
miruka
509b35a633 Make flickToTop/Bottom faster and more accurate 2021-03-03 17:14:55 -04:00
miruka
42f04b013e Add PCN theme system
Coexist with the old theme system for now. QML components have to be
updated to use the new system.
2021-03-03 17:14:55 -04:00
miruka
1af1d30c48 Make color module objects available to PCN 2021-03-03 17:14:55 -04:00
miruka
64c0998a68 Merge color.py and svg_colors.py
The SVG colors are now an enum of Color objects, instead of hex strings.
The "transparent" color was also added, which isn't in the standards but
works in QML.
2021-03-03 17:14:55 -04:00
miruka
97cfe7049d Add color.py module for theming 2021-03-03 17:14:55 -04:00
miruka
a53aec0ff9 Fix handling of config file deleted at runtime 2021-03-03 17:14:55 -04:00
miruka
c1dc9a80b2 Fix default data when no .gui.json file exists 2021-03-03 17:14:55 -04:00
miruka
9a813ecaa8 Fix PCN include_builtin() when running under QRC 2021-03-03 17:14:55 -04:00
miruka
1e002eb4a5 Fix flake8/mypy/isort code errors from new setup 2021-03-03 17:14:55 -04:00
miruka
eed2cc4818 Remove double blank lines from QML files 2021-03-03 17:14:55 -04:00
miruka
93eba7ce92 Fix incorrect account switching keybind order
The keybinds to switch to the first room in account number X did not
behave properly when the accounts weren't ordered lexically.
2021-03-03 17:13:51 -04:00
miruka
3564e7a571 Turn bookmarks/aliases/at_index into Sections 2021-03-03 17:13:51 -04:00
miruka
fbd3f6f4a2 PCN: allow adding new properties at run-time 2021-03-03 17:13:51 -04:00
miruka
9348df32f7 PCN: support quoted strings as property names 2021-03-03 17:13:51 -04:00
miruka
db12036372 Use new PCN format for settings config file 2021-03-03 17:12:09 -04:00
miruka
6ce3059322 Raise error if loading a JSON fails
Don't use the default config if there's an error in a JSON config file,
a single typo could lead to an entire user settings file getting
overwritten by default data.
2021-03-03 17:12:09 -04:00
miruka
75fbf23b21 Refactor user_files module & add live reloading
- Cleaner design for the backend user_files classes and simplified
  interaction with QML
- Config and theme files will now automatically reload when changed on
  disk
- Removed manual reload keybind and button
2021-03-03 17:12:09 -04:00
miruka
00c468384a Delay increasing timeline cache buffer, reduce lag
When switching rooms, first load only the delegates in the user's view
and wait a second before expanding the cacheBuffer and loading more
delegates outside the view. This reduces the amount of delegates to load
all at once by 3x.
2021-03-03 17:12:09 -04:00
miruka
ce3ed86bef Fix timeline occasionally breaking on room switch
When a chat page is recycled, set the eventList model to
null, wait for any animations to finish, then explicitely reassign it.
This prevents from model from randomly mixing up old and news delegates.
2021-03-03 17:12:09 -04:00
miruka
9ef13c9d50 idleMilliseconds: return -1 if WAYLAND_DISPLAY set
CppUtils.idleMilliseconds(): If the WAYLAND_DISPLAY environment
variable is set, assume we're running under a Wayland environment
and return early before trying to connect to an X11 display.
2021-03-03 17:12:09 -04:00
miruka
acce5d60ae Prevent error spam when XScreenSaver not supported
If XScreenSaver is available but not supported
(e.g. when running in XWayland), return -1 for
Utils.idleMilliseconds(), instead of letting the code fail and print an
error every time this function gets called to check for the machine's
idle time.
2021-03-03 17:12:09 -04:00
miruka
ed74592769 Add HToolTip.instantToggle(), use for some buttons
Used for buttons that trigger a tooltip instantly: if the tooltip is
currently visible, hide it.
2021-03-03 17:12:09 -04:00
miruka
0eb57c5986 Move composer alias "?" icon to be inside field
Be more consistent with the user ID field and its copy button.
2021-03-03 17:12:09 -04:00
miruka
28b25a53ea Make account user ID an easily copiable RO field 2021-03-03 17:12:09 -04:00
miruka
6af4cca315 Add FieldCopyButton.qml, split from SignInSso.qml 2021-03-03 17:12:09 -04:00
miruka
32484c3ae5 Prevent focusing readOnly field/areas on click 2021-03-03 17:12:09 -04:00
miruka
74ffbdb0a8 Account settings: make user ID label copiable 2021-03-03 17:12:09 -04:00
miruka
3d8914cb39 HTextContextMenu: less entries for readOnly fields
If the context menu is for a readOnly field or area, hide pointless
options like undo/redo and cut/paste.
2021-03-03 17:12:09 -04:00
miruka
dba41c30c2 Put HAvatar's tooltip image inside a Loader
Make sure to not load tooltip images unless the user is
currently trying to see one by hovering on an avatar.
This also seems to reduce idle CPU usage.
2021-03-03 17:12:09 -04:00
miruka
8ca8f490fa JSONify ModelItemDeleted.ids for QML if needed
If a model has tuple keys, these already get turned into JSON strings
for the ModelItemSet pyotherside event (for QML and JS reasons).
Do the same for ModelItemDeleted's ids field, else the QML event handler
will be unable to find the items by IDs.
2021-03-03 17:12:09 -04:00
miruka
b38fbc6d9b Fix filtered_members models updates 2021-03-03 17:12:09 -04:00
travankor
055b68126a Add Sorted Containers to replace blist 2021-03-03 17:12:09 -04:00
travankor
1dcd6daaba Improve Python 3.9 compatibility
Blist has been unmaintained for 5+ years and is now broken on Python 3.9.
2021-03-03 17:12:09 -04:00
miruka
7564b40c3e Fix copying multi-line selected rich text
For rich text (rendered HTML) fields and areas, the selectedText
property for some reason contains "\u2028" or "\u2029"
characters that look like newlines in Qt programs but are just
invisible anywhere else. Translate them to normal "\n".
2021-03-03 17:12:09 -04:00
miruka
da75568428 Fix segfault on coroutine cancelling from QML
Since 87fcb0a773f4855cdae7212fa9448a05de57be56, it was possible to call
a Python coroutine, but cancel it (due to parent component destruction)
before Python even has time to start it.
The registred QML callbacks for this coro would then be called,
potentially causing a segfault if that callback tried to access the
parent component or its properties.
2021-03-03 17:12:09 -04:00
miruka
b94570f853 Support drag and drop for files and text in chat 2021-03-03 17:12:09 -04:00
miruka
63fe083cad Fix Alt+(Shift+)U/M ignoring local unread rooms
The goTo{Previous,Next}{Unread,Mentioned}Room keybinds only took into
accounts rooms that had a server-sent unread/highlight count, and not
those that only had a client-side unread "!" badge (e.g. for rooms that
get new messages but that have push rules disabling notifications).
2021-03-03 17:12:09 -04:00
miruka
4c04c1158c Fix sign in button always showing spinner 2021-03-03 17:12:09 -04:00
miruka
ac111603da Fix err with no M_CODE falling back on wrong class
When we received server errors with no matrix M_CODE, the MatrixError
class would fall back to its first subclass that had a matching HTTP
status code. This notably caused any 401 error to be interpreted as
MatrixInvalidAccessToken, and disconnect the user.
2021-03-03 17:12:09 -04:00
koudja
52b0bb18cb Add room bookmarking: bookmarks are always on top
Introduce a bookmark system for rooms:
a room bookmarked will always appear on top of every other
(for a given account).

Bookmarking can be done through context menu on targeted room
(as well as un-bookmarking) or through settings.json
(key roomBookmarkIDs) for permanent bookmark.
roomBookmarkIds is a {account_user_id: [room_id]} dict.
2021-03-03 17:12:09 -04:00
miruka
38360b101a Fix JoinRoom cancel button not going to last page 2021-03-03 17:12:09 -04:00
miruka
d4be4cca69 Fix incorrectly espaced HTML for redaction reason
A redacted event with a reason containing problematic HTML characters,
e.g. "<test>" would render as literal escaped HTML, e.g. "&lt;test&gt;"
2021-03-03 17:12:09 -04:00
miruka
f682e0e261 Fix onLoopException calling showError incorrectly 2021-03-03 17:12:09 -04:00
hashashini
fd69046528 Require double click to open homepage (#140)
Require double click to open homepage (#140)

* Update TopBar.qml

To raise Mirage's window in a stacking wm, clicking on an area
without text, especially in the topbar, is probably what most users do.
In the case of the 2nd button in the topbar this currently accidentally
opens a browser window and thus becomes a privacy issue.

So for now require a double click to open mirage's homepage.
Alternatively the size of this button should at least be closely
restricted to the text "Mirage ${version number}".

In the long term it might be preferable to put this link into
some kind of "about" section instead of the "title" section.

* Make tooltip indicate that double click is required

Co-authored-by: miruka <miruka@disroot.org>
2021-03-03 17:12:09 -04:00
miruka
3bfaee4758 Fix invisible "Copy link address" event menu entry
menu.mediaType can be an enum value, which includes 0 to represent a
web page link, or null if no link was right clicked.
Check for null explicitely when evaluating whether the menu entry
should be displayed.
2021-03-03 17:12:08 -04:00
miruka
6e2f3440d7 Close reply bar when switching/recycling chat page 2021-03-03 17:12:08 -04:00
miruka
1feda8667f Cancel reply when pressing keybind on same event 2021-03-03 17:12:08 -04:00
miruka
12cfbd2a96 CppUtils.hsluv(): prevent out of bounds sat/luv 2021-03-03 17:12:08 -04:00
miruka
0e3821a592 Prefix event transaction_id keys with reverse DNS
Respect the Matrix spec by using
"io.github.mirukana.mirage.transaction_id" instead of
"mirage.transaction_id".
2021-03-03 17:12:08 -04:00
miruka
2313673993 Reduce themes fontSize.big from 22 to 20 2021-03-03 17:12:08 -04:00
miruka
6a36943dae Account settings: fix incorrect "User ID:" color 2021-03-03 17:12:08 -04:00
miruka
aa5d522902 Swap default shift & nomod image viewer keybinds
zoomOut/zoomIn, rotateRight/rotateLeft, previousSpeed/nextSpeed:
Make them shift+Z/Z, shift+R/R, shift+S/S by default
instead of Z/Shift+Z, R/shift+R, S/shift+S
2021-03-03 17:12:08 -04:00
miruka
8acc7299e9 Add workaround for delegate stuck transition bug
Sometimes and randomly, a HListView/HGridView delegate's
add/populate transition will stop before completion.

This especially happens on startup when loading a large room list,
one room might get stuck and left tiny or invisible, despite its
normal space still being taken.
2021-03-03 17:12:08 -04:00
miruka
35fa1fa16b Fix account page not being highlighted on startup
If the page loaded on app startup is account settings or add new chat,
ensure the room list properly highlights the corresponding account
delegate.
2021-03-03 17:12:08 -04:00
miruka
2664bf1e93 HTile: prevent opening multiple context menus
If a context menu is already opened for that HTile when right clicking
or using a keybind like Alt+P (openPresenceMenu), close it instead of
just creating a duplicate one.
2021-03-03 17:12:08 -04:00
miruka
e6499d8fba Fix read counter display on EventImage
- Fix extra spacing on the right of the date when there's no read
  counter to show

- Fix read counter not being colored
2021-03-03 17:12:08 -04:00
miruka
ee1091b4dc Don't pass Python Future objects to QML
Returning a Future doesn't work on Windows for some reason
(https://github.com/thp/pyotherside/issues/116).

Instead of using these objects from QML to cancel running coroutines,
call a Python QMLBridge function that takes a coroutine UUID and will
take care of the cancelling.
2021-03-03 17:12:08 -04:00
miruka
53d2ab17af Fix display of right-to-left text in timeline
Set an explicit default left alignment for label components, to prevent
other people's right-to-left names or text from messing up the UI
in a left-to-right environment.
2021-03-03 17:12:08 -04:00
miruka
dbd78587fe DebugConsole: improve field placeholder & .help 2021-03-03 17:12:08 -04:00
miruka
e3fcb39556 DebugConsole: improve text & border coloring 2021-03-03 17:12:08 -04:00
miruka
d6062a8320 DebugConsole: add border "prompt" to delegates 2021-03-03 17:12:08 -04:00
miruka
192112ab4e DebugConsole output: add text selection & copying 2021-03-03 17:12:08 -04:00
miruka
4cc4229728 DebugConsole: restore non-history text on down key
When user starts typing something in the console, then navigates the
history with up but comes back to normal input by pressing down, restore
the text that was initially typed before navigating.
2021-03-03 17:12:08 -04:00
miruka
68d1ddfa61 Fix DebugConsole cursor at position 0 invisible 2021-03-03 17:12:08 -04:00
miruka
7d27acfcc8 Allow multi-line input in DebugConsole
Use ctrl/shift/alt+return to insert a newline, tab to insert 4 spaces
2021-03-03 17:12:08 -04:00
miruka
d9118ef24e Clear HList/GridView checked on model change
Clear the checked items and prevent potential segfaults
2021-03-03 17:12:08 -04:00
miruka
58613446f0 Fix event context menu targeting wrong message
If user right clicked on the most recent event in the timeline
(index 0), a new message was posted in the room (the new index 0),
and the user right clicked on it, the EventContextMenu's `event`
property relying on the index would not detect any change and
thus would still target the previous event.

This affected options depending on this property like "Reply".

The problem was reproducible with any same index repetition, not just 0.
2021-03-03 17:12:08 -04:00
miruka
c861c29b73 Add nonKineticScrollingSpeed multiplicator setting 2021-03-03 17:12:08 -04:00
miruka
1df7cb8014 Add copyright header to source code files
Copyright notice as per
https://reuse.software/spec/#format-of-copyright-notices

Fixes #134
2021-03-03 17:12:08 -04:00
miruka
90829125bd Strip non-free ICC profile out from midnight.jpg
Fixes #129
2021-03-03 17:12:08 -04:00
miruka
54234399f5 Fix "Mentions & keywords" notification level
Make it work in cases where multiple accounts are present in the room
and one of them is highlighted.
2021-03-03 17:12:08 -04:00
miruka
e8d8f7fe0b Add global notification control icon in top bar
The "Mentions & keywords only" option doesn't work yet in multi-account
cases: when notifications arrive for a room that multiple accounts are
part of, the first notification to arrive is let through, and the
duplicate later ones are ignored. The first notification to arrive may
not be from the account that gets highlighted, thus it is ignored under
the "Mentions & keywords" setting.
2021-03-03 17:12:08 -04:00
miruka
03e4f9b85e Make settings icon open a more complete menu 2021-03-03 17:12:08 -04:00
miruka
22e7dc7e8d Notifications: format replies properly 2021-03-03 17:12:08 -04:00
miruka
4cd562e02f Notifications: process non-message events text 2021-03-03 17:12:08 -04:00
miruka
94a623f677 Print coro infos on get_client not found error 2021-03-03 17:12:08 -04:00
miruka
7ae2ae6cd7 Notifications: turn newline symbols into real <br> 2021-03-03 17:12:08 -04:00
miruka
4a6e2ea46a Prevent duplicate notifications for the same event 2021-03-03 17:12:08 -04:00
miruka
8691a8c85b Add sender avatar to desktop notifications 2021-03-03 17:12:08 -04:00
miruka
21ccf90d23 Notifications: properly italicize emote messages 2021-03-03 17:12:08 -04:00
miruka
dcc3473ecf Don't show notification if window is focused 2021-03-03 17:12:08 -04:00
miruka
a8a25d09ee Ensure room has 2 members to hide notif. sender 2021-03-03 17:12:08 -04:00
miruka
04daae8328 Fix account unreads not updated from old events 2021-03-03 17:12:08 -04:00
miruka
4dacc3a12d Make alerts and notification push rules-aware 2021-03-03 17:12:08 -04:00
miruka
69e414b31c Add basic desktop notifications support 2021-03-03 17:12:08 -04:00
miruka
60a57db33e Fix QML Connections-using code for Qt 5.12 2020-09-16 08:29:07 -04:00
miruka
8d71e5eb87 Bump version to 0.6.4 2020-09-16 07:52:04 -04:00
miruka
e65202cfbe Fix checkbox update when default state changes
Make sure to update checkboxes when their default value changes
and the user hasn't already changed the value themselves.

This fixes a dangerous issue with new room switching and
room settings checkboxes keeping their value from the previous room.
2020-09-16 07:46:27 -04:00
miruka
9ac4cd0a97 Separate localEcho & readCounter theme properties
Allows making the hourglass gray by default again, while the read
counter uses the accent color.
2020-09-16 06:40:21 -04:00
miruka
0db80d312b Bump to version 0.6.3 2020-09-15 15:03:47 -04:00
miruka
5ce30d6019 Add message echo/read counter color theme property 2020-09-15 14:55:03 -04:00
miruka
d7d111705f Don't center the room list on clicks by default
Previously, clicking to select a room would make the list jump around
to become centered again. This behavior is now reserved to keyboard
navigation.

A "centerRoomListOnClick" setting has been added to allow going back
to the previous behavior.
2020-09-14 12:02:28 -04:00
miruka
2712896456 Show read marker counts on messages
Tells how many people have the message as their last seen one in the
room.
2020-09-14 11:58:37 -04:00
miruka
0d7a33d3a9 Unify Sessions (shift+)tab and up/down navigation 2020-09-13 19:28:50 -04:00
miruka
fb846226f8 Focus filter field on member profile exit 2020-09-13 19:16:46 -04:00
miruka
9b1608b696 Delay members loading for faster room switching 2020-09-13 16:05:23 -04:00
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
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
miruka
d8c006a8c8 Remove a bunch of leftover debug prints 2020-09-02 13:41:31 -04:00
miruka
f5cb3ecaa0 Keep a {id: item} cache for ModelStore models
Accelerates the ModelStore ListView find() function,
which now just has to get an object key instead of looping through the
whole model.
2020-09-02 13:38:11 -04:00
miruka
b1398e5dbf EventDelegate: remove pointless content x Behavior 2020-09-02 12:06:09 -04:00
miruka
eebe215a62 Fix image viewer size 0x0 while loading & for GIFs 2020-09-02 11:53:44 -04:00
miruka
5a1ca24e65 Image viewer open: pause timeline URL preview GIF 2020-09-02 11:40:49 -04:00
miruka
377f1ffd4a Fix URL preview thumbnail GIFs not being animated 2020-09-02 11:37:51 -04:00
miruka
519eaa2ca0 EventDelegate: replace json() by dict() for debug
When debugging an event, `target.dict()` will return an object that can
be properly worked with and pretty-printed using the `.j` command.
2020-09-02 11:26:44 -04:00
miruka
9c4d37f64b Fix copying non-message single event text
For events with no body in their source, copy Mirage's generated
content text.
2020-09-02 10:56:45 -04:00
miruka
b79006f2ec Rename menu "Debug this event" to just "Debug" 2020-09-02 10:43:12 -04:00
miruka
b3ca5599cf Simplify & fix bugs event images context menu
Fix copy menu entries for messages with URL thumbnail previews
2020-09-02 10:40:37 -04:00
miruka
648c37f413 Refactor event context menu into its separate file
Have only one menu component attached to the EventList,
instead of every delegate carrying its own.
2020-09-02 09:47:42 -04:00
miruka
b5b968db3a Focus center event if scrolled up when ctrl+j/k
When using the focus(Previous/Next)Message keybinds, no message is
focused and the view has been scrolled up, focus the message in the
center of the view instead of returning to the list's bottom to focus
the most recent one.
2020-09-01 18:24:40 -04:00
miruka
a1b9f34958 Add setting to sort rooms lexically 2020-09-01 14:42:08 -04:00
miruka
8d61826887 Fix up/down not working with cursor in @word
In the composer, when the text cursor was inside a word starting
with a @ but not matching any username (thus the completion UI being
invisible), pressing up/down arrow would not do anything instead of
going to the prev/next line.
2020-09-01 14:27:28 -04:00
miruka
8b37ca2524 Add a persistent zoom setting to settings.json
The zoom keybinds now modify this setting directly.
The `uiScale` property in themes now default to using this zoom setting,
since just removing it would need of annoying changes through theme
files and QML code, and is best left to until the future theming
overhaul update.
2020-09-01 14:19:40 -04:00
miruka
bd8c6ec0fc Force-reload background image on config reload
Make it possible to see the change without restarting Mirage if an
image used for the theme's background was edited, or if used did the
mistake of typing "/path/to/img" then corrects it to
"file:///path/to/img".
2020-09-01 14:08:31 -04:00
miruka
63ccca60cb Fix theme file finder ignoring $MIRAGE_DATA_DIR 2020-09-01 14:05:19 -04:00
miruka
f5ad22fcfb EventDelegate: fix separationSpacing indentation 2020-09-01 13:48:15 -04:00
miruka
39f159f0a3 Fix the one-line events combining
When there's a one line (emote or non-message) event with its avatar
shown and combinable events follow it, that first event delegate's height
is supposed to be one line with the avatar overflowing into
the following event's blank space.

This behavior hasn't been working for a long time. This commit restores
it, along with improving the related code's quality.
2020-09-01 13:48:15 -04:00
miruka
27c3d08031 EventDelegate/Content property usage improvements
- Remove pointless confusing aliases for avatar properties
  (smallAvatar, collapseAvatar, etc)

- Make some EventDelegate properties readonly as they should be

- Use Layout.preferredWidth/Height for avatarWrapper instead of both
  minimum and maximum W/H
2020-09-01 13:48:15 -04:00
miruka
107eddaa5c Use HTextArea.RichText, not Qt.RichText 2020-09-01 13:48:15 -04:00
miruka
2a0f6aead1 Fix Midnight.qpl stylesheet error from 48663ae
Missing `}` in `chat.message.styleSheet` caused some CSS properties to
not work (sender name bottom margin, quotes color, no underline for
mentions, etc).
2020-09-01 13:38:30 -04:00
miruka
d53cf0cbbe Bump version to v0.6.2 2020-08-28 10:45:37 -04:00
miruka
48663ae846 Increase spacing between list items in messages 2020-08-28 09:27:59 -04:00
miruka
6d26ac9006 Join/LeftBanner: auto keyboard-focus first button 2020-08-28 07:40:48 -04:00
miruka
78acb51220 Refactor the QML past events loading code
- Make the code cleaner and more declarative
- Start loading past events when the join state of the room changes,
  e.g. when accepting an invite, load history right then
- Properly cancel the loading task when leaving the room chat page
2020-08-28 07:19:26 -04:00
miruka
702497cb48 Fix 403 error on invited room chat page
Don't try to fetch room members while user is only invited or has left
the room.
2020-08-25 09:37:09 -04:00
miruka
0d2be820fe Allow "replying" to an event with a file
Send a pseudo-reply consisting of two messages: a `m.text` which is just
a reply with an empty body, then the file event itself.

This is a workaround to the restriction imposed by the Matrix API,
which prevents us from simply attaching a reply to a media event:
https://matrix.org/docs/spec/client_server/latest#rich-replies
2020-08-24 10:17:04 -04:00
miruka
6d9a013d5d Composer: allow sending a reply with no text
Useful for "forwarding" a message (to the same room)
2020-08-24 09:54:49 -04:00
miruka
bbb46a9feb Disallow whitespace in composer aliases
These cause problems with the composer alias parsing code.
If an alias from the config file has whitespace, only the first word
will be taken into account (ignoring any leading or trailing whitespace).
2020-08-24 09:54:49 -04:00
miruka
83f35c034e Refactor MessageArea composer alias handling
Simplify the code, make it more declarative, and improve the reliability
of sending typing notifications (notably when changing the used alias in
the middle of a message).
2020-08-24 09:54:49 -04:00
miruka
aba47ef26b Discard room members from outdated initial sync
Fix in cooperation with matrix-nio commit
ffc42287c22a1179a9be7d4e47555693417f715d, see its description.
2020-08-24 09:54:49 -04:00
miruka
b83fd63769 Save composer state as right user when using alias
If the chat was opened under e.g. "@user1:example.org", but the
composer text is "o abc" where "o" is a composer alias for
"@other_account:example.org", save the composer text to state.json as
"@user1:example.org" and not the alias user.
2020-08-24 09:54:49 -04:00
miruka
df3f1fb645 Remove all Backend "get_any_client"-using methods
thumbnail() and download() were remaining.
Use a direct and carefully chosen MatrixClient's methods instead to
avoid problems mentioned in the previous commit 7502c1.
2020-08-24 09:54:43 -04:00
miruka
0f2efa9ba3 Don't pick a random client to get user profiles
Causes problem if one of the candidate client is on a server that
doesn't federate (e.g. a local one). Move the `get_profile()` function
from Backend to MatrixClient.
2020-08-23 16:18:54 -04:00
miruka
7502c1a9b4 Don't use TapHandlers in TextArea/TextField
Causes conflicts on touch/pen which prevent the component from being
focused. Use the normal press/pressHold signals instead.
2020-08-23 15:41:20 -04:00
miruka
71a2951f5b Move tooltip window hover detector to HToolTip
Having a HoverHandler covering the root ApplicationWindow causes
problems for some Qt Quick Controls with pen/touch, e.g. it's impossible
to focus a TextArea/TextField.

The HoverHandler is moved to HToolTip (since it's used for those),
targets the ApplicationWindow but is now only enabled while a tooltip is
visible.
2020-08-23 15:17:06 -04:00
miruka
f68dda9f14 Don't start with any member in autocompl. models
Fix the AutoCompletedMembers filter model to ensure that it doesn't
pick all the items from the corresponding room member model on startup,
wait until the user actually uses the completion feature to fill it.
2020-08-23 10:54:03 -04:00
miruka
fc6827807c Fix mentioning blank display names
If the display name of a user is blank (e.g. just a space character),
autocomplete it as a user ID.

If the display name starts or ends with whitespace, trim it.
2020-08-23 10:46:59 -04:00
miruka
fbf6e48b5b Fix mentioning users without display names 2020-08-23 09:41:41 -04:00
miruka
e79094c18c Fix click on user delegate not making it a mention 2020-08-23 09:23:34 -04:00
miruka
4000d70514 Reset input method when autocompleting a user
Fixes IME being left in a strange state upon autocompleting a word that
was being edited.
2020-08-23 09:14:45 -04:00
miruka
0434659ad1 CompletableUserDelegate avatar: respect uiScale 2020-08-22 15:17:52 -04:00
miruka
223197b84e Pass HTTPS server URL to Python when possible
Reduce the time it takes to connect to the server since Python won't
need to guess the real protocol.
2020-08-22 15:15:15 -04:00
miruka
9cc9229fdb Simplify pinging & properly close aiohttp session 2020-08-22 13:19:38 -04:00
miruka
f327c99a99 Use the new improved anchel.nl JSON API
The /publiclist.json provides all the server event/downtime logs
in one file, so we don't have to do requests for every server anymore.
2020-08-22 13:10:04 -04:00
miruka
e7f769b344 HTextArea: consider preeditText for getWordAt()
`preeditText` is partial input from IME and touchscreen
autocompleting keyboards, consider it together with `text` for the
`getWordAt()` function.

This should allow user autocompletion to work properly in these
specific conditions.
2020-08-22 01:47:53 -04:00
miruka
eadc4bb317 Remove unused function inside UserAutoCompletion 2020-08-22 01:44:41 -04:00
miruka
bc3d6d902f Fix @autocomplete closing after one character
Typing e.g. "@a" would work, but "@ab" would always instantly close
the autocompletion UI if the cursor was at the end of the text area.
2020-08-22 01:23:44 -04:00
miruka
8ab4ce8ad7 Bump version to v0.6.1 2020-08-21 12:10:22 -04:00
miruka
12c47476fc Add theme properties for autocompletion UI 2020-08-21 12:10:22 -04:00
miruka
044060d1c0 Color name when highlighting member delegates 2020-08-21 12:10:22 -04:00
miruka
010675001c Add bottom margin to autocompletion UI 2020-08-21 12:10:22 -04:00
miruka
6f37ce3519 Fix completing in the middle of a name with spaces 2020-08-21 12:10:22 -04:00
miruka
bea1d60621 Fix autocompletion for users without display name 2020-08-21 12:10:22 -04:00
miruka
cd81c94ce8 Fix autocompletion for display names with spaces 2020-08-21 12:10:22 -04:00
miruka
9dc9a5e70f Clip the autocompletion UI 2020-08-21 12:10:21 -04:00
miruka
9b3d01b9a8 ServerDelegate: add ping icon tooltips 2020-08-21 12:10:21 -04:00
miruka
93b73b86bb Add a "table header" to server browser 2020-08-21 12:10:21 -04:00
miruka
6160deace5 Improve ServerBrowser text wording 2020-08-21 12:10:21 -04:00
miruka
85f4620b3b Equalize "Homeserver address" label padding 2020-08-21 12:10:21 -04:00
miruka
339341da68 Disable new scrollbar auto-show behavior for now
There are still some usability issues to fix with it
2020-08-21 12:10:18 -04:00
miruka
b79b032184 Better delegate for completable users 2020-08-21 09:27:01 -04:00
miruka
6dcc244998 Move UserAutoCompletion outside of Composer 2020-08-21 05:50:37 -04:00
miruka
4ea3a7d52a Remove HFlickable leftover debug print 2020-08-21 05:33:59 -04:00
miruka
e0e92152d0 Fix infinite account spinner when logging in twice 2020-08-21 05:33:57 -04:00
miruka
bd01d9edd0 Fix segfault when leaving loading server list page 2020-08-21 05:18:08 -04:00
miruka
6ba6202771 Fix clicking on server in server browser 2020-08-21 05:10:32 -04:00
miruka
2ccb28fa49 Box/popups: ignore enter press on disabled buttons 2020-08-21 05:08:12 -04:00
miruka
8fbe59f6eb Fix cursorShape over fields inside a HFlickable
Bug introduced in 6b907, made the cursor stay as a normal arrow when
hovering text fields/areas inside a HFlickable due to the
HKineticScrollingDisabler's width/height being incorrectly set.
2020-08-21 04:58:58 -04:00
miruka
43b14f3129 Make autocompletion work not just at end of line 2020-08-21 04:44:55 -04:00
miruka
1b919ec7be Cursor moves before last word: close completion UI 2020-08-21 01:46:07 -04:00
miruka
063f9d2b1d Only mention tab-completed usernames 2020-08-21 01:21:51 -04:00
miruka
5ba669444d Add basic user autocompletion UI 2020-08-21 01:21:10 -04:00
miruka
ec17d54923 ServerDelegate: ignore compact mode 2020-08-21 01:19:18 -04:00
miruka
cc06645275 Add spinner when fetching homeservers list 2020-08-21 01:19:18 -04:00
miruka
4f1b007e6f Add some top/bottom padding to account bar 2020-08-21 01:19:18 -04:00
miruka
ede99b310e Fix login box tab shortcuts 2020-08-21 01:19:18 -04:00
miruka
3c79ffbf21 Don't show register/reset tabs on sso login box 2020-08-21 01:19:18 -04:00
miruka
f648807730 Remove unused Device model item 2020-08-21 01:19:18 -04:00