2017-06-07 08:56:42 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
2020-05-29 21:05:05 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Item {
|
2020-05-29 21:05:05 +03:00
|
|
|
id: profileHeader
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2020-05-29 21:05:05 +03:00
|
|
|
property int value: 0
|
|
|
|
property string title: ""
|
|
|
|
property string description: ""
|
|
|
|
property string image: ""
|
|
|
|
property string bg: ""
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
width: parent.width
|
2020-06-10 17:20:54 +03:00
|
|
|
height: if (bot === true) {
|
2020-06-10 14:26:16 +03:00
|
|
|
avatarImage.height + Theme.paddingLarge*2 + infoLbl.height + Theme.paddingLarge
|
|
|
|
} else avatarImage.height + Theme.paddingLarge*2
|
2020-05-25 18:54:02 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Rectangle {
|
2020-05-25 18:54:02 +03:00
|
|
|
id: bgImage
|
2020-01-16 20:29:26 +03:00
|
|
|
opacity: 0.2
|
2017-06-07 08:56:42 +03:00
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop { position: 0.0; color: Theme.highlightBackgroundColor }
|
2020-05-25 18:54:02 +03:00
|
|
|
GradientStop { position: 1.0; color: Theme.highlightBackgroundColor }
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2020-05-25 18:54:02 +03:00
|
|
|
Image {
|
|
|
|
asynchronous: true
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
source: bg
|
|
|
|
opacity: 0.8
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.fill: parent
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Image {
|
2020-06-10 12:44:58 +03:00
|
|
|
id: avatarImage
|
2020-06-03 08:34:33 +03:00
|
|
|
asynchronous: true
|
|
|
|
source:
|
2020-06-10 12:44:58 +03:00
|
|
|
if (avatarImage.status === Image.Error)
|
2020-06-03 08:34:33 +03:00
|
|
|
source = "../../images/icon-l-profile.svg?" + (pressed
|
|
|
|
? Theme.highlightColor
|
|
|
|
: Theme.primaryColor)
|
|
|
|
else image
|
|
|
|
width: description === "" ? Theme.iconSizeMedium : Theme.iconSizeLarge
|
|
|
|
height: width
|
2017-06-07 08:56:42 +03:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: Theme.paddingLarge
|
|
|
|
top: parent.top
|
|
|
|
topMargin: Theme.paddingLarge
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
|
|
|
Button {
|
|
|
|
id: imageButton
|
|
|
|
opacity: 0
|
|
|
|
width: Theme.iconSizeExtraLarge * 1.2
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
pageStack.push(Qt.resolvedUrl("ProfileImage.qml"), {
|
|
|
|
"image": image
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Column {
|
|
|
|
anchors {
|
2020-06-10 14:26:16 +03:00
|
|
|
top: parent.top
|
|
|
|
topMargin: Theme.paddingLarge
|
2020-06-10 12:44:58 +03:00
|
|
|
left: avatarImage.right
|
2017-06-07 08:56:42 +03:00
|
|
|
leftMargin: Theme.paddingLarge
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: Theme.paddingLarge
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Label {
|
2020-06-10 14:26:16 +03:00
|
|
|
id: profileTitle
|
|
|
|
text: if (title === "") {
|
|
|
|
description.split('@')[0]
|
|
|
|
}
|
|
|
|
else title
|
2017-06-07 08:56:42 +03:00
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
font.family: Theme.fontFamilyHeading
|
2020-06-03 08:34:33 +03:00
|
|
|
color: Theme.highlightColor
|
2017-06-07 08:56:42 +03:00
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
width: parent.width
|
2020-06-03 08:34:33 +03:00
|
|
|
height: contentHeight
|
|
|
|
horizontalAlignment: Text.AlignRight
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Label {
|
2020-06-10 14:26:16 +03:00
|
|
|
id: profileDescription
|
2020-05-11 13:24:44 +03:00
|
|
|
text: "@"+description
|
2017-06-07 08:56:42 +03:00
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
|
|
font.family: Theme.fontFamilyHeading
|
2020-06-03 08:34:33 +03:00
|
|
|
color: Theme.secondaryHighlightColor
|
2017-06-07 08:56:42 +03:00
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
width: parent.width
|
2020-06-03 08:34:33 +03:00
|
|
|
height: description === "" ? 0 : contentHeight
|
|
|
|
horizontalAlignment: Text.AlignRight
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-10 14:26:16 +03:00
|
|
|
Row {
|
|
|
|
id: infoLbl
|
|
|
|
spacing: Theme.paddingLarge
|
|
|
|
layoutDirection: Qt.RightToLeft
|
|
|
|
height: Theme.iconSizeSmall + Theme.paddingSmall
|
|
|
|
anchors {
|
|
|
|
top: avatarImage.bottom
|
|
|
|
topMargin: Theme.paddingLarge
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: Theme.paddingLarge
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: Theme.paddingLarge
|
|
|
|
}
|
|
|
|
|
2020-06-10 17:20:54 +03:00
|
|
|
/* Rectangle {
|
2020-06-10 14:26:16 +03:00
|
|
|
id: followingBg
|
|
|
|
visible: (following ? true : false)
|
|
|
|
radius: Theme.paddingSmall
|
|
|
|
color: Theme.secondaryHighlightColor
|
2020-06-10 15:33:23 +03:00
|
|
|
width: followingLbl.width + 2*Theme.paddingLarge
|
2020-06-10 14:26:16 +03:00
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: followingLbl
|
|
|
|
text: qsTr("Follows you")
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
color: Theme.primaryColor
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2020-06-10 17:20:54 +03:00
|
|
|
} */
|
2020-06-10 14:26:16 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: botBg
|
|
|
|
visible: (bot ? true : false)
|
|
|
|
radius: Theme.paddingSmall
|
|
|
|
color: Theme.secondaryHighlightColor
|
2020-06-10 15:33:23 +03:00
|
|
|
width: botLbl.width + 2*Theme.paddingLarge
|
2020-06-10 14:26:16 +03:00
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: botLbl
|
|
|
|
text: qsTr("Bot")
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
color: Theme.primaryColor
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|