Time and date support in messageeventmodel && local echo support.

This commit is contained in:
Black Hat
2018-07-30 00:00:41 +08:00
parent a105f344f4
commit 93a303799a
7 changed files with 279 additions and 216 deletions

View File

@@ -96,6 +96,21 @@ Item {
delegate: MessageDelegate {}
section.property: "section"
section.criteria: ViewSection.FullString
section.delegate: Label {
text: section
color: "grey"
padding: 16
verticalAlignment: Text.AlignVCenter
anchors.horizontalCenter: parent.horizontalCenter
background: Rectangle {
anchors.fill: parent
anchors.margins: 4
color: Material.theme == Material.Light ? "#dbdbdb" : "#363636"
}
}
onAtYBeginningChanged: atYBeginning && currentRoom ? currentRoom.getPreviousContent(50) : {}
onAtYEndChanged: atYEnd && currentRoom ? currentRoom.markAllMessagesAsRead() : {}
@@ -180,6 +195,13 @@ Item {
bottomPadding: 0
selectByMouse: true
Keys.onReturnPressed: {
if (inputField.text) {
inputField.postMessage(inputField.text)
inputField.text = ""
}
}
background: Item {
Rectangle {
z: 5
@@ -191,16 +213,6 @@ Item {
Rectangle { anchors.fill: parent; color: Material.theme == Material.Light ? "#eaeaea" : "#242424" }
}
Shortcut {
sequence: "Ctrl+Return"
onActivated: {
if (inputField.text) {
inputField.postMessage(inputField.text)
inputField.text = ""
}
}
}
function postMessage(text) {
if (text.trim().length === 0) { return }
if(!currentRoom) { return }