From eb7b9c2383568b069fa8090e3ad74f491a72e8fa Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 23 Sep 2020 14:01:33 -0400 Subject: [PATCH] chore: fix qml warnings in a couple of components --- .../Chat/components/RenameGroupPopup.qml | 76 ++++++------------- .../Profile/Sections/BackupSeedModal.qml | 2 +- .../Profile/Sections/ContactsContainer.qml | 4 - .../Profile/Sections/SoundsContainer.qml | 18 +++-- ui/nim-status-client.pro | 1 + ui/shared/GasValidator.qml | 2 +- ui/shared/ModalPopup.qml | 4 +- 7 files changed, 41 insertions(+), 66 deletions(-) diff --git a/ui/app/AppLayouts/Chat/components/RenameGroupPopup.qml b/ui/app/AppLayouts/Chat/components/RenameGroupPopup.qml index 58a66b9a34..c7f585e31d 100644 --- a/ui/app/AppLayouts/Chat/components/RenameGroupPopup.qml +++ b/ui/app/AppLayouts/Chat/components/RenameGroupPopup.qml @@ -5,72 +5,42 @@ import "../../../../imports" import "../../../../shared" import "./" -Popup { +ModalPopup { function doRename(){ chatsModel.renameGroup(groupName.text) popup.close(); } id: popup - modal: true + height: 210 - Overlay.modal: Rectangle { - color: "#60000000" - } + //% "Group name" + title: qsTrId("group-name") onOpened: { groupName.forceActiveFocus(Qt.MouseFocusReason) groupName.text = chatsModel.activeChannel.name } - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - parent: Overlay.overlay - x: Math.round((parent.width - width) / 2) - y: Math.round((parent.height - height) / 2) - width: 480 - height: 159 - background: Rectangle { - color: Style.current.white - radius: 8 + Input { + id: groupName + anchors.left: parent.left + anchors.leftMargin: Style.current.padding + anchors.right: parent.right + anchors.rightMargin: Style.current.padding + //% "Group name" + placeholderText: qsTrId("group-name") + Keys.onEnterPressed: doRename() + Keys.onReturnPressed: doRename() } - padding: 0 - contentItem: Item { - StyledText { - id: groupTitleLabel - //% "Group name" - text: qsTrId("group-name") - anchors.top: parent.top - anchors.left: parent.left - font.pixelSize: 13 - anchors.leftMargin: 16 - anchors.topMargin: Style.current.padding - anchors.bottomMargin: Style.current.padding - } - - Input { - id: groupName - anchors.top: groupTitleLabel.bottom - anchors.topMargin: 7 - anchors.left: parent.left - anchors.leftMargin: Style.current.padding - anchors.right: parent.right - anchors.rightMargin: Style.current.padding - //% "Group name" - placeholderText: qsTrId("group-name") - Keys.onEnterPressed: doRename() - Keys.onReturnPressed: doRename() - } - - StyledButton { - id: saveBtn - anchors.top: groupName.bottom - anchors.topMargin: 22 - anchors.right: parent.right - anchors.rightMargin: Style.current.padding - //% "Save" - label: qsTrId("save") - onClicked : doRename() - } - } + footer: StyledButton { + id: saveBtn + height: 44 + anchors.bottom: parent.bottom + anchors.right: parent.right + //% "Save" + label: qsTrId("save") + onClicked : doRename() + } } diff --git a/ui/app/AppLayouts/Profile/Sections/BackupSeedModal.qml b/ui/app/AppLayouts/Profile/Sections/BackupSeedModal.qml index 6cddbdb746..7136d48d6c 100644 --- a/ui/app/AppLayouts/Profile/Sections/BackupSeedModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/BackupSeedModal.qml @@ -13,7 +13,7 @@ ModalPopup { Loader { active: popup.opened width: parent.width - height: item.height + height: item ? item.height : 0 sourceComponent: Component { id: seedComponent diff --git a/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml b/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml index acd540a3b5..b7ea316e23 100644 --- a/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/ContactsContainer.qml @@ -168,8 +168,6 @@ Item { StyledText { - anchors.top: addContactSearchInput.bottom - anchors.topMargin: Style.current.padding anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 12 color: Style.current.darkGrey @@ -181,8 +179,6 @@ Item { StyledText { id: contactUsername text: profileModel.contactToAddUsername + " • " - anchors.top: addContactSearchInput.bottom - anchors.topMargin: Style.current.padding font.pixelSize: 12 color: Style.current.darkGrey visible: !!profileModel.contactToAddPubKey diff --git a/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml b/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml index 1049d1c4d4..06bdc3347c 100644 --- a/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml @@ -7,10 +7,8 @@ import "../../../../shared/status" Item { id: soundsContainer - anchors.right: parent.right - anchors.rightMargin: contentMargin - anchors.left: parent.left - anchors.leftMargin: contentMargin + Layout.fillHeight: true + Layout.fillWidth: true StyledText { id: element5 @@ -28,7 +26,9 @@ Item { id: labelVolume anchors.top: element5.bottom anchors.topMargin: Style.current.bigPadding - text: qsTrId("Sound volume") + " " + volume.value + anchors.left: parent.left + anchors.leftMargin: 24 + text: qsTr("Sound volume") + " " + volume.value font.pixelSize: 15 } @@ -36,6 +36,8 @@ Item { id: volume anchors.top: labelVolume.bottom anchors.topMargin: Style.current.padding + anchors.left: parent.left + anchors.leftMargin: 24 minimumValue: 0.0 maximumValue: 1.0 value: appSettings.volume @@ -46,3 +48,9 @@ Item { } } + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/ diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index fa4a6a2bb3..9d05681b1b 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -350,6 +350,7 @@ DISTFILES += \ shared/AssetAndAmountInput.qml \ shared/CopyToClipBoardButton.qml \ shared/GasSelector.qml \ + shared/GasValidator.qml \ shared/RoundedImage.qml \ shared/SearchBox.qml \ shared/Select.qml \ diff --git a/ui/shared/GasValidator.qml b/ui/shared/GasValidator.qml index 43a581beac..dd6f93bf3f 100644 --- a/ui/shared/GasValidator.qml +++ b/ui/shared/GasValidator.qml @@ -42,7 +42,7 @@ Item { gasTotal += selectedAmount } const currAcctGasAsset = Utils.findAssetBySymbol(selectedAccount.assets, "ETH") - if (currAcctGasAsset.value < gasTotal) { + if (currAcctGasAsset && currAcctGasAsset.value < gasTotal) { isValid = false txtValidationError.text = notEnoughEthForGasMessage } diff --git a/ui/shared/ModalPopup.qml b/ui/shared/ModalPopup.qml index 440d7bf805..22538a4c29 100644 --- a/ui/shared/ModalPopup.qml +++ b/ui/shared/ModalPopup.qml @@ -19,8 +19,8 @@ Popup { } closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside parent: Overlay.overlay - x: Math.round((parent.width - width) / 2) - y: Math.round((parent.height - height) / 2) + x: Math.round(((parent ? parent.width : 0) - width) / 2) + y: Math.round(((parent ? parent.height : 0) - height) / 2) width: 480 height: 510 // TODO find a way to make this dynamic background: Rectangle {