From 4494a2b16810c7d459102082a7be09f5d738cbe4 Mon Sep 17 00:00:00 2001 From: erinn Date: Wed, 17 Apr 2019 14:03:50 -0700 Subject: [PATCH] chatoverlay scaling --- android/AndroidManifest.xml | 2 +- go/characters/incominglistener.go | 4 ++-- go/gothings/gcd.go | 5 ++++- qml/main.qml | 6 +++--- qml/overlays/ChatOverlay.qml | 9 ++++++--- qml/widgets/ContactPicture.qml | 19 ++++++++++--------- qml/widgets/ContactRow.qml | 5 +++-- qml/widgets/Message.qml | 30 +++++++++++++++++++----------- 8 files changed, 48 insertions(+), 32 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 4d16620d..90de07c3 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,7 +1,7 @@ - + diff --git a/go/characters/incominglistener.go b/go/characters/incominglistener.go index 2c1b10bd..2d64004f 100644 --- a/go/characters/incominglistener.go +++ b/go/characters/incominglistener.go @@ -47,10 +47,10 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func( if ctc != nil { name, exists = ctc.GetAttribute("nick") if !exists || name == "" { - name = e.Data[event.RemotePeer] + "..." + name = e.Data[event.RemotePeer] } } else { - name = e.Data[event.RemotePeer] + "..." + name = e.Data[event.RemotePeer] } ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent]) diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 206a9e17..4b545016 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -200,9 +200,12 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) { if ctc != nil { name, exists = ctc.GetAttribute("nick") if !exists || name == "" { - name = tl[i].PeerID[:16] + "..." + name = tl[i].PeerID } + } else { + name = tl[i].PeerID } + this.PrependMessage( handle, tl[i].PeerID, diff --git a/qml/main.qml b/qml/main.qml index 389ca411..cbbade10 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -145,7 +145,7 @@ ApplicationWindow { Layout.fillHeight: true Layout.minimumWidth: Layout.maximumWidth Layout.maximumWidth: theStack.pane == theStack.emptyPane ? parent.width : 450 - visible: (ratio <= 1.08 && windowItem.width >= 700) || theStack.pane == theStack.emptyPane + visible: (ratio <= 1.08 && windowItem.width >= 700 && !Qt.inputMethod.visible) || theStack.pane == theStack.emptyPane ContactList{ @@ -202,7 +202,7 @@ ApplicationWindow { anchors.horizontalCenter: parent.horizontalCenter anchors.topMargin: 20 width: lblPopup.width + 30 - height: lblPopup.height + 8 + height: lblPopup.height + 8 * gcd.themeScale color: "#000000" opacity: 0.5 radius: 15 @@ -213,7 +213,7 @@ ApplicationWindow { id: lblPopup anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - font.pixelSize: 18 + font.pixelSize: 18 * gcd.themeScale color: "#FFFFFF" } } diff --git a/qml/overlays/ChatOverlay.qml b/qml/overlays/ChatOverlay.qml index 3b90577f..b0f141f4 100644 --- a/qml/overlays/ChatOverlay.qml +++ b/qml/overlays/ChatOverlay.qml @@ -25,6 +25,7 @@ ColumnLayout { spacing: 6 clip: true ScrollBar.vertical: ScrollBar {} + maximumFlickVelocity: 1250 delegate: Message { handle: _handle @@ -93,7 +94,7 @@ ColumnLayout { "_handle": handle, "_from": from, "_displayName": displayName, - "_message":parse(msg.d, 12), + "_message":parse(msg.d, 24), "_rawMessage":msg.d, "_image": image, "_mid": mid, @@ -137,7 +138,7 @@ ColumnLayout { TextEdit { id: txtMessage - font.pixelSize: 10 + font.pixelSize: 10 * gcd.themeScale text: "" padding: 6 wrapMode: TextEdit.Wrap @@ -265,7 +266,9 @@ ColumnLayout { anchors.right: btnAttach.left anchors.rightMargin: 2 - onClicked: gcd.popup("emoji not yet implemented, sorry") + onClicked: { + gcd.popup("emoji not yet implemented, sorry") + } } SimpleButton { diff --git a/qml/widgets/ContactPicture.qml b/qml/widgets/ContactPicture.qml index 9a3cbc1e..7f0f45a9 100644 --- a/qml/widgets/ContactPicture.qml +++ b/qml/widgets/ContactPicture.qml @@ -17,7 +17,8 @@ Item { property bool isGroup property bool showStatus property bool highlight - property int baseWidth: 48 * gcd.themeScale + property real logscale: 4 * Math.log10(gcd.themeScale + 1) + property int baseWidth: 48 * logscale Rectangle { id: mainImage @@ -59,22 +60,22 @@ Item { Rectangle { // PRESENCE INDICATOR visible: showStatus color: "#FFFFFF" - width: 8 * gcd.themeScale - height: 8 * gcd.themeScale - radius: 2 * gcd.themeScale + width: 8 * logscale + height: 8 * logscale + radius: 2 * logscale anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 4 * gcd.themeScale + anchors.margins: 4 * logscale Rectangle { //-2:WtfCodeError,-1:Untrusted,0:Disconnected,1:Connecting,2:Connected,3:Authenticated,4:Failed,5:Killed color: status == 3 ? "green" : status == -1 ? "blue" : status == 1 ? "orange" : status == 2 ? "orange" : "red" - width: 5 * gcd.themeScale - height: 5 * gcd.themeScale - radius: 2 * gcd.themeScale + width: 5 * logscale + height: 5 * logscale + radius: 2 * logscale anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 1.5 * gcd.themeScale + anchors.margins: 1.5 * logscale } } diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index 37943bc9..782f9b35 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -9,9 +9,10 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY anchors.left: parent.left anchors.right: parent.right visible: !deleted - height: 48 * gcd.themeScale + 3 + height: 48 * logscale + 3 implicitHeight: height + property real logscale: 4 * Math.log10(gcd.themeScale + 1) property alias displayName: cn.text property alias image: imgProfile.source property string handle @@ -29,7 +30,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY id: crRect anchors.left: parent.left anchors.right: parent.right - height: 48 * gcd.themeScale + 3 + height: 48 * logscale + 3 width: parent.width color: background ? (isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")) : windowItem.cwtch_background_color diff --git a/qml/widgets/Message.qml b/qml/widgets/Message.qml index 0698d514..d1f1ca86 100644 --- a/qml/widgets/Message.qml +++ b/qml/widgets/Message.qml @@ -6,7 +6,7 @@ import QtQuick.Layouts 1.3 import "controls" as Awesome -RowLayout { +Item { id: root anchors.left: fromMe ? undefined : parent.left @@ -73,12 +73,8 @@ RowLayout { Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE id: rectMessageBubble - height: lbl.height + ts.height + 8 - Layout.minimumHeight: height - Layout.maximumHeight: height + height: colMessageBubble.height + 8 width: colMessageBubble.width + 6 - Layout.minimumWidth: width - Layout.maximumWidth: width color: fromMe ? "#B09CBC" : "#4B3557" radius: 5 @@ -130,29 +126,41 @@ RowLayout { Label { // TIMESTAMP id: ts color: "#FFFFFF" - font.pixelSize: 10 + font.pixelSize: 10 * gcd.themeScale anchors.left: parent.left leftPadding: 10 } Label { // DISPLAY NAME FOR GROUPS color: "#FFFFFF" - font.pixelSize: 10 + font.pixelSize: 10 * gcd.themeScale anchors.right: parent.right - text: displayName + text: displayName.length > 12 ? displayName.substr(0,12) + "..." : displayName visible: !fromMe + ToolTip.text: from + ToolTip.visible: ma2.containsMouse + ToolTip.delay: 200 + + MouseArea { + id: ma2 + anchors.fill: parent + hoverEnabled: true + } } Image { // ACKNOWLEDGEMENT ICON id: ack anchors.right: parent.right source: root.error != "" ? "qrc:/qml/images/fontawesome/regular/window-close.svg" : (root.ackd ? "qrc:/qml/images/fontawesome/regular/check-circle.svg" : "qrc:/qml/images/fontawesome/regular/hourglass.svg") - height: 10 - sourceSize.height: 10 + height: 10 * gcd.themeScale + sourceSize.height: 10 * gcd.themeScale visible: fromMe ToolTip.visible: ma.containsMouse + ToolTip.delay: 200 //: Could not send this message ToolTip.text: root.error != "" ? qsTr("could-not-send-msg-error") + ":" + root.error : (root.ackd ? qsTr("acknowledged-label") : qsTr("pending-label")) + + MouseArea { id: ma anchors.fill: parent