From d4b0e90a876f115546574da0af5f19a0eb438a9b Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 28 Feb 2020 03:01:06 +0100 Subject: [PATCH] Clean up QML --- messagemodel.go | 4 +++- qml/MessagePopup.qml | 8 +++++--- qml/MessageText.qml | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/messagemodel.go b/messagemodel.go index 7fa52de..22e291f 100644 --- a/messagemodel.go +++ b/messagemodel.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "time" humanize "github.com/dustin/go-humanize" @@ -9,7 +10,7 @@ import ( // maxMessageCount defines the max amount of messages stored in a model const ( - maxMessageCount = 150 + maxMessageCount = 80 ) // Model Roles @@ -314,6 +315,7 @@ func (m *MessageModel) removeMessageID(id string) { } func (m *MessageModel) updateMessageTime() { + fmt.Println("Updating timelines...") if len(m.Messages()) > 0 { var fIndex = m.Index(0, 0, core.NewQModelIndex()) var lIndex = m.Index(len(m.Messages())-1, 0, core.NewQModelIndex()) diff --git a/qml/MessagePopup.qml b/qml/MessagePopup.qml index cc466aa..4757c51 100644 --- a/qml/MessagePopup.qml +++ b/qml/MessagePopup.qml @@ -4,10 +4,10 @@ import QtQuick.Controls.Material 2.1 import QtQuick.Layouts 1.3 Popup { - property var message - id: popup + property var message + modal: true focus: true height: Math.min(mainWindow.height * 0.8, layout.implicitHeight + 32) @@ -134,11 +134,13 @@ Popup { onClicked: { popup.close() var msg = messageArea.text - var msgid = ""; + var msgid = "" + if (message != null) { msgid = message.messageid msg = "@" + message.author + " " + msg } + uiBridge.postButton(msgid, msg) messageArea.clear() } diff --git a/qml/MessageText.qml b/qml/MessageText.qml index 69bf6e7..0647fdb 100644 --- a/qml/MessageText.qml +++ b/qml/MessageText.qml @@ -13,7 +13,6 @@ TextEdit selectionColor: Material.accent MouseArea { - id: ma1 anchors.fill: parent // we don't want to eat clicks on the Label acceptedButtons: Qt.RightButton