harbour-tooter/qml/pages/components/MiniHeader.qml

70 lines
2.5 KiB
QML
Raw Permalink Normal View History

import QtQuick 2.0
import Sailfish.Silica 1.0
Item {
id: miniHeader
height: lblName.height
width: parent.width
Label {
id: lblName
2020-06-18 09:32:52 +03:00
text: account_display_name ? account_display_name : account_username.split('@')[0]
font.weight: Font.Bold
font.pixelSize: Theme.fontSizeSmall
2020-06-18 09:32:52 +03:00
color: if ( myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) {
( pressed ? Theme.secondaryHighlightColor : (!highlight ? Theme.secondaryColor : Theme.secondaryHighlightColor ))
} else ( pressed ? Theme.highlightColor : ( !highlight ? Theme.primaryColor : Theme.secondaryColor ))
2020-06-10 11:17:51 +03:00
truncationMode: TruncationMode.Fade
2020-06-19 11:16:13 +03:00
width: myList.type !== "follow" ? ( contentWidth > parent.width /2 ? parent.width /2 : contentWidth ) : parent.width - Theme.paddingMedium
anchors {
2020-06-19 11:16:13 +03:00
left: parent.left
leftMargin: Theme.paddingMedium
}
}
Label {
id: lblScreenName
2020-06-18 09:32:52 +03:00
visible: model.type !== "follow"
text: '@'+account_username
font.pixelSize: Theme.fontSizeExtraSmall
2020-06-18 09:32:52 +03:00
color: ( pressed ? Theme.secondaryHighlightColor : Theme.secondaryColor )
2020-06-10 11:17:51 +03:00
truncationMode: TruncationMode.Fade
anchors {
2020-06-19 11:16:13 +03:00
left: lblName.right
leftMargin: Theme.paddingMedium
right: lblDate.left
2020-06-18 09:32:52 +03:00
rightMargin: Theme.paddingMedium
verticalCenter: lblName.verticalCenter
}
}
Label {
id: lblScreenNameFollow
2020-06-19 11:16:13 +03:00
visible: model.type === "follow"
2020-06-18 09:32:52 +03:00
text: '@'+account_username
font.pixelSize: Theme.fontSizeExtraSmall
color: ( pressed ? Theme.secondaryHighlightColor : Theme.secondaryColor )
2020-06-19 11:16:13 +03:00
width: parent.width - Theme.paddingMedium
2020-06-18 09:32:52 +03:00
truncationMode: TruncationMode.Fade
anchors {
2020-07-03 11:45:30 +03:00
top: lblName.bottom
2020-06-18 09:32:52 +03:00
left: parent.left
2020-06-19 11:16:13 +03:00
leftMargin: Theme.paddingMedium
}
}
Label {
id: lblDate
text: Format.formatDate(created_at, new Date() - created_at < 60*60*1000 ? Formatter.DurationElapsedShort : Formatter.TimeValueTwentyFourHours)
font.pixelSize: Theme.fontSizeExtraSmall
2020-06-18 09:32:52 +03:00
color: ( pressed ? Theme.highlightColor : Theme.secondaryColor )
horizontalAlignment: Text.AlignRight
anchors {
right: parent.right
2020-06-19 11:16:13 +03:00
rightMargin: Theme.horizontalPageMargin
2020-06-18 09:32:52 +03:00
verticalCenter: lblName.verticalCenter
}
}
}