diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index d8db152f..206a9e17 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -179,7 +179,6 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) { if len(handle) == 32 { // LOAD GROUP - log.Debugf("LOADING GROUP %s", handle) group := the.Peer.GetGroup(handle) tl := group.GetTimeline() nick, _ := group.GetAttribute("nick") @@ -188,7 +187,7 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) { } else { this.SetToolbarTitle(nick) } - log.Debugf("messages: %d", len(tl)) + for i := len(tl) - 1; i >= 0; i-- { if tl[i].PeerID == the.Peer.GetProfile().Onion { handle = "me" diff --git a/qml/main.qml b/qml/main.qml index 59374554..389ca411 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -55,9 +55,13 @@ ApplicationWindow { return newtext } - function scale() { - return 0.1 + 2 * zoomSlider.value - } + function ptToPx(pt) { + return Screen.pixelDensity * 25.4 * pt / 72 + } + + function pxToPt(px) { + return px * 72 / (Screen.pixelDensity * 25.4) + } /* Rectangle { // THE TOOLBAR diff --git a/qml/panes/AddGroupPane.qml b/qml/panes/AddGroupPane.qml index e8e3ff03..048e8aaa 100644 --- a/qml/panes/AddGroupPane.qml +++ b/qml/panes/AddGroupPane.qml @@ -10,17 +10,32 @@ import "../widgets" import "../styles" ColumnLayout { // settingsPane + id: root anchors.fill: parent StackToolbar { + id: stb text: qsTr("create-group-title") aux.visible: false + membership.visible: false } + Flickable { + anchors.top: stb.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + boundsBehavior: Flickable.StopAtBounds + clip:true + contentWidth: tehcol.width + contentHeight: tehcol.height + Column { + id: tehcol leftPadding: 10 spacing: 5 + width: root.width ScalingLabel { //: Server label @@ -29,7 +44,7 @@ ColumnLayout { // settingsPane TextField { id: txtServer - style: CwtchTextFieldStyle{ width: 400 } + style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } text: "2c3kmoobnyghj2zw6pwv7d57yzld753auo3ugauezzpvfak3ahc4bdyd" } @@ -40,7 +55,7 @@ ColumnLayout { // settingsPane TextField { id: txtGroupName - style: CwtchTextFieldStyle{ width: 400 } + style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } //: default suggested group name text: qsTr("default-group-name") } @@ -55,4 +70,5 @@ ColumnLayout { // settingsPane } }//end of column with padding + }//end of flickable } \ No newline at end of file diff --git a/qml/panes/GroupSettingsPane.qml b/qml/panes/GroupSettingsPane.qml index d5531162..7616158d 100644 --- a/qml/panes/GroupSettingsPane.qml +++ b/qml/panes/GroupSettingsPane.qml @@ -22,7 +22,19 @@ ColumnLayout { // groupSettingsPane back.onClicked: theStack.pane = theStack.messagePane } + Flickable { + anchors.top: toolbar.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + boundsBehavior: Flickable.StopAtBounds + clip:true + contentWidth: tehcol.width + contentHeight: tehcol.height + Column { + id: tehcol + width: gsp.width leftPadding: 10 spacing: 5 @@ -32,7 +44,7 @@ ColumnLayout { // groupSettingsPane TextField { id: txtServer - style: CwtchTextFieldStyle{ width: 400 } + style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } readOnly: true } @@ -53,7 +65,7 @@ ColumnLayout { // groupSettingsPane TextField { id: txtInvitation - style: CwtchTextFieldStyle{ width: 400 } + style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } readOnly: true } @@ -74,7 +86,7 @@ ColumnLayout { // groupSettingsPane TextField { id: txtGroupName - style: CwtchTextFieldStyle{ width: 400 } + style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } } SimpleButton { @@ -117,6 +129,7 @@ ColumnLayout { // groupSettingsPane } }//end of column with padding + }//end of flickable Connections { target: gcd diff --git a/qml/panes/PeerSettingsPane.qml b/qml/panes/PeerSettingsPane.qml index 846a49e6..307c90f9 100644 --- a/qml/panes/PeerSettingsPane.qml +++ b/qml/panes/PeerSettingsPane.qml @@ -10,6 +10,7 @@ import "../widgets" import "../styles" ColumnLayout { // peerSettingsPane + id: root anchors.fill: parent @@ -21,7 +22,19 @@ ColumnLayout { // peerSettingsPane back.onClicked: theStack.pane = theStack.messagePane } + Flickable { + anchors.top: toolbar.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + boundsBehavior: Flickable.StopAtBounds + clip:true + contentWidth: tehcol.width + contentHeight: tehcol.height + Column { + id: tehcol + width: root.width leftPadding: 10 spacing: 5 @@ -31,7 +44,7 @@ ColumnLayout { // peerSettingsPane TextField { id: txtOnion - style: CwtchTextFieldStyle{ width: 400 } + style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } readOnly: true } @@ -53,7 +66,7 @@ ColumnLayout { // peerSettingsPane TextField { id: txtDisplayName - style: CwtchTextFieldStyle{ width: 400 } + style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } } SimpleButton { @@ -77,6 +90,7 @@ ColumnLayout { // peerSettingsPane } }//end of column with padding + }//end of flickable Connections { diff --git a/qml/panes/SettingsPane.qml b/qml/panes/SettingsPane.qml index 22e308c0..8d4efa0b 100644 --- a/qml/panes/SettingsPane.qml +++ b/qml/panes/SettingsPane.qml @@ -10,26 +10,45 @@ import "../widgets" import "../widgets/controls" ColumnLayout { // settingsPane + id: root anchors.fill: parent StackToolbar { + id: stb //: Cwtch Settings title text: qsTr("cwtch-settings-title") aux.visible: false + membership.visible: false } + Flickable { + anchors.top: stb.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + boundsBehavior: Flickable.StopAtBounds + clip:true + contentWidth: tehcol.width + contentHeight: tehcol.height + + Column { + id: tehcol leftPadding: 10 spacing: 5 + width: root.width ScalingLabel { + width: parent.width + wrapMode: TextEdit.Wrap //: Version: %1 Built on: %2 text: qsTr("version %1 builddate %2").arg(gcd.version).arg(gcd.buildDate) } ScalingLabel { - Layout.maximumWidth: parent.width + width: parent.width + wrapMode: TextEdit.Wrap //: Interface zoom (mostly affects text and button sizes) text: qsTr("zoom-label") + ":" } @@ -48,13 +67,16 @@ ColumnLayout { // settingsPane } ScalingLabel { + wrapMode: TextEdit.Wrap text: qsTr("large-text-label") size: 20 } ScalingLabel{ + width: parent.width + wrapMode: TextEdit.Wrap //: "Default size text (scale factor: " - text: qsTr("default-scaling-text") + zoomSlider.value + ")" + text: qsTr("default-scaling-text") + " " + Math.round(zoomSlider.value * 100) / 100 + ")" } ScalingLabel { @@ -90,6 +112,7 @@ ColumnLayout { // settingsPane } }//end of column with padding + }//end of flickable function saveSettings() { // language switcher saves itself because erinn is a bad (read: amazing) programmer diff --git a/qml/styles/CwtchTextFieldStyle.qml b/qml/styles/CwtchTextFieldStyle.qml index 2dbdafc9..768af1cd 100644 --- a/qml/styles/CwtchTextFieldStyle.qml +++ b/qml/styles/CwtchTextFieldStyle.qml @@ -1,17 +1,16 @@ import QtQuick.Controls.Styles 1.4 import QtQuick 2.7 - TextFieldStyle { id: root textColor: "black" - font.pointSize: 10 + font.pointSize: 10 * gcd.themeScale property int width: 100 background: Rectangle { radius: 2 implicitWidth: root.width - implicitHeight: 24 + implicitHeight: ptToPx(10 * gcd.themeScale) color: windowItem.cwtch_background_color border.color: windowItem.cwtch_color } diff --git a/qml/widgets/ContactPicture.qml b/qml/widgets/ContactPicture.qml index 2b020d0c..9a3cbc1e 100644 --- a/qml/widgets/ContactPicture.qml +++ b/qml/widgets/ContactPicture.qml @@ -7,8 +7,8 @@ import CustomQmlTypes 1.0 Item { id: imgProfile - implicitWidth: 48 - implicitHeight: 48 + implicitWidth: baseWidth + implicitHeight: baseWidth anchors.margins: 5 property string handle @@ -17,17 +17,18 @@ Item { property bool isGroup property bool showStatus property bool highlight + property int baseWidth: 48 * gcd.themeScale Rectangle { id: mainImage - width: 48 - height: 48 + width: baseWidth + height: baseWidth color: highlight ? windowItem.cwtch_dark_color: "#FFFFFF" radius: width / 2 Rectangle { - width: highlight ? 44 : 48 - height: highlight ? 44 : 48 + width: highlight ? baseWidth - 4 : baseWidth + height: highlight ? baseWidth - 4 : baseWidth color: "#FFFFFF" radius: width / 2 anchors.centerIn:parent @@ -58,22 +59,22 @@ Item { Rectangle { // PRESENCE INDICATOR visible: showStatus color: "#FFFFFF" - width: 8 - height: 8 - radius: 2 + width: 8 * gcd.themeScale + height: 8 * gcd.themeScale + radius: 2 * gcd.themeScale anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 4 + anchors.margins: 4 * gcd.themeScale 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 - height: 5 - radius: 2 + width: 5 * gcd.themeScale + height: 5 * gcd.themeScale + radius: 2 * gcd.themeScale anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: 1.5 + anchors.margins: 1.5 * gcd.themeScale } } diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index 0c71a60c..37943bc9 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -5,10 +5,12 @@ import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.3 import CustomQmlTypes 1.0 -RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY +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 + implicitHeight: height property alias displayName: cn.text property alias image: imgProfile.source @@ -24,61 +26,60 @@ RowLayout { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY Rectangle { // CONTACT ENTRY BACKGROUND COLOR - id: root + id: crRect anchors.left: parent.left anchors.right: parent.right - height: childrenRect.height + 3 + height: 48 * gcd.themeScale + 3 width: parent.width color: background ? (isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")) : windowItem.cwtch_background_color + ContactPicture { + id: imgProfile + showStatus: true + } - RowLayout { - width: parent.width - anchors.left: parent.left - anchors.right: parent.right + Label { // CONTACT NAME + id: cn + leftPadding: 10 + rightPadding: 10 + //wrapMode: Text.WordWrap + anchors.left: imgProfile.right + anchors.right: rectUnread.left + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 16 * gcd.themeScale + font.italic: !trusted + textFormat: Text.PlainText + //fontSizeMode: Text.HorizontalFit + elide: Text.ElideRight + color: "#000000" + } + Rectangle { // UNREAD MESSAGES? + id: rectUnread + height: txtmetric.tightBoundingRect.height + 8 * gcd.themeScale + width: txtmetric.tightBoundingRect.width + 8 * gcd.themeScale + radius: 8 * gcd.themeScale + color: "#4B3557" + visible: badge != 0 + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 9 * gcd.themeScale - ContactPicture { - id: imgProfile - showStatus: true - } + Label { + id: lblUnread + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + color: "#FFFFFF" + font.pixelSize: 12 * gcd.themeScale + text: txtmetric.text + } - Label { // CONTACT NAME - id: cn - leftPadding: 10 - rightPadding: 10 - //wrapMode: Text.WordWrap - anchors.left: imgProfile.right - anchors.right: rectUnread.left - font.pixelSize: 16 - font.italic: !trusted - textFormat: Text.PlainText - //fontSizeMode: Text.HorizontalFit - elide: Text.ElideRight - color: "#000000" - } - - Rectangle { // UNREAD MESSAGES? - id: rectUnread - anchors.right: parent.right - height: 16 - width: lblUnread.width + 10 - radius: 8 - color: "#4B3557" - visible: badge != 0 - anchors.rightMargin: 9 - - - Label { - id: lblUnread - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: "#FFFFFF" - font.pixelSize: 12 - text: badge - } - } - } + TextMetrics { + id: txtmetric + text: badge + font: lblUnread.font + } + } } MouseArea { // ONCLICK: LOAD CONVERSATION WITH THIS CONTACT diff --git a/qml/widgets/Message.qml b/qml/widgets/Message.qml index 2b42e64e..0698d514 100644 --- a/qml/widgets/Message.qml +++ b/qml/widgets/Message.qml @@ -113,7 +113,7 @@ RowLayout { padding: 6 leftPadding: 10 font.pixelSize: gcd.themeScale * 12 - selectByMouse: false + selectByMouse: gcd.os != "android" readOnly: true width: Math.min(dummy.width, root.parent.width - (imgProfile.visible ? imgProfile.width : 0) - 40) wrapMode: TextEdit.Wrap @@ -169,7 +169,7 @@ RowLayout { } MouseArea { - anchors.fill: parent + anchors.fill: gcd.os == "android" ? parent : null onPressAndHold: { diff --git a/qml/widgets/MyProfile.qml b/qml/widgets/MyProfile.qml index 9d80501e..6321f58d 100644 --- a/qml/widgets/MyProfile.qml +++ b/qml/widgets/MyProfile.qml @@ -144,13 +144,13 @@ ColumnLayout { } */ - ScalingLabel { // ONION ADDRESS + Text { // ONION ADDRESS id: lblOnion - //font.pixelSize: 6 + fontSizeMode: Text.HorizontalFit + minimumPointSize: 2 Layout.fillWidth: true - padding: 3 horizontalAlignment: Text.AlignHCenter - text:onion + text: onion } Row { // TOOLS FOR EDITING PROFILE