From cccc7f599f09ae1a7ebf09f88d67d0bff8d089f0 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 27 May 2020 14:40:58 -0400 Subject: [PATCH] chore: fix last anchor warnings --- ui/app/AppLayouts/Chat/ChatColumn.qml | 52 +- ui/app/AppLayouts/Chat/ContactsColumn.qml | 626 ++++++++++---------- ui/app/AppLayouts/Profile/ProfileLayout.qml | 2 +- ui/app/AppLayouts/Wallet/LeftTab.qml | 3 +- 4 files changed, 346 insertions(+), 337 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatColumn.qml b/ui/app/AppLayouts/Chat/ChatColumn.qml index 222482d49a..a50ad9321c 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn.qml @@ -115,7 +115,10 @@ StackLayout { Menu { id: contextMenu - MenuItem { text: "Leave Chat"; onTriggered: chatsModel.leaveActiveChat() } + MenuItem { + text: "Leave Chat" + onTriggered: chatsModel.leaveActiveChat() + } } } } @@ -215,7 +218,7 @@ StackLayout { onCountChanged: { if (!this.atYEnd) { // User has scrolled up, we don't want to scroll back - return; + return } // positionViewAtEnd doesn't work well. Instead, we use highlightFollowsCurrentItem @@ -223,7 +226,6 @@ StackLayout { while (this.currentIndex < this.count - 1) { this.incrementCurrentIndex() } - } } } @@ -303,36 +305,39 @@ StackLayout { id: mouseArea1 anchors.rightMargin: 50 anchors.fill: parent - onClicked : { + onClicked: { txtData.forceActiveFocus(Qt.MouseFocusReason) } } } } } - } Item { - id: element - anchors.left: parent.left - anchors.leftMargin: 200 - anchors.right: parent.right - anchors.rightMargin: 200 - anchors.bottom: parent.bottom - anchors.bottomMargin: 200 - anchors.top: parent.top - anchors.topMargin: 100 - Image { - source: "../../../onboarding/img/chat@2x.jpg" - } + Layout.fillHeight: true + Layout.fillWidth: true + Item { + id: walkieTalkieContainer + anchors.left: parent.left + anchors.leftMargin: 200 + anchors.right: parent.right + anchors.rightMargin: 200 + anchors.bottom: parent.bottom + anchors.bottomMargin: 200 + anchors.top: parent.top + anchors.topMargin: 100 + Image { + source: "../../../onboarding/img/chat@2x.jpg" + } - Text { - text: "Select a chat to start messaging" - anchors.horizontalCenter: parent.horizontalCenter - font.weight: Font.DemiBold - font.pixelSize: 15 - color: Theme.darkGrey + Text { + text: "Select a chat to start messaging" + anchors.horizontalCenter: parent.horizontalCenter + font.weight: Font.DemiBold + font.pixelSize: 15 + color: Theme.darkGrey + } } } } @@ -342,3 +347,4 @@ Designer { D{i:0;formeditorColor:"#ffffff";height:770;width:800} } ##^##*/ + diff --git a/ui/app/AppLayouts/Chat/ContactsColumn.qml b/ui/app/AppLayouts/Chat/ContactsColumn.qml index fd955b7da3..6c3be88f1f 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn.qml @@ -14,232 +14,228 @@ Item { id: contactsColumn width: 300 Layout.minimumWidth: 200 + Layout.fillHeight: true - Item { - Layout.preferredHeight: 100 - Layout.fillHeight: false - Layout.fillWidth: true + Text { + id: title + x: 772 + text: qsTr("Chat") + anchors.top: parent.top + anchors.topMargin: 17 + font.bold: true + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 17 + } + + Rectangle { + id: searchBox + height: 36 + color: Theme.grey + anchors.top: parent.top + anchors.topMargin: 59 + radius: 8 + anchors.right: parent.right + anchors.rightMargin: 65 + anchors.left: parent.left + anchors.leftMargin: 16 + + TextField { + id: searchText + placeholderText: qsTr("Search or join channel") + anchors.left: parent.left + anchors.leftMargin: 32 + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 12 + background: Rectangle { + color: "#00000000" + } + } + + Image { + id: image4 + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.verticalCenter: parent.verticalCenter + fillMode: Image.PreserveAspectFit + source: "../../img/search.svg" + } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + searchText.forceActiveFocus(Qt.MouseFocusReason) + } + } + } + + Rectangle { + id: addChat + x: 183 + width: 36 + height: 36 + color: Theme.blue + radius: 50 + anchors.right: parent.right + anchors.rightMargin: 16 + anchors.top: parent.top + anchors.topMargin: 59 Text { - id: title - x: 772 - text: qsTr("Chat") - anchors.top: parent.top - anchors.topMargin: 17 - font.bold: true + id: addChatLbl + color: "#ffffff" + text: qsTr("+") + anchors.verticalCenterOffset: -1 + anchors.horizontalCenterOffset: 1 anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: 17 + anchors.verticalCenter: parent.verticalCenter + lineHeight: 1 + fontSizeMode: Text.FixedSize + font.bold: true + font.pixelSize: 28 + state: "default" + rotation: 0 + states: [ + State { + name: "default" + PropertyChanges { + target: addChatLbl + rotation: 0 + } + }, + State { + name: "rotated" + PropertyChanges { + target: addChatLbl + rotation: 45 + } + } + ] + + transitions: [ + Transition { + from: "default" + to: "rotated" + RotationAnimation { + duration: 150 + direction: RotationAnimation.Clockwise + easing.type: Easing.InCubic + } + }, + Transition { + from: "rotated" + to: "default" + RotationAnimation { + duration: 150 + direction: RotationAnimation.Counterclockwise + easing.type: Easing.OutCubic + } + } + ] } - Rectangle { - id: searchBox - height: 36 - color: Theme.grey - anchors.top: parent.top - anchors.topMargin: 59 - radius: 8 - anchors.right: parent.right - anchors.rightMargin: 65 - anchors.left: parent.left - anchors.leftMargin: 16 + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + addChatLbl.state = "rotated" + let x = addChatLbl.x + addChatLbl.width / 2 - newChatMenu.width / 2 + newChatMenu.popup(x, addChatLbl.height + 10) + } - TextField { - id: searchText - placeholderText: qsTr("Search or join channel") - anchors.left: parent.left - anchors.leftMargin: 32 - anchors.verticalCenter: parent.verticalCenter - font.pixelSize: 12 - background: Rectangle { - color: "#00000000" + QQC2.Menu { + id: newChatMenu + QQC2.Action { + text: qsTr("Start new chat") + icon.source: "../../img/new_chat.svg" + onTriggered: { + console.log("TODO: Start new chat") + } } - } - - Image { - id: image4 - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.verticalCenter: parent.verticalCenter - fillMode: Image.PreserveAspectFit - source: "../../img/search.svg" - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: { - searchText.forceActiveFocus(Qt.MouseFocusReason) + QQC2.Action { + text: qsTr("Start group chat") + icon.source: "../../img/group_chat.svg" + onTriggered: { + console.log("TODO: Start group chat") + } } - } - } - - Rectangle { - id: addChat - width: 36 - height: 36 - color: Theme.blue - radius: 50 - anchors.right: parent.right - anchors.rightMargin: 16 - anchors.top: parent.top - anchors.topMargin: 59 - - Text { - id: addChatLbl - color: "#ffffff" - text: qsTr("+") - anchors.verticalCenterOffset: -1 - anchors.horizontalCenterOffset: 1 - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - lineHeight: 1 - fontSizeMode: Text.FixedSize - font.bold: true - font.pixelSize: 28 - state: "default" - rotation: 0 - states: [ - State { - name: "default" - PropertyChanges { - target: addChatLbl - rotation: 0 - } - }, - State { - name: "rotated" - PropertyChanges { - target: addChatLbl - rotation: 45 - } + QQC2.Action { + text: qsTr("Join public chat") + icon.source: "../../img/public_chat.svg" + onTriggered: { + chatGroupsListView.currentIndex = chatsModel.joinChat( + searchText.text) + searchText.text = "" } - ] - - transitions: [ - Transition { - from: "default" - to: "rotated" - RotationAnimation { - duration: 150 - direction: RotationAnimation.Clockwise - easing.type: Easing.InCubic - } - }, - Transition { - from: "rotated" - to: "default" - RotationAnimation { - duration: 150 - direction: RotationAnimation.Counterclockwise - easing.type: Easing.OutCubic - } - } - ] - } - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - addChatLbl.state = "rotated" - let x = addChatLbl.x + addChatLbl.width / 2 - newChatMenu.width / 2 - newChatMenu.popup(x, addChatLbl.height + 10) } + onAboutToHide: { + addChatLbl.state = "default" + } + topPadding: 16 + bottomPadding: 16 - QQC2.Menu { - id: newChatMenu - QQC2.Action { - text: qsTr("Start new chat") - icon.source: "../../img/new_chat.svg" - onTriggered: { - console.log("TODO: Start new chat") - } - } - QQC2.Action { - text: qsTr("Start group chat") - icon.source: "../../img/group_chat.svg" - onTriggered: { - console.log("TODO: Start group chat") - } - } - QQC2.Action { - text: qsTr("Join public chat") - icon.source: "../../img/public_chat.svg" - onTriggered: { - chatGroupsListView.currentIndex = chatsModel.joinChat( - searchText.text) - searchText.text = "" - } - } - onAboutToHide: { - addChatLbl.state = "default" - } - topPadding: 16 - bottomPadding: 16 - - delegate: QQC2.MenuItem { - id: addChatMenuItem - implicitWidth: 200 - implicitHeight: 40 - font.pixelSize: 15 - icon.color: addChatMenuItem.highlighted ? "white" : Theme.blue - background: Rectangle { - implicitWidth: 220 - implicitHeight: 40 - color: addChatMenuItem.highlighted ? Theme.blue : "transparent" - } - } - + delegate: QQC2.MenuItem { + id: addChatMenuItem + implicitWidth: 200 + implicitHeight: 40 + font.pixelSize: 15 + icon.color: addChatMenuItem.highlighted ? "white" : Theme.blue background: Rectangle { - id: bgAddItemMenu implicitWidth: 220 - implicitHeight: 172 - color: "transparent" + implicitHeight: 40 + color: addChatMenuItem.highlighted ? Theme.blue : "transparent" + } + } - Rectangle { - id: bgAddItemMenuArrow - color: Theme.white2 - height: 14 - width: 14 - rotation: 135 - x: bgAddItemMenu.width / 2 - width / 2 - layer.enabled: true - layer.effect: DropShadow { - width: bgAddItemMenuArrow.width - height: bgAddItemMenuArrow.height - x: bgAddItemMenuArrow.x - y: bgAddItemMenuArrow.y + 10 - visible: bgAddItemMenuArrow.visible - source: bgAddItemMenuArrow - horizontalOffset: 0 - verticalOffset: 5 - radius: 10 - samples: 15 - color: "#22000000" - } + background: Rectangle { + id: bgAddItemMenu + implicitWidth: 220 + implicitHeight: 172 + color: "transparent" + + Rectangle { + id: bgAddItemMenuArrow + color: Theme.white2 + height: 14 + width: 14 + rotation: 135 + x: bgAddItemMenu.width / 2 - width / 2 + layer.enabled: true + layer.effect: DropShadow { + width: bgAddItemMenuArrow.width + height: bgAddItemMenuArrow.height + x: bgAddItemMenuArrow.x + y: bgAddItemMenuArrow.y + 10 + visible: bgAddItemMenuArrow.visible + source: bgAddItemMenuArrow + horizontalOffset: 0 + verticalOffset: 5 + radius: 10 + samples: 15 + color: "#22000000" } + } - Rectangle { - id: bgAddItemMenu2 - y: 7 - implicitWidth: 220 - implicitHeight: 152 - color: Theme.white2 - radius: 16 - layer.enabled: true - layer.effect: DropShadow { - width: bgAddItemMenu2.width - height: bgAddItemMenu2.height - x: bgAddItemMenu2.x - y: bgAddItemMenu2.y + 10 - visible: bgAddItemMenu2.visible - source: bgAddItemMenu2 - horizontalOffset: 0 - verticalOffset: 7 - radius: 10 - samples: 15 - color: "#22000000" - } + Rectangle { + id: bgAddItemMenu2 + y: 7 + implicitWidth: 220 + implicitHeight: 152 + color: Theme.white2 + radius: 16 + layer.enabled: true + layer.effect: DropShadow { + width: bgAddItemMenu2.width + height: bgAddItemMenu2.height + x: bgAddItemMenu2.x + y: bgAddItemMenu2.y + 10 + visible: bgAddItemMenu2.visible + source: bgAddItemMenu2 + horizontalOffset: 0 + verticalOffset: 7 + radius: 10 + samples: 15 + color: "#22000000" } } } @@ -248,8 +244,15 @@ Item { } StackLayout { - Layout.fillHeight: true - Layout.fillWidth: true + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.top: searchBox.bottom + anchors.topMargin: 16 + currentIndex: chatGroupsListView.count > 0 ? 1 : 0 Item { @@ -321,120 +324,121 @@ Item { } } } - } - Item { - id: chatGroupsContainer - Layout.fillWidth: true - Layout.fillHeight: true + Item { + id: chatGroupsContainer + Layout.fillHeight: true + Layout.fillWidth: true - Component { - id: chatViewDelegate - - Rectangle { - id: wrapper - color: ListView.isCurrentItem ? Theme.lightBlue : Theme.transparent - anchors.right: parent.right - anchors.rightMargin: Theme.padding - anchors.top: applicationWindow.top - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: Theme.padding - radius: 8 - // Hide the box if it is filtered out - property bool isVisible: searchStr == "" || name.includes(searchStr) - visible: isVisible ? true : false - height: isVisible ? 64 : 0 - - MouseArea { - cursorShape: Qt.PointingHandCursor - anchors.fill: parent - onClicked: { - chatsModel.setActiveChannelByIndex(index) - chatGroupsListView.currentIndex = index - } - } + Component { + id: chatViewDelegate Rectangle { - id: contactImage - width: 40 - color: Theme.darkGrey + id: wrapper + color: ListView.isCurrentItem ? Theme.lightBlue : Theme.transparent + anchors.right: parent.right + anchors.rightMargin: Theme.padding + anchors.top: applicationWindow.top + anchors.topMargin: 0 anchors.left: parent.left anchors.leftMargin: Theme.padding - anchors.top: parent.top - anchors.topMargin: 12 - anchors.bottom: parent.bottom - anchors.bottomMargin: 12 - radius: 50 - } + radius: 8 + // Hide the box if it is filtered out + property bool isVisible: searchStr == "" || name.includes(searchStr) + visible: isVisible ? true : false + height: isVisible ? 64 : 0 + + MouseArea { + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + onClicked: { + chatsModel.setActiveChannelByIndex(index) + chatGroupsListView.currentIndex = index + } + } + + Rectangle { + id: contactImage + width: 40 + color: Theme.darkGrey + anchors.left: parent.left + anchors.leftMargin: Theme.padding + anchors.top: parent.top + anchors.topMargin: 12 + anchors.bottom: parent.bottom + anchors.bottomMargin: 12 + radius: 50 + } - Text { - id: contactInfo - text: name - anchors.right: contactTime.left - anchors.rightMargin: Theme.smallPadding - elide: Text.ElideRight - font.weight: Font.Medium - font.pixelSize: 15 - anchors.left: contactImage.right - anchors.leftMargin: Theme.padding - anchors.top: parent.top - anchors.topMargin: Theme.smallPadding - color: "black" - } - Text { - id: lastChatMessage - text: lastMessage || qsTr("No messages") - anchors.right: contactNumberChatsCircle.left - anchors.rightMargin: Theme.smallPadding - elide: Text.ElideRight - anchors.bottom: parent.bottom - anchors.bottomMargin: Theme.smallPadding - font.pixelSize: 15 - anchors.left: contactImage.right - anchors.leftMargin: Theme.padding - color: Theme.darkGrey - } - Text { - id: contactTime - text: timestamp - anchors.right: parent.right - anchors.rightMargin: Theme.padding - anchors.top: parent.top - anchors.topMargin: Theme.smallPadding - font.pixelSize: 11 - color: Theme.darkGrey - } - Rectangle { - id: contactNumberChatsCircle - width: 22 - height: 22 - radius: 50 - anchors.bottom: parent.bottom - anchors.bottomMargin: Theme.smallPadding - anchors.right: parent.right - anchors.rightMargin: Theme.padding - color: Theme.blue - visible: unviewedMessagesCount > 0 Text { - id: contactNumberChats - text: unviewedMessagesCount - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - color: "white" + id: contactInfo + text: name + anchors.right: contactTime.left + anchors.rightMargin: Theme.smallPadding + elide: Text.ElideRight + font.weight: Font.Medium + font.pixelSize: 15 + anchors.left: contactImage.right + anchors.leftMargin: Theme.padding + anchors.top: parent.top + anchors.topMargin: Theme.smallPadding + color: "black" + } + Text { + id: lastChatMessage + text: lastMessage || qsTr("No messages") + anchors.right: contactNumberChatsCircle.left + anchors.rightMargin: Theme.smallPadding + elide: Text.ElideRight + anchors.bottom: parent.bottom + anchors.bottomMargin: Theme.smallPadding + font.pixelSize: 15 + anchors.left: contactImage.right + anchors.leftMargin: Theme.padding + color: Theme.darkGrey + } + Text { + id: contactTime + text: timestamp + anchors.right: parent.right + anchors.rightMargin: Theme.padding + anchors.top: parent.top + anchors.topMargin: Theme.smallPadding + font.pixelSize: 11 + color: Theme.darkGrey + } + Rectangle { + id: contactNumberChatsCircle + width: 22 + height: 22 + radius: 50 + anchors.bottom: parent.bottom + anchors.bottomMargin: Theme.smallPadding + anchors.right: parent.right + anchors.rightMargin: Theme.padding + color: Theme.blue + visible: unviewedMessagesCount > 0 + Text { + id: contactNumberChats + text: unviewedMessagesCount + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: "white" + } } } } - } - ListView { - id: chatGroupsListView - anchors.topMargin: 24 - anchors.fill: parent - model: chatsModel.chats - delegate: chatViewDelegate + ListView { + id: chatGroupsListView + anchors.topMargin: 24 + anchors.fill: parent + model: chatsModel.chats + delegate: chatViewDelegate + } } } + } /*##^## diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index 650a2eb2e0..31a7f56d84 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -99,7 +99,7 @@ Item { ListView { id: contactListView anchors.topMargin: 48 - anchors.top: element4.bottom + anchors.top: element2.bottom anchors.fill: parent model: profileModel.contactList delegate: contactsList diff --git a/ui/app/AppLayouts/Wallet/LeftTab.qml b/ui/app/AppLayouts/Wallet/LeftTab.qml index 94fa9122d4..3bf9d5f09d 100644 --- a/ui/app/AppLayouts/Wallet/LeftTab.qml +++ b/ui/app/AppLayouts/Wallet/LeftTab.qml @@ -6,10 +6,9 @@ import Qt.labs.platform 1.1 import "../../../imports" import "../../../shared" -Column { +Item { id: walletInfoContainer width: 340 - spacing: 0 Text { id: title