From be7a56cc277942c27171f976637563ea7c362705 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Thu, 21 Oct 2021 00:47:23 +0200 Subject: [PATCH] refactor: replace all the StatusImageIdenticon with StatusQ's StatusSmartIdenticon closes #3848 --- ui/app/AppLayouts/Chat/controls/Contact.qml | 7 +++++-- .../Chat/panels/ContactRequestPanel.qml | 8 +++++--- .../Chat/panels/MessageContextMenuPanel.qml | 8 +++++--- .../Chat/panels/SuggestionBoxPanel.qml | 13 +++++++----- .../AppLayouts/Chat/popups/GroupInfoPopup.qml | 5 +++-- .../controls/AccountViewDelegate.qml | 7 +++++-- .../popups/MnemonicRecoverySuccessModal.qml | 10 ++++++---- .../AppLayouts/Onboarding/views/LoginView.qml | 7 +++++-- .../Profile/panels/ContactPanel.qml | 7 +++++-- ui/shared/controls/ContactSelector.qml | 20 ++++++++++--------- ui/shared/popups/UserStatusContextMenu.qml | 9 +++++---- ui/shared/status/StatusChatInput.qml | 6 ++++-- ui/shared/status/StatusImageIdenticon.qml | 16 --------------- ui/shared/status/qmldir | 1 - ui/shared/views/SearchResults.qml | 7 +++++-- ui/shared/views/TransactionPreview.qml | 8 +++++--- 16 files changed, 77 insertions(+), 62 deletions(-) delete mode 100644 ui/shared/status/StatusImageIdenticon.qml diff --git a/ui/app/AppLayouts/Chat/controls/Contact.qml b/ui/app/AppLayouts/Chat/controls/Contact.qml index 69b1e32f28..ccc1aa2ef4 100644 --- a/ui/app/AppLayouts/Chat/controls/Contact.qml +++ b/ui/app/AppLayouts/Chat/controls/Contact.qml @@ -6,6 +6,8 @@ import Qt.labs.platform 1.1 import utils 1.0 import StatusQ.Controls 0.1 as StatusQControls +import StatusQ.Components 0.1 + import "../../../../shared/panels" import "../../../../shared/status" @@ -36,12 +38,13 @@ Rectangle { radius: Style.current.radius color: isHovered ? Style.current.backgroundHover : Style.current.transparent - StatusImageIdenticon { + StatusSmartIdenticon { id: accountImage anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter - source: identicon anchors.leftMargin: Style.current.padding + image.source: identicon + image.isIdenticon: true } StyledText { diff --git a/ui/app/AppLayouts/Chat/panels/ContactRequestPanel.qml b/ui/app/AppLayouts/Chat/panels/ContactRequestPanel.qml index 5e227f711a..cff19b8502 100644 --- a/ui/app/AppLayouts/Chat/panels/ContactRequestPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/ContactRequestPanel.qml @@ -5,7 +5,8 @@ import QtQuick.Layouts 1.13 import utils 1.0 import "../../../../shared" import "../../../../shared/panels" -import "../../../../shared/status" + +import StatusQ.Components 0.1 Rectangle { property string name @@ -26,12 +27,13 @@ Rectangle { radius: Style.current.radius color: isHovered ? Style.current.backgroundHover : Style.current.transparent - StatusImageIdenticon { + StatusSmartIdenticon { id: accountImage anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.verticalCenter: parent.verticalCenter - source: identicon + image.source: identicon + image.isIdenticon: true } StyledText { diff --git a/ui/app/AppLayouts/Chat/panels/MessageContextMenuPanel.qml b/ui/app/AppLayouts/Chat/panels/MessageContextMenuPanel.qml index 4d4662e8b9..5346d90b71 100644 --- a/ui/app/AppLayouts/Chat/panels/MessageContextMenuPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/MessageContextMenuPanel.qml @@ -5,7 +5,7 @@ import QtQml.Models 2.3 import QtQuick.Dialogs 1.0 import StatusQ.Popups 0.1 - +import StatusQ.Components 0.1 import utils 1.0 import "../../../../shared" @@ -116,12 +116,14 @@ StatusPopupMenu { visible: mouseArea.containsMouse color: Style.current.backgroundHover } - StatusImageIdenticon { + + StatusSmartIdenticon { id: profileImage - source: identicon anchors.top: parent.top anchors.topMargin: 4 anchors.horizontalCenter: parent.horizontalCenter + image.source: identicon + image.isIdenticon: true } StyledText { diff --git a/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml b/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml index 3f5cfe93d2..485ef5f3d3 100644 --- a/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/SuggestionBoxPanel.qml @@ -23,10 +23,12 @@ import QtGraphicalEffects 1.13 import QtQml.Models 2.13 import utils 1.0 + +import StatusQ.Components 0.1 + import "../../../../shared" import "../../../../shared/panels" import "../../../../shared/controls" -import "../../../../shared/status" Rectangle { id: container @@ -184,14 +186,15 @@ Rectangle { height: 42 radius: Style.current.radius - StatusImageIdenticon { + StatusSmartIdenticon { id: accountImage - width: 32 - height: 32 anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: Style.current.smallPadding - source: model.identicon + image.width: 32 + image.height: 32 + image.source: model.identicon + image.isIdenticon: true } StyledText { diff --git a/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml b/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml index f50bab4f9b..34e822617d 100644 --- a/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/GroupInfoPopup.qml @@ -289,10 +289,11 @@ ModalPopup { property string nickname: appMain.getUserNickname(model.publicKey) - StatusImageIdenticon { + StatusQ.StatusSmartIdenticon { id: identicon anchors.left: parent.left - source: appMain.getProfileImage(model.publicKey) || model.identicon + image.source: appMain.getProfileImage(model.publicKey)|| model.identicon + image.isIdenticon: true } StyledText { diff --git a/ui/app/AppLayouts/Onboarding/controls/AccountViewDelegate.qml b/ui/app/AppLayouts/Onboarding/controls/AccountViewDelegate.qml index 48167da693..2b7a365497 100644 --- a/ui/app/AppLayouts/Onboarding/controls/AccountViewDelegate.qml +++ b/ui/app/AppLayouts/Onboarding/controls/AccountViewDelegate.qml @@ -8,6 +8,7 @@ import "../../../../shared/panels" import "../../../../shared/status" import StatusQ.Controls 0.1 as StatusQControls +import StatusQ.Components 0.1 Rectangle { id: accountViewDelegate @@ -36,13 +37,15 @@ Rectangle { return Style.current.transparent } - StatusImageIdenticon { + StatusSmartIdenticon { id: accountImage anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.verticalCenter: parent.verticalCenter - source: identicon + image.source : identicon + image.isIdenticon: true } + StyledText { id: usernameText text: username diff --git a/ui/app/AppLayouts/Onboarding/popups/MnemonicRecoverySuccessModal.qml b/ui/app/AppLayouts/Onboarding/popups/MnemonicRecoverySuccessModal.qml index 6dd0a2dbff..dd7dd4a929 100644 --- a/ui/app/AppLayouts/Onboarding/popups/MnemonicRecoverySuccessModal.qml +++ b/ui/app/AppLayouts/Onboarding/popups/MnemonicRecoverySuccessModal.qml @@ -11,6 +11,8 @@ import "../../../../shared/panels" import "../../../../shared/popups" import "../stores" +import StatusQ.Components 0.1 + // TODO: replace with StatusModal ModalPopup { id: popup @@ -36,14 +38,14 @@ ModalPopup { horizontalAlignment: Text.AlignHCenter } - StatusImageIdenticon { + StatusSmartIdenticon { id: identicon - source: OnboardingStore.currentAccount.identicon anchors.top: info.bottom anchors.topMargin: Style.current.bigPadding anchors.horizontalCenter: parent.horizontalCenter - width: 60 - height: 60 + image.source: OnboardingStore.currentAccount.identicon + image.width: 60 + image.height: 60 } StyledText { diff --git a/ui/app/AppLayouts/Onboarding/views/LoginView.qml b/ui/app/AppLayouts/Onboarding/views/LoginView.qml index fa3a9c7e2f..27fe3d2e24 100644 --- a/ui/app/AppLayouts/Onboarding/views/LoginView.qml +++ b/ui/app/AppLayouts/Onboarding/views/LoginView.qml @@ -13,6 +13,8 @@ import "../../../../shared/status" import "../popups" import "../stores" +import StatusQ.Components 0.1 + import utils 1.0 Item { @@ -94,10 +96,11 @@ Item { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - StatusImageIdenticon { + StatusSmartIdenticon { id: userImage anchors.horizontalCenter: parent.horizontalCenter - source: LoginStore.currentAccount.thumbnailImage + image.source : LoginStore.currentAccount.thumbnailImage + image.isIdenticon: true } StyledText { diff --git a/ui/app/AppLayouts/Profile/panels/ContactPanel.qml b/ui/app/AppLayouts/Profile/panels/ContactPanel.qml index a2ebf543c5..13dee4c0a6 100644 --- a/ui/app/AppLayouts/Profile/panels/ContactPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ContactPanel.qml @@ -8,6 +8,8 @@ import "../../../../shared/popups" import "../../../../shared/panels" import "../../../../shared/status" +import StatusQ.Components 0.1 + Rectangle { property string name: "Jotaro Kujo" property string address: "0x04d8c07dd137bd1b73a6f51df148b4f77ddaa11209d36e43d8344c0a7d6db1cad6085f27cfb75dd3ae21d86ceffebe4cf8a35b9ce8d26baa19dc264efe6d8f221b" @@ -35,12 +37,13 @@ Rectangle { radius: Style.current.radius color: isHovered ? Style.current.backgroundHover : Style.current.transparent - StatusImageIdenticon { + StatusSmartIdenticon { id: accountImage anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.verticalCenter: parent.verticalCenter - source: identicon + image.source: identicon + image.isIdenticon: true } StyledText { diff --git a/ui/shared/controls/ContactSelector.qml b/ui/shared/controls/ContactSelector.qml index 3c443ec65a..3057c1b047 100644 --- a/ui/shared/controls/ContactSelector.qml +++ b/ui/shared/controls/ContactSelector.qml @@ -7,9 +7,10 @@ import utils 1.0 import "../" import "../views" import "../panels" -import "../status" import "." +import StatusQ.Components 0.1 + Item { id: root property var contacts @@ -91,17 +92,17 @@ Item { menuAlignment: Select.MenuAlignment.Left selectedItemView: Item { anchors.fill: parent - StatusImageIdenticon { + StatusSmartIdenticon { id: iconImg anchors.left: parent.left anchors.leftMargin: 14 anchors.verticalCenter: parent.verticalCenter - height: 32 - width: (!!selectedContact && !!selectedContact.identicon) ? 32 : 0 - visible: !!selectedContact && !!selectedContact.identicon - source: (!!selectedContact && !!selectedContact.identicon) ? selectedContact.identicon : "" + image.width: (!!selectedContact && !!selectedContact.identicon) ? 32 : 0 + image.height: 32 + image.source: (!!selectedContact && !!selectedContact.identicon) ? selectedContact.identicon : "" + image.isIdenticon: true + active: !!selectedContact && !!selectedContact.identicon } - StyledText { id: selectedTextField text: !!selectedContact ? selectedContact.name : "" @@ -159,12 +160,13 @@ Item { width: parent.width height: visible ? 72 : 0 - StatusImageIdenticon { + StatusSmartIdenticon { id: iconImg anchors.left: parent.left anchors.leftMargin: Style.current.padding anchors.verticalCenter: parent.verticalCenter - source: identicon + image.source: identicon + image.isIdenticon: true } Column { anchors.left: iconImg.right diff --git a/ui/shared/popups/UserStatusContextMenu.qml b/ui/shared/popups/UserStatusContextMenu.qml index e9ad51620a..7f987372f0 100644 --- a/ui/shared/popups/UserStatusContextMenu.qml +++ b/ui/shared/popups/UserStatusContextMenu.qml @@ -4,10 +4,11 @@ import QtQuick.Layouts 1.3 import QtQml.Models 2.3 import utils 1.0 -import "../status" import "../panels" import "." +import StatusQ.Components 0.1 + // TODO: replace with StatusPopupMenu PopupMenu { id: root @@ -23,14 +24,14 @@ PopupMenu { visible: mouseArea.containsMouse color: Style.current.backgroundHover } - StatusImageIdenticon { + StatusSmartIdenticon { id: profileImage - source: profileModel.profile.thumbnailImage || "" anchors.top: parent.top anchors.topMargin: 4 anchors.horizontalCenter: parent.horizontalCenter + image.source: profileModel.profile.thumbnailImage || "" + image.isIdenticon: true } - StyledText { id: username text: Utils.removeStatusEns(profileModel.ens.preferredUsername || profileModel.profile.username) diff --git a/ui/shared/status/StatusChatInput.qml b/ui/shared/status/StatusChatInput.qml index 33f4bcda94..244dea0300 100644 --- a/ui/shared/status/StatusChatInput.qml +++ b/ui/shared/status/StatusChatInput.qml @@ -15,6 +15,7 @@ import "../../app/AppLayouts/Chat/panels" import "./emojiList.js" as EmojiJSON import StatusQ.Core.Theme 0.1 +import StatusQ.Components 0.1 import StatusQ.Controls 0.1 as StatusQ Rectangle { @@ -851,13 +852,14 @@ Rectangle { } } - StatusImageIdenticon { + StatusSmartIdenticon { id: profileImage - source: profileModel.profile.thumbnailImage || profileModel.profile.identicon anchors.left: parent.left anchors.leftMargin: Style.current.smallPadding anchors.top: parent.top anchors.topMargin: Style.current.halfPadding + image.source: profileModel.profile.thumbnailImage || profileModel.profile.identicon + image.isIdenticon: true visible: control.isStatusUpdateInput } diff --git a/ui/shared/status/StatusImageIdenticon.qml b/ui/shared/status/StatusImageIdenticon.qml deleted file mode 100644 index 6bd6f53bd3..0000000000 --- a/ui/shared/status/StatusImageIdenticon.qml +++ /dev/null @@ -1,16 +0,0 @@ -import QtQuick 2.13 - -import utils 1.0 -import "../panels" - -RoundedImage { - id: root - noHover: true - source:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAg0lEQVR4nOzXwQmAMBAFURV7sQybsgybsgyr0QYUlE1g+Mw7ioQMe9lMQwhDaAyhMYTGEJqYkPnrj/t5XE/ft2UdW1yken7MRAyhMYTGEBpDaAyhKe9JbzvSX9WdLWYihtAYQuMLkcYQGkPUScxEDKExhMYQGkNoDKExhMYQmjsAAP//ZfIUZgXTZXQAAAAASUVORK5CYII=" - width: 40 - height: 40 - border.width: 1 - border.color: Style.current.borderSecondary - smooth: false - antialiasing: true -} diff --git a/ui/shared/status/qmldir b/ui/shared/status/qmldir index 3bb138f4cf..71d8836733 100644 --- a/ui/shared/status/qmldir +++ b/ui/shared/status/qmldir @@ -6,7 +6,6 @@ StatusEmojiPopup 1.0 StatusEmojiPopup.qml StatusEmojiSection 1.0 StatusEmojiSection.qml StatusGifPopup 1.0 StatusGifPopup.qml StatusGifColumn 1.0 StatusGifColumn.qml -StatusImageIdenticon 1.0 StatusImageIdenticon.qml StatusSectionHeadline 1.0 StatusSectionHeadline.qml StatusStickerButton 1.0 StatusStickerButton.qml StatusStickerList 1.0 StatusStickerList.qml diff --git a/ui/shared/views/SearchResults.qml b/ui/shared/views/SearchResults.qml index 57468e5e2b..de55ca1e9f 100644 --- a/ui/shared/views/SearchResults.qml +++ b/ui/shared/views/SearchResults.qml @@ -13,6 +13,8 @@ import "../panels" import "../../app/AppLayouts/Chat/controls" import "./" +import StatusQ.Components 0.1 + Item { id: root height: 64 @@ -73,12 +75,13 @@ Item { height: 64 visible: root.pubKey !== "" && !root.loading - StatusImageIdenticon { + StatusSmartIdenticon { id: contactIdenticon anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: Style.current.padding - source: utilsModel.generateIdenticon(root.pubKey) + image.source: utilsModel.generateIdenticon(root.pubKey) + image.isIdenticon: true } StyledText { diff --git a/ui/shared/views/TransactionPreview.qml b/ui/shared/views/TransactionPreview.qml index c8236b6a69..38bb8dee38 100644 --- a/ui/shared/views/TransactionPreview.qml +++ b/ui/shared/views/TransactionPreview.qml @@ -11,6 +11,8 @@ import "../panels" import "../controls" import "../popups" +import StatusQ.Components 0.1 + Item { id: root property var fromAccount @@ -253,14 +255,14 @@ Item { visible: false source: imgToWallet } - StatusImageIdenticon { + StatusSmartIdenticon { id: idtToContact visible: false anchors.right: toInvalid.visible ? toInvalid.left : parent.right anchors.rightMargin: toInvalid.visible ? Style.current.halfPadding : 0 anchors.verticalCenter: parent.verticalCenter - width: 32 - height: 32 + image.width: 32 + image.height: 32 } SVGImage { id: toInvalid