refactor: remove StatusToolTip.qml from ui/shared/status

Updated path to use StatusQ StatusToolTip.

closes #3819
This commit is contained in:
Khushboo Mehta 2021-10-14 22:30:51 +02:00 committed by Khushboo-dev-cpp
parent 59109e1318
commit b59e4c0b93
10 changed files with 35 additions and 91 deletions

View File

@ -1,8 +1,9 @@
import QtQuick 2.13 import QtQuick 2.13
import QtGraphicalEffects 1.13 import QtGraphicalEffects 1.13
import "../../../../shared"
import "../../../../shared/status" import "../../../../shared/status"
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0 import utils 1.0
Rectangle { Rectangle {
@ -80,7 +81,7 @@ Rectangle {
buttonsContainer.hoverChanged(this.hovered) buttonsContainer.hoverChanged(this.hovered)
} }
StatusToolTip { StatusQ.StatusToolTip {
visible: emojiBtn.hovered visible: emojiBtn.hovered
//% "Add reaction" //% "Add reaction"
text: qsTrId("add-reaction") text: qsTrId("add-reaction")
@ -103,7 +104,7 @@ Rectangle {
buttonsContainer.hoverChanged(this.hovered) buttonsContainer.hoverChanged(this.hovered)
} }
StatusToolTip { StatusQ.StatusToolTip {
visible: replyBtn.hovered visible: replyBtn.hovered
//% "Reply" //% "Reply"
text: qsTrId("message-reply") text: qsTrId("message-reply")
@ -124,7 +125,7 @@ Rectangle {
buttonsContainer.hoverChanged(btn.hovered) buttonsContainer.hoverChanged(btn.hovered)
} }
StatusToolTip { StatusQ.StatusToolTip {
visible: btn.hovered visible: btn.hovered
//% "Edit" //% "Edit"
text: qsTrId("edit") text: qsTrId("edit")
@ -151,7 +152,7 @@ Rectangle {
onHoveredChanged: { onHoveredChanged: {
buttonsContainer.hoverChanged(this.hovered) buttonsContainer.hoverChanged(this.hovered)
} }
StatusToolTip { StatusQ.StatusToolTip {
visible: otherBtn.hovered visible: otherBtn.hovered
//% "More" //% "More"
text: qsTrId("more") text: qsTrId("more")

View File

@ -4,7 +4,8 @@ import QtGraphicalEffects 1.13
import "../../../../shared" import "../../../../shared"
import "../../../../shared/panels" import "../../../../shared/panels"
import "../../../../shared/status"
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0 import utils 1.0
Item { Item {
@ -40,7 +41,7 @@ Item {
(isHovered ? Style.current.emojiReactionActiveBackgroundHovered : Style.current.secondaryBackground) : (isHovered ? Style.current.emojiReactionActiveBackgroundHovered : Style.current.secondaryBackground) :
(isHovered ? Style.current.emojiReactionBackgroundHovered : Style.current.emojiReactionBackground) (isHovered ? Style.current.emojiReactionBackgroundHovered : Style.current.emojiReactionBackground)
StatusToolTip { StatusQ.StatusToolTip {
visible: mouseArea.containsMouse visible: mouseArea.containsMouse
maxWidth: 400 maxWidth: 400
text: showReactionAuthors(modelData.fromAccounts, modelData.emojiId) text: showReactionAuthors(modelData.fromAccounts, modelData.emojiId)
@ -180,7 +181,7 @@ Item {
} }
} }
StatusToolTip { StatusQ.StatusToolTip {
visible: addEmojiBtn.isHovered visible: addEmojiBtn.isHovered
//% "Add reaction" //% "Add reaction"
text: qsTrId("add-reaction") text: qsTrId("add-reaction")

View File

@ -1,6 +1,10 @@
import QtQuick 2.13 import QtQuick 2.13
import utils 1.0 import utils 1.0
import StatusQ.Controls 0.1 as StatusQ
import "../../../../shared" import "../../../../shared"
import "../../../../shared/status" import "../../../../shared/status"
import "../../../../shared/popups" import "../../../../shared/popups"
@ -48,11 +52,11 @@ Item {
onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id, model.message.communityId, model.message.chatId, model.notificationType) onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id, model.message.communityId, model.message.chatId, model.notificationType)
StatusToolTip { StatusQ.StatusToolTip {
visible: markReadBtn.hovered visible: markReadBtn.hovered
//% "Mark as Read" //% "Mark as Read"
text: qsTrId("mark-as-read") text: qsTrId("mark-as-read")
orientation: "left" orientation: StatusQ.StatusToolTip.Orientation.Left// "left"
x: - width - Style.current.padding x: - width - Style.current.padding
y: markReadBtn.height / 2 - height / 2 + 4 y: markReadBtn.height / 2 - height / 2 + 4
} }

View File

@ -1,7 +1,8 @@
import QtQuick 2.14 import QtQuick 2.14
import "../../../../shared" import "../../../../shared"
import "../../../../shared/panels" import "../../../../shared/panels"
import "../../../../shared/status"
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0 import utils 1.0
StyledText { StyledText {
@ -12,7 +13,7 @@ StyledText {
text: Utils.formatTime(timestamp) text: Utils.formatTime(timestamp)
font.pixelSize: Style.current.asideTextFontSize font.pixelSize: Style.current.asideTextFontSize
StatusToolTip { StatusQ.StatusToolTip {
visible: hhandler.hovered visible: hhandler.hovered
text: new Date(parseInt(timestamp, 10)).toLocaleString(Qt.locale(globalSettings.locale)) text: new Date(parseInt(timestamp, 10)).toLocaleString(Qt.locale(globalSettings.locale))
maxWidth: 350 maxWidth: 350

View File

@ -5,9 +5,10 @@ import QtGraphicalEffects 1.13
import QtQml.Models 2.14 import QtQml.Models 2.14
import utils 1.0 import utils 1.0
import StatusQ.Controls 0.1 as StatusQ
import "../../shared" import "../../shared"
import "../../shared/panels" import "../../shared/panels"
import "../status"
import "." import "."
Item { Item {
@ -93,7 +94,7 @@ Item {
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
height: 18 height: 18
StatusToolTip { StatusQ.StatusToolTip {
enabled: txtAssetBalance.truncated enabled: txtAssetBalance.truncated
id: assetTooltip id: assetTooltip
text: txtAssetBalance.text text: txtAssetBalance.text

View File

@ -2,10 +2,11 @@ import QtQuick 2.13
import QtQuick.Controls 2.13 import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13 import QtGraphicalEffects 1.13
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0 import utils 1.0
import "./" import "./"
import "../" import "../"
import "../status"
// TODO: Replace with StatusQ components // TODO: Replace with StatusQ components
Rectangle { Rectangle {
@ -62,11 +63,11 @@ Rectangle {
} }
} }
StatusToolTip { StatusQ.StatusToolTip {
id: toolTip id: toolTip
//% "Copied!" //% "Copied!"
text: qsTrId("copied-") text: qsTrId("copied-")
orientation: tooltipUnder ? "bottom" : "top" orientation: tooltipUnder ? StatusQ.StatusToolTip.Orientation.Bottom: StatusQ.StatusToolTip.Orientation.Top
} }
Timer { Timer {

View File

@ -4,8 +4,8 @@ import QtGraphicalEffects 1.13
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0 import utils 1.0
import "./"
Menu { Menu {
id: root id: root
@ -67,7 +67,7 @@ Menu {
icon.height: menuItem.action.icon.height icon.height: menuItem.action.icon.height
onClicked: menuItem.action.actionTriggered() onClicked: menuItem.action.actionTriggered()
highlighted: menuItem.action.checked highlighted: menuItem.action.checked
StatusToolTip { StatusQ.StatusToolTip {
visible: parent.hovered visible: parent.hovered
text: menuItem.action.text text: menuItem.action.text
} }

View File

@ -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
}
}

View File

@ -3,7 +3,9 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13 import QtGraphicalEffects 1.13
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0 import utils 1.0
import "../status" import "../status"
import "../panels" import "../panels"
import "../controls" import "../controls"
@ -405,7 +407,7 @@ Item {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight elide: Text.ElideRight
StatusToolTip { StatusQ.StatusToolTip {
enabled: networkFeeText.truncated enabled: networkFeeText.truncated
id: networkFeeTooltip id: networkFeeTooltip
text: networkFeeText.text text: networkFeeText.text

View File

@ -2,7 +2,9 @@ import QtQuick 2.13
import QtQuick.Controls 2.13 import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import StatusQ.Controls 0.1 as StatusQ
import utils 1.0 import utils 1.0
import "../status" import "../status"
import "../panels" import "../panels"
import "../controls" import "../controls"
@ -60,7 +62,7 @@ Item {
icon.width: width icon.width: width
icon.height: height icon.height: height
icon.name: "info" icon.name: "info"
StatusToolTip { StatusQ.StatusToolTip {
visible: infoButton.hovered visible: infoButton.hovered
//% "Signing phrase is a 3 word combination that displayed when you entered the wallet on this device for the first time." //% "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-") 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.width: width
icon.height: height icon.height: height
icon.name: "info" icon.name: "info"
StatusToolTip { StatusQ.StatusToolTip {
visible: passwordInfoButton.hovered visible: passwordInfoButton.hovered
//% "Enter the password you use to unlock this device" //% "Enter the password you use to unlock this device"
text: qsTrId("enter-the-password-you-use-to-unlock-this-device") text: qsTrId("enter-the-password-you-use-to-unlock-this-device")