From b59e4c0b93f0839438376c9d5663ff0ed886043d Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Thu, 14 Oct 2021 22:30:51 +0200 Subject: [PATCH] refactor: remove StatusToolTip.qml from ui/shared/status Updated path to use StatusQ StatusToolTip. closes #3819 --- .../Chat/panels/ChatButtonsPanel.qml | 11 +-- .../Chat/panels/EmojiReactionsPanel.qml | 7 +- .../ActivityCenterMessageComponentView.qml | 8 ++- ui/app/AppLayouts/Chat/views/ChatTimeView.qml | 5 +- ui/shared/controls/AccountSelector.qml | 5 +- ui/shared/controls/CopyToClipBoardButton.qml | 7 +- ui/shared/status/StatusTextFormatMenu.qml | 4 +- ui/shared/status/StatusToolTip.qml | 69 ------------------- ui/shared/views/TransactionPreview.qml | 4 +- ui/shared/views/TransactionSigner.qml | 6 +- 10 files changed, 35 insertions(+), 91 deletions(-) delete mode 100644 ui/shared/status/StatusToolTip.qml diff --git a/ui/app/AppLayouts/Chat/panels/ChatButtonsPanel.qml b/ui/app/AppLayouts/Chat/panels/ChatButtonsPanel.qml index e0bff5217e..8acc6fa32e 100644 --- a/ui/app/AppLayouts/Chat/panels/ChatButtonsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/ChatButtonsPanel.qml @@ -1,8 +1,9 @@ import QtQuick 2.13 import QtGraphicalEffects 1.13 -import "../../../../shared" + import "../../../../shared/status" +import StatusQ.Controls 0.1 as StatusQ import utils 1.0 Rectangle { @@ -80,7 +81,7 @@ Rectangle { buttonsContainer.hoverChanged(this.hovered) } - StatusToolTip { + StatusQ.StatusToolTip { visible: emojiBtn.hovered //% "Add reaction" text: qsTrId("add-reaction") @@ -103,7 +104,7 @@ Rectangle { buttonsContainer.hoverChanged(this.hovered) } - StatusToolTip { + StatusQ.StatusToolTip { visible: replyBtn.hovered //% "Reply" text: qsTrId("message-reply") @@ -124,7 +125,7 @@ Rectangle { buttonsContainer.hoverChanged(btn.hovered) } - StatusToolTip { + StatusQ.StatusToolTip { visible: btn.hovered //% "Edit" text: qsTrId("edit") @@ -151,7 +152,7 @@ Rectangle { onHoveredChanged: { buttonsContainer.hoverChanged(this.hovered) } - StatusToolTip { + StatusQ.StatusToolTip { visible: otherBtn.hovered //% "More" text: qsTrId("more") diff --git a/ui/app/AppLayouts/Chat/panels/EmojiReactionsPanel.qml b/ui/app/AppLayouts/Chat/panels/EmojiReactionsPanel.qml index 44dc3261d9..250ec55acc 100644 --- a/ui/app/AppLayouts/Chat/panels/EmojiReactionsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/EmojiReactionsPanel.qml @@ -4,7 +4,8 @@ import QtGraphicalEffects 1.13 import "../../../../shared" import "../../../../shared/panels" -import "../../../../shared/status" + +import StatusQ.Controls 0.1 as StatusQ import utils 1.0 Item { @@ -40,7 +41,7 @@ Item { (isHovered ? Style.current.emojiReactionActiveBackgroundHovered : Style.current.secondaryBackground) : (isHovered ? Style.current.emojiReactionBackgroundHovered : Style.current.emojiReactionBackground) - StatusToolTip { + StatusQ.StatusToolTip { visible: mouseArea.containsMouse maxWidth: 400 text: showReactionAuthors(modelData.fromAccounts, modelData.emojiId) @@ -180,7 +181,7 @@ Item { } } - StatusToolTip { + StatusQ.StatusToolTip { visible: addEmojiBtn.isHovered //% "Add reaction" text: qsTrId("add-reaction") diff --git a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml index 12c891f574..a4b72c74f3 100644 --- a/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml +++ b/ui/app/AppLayouts/Chat/views/ActivityCenterMessageComponentView.qml @@ -1,6 +1,10 @@ import QtQuick 2.13 + import utils 1.0 + +import StatusQ.Controls 0.1 as StatusQ + import "../../../../shared" import "../../../../shared/status" import "../../../../shared/popups" @@ -48,11 +52,11 @@ Item { onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id, model.message.communityId, model.message.chatId, model.notificationType) - StatusToolTip { + StatusQ.StatusToolTip { visible: markReadBtn.hovered //% "Mark as Read" text: qsTrId("mark-as-read") - orientation: "left" + orientation: StatusQ.StatusToolTip.Orientation.Left// "left" x: - width - Style.current.padding y: markReadBtn.height / 2 - height / 2 + 4 } diff --git a/ui/app/AppLayouts/Chat/views/ChatTimeView.qml b/ui/app/AppLayouts/Chat/views/ChatTimeView.qml index 3a799e9a2d..39d340ff7f 100644 --- a/ui/app/AppLayouts/Chat/views/ChatTimeView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatTimeView.qml @@ -1,7 +1,8 @@ import QtQuick 2.14 import "../../../../shared" import "../../../../shared/panels" -import "../../../../shared/status" + +import StatusQ.Controls 0.1 as StatusQ import utils 1.0 StyledText { @@ -12,7 +13,7 @@ StyledText { text: Utils.formatTime(timestamp) font.pixelSize: Style.current.asideTextFontSize - StatusToolTip { + StatusQ.StatusToolTip { visible: hhandler.hovered text: new Date(parseInt(timestamp, 10)).toLocaleString(Qt.locale(globalSettings.locale)) maxWidth: 350 diff --git a/ui/shared/controls/AccountSelector.qml b/ui/shared/controls/AccountSelector.qml index 8b57c892f7..e33bf86fd6 100644 --- a/ui/shared/controls/AccountSelector.qml +++ b/ui/shared/controls/AccountSelector.qml @@ -5,9 +5,10 @@ import QtGraphicalEffects 1.13 import QtQml.Models 2.14 import utils 1.0 +import StatusQ.Controls 0.1 as StatusQ + import "../../shared" import "../../shared/panels" -import "../status" import "." Item { @@ -93,7 +94,7 @@ Item { horizontalAlignment: Text.AlignRight height: 18 - StatusToolTip { + StatusQ.StatusToolTip { enabled: txtAssetBalance.truncated id: assetTooltip text: txtAssetBalance.text diff --git a/ui/shared/controls/CopyToClipBoardButton.qml b/ui/shared/controls/CopyToClipBoardButton.qml index 6fb98d7bd0..d809a0c70a 100644 --- a/ui/shared/controls/CopyToClipBoardButton.qml +++ b/ui/shared/controls/CopyToClipBoardButton.qml @@ -2,10 +2,11 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import QtGraphicalEffects 1.13 +import StatusQ.Controls 0.1 as StatusQ import utils 1.0 + import "./" import "../" -import "../status" // TODO: Replace with StatusQ components Rectangle { @@ -62,11 +63,11 @@ Rectangle { } } - StatusToolTip { + StatusQ.StatusToolTip { id: toolTip //% "Copied!" text: qsTrId("copied-") - orientation: tooltipUnder ? "bottom" : "top" + orientation: tooltipUnder ? StatusQ.StatusToolTip.Orientation.Bottom: StatusQ.StatusToolTip.Orientation.Top } Timer { diff --git a/ui/shared/status/StatusTextFormatMenu.qml b/ui/shared/status/StatusTextFormatMenu.qml index 7f9b3efd66..8bd0d7e36b 100644 --- a/ui/shared/status/StatusTextFormatMenu.qml +++ b/ui/shared/status/StatusTextFormatMenu.qml @@ -4,8 +4,8 @@ import QtGraphicalEffects 1.13 import QtQuick.Layouts 1.13 import QtQuick.Dialogs 1.3 +import StatusQ.Controls 0.1 as StatusQ import utils 1.0 -import "./" Menu { id: root @@ -67,7 +67,7 @@ Menu { icon.height: menuItem.action.icon.height onClicked: menuItem.action.actionTriggered() highlighted: menuItem.action.checked - StatusToolTip { + StatusQ.StatusToolTip { visible: parent.hovered text: menuItem.action.text } diff --git a/ui/shared/status/StatusToolTip.qml b/ui/shared/status/StatusToolTip.qml deleted file mode 100644 index 95c94fddb7..0000000000 --- a/ui/shared/status/StatusToolTip.qml +++ /dev/null @@ -1,69 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 - -import utils 1.0 -import "../../shared" -import "../../shared/panels" - -ToolTip { - id: tooltip - property int maxWidth: 800 - property string orientation: "top" - - implicitWidth: Math.min(maxWidth, textContent.implicitWidth + Style.current.bigPadding) - leftPadding: Style.current.smallPadding - rightPadding: Style.current.smallPadding - topPadding: Style.current.smallPadding - bottomPadding: Style.current.smallPadding - delay: 200 - - background: Item { - id: tooltipBg - Rectangle { - id: tooltipContentBg - color: Style.current.tooltipBackgroundColor - radius: Style.current.radius - anchors.fill: parent - anchors.bottomMargin: Style.current.smallPadding - } - Rectangle { - color: tooltipContentBg.color - height: 26 - width: 26 - rotation: 45 - radius: 1 - x: { - if (orientation === "top" || orientation === "bottom") { - return tooltipBg.width / 2 - width / 2 - } - if (orientation === "left") { - return tooltipContentBg.width - (width / 2) - 7 - } - if (orientation === "right") { - return -width/2 + 7 - } - } - y: { - if ((orientation === "bottom") || (tooltip.y > 0)) { - return -height / 2 + 5 - } - if (orientation === "top") { - return tooltipBg.height - height - 5 - } - if (orientation === "left" || orientation === "right") { - return tooltipContentBg.height / 2 - (height / 2) - } - } - } - } - contentItem: StyledText { - id: textContent - text: tooltip.text - color: Style.current.tooltipForegroundColor - wrapMode: Text.WordWrap - font.pixelSize: 13 - font.weight: Font.Medium - horizontalAlignment: Text.AlignHCenter - bottomPadding: Style.current.smallPadding - } -} diff --git a/ui/shared/views/TransactionPreview.qml b/ui/shared/views/TransactionPreview.qml index c468eb7f9b..c8236b6a69 100644 --- a/ui/shared/views/TransactionPreview.qml +++ b/ui/shared/views/TransactionPreview.qml @@ -3,7 +3,9 @@ import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 import QtGraphicalEffects 1.13 +import StatusQ.Controls 0.1 as StatusQ import utils 1.0 + import "../status" import "../panels" import "../controls" @@ -405,7 +407,7 @@ Item { verticalAlignment: Text.AlignVCenter elide: Text.ElideRight - StatusToolTip { + StatusQ.StatusToolTip { enabled: networkFeeText.truncated id: networkFeeTooltip text: networkFeeText.text diff --git a/ui/shared/views/TransactionSigner.qml b/ui/shared/views/TransactionSigner.qml index aaa163eda3..99cae95031 100644 --- a/ui/shared/views/TransactionSigner.qml +++ b/ui/shared/views/TransactionSigner.qml @@ -2,7 +2,9 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 +import StatusQ.Controls 0.1 as StatusQ import utils 1.0 + import "../status" import "../panels" import "../controls" @@ -60,7 +62,7 @@ Item { icon.width: width icon.height: height icon.name: "info" - StatusToolTip { + StatusQ.StatusToolTip { visible: infoButton.hovered //% "Signing phrase is a 3 word combination that displayed when you entered the wallet on this device for the first time." text: qsTrId("signing-phrase-is-a-3-word-combination-that-displayed-when-you-entered-the-wallet-on-this-device-for-the-first-time-") @@ -88,7 +90,7 @@ Item { icon.width: width icon.height: height icon.name: "info" - StatusToolTip { + StatusQ.StatusToolTip { visible: passwordInfoButton.hovered //% "Enter the password you use to unlock this device" text: qsTrId("enter-the-password-you-use-to-unlock-this-device")