Remove sender tooltip, and sender label, simplify MessageDelegate, add

an option to invoke GC, and update libqmatrixclient.
This commit is contained in:
Black Hat 2018-08-13 22:44:32 +08:00
parent c765af9bce
commit 230231a42f
12 changed files with 58 additions and 26 deletions

@ -1 +1 @@
Subproject commit 825b46f42c3d7c813ccab49023e6f7ed6a5e1477
Subproject commit 4e45218924babe6708fe2128574a3cf6341fe3c6

View File

@ -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 {

View File

@ -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()
}

View File

@ -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()

View File

@ -18,6 +18,7 @@ AvatarContainer {
maximumWidth: messageListView.width
highlighted: !sentByMe
timeLabelVisible: false
authorLabelVisible: messageRow.avatarVisible
displayText: "<b>File: </b>" + content.body
}

View File

@ -13,6 +13,7 @@ AvatarContainer {
flat: isNotice
highlighted: !sentByMe
timeLabelVisible: Math.abs(time - aboveTime) > 600000 || index == 0
authorLabelVisible: messageRow.avatarVisible
displayText: display
}

View File

@ -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()
}

View File

@ -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 ""
}
}
}

View File

@ -6,6 +6,7 @@ TextDelegate {
maximumWidth: messageListView.width
highlighted: eventType === "emote"
timeLabelVisible: false
authorLabelVisible: false
displayText: "<b>" + author.displayName + "</b> " + display
}

View File

@ -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

View File

@ -9,5 +9,10 @@ Page {
id: lazyLoadSwitch
text: "Lazy Load at Initial Sync"
}
Button {
text: "Invoke GC"
highlighted: true
onClicked: gc()
}
}
}

View File

@ -32,5 +32,6 @@
<file>qml/form/SettingGeneralForm.qml</file>
<file>qml/component/EmojiPicker.qml</file>
<file>qml/component/EmojiButton.qml</file>
<file>qml/component/DownloadDialog.qml</file>
</qresource>
</RCC>