Improve Reply UI.

Fix a bug in ImageItem.
Update libqmatrixclient.
This commit is contained in:
Black Hat 2018-11-21 19:40:54 +08:00
parent 6d17716e97
commit 9ad062ca30
5 changed files with 42 additions and 22 deletions

View File

@ -32,7 +32,6 @@ ColumnLayout {
visible: avatarVisible
font.pixelSize: 13
font.weight: Font.Medium
verticalAlignment: Text.AlignVCenter
}
@ -80,7 +79,6 @@ ColumnLayout {
anchors.fill: parent
onSecondaryClicked: {
index === messageListView.currentIndex ? messageListView.currentIndex = -1 : messageListView.currentIndex = index
messageContextMenu.root = root
messageContextMenu.model = model
messageContextMenu.selectedText = contentLabel.selectedText
@ -227,14 +225,14 @@ ColumnLayout {
}
}
Label {
Layout.leftMargin: sentByMe ? 12 : 48
// Label {
// Layout.leftMargin: sentByMe ? 12 : 48
text: Qt.formatDateTime(time, "dd/MM/yyyy '-' hh:mm")
// text: Qt.formatDateTime(time, "dd/MM/yyyy '-' hh:mm")
visible: index === messageListView.currentIndex
// visible: index === messageListView.currentIndex
font.pixelSize: 13
verticalAlignment: Text.AlignVCenter
}
// font.pixelSize: 13
// verticalAlignment: Text.AlignVCenter
// }
}

View File

@ -37,10 +37,10 @@ Menu {
text: "Reply"
onTriggered: {
roomPanelInput.isReply = true
roomPanelInput.replyUserID = model.author.id
roomPanelInput.replyUser = model.author
roomPanelInput.replyEventID = model.eventId
roomPanelInput.replyContent = selectedText != "" ? selectedText : model.message
roomPanelInput.isReply = true
}
}
MenuItem {

View File

@ -14,7 +14,7 @@ import "qrc:/js/md.js" as Markdown
Control {
property bool isReply
property string replyUserID
property var replyUser
property string replyEventID
property string replyContent
@ -107,15 +107,37 @@ Control {
}
}
contentItem: Column {
contentItem: ColumnLayout {
spacing: 0
add: Transition {
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 250 }
RowLayout {
Layout.fillWidth: true
Layout.margins: 8
visible: isReply
spacing: 8
ImageItem {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
source: replyUser ? replyUser.paintable : null
hint: replyUser ? replyUser.displayName : "No name"
}
Label {
Layout.fillWidth: true
text: replyContent
font.pixelSize: 16
wrapMode: Label.Wrap
}
}
EmojiPicker {
width: parent.width
Layout.fillWidth: true
id: emojiPicker
@ -133,7 +155,7 @@ Control {
}
RowLayout {
width: parent.width
Layout.fillWidth: true
spacing: 0
@ -179,7 +201,7 @@ Control {
id: inputField
wrapMode: Text.Wrap
placeholderText: isReply ? "Reply to " + replyUserID : "Send a Message"
placeholderText: "Send a Message"
topPadding: 0
bottomPadding: 0
selectByMouse: true
@ -288,7 +310,7 @@ Control {
var PREFIX_MARKDOWN = '/md '
if (isReply) {
currentRoom.sendReply(replyUserID, replyEventID, replyContent, text)
currentRoom.sendReply(replyUser.id, replyEventID, replyContent, text)
clearReply()
return
}
@ -356,7 +378,7 @@ Control {
function clearReply() {
isReply = false
replyUserID = ""
replyUser = null
replyEventID = ""
replyContent = ""
}

@ -1 +1 @@
Subproject commit e1fdb33a4161b29d6df590ccea339d361d9fc4e8
Subproject commit f9dccac588f2aa1c809018c0c5eb606a1470d2c5

View File

@ -82,7 +82,7 @@ void ImageItem::setPaintable(Paintable *paintable) {
}
void ImageItem::setHint(QString newHint) {
if (m_hint != newHint) {
if (!m_hint.isNull() && m_hint != newHint) {
m_hint = newHint;
emit hintChanged();
update();