2020-05-19 19:49:52 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import QtQuick 2.7
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Controls.Material 2.0
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import CustomQmlTypes 1.0
|
2020-05-19 20:25:56 +00:00
|
|
|
import "styles"
|
2020-05-19 23:00:32 +00:00
|
|
|
import "." as Widgets
|
2020-05-19 20:25:56 +00:00
|
|
|
import "theme"
|
2020-06-23 23:58:11 +00:00
|
|
|
import "../opaque/fonts"
|
2020-05-19 19:49:52 +00:00
|
|
|
import QtQuick.Controls 1.4
|
|
|
|
import QtQuick.Controls.Styles 1.4
|
|
|
|
|
2020-07-16 18:38:33 +00:00
|
|
|
Item {
|
2020-05-19 19:49:52 +00:00
|
|
|
id: crItem
|
2020-07-25 16:44:47 +00:00
|
|
|
implicitHeight: Theme.contactPortraitSize * logscale + 3
|
2020-07-16 18:38:33 +00:00
|
|
|
height: implicitHeight
|
2020-05-19 19:49:52 +00:00
|
|
|
|
|
|
|
property real logscale: 4 * Math.log10(gcd.themeScale + 1)
|
|
|
|
property string displayName
|
|
|
|
property alias image: portrait.source
|
|
|
|
property string handle
|
|
|
|
property bool isActive
|
|
|
|
property bool isHover
|
|
|
|
property string tag // profile version/type
|
|
|
|
|
2020-06-23 23:58:11 +00:00
|
|
|
property color rowColor: Theme.backgroundMainColor
|
|
|
|
property color rowHilightColor: Theme.backgroundHilightElementColor
|
2020-05-19 19:49:52 +00:00
|
|
|
property alias portraitBorderColor: portrait.portraitBorderColor
|
|
|
|
property alias portraitColor: portrait.portraitColor
|
|
|
|
property alias nameColor: cn.color
|
|
|
|
property alias onionColor: onion.color
|
|
|
|
property alias onionVisible: onion.visible
|
2020-09-04 23:59:33 +00:00
|
|
|
|
|
|
|
property alias badgeColor: portrait.badgeColor
|
2020-05-19 19:49:52 +00:00
|
|
|
property alias badgeVisible: portrait.badgeVisible
|
|
|
|
property alias badgeContent: portrait.badgeContent
|
2020-09-04 23:59:33 +00:00
|
|
|
|
2020-05-19 19:49:52 +00:00
|
|
|
property alias hoverEnabled: buttonMA.hoverEnabled
|
|
|
|
|
2020-09-03 22:40:44 +00:00
|
|
|
// Ideally read only for icons to match against
|
|
|
|
property alias color: crRect.color
|
|
|
|
|
2020-05-19 19:49:52 +00:00
|
|
|
property alias content: extraMeta.children
|
|
|
|
|
2020-11-04 01:05:40 +00:00
|
|
|
property alias portraitOverlayColor: portrait.overlayColor
|
|
|
|
property alias portraitPerformTransform: portrait.performTransform
|
|
|
|
|
2020-05-19 19:49:52 +00:00
|
|
|
signal clicked(string handle)
|
|
|
|
|
|
|
|
Rectangle { // CONTACT ENTRY BACKGROUND COLOR
|
|
|
|
id: crRect
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
height: crItem.height
|
|
|
|
width: parent.width
|
2020-06-23 23:58:11 +00:00
|
|
|
color: isHover ? crItem.rowHilightColor : (isActive ? crItem.rowHilightColor : crItem.rowColor)
|
2020-05-19 19:49:52 +00:00
|
|
|
|
|
|
|
Portrait {
|
|
|
|
id: portrait
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 25 * logscale
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: portraitMeta
|
|
|
|
|
|
|
|
anchors.left: portrait.right
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.leftMargin: 4 * logscale
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
2020-11-20 00:15:50 +00:00
|
|
|
Label { // CONTACT NAME
|
2020-05-19 19:49:52 +00:00
|
|
|
id: cn
|
2020-11-20 00:15:50 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.pixelSize: Theme.usernameSize * gcd.themeScale
|
2020-06-23 23:58:11 +00:00
|
|
|
font.family: Fonts.applicationFontExtraBold.name
|
|
|
|
font.styleName: "ExtraBold"
|
2020-05-19 19:49:52 +00:00
|
|
|
text: displayName
|
|
|
|
}
|
|
|
|
|
2020-11-20 00:15:50 +00:00
|
|
|
Label { // Onion
|
2020-05-19 19:49:52 +00:00
|
|
|
id: onion
|
|
|
|
text: handle
|
2020-11-20 00:15:50 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.pixelSize: Theme.secondaryTextSize * gcd.themeScale
|
2020-05-19 19:49:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: extraMeta
|
|
|
|
anchors.left: portraitMeta.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea { // Full row mouse area triggering onClick
|
|
|
|
id: buttonMA
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
|
|
onClicked: { crItem.clicked(crItem.handle) }
|
|
|
|
|
|
|
|
onEntered: {
|
|
|
|
isHover = true
|
|
|
|
}
|
|
|
|
|
|
|
|
onExited: {
|
|
|
|
isHover = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections { // UPDATE UNREAD MESSAGES COUNTER
|
|
|
|
target: gcd
|
|
|
|
|
|
|
|
onResetMessagePane: function() {
|
|
|
|
isActive = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onUpdateContactDisplayName: function(_handle, _displayName) {
|
|
|
|
if (handle == _handle) {
|
2020-06-23 23:58:11 +00:00
|
|
|
displayName = _displayName
|
2020-05-19 19:49:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onUpdateContactPicture: function(_handle, _image) {
|
|
|
|
if (handle == _handle) {
|
|
|
|
image = _image
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|