2021-08-05 18:06:19 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import QtQml.Models 2.3
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-14 13:52:30 +00:00
|
|
|
import "../panels"
|
|
|
|
import "."
|
2021-08-05 18:06:19 +00:00
|
|
|
|
2021-10-20 22:47:23 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2021-10-14 11:48:03 +00:00
|
|
|
// TODO: replace with StatusPopupMenu
|
2021-08-05 18:06:19 +00:00
|
|
|
PopupMenu {
|
|
|
|
id: root
|
|
|
|
width: profileHeader.width
|
2021-09-27 10:31:17 +00:00
|
|
|
closePolicy: Popup.CloseOnReleaseOutsideParent | Popup.CloseOnEscape
|
2021-08-05 18:06:19 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: profileHeader
|
|
|
|
width: 200
|
|
|
|
height: visible ? profileImage.height + username.height + viewProfileBtn.height + Style.current.padding * 2 : 0
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
visible: mouseArea.containsMouse
|
|
|
|
color: Style.current.backgroundHover
|
|
|
|
}
|
2021-10-20 22:47:23 +00:00
|
|
|
StatusSmartIdenticon {
|
2021-08-05 18:06:19 +00:00
|
|
|
id: profileImage
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 4
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-10-29 11:39:17 +00:00
|
|
|
image.source: profileModule.thumbnailImage || ""
|
2021-10-20 22:47:23 +00:00
|
|
|
image.isIdenticon: true
|
2021-08-05 18:06:19 +00:00
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: username
|
|
|
|
text: Utils.removeStatusEns(profileModel.ens.preferredUsername || profileModel.profile.username)
|
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 3
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
anchors.top: profileImage.bottom
|
|
|
|
anchors.topMargin: 4
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 13
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: viewProfileBtn
|
|
|
|
text: qsTr("My profile →")
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
anchors.top: username.bottom
|
|
|
|
anchors.topMargin: 4
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
|
|
font.weight: Font.Medium
|
2021-08-06 16:54:06 +00:00
|
|
|
font.pixelSize: Style.current.tertiaryTextFontSize
|
2021-08-05 18:06:19 +00:00
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: mouseArea
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
2021-10-29 11:39:17 +00:00
|
|
|
openProfilePopup(profileModule.username, profileModule.pubKey, profileModule.thumbnailImage || "");
|
2021-08-05 18:06:19 +00:00
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
2021-08-13 20:06:52 +00:00
|
|
|
anchors.bottom: profileHeader.bottom
|
2021-08-05 18:06:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
overrideTextColor: Style.current.textColor
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: qsTr("Online")
|
|
|
|
onTriggered: {
|
2021-10-29 11:39:17 +00:00
|
|
|
if (profileModule.sendUserStatus != true) {
|
|
|
|
profileModule.setSendUserStatus(true)
|
2021-08-05 18:06:19 +00:00
|
|
|
}
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
icon.color: Style.current.green
|
2021-09-28 15:04:06 +00:00
|
|
|
icon.source: Style.svg("online")
|
2021-08-05 18:06:19 +00:00
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: qsTr("Offline")
|
|
|
|
onTriggered: {
|
2021-10-29 11:39:17 +00:00
|
|
|
if (profileModule.sendUserStatus != false) {
|
|
|
|
profileModule.setSendUserStatus(false)
|
2021-08-05 18:06:19 +00:00
|
|
|
}
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
|
2021-08-19 07:48:49 +00:00
|
|
|
icon.color: Style.current.midGrey
|
2021-09-28 15:04:06 +00:00
|
|
|
icon.source: Style.svg("offline")
|
2021-08-05 18:06:19 +00:00
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|