diff --git a/include/libqmatrixclient b/include/libqmatrixclient index 825b46f..4e45218 160000 --- a/include/libqmatrixclient +++ b/include/libqmatrixclient @@ -1 +1 @@ -Subproject commit 825b46f42c3d7c813ccab49023e6f7ed6a5e1477 +Subproject commit 4e45218924babe6708fe2128574a3cf6341fe3c6 diff --git a/qml/component/AvatarContainer.qml b/qml/component/AvatarContainer.qml index 6a1fc96..64c4599 100644 --- a/qml/component/AvatarContainer.qml +++ b/qml/component/AvatarContainer.qml @@ -2,7 +2,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 Row { - readonly property bool avatarVisible: !sentByMe && aboveAuthor !== author || section !== aboveSection + readonly property bool avatarVisible: !(sentByMe || (aboveAuthor === author && section === aboveSection)) spacing: 6 @@ -15,14 +15,6 @@ Row { visible: avatarVisible source: author.avatarUrl != "" ? "image://mxc/" + author.avatarUrl : null displayText: author.displayName - - MouseArea { - anchors.fill: parent - - hoverEnabled: true - ToolTip.visible: containsMouse - ToolTip.text: author.displayName - } } Rectangle { diff --git a/qml/component/DownloadDialog.qml b/qml/component/DownloadDialog.qml new file mode 100644 index 0000000..1c43709 --- /dev/null +++ b/qml/component/DownloadDialog.qml @@ -0,0 +1,13 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtQuick.Dialogs 1.2 + +FileDialog { + id: locationDialog + title: "Please choose a location" + folder: shortcuts.home + selectFolder: true + + onAccepted: currentRoom.downloadFile(eventId, folder + "/" + currentRoom.fileNameToDownload(eventId)) + onVisibleChanged: visible ? {} : locationDialog.destroy() +} diff --git a/qml/component/DownloadableContent.qml b/qml/component/DownloadableContent.qml index 495f22b..0268b8f 100644 --- a/qml/component/DownloadableContent.qml +++ b/qml/component/DownloadableContent.qml @@ -1,7 +1,6 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2 -import QtQuick.Dialogs 1.2 Item { property bool openOnFinished: false @@ -15,19 +14,10 @@ Item { opacity: 0.4 } - FileDialog { - id: locationDialog - title: "Please choose a location" - folder: shortcuts.home - selectFolder: true - - onAccepted: currentRoom.downloadFile(eventId, folder + "/" + currentRoom.fileNameToDownload(eventId)) - } - onDownloadedChanged: downloaded && openOnFinished ? openSavedFile() : {} function saveFileAs() { - locationDialog.open() + Qt.createComponent("DownloadDialog.qml").createObject(this).open() } function downloadAndOpen() diff --git a/qml/component/FileBubble.qml b/qml/component/FileBubble.qml index 5240af1..c73a5f8 100644 --- a/qml/component/FileBubble.qml +++ b/qml/component/FileBubble.qml @@ -18,6 +18,7 @@ AvatarContainer { maximumWidth: messageListView.width highlighted: !sentByMe timeLabelVisible: false + authorLabelVisible: messageRow.avatarVisible displayText: "File: " + content.body } diff --git a/qml/component/MessageBubble.qml b/qml/component/MessageBubble.qml index fcde06e..7e87cae 100644 --- a/qml/component/MessageBubble.qml +++ b/qml/component/MessageBubble.qml @@ -13,6 +13,7 @@ AvatarContainer { flat: isNotice highlighted: !sentByMe timeLabelVisible: Math.abs(time - aboveTime) > 600000 || index == 0 + authorLabelVisible: messageRow.avatarVisible displayText: display } diff --git a/qml/component/MessageContextMenu.qml b/qml/component/MessageContextMenu.qml index 5eab2d8..dd2b92d 100644 --- a/qml/component/MessageContextMenu.qml +++ b/qml/component/MessageContextMenu.qml @@ -2,6 +2,10 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 Menu { + readonly property bool isFile: eventType === "video" || eventType === "audio" || eventType === "file" || eventType === "image" + + id: messageContextMenu + MenuItem { text: "Copy" onTriggered: matriqueController.copyToClipboard(plainText) @@ -30,4 +34,5 @@ Menu { } Component.onCompleted: popup() + onClosed: messageContextMenu.destroy() } diff --git a/qml/component/MessageDelegate.qml b/qml/component/MessageDelegate.qml index d108ba9..33cef39 100644 --- a/qml/component/MessageDelegate.qml +++ b/qml/component/MessageDelegate.qml @@ -11,8 +11,6 @@ Item { readonly property bool sentByMe: author === currentRoom.localUser readonly property bool isState: eventType === "state" || eventType === "emote" - readonly property bool isMessage: eventType === "message" || eventType === "notice" - readonly property bool isFile: eventType === "video" || eventType === "audio" || eventType === "file" || eventType === "image" visible: marks !== EventStatus.Hidden @@ -31,6 +29,23 @@ Item { Loader { id: delegateLoader - source: eventType != "redaction" ? isMessage ? "MessageBubble.qml" : isState ? "StateBubble.qml" : isFile ? eventType === "image" ? "ImageBubble.qml" : "FileBubble.qml" : "" : "" + source: { + if (eventType == "redaction") return "" + switch (eventType) { + case "state": + case "emote": + return "StateBubble.qml" + case "message": + case "notice": + return "MessageBubble.qml" + case "image": + return "ImageBubble.qml" + case "video": + case "audio": + case "file": + return "FileBubble.qml" + } + return "" + } } } diff --git a/qml/component/StateBubble.qml b/qml/component/StateBubble.qml index a7e9e99..693c677 100644 --- a/qml/component/StateBubble.qml +++ b/qml/component/StateBubble.qml @@ -6,6 +6,7 @@ TextDelegate { maximumWidth: messageListView.width highlighted: eventType === "emote" timeLabelVisible: false + authorLabelVisible: false displayText: "" + author.displayName + " " + display } diff --git a/qml/component/TextDelegate.qml b/qml/component/TextDelegate.qml index 671bc5b..548d147 100644 --- a/qml/component/TextDelegate.qml +++ b/qml/component/TextDelegate.qml @@ -8,6 +8,7 @@ Rectangle { property bool highlighted: false property string displayText: "" property alias timeLabelVisible: timeText.visible + property alias authorLabelVisible: authorText.visible property int maximumWidth @@ -15,8 +16,8 @@ Rectangle { id: messageRect - width: Math.min(Math.max(messageText.implicitWidth, (timeText.visible ? timeText.implicitWidth : 0)) + 24, maximumWidth) - height: messageText.implicitHeight + (timeText.visible ? timeText.implicitHeight : 0) + 24 + width: Math.min(Math.max(messageText.implicitWidth, (timeText.visible ? timeText.implicitWidth : 0), (authorLabelVisible ? authorText.implicitWidth : 0)) + 24, maximumWidth) + height: (authorText.visible ? authorText.implicitHeight : 0) + messageText.implicitHeight + (timeText.visible ? timeText.implicitHeight : 0) + 24 color: flat ? "transparent" : highlighted ? Material.accent : background border.color: Material.accent @@ -29,6 +30,13 @@ Rectangle { anchors.margins: 12 spacing: 0 + Label { + id: authorText + text: author.displayName + color: darkBackground ? "white" : Material.accent + font.bold: true + } + Label { id: messageText Layout.maximumWidth: parent.width diff --git a/qml/form/SettingGeneralForm.qml b/qml/form/SettingGeneralForm.qml index 75bfc14..eb027c7 100644 --- a/qml/form/SettingGeneralForm.qml +++ b/qml/form/SettingGeneralForm.qml @@ -9,5 +9,10 @@ Page { id: lazyLoadSwitch text: "Lazy Load at Initial Sync" } + Button { + text: "Invoke GC" + highlighted: true + onClicked: gc() + } } } diff --git a/res.qrc b/res.qrc index 2876660..7112288 100644 --- a/res.qrc +++ b/res.qrc @@ -32,5 +32,6 @@ qml/form/SettingGeneralForm.qml qml/component/EmojiPicker.qml qml/component/EmojiButton.qml + qml/component/DownloadDialog.qml