Make media openable with the openLinks keybind

This involved a refactoring to move all the media handling functions
(downloading, opening externally, etc) out of the Event delegates and
into the EventList, which manage keybinds instead.

This should also be better for performance since all these functions are
no longer duplicated for every Event in view.

Other user-noticable change: clicking on non-image media will
always download and open them no matter if the room is encrypted or not,
instead of opening non-encrypted files in browser like before. It will
be possible to still do that with an "open externally" command later.
This commit is contained in:
miruka
2020-07-19 20:10:31 -04:00
parent fe08014697
commit de6d8fa59d
9 changed files with 207 additions and 169 deletions

View File

@@ -9,8 +9,6 @@ import "../../../Base"
HColumnLayout {
id: eventDelegate
enum Media { Page, File, Image, Video, Audio }
property var hoveredMediaTypeUrl: []
property var fetchProfilesFuture: null
@@ -171,19 +169,19 @@ HColumnLayout {
text:
contextMenu.media.length < 1 ? "" :
contextMenu.media[0] === EventDelegate.Media.Page ?
contextMenu.media[0] === Utils.Media.Page ?
qsTr("Copy page address") :
contextMenu.media[0] === EventDelegate.Media.File ?
contextMenu.media[0] === Utils.Media.File ?
qsTr("Copy file address") :
contextMenu.media[0] === EventDelegate.Media.Image ?
contextMenu.media[0] === Utils.Media.Image ?
qsTr("Copy image address") :
contextMenu.media[0] === EventDelegate.Media.Video ?
contextMenu.media[0] === Utils.Media.Video ?
qsTr("Copy video address") :
contextMenu.media[0] === EventDelegate.Media.Audio ?
contextMenu.media[0] === Utils.Media.Audio ?
qsTr("Copy audio address") :
qsTr("Copy media address")