This repository has been archived on 2023-11-19. You can view files and clone it, but cannot push or open issues or pull requests.
goober-bb10/assets/ProfilePage.qml

188 lines
6.2 KiB
QML
Raw Normal View History

2016-10-21 13:09:34 +00:00
import bb.cascades 1.4
import org.labsquare 1.0
Page {
property variant user
property variant theme : Application.themeSupport.theme.colorTheme.style
signal follow(string uid)
signal unfollow(string uid)
signal block(string uid)
signal unblock(string uid)
signal mute(string uid)
signal unmute(string uid)
2016-10-21 13:09:34 +00:00
Container {
Container {
layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill
preferredHeight: cover.height
Container {
Container {
opacity: 0.5
WebImageView {
id: cover
preferredWidth: 1440
scalingMethod: ScalingMethod.AspectFit
//imageSource: "asset:///icons/default_cover.png"
url: user.content.cover_image.link
}
}
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
topPadding: ui.sdu(3)
leftPadding: ui.sdu(3)
Container {
background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828")
WebImageView {
//imageSource: "asset:///icons/laughing_man.png"
url: user.content.avatar_image.link
maxHeight: ui.du(14)
maxWidth: ui.du(14)
}
}
Container {
leftPadding: ui.sdu(3)
rightPadding: ui.sdu(3)
horizontalAlignment: HorizontalAlignment.Fill
//background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828")
Container {
Label {
//text: "Morgan McMillian"
text: user.name
textStyle.fontWeight: FontWeight.Bold
textStyle.fontSize: FontSize.Large
}
}
Container {
Label {
//text: "thrrgilag"
text: user.username
textStyle.fontSize: FontSize.Medium
}
}
}
}
}
Container {
topPadding: ui.sdu(3)
leftPadding: ui.sdu(3)
layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill
Container {
Label {
//text: "Bio goes here."
text: user.content.text
multiline: true
}
}
Container {
horizontalAlignment: HorizontalAlignment.Right
rightPadding: ui.sdu(3)
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
horizontalAlignment: HorizontalAlignment.Right
Label {
text: qsTr("Following")
}
Label {
text: user.counts.following
}
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
horizontalAlignment: HorizontalAlignment.Right
Label {
text: qsTr("Followers")
}
Label {
text: user.counts.followers
}
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
horizontalAlignment: HorizontalAlignment.Right
Label {
text: qsTr("Posts")
}
Label {
text: user.counts.posts
}
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
horizontalAlignment: HorizontalAlignment.Right
Label {
text: qsTr("Bookmarks")
}
Label {
text: user.counts.bookmarks
}
}
}
}
}
actions: [
ActionItem {
title: (user.you_follow) ? qsTr("Unfollow") : qsTr("Follow")
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
if (user.you_follow) {
unfollow(user.id)
} else {
follow(user.id)
}
}
imageSource: (user.you_follow) ? "asset:///icons/minus-circle.png" : "asset:///icons/ic_add.png"
},
ActionItem {
title: (user.you_muted) ? qsTr("Unmute") : qsTr("Mute")
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
if (user.you_muted) {
unmute(user.id)
} else {
mute(user.id)
}
}
imageSource: (user.you_muted) ? "asset:///icons/bell.png" : "asset:///icons/bell-slash.png"
},
ActionItem {
title: (user.you_blocked) ? qsTr("Unblock") : qsTr("Block")
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
if (user.you_blocked) {
unblock(user.id)
} else {
block(user.id)
}
}
imageSource: "asset:///icons/ic_cancel.png"
2016-10-21 13:09:34 +00:00
}
]
}