Warning, /maui/communicator/src/views/contacts/GridContactDelegate.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.9
0002 import QtQuick.Controls 2.3
0003 import QtQuick.Layouts 1.3
0004 import QtGraphicalEffects 1.0
0005 
0006 import org.mauikit.controls 1.0 as Maui
0007 
0008 Maui.ItemDelegate
0009 {
0010     id: control
0011     property bool showMenuIcon: false
0012     signal favClicked(int index)
0013 
0014     Maui.Theme.inherit: false
0015     Maui.Theme.backgroundColor: "#333";
0016     Maui.Theme.textColor: "#fafafa"
0017 
0018     ToolButton
0019     {
0020         anchors
0021         {
0022             top: parent.top
0023             right: parent.right
0024             margins: Maui.Style.space.medium
0025         }
0026 
0027         icon.color: "#fff"
0028         visible: showMenuIcon
0029         icon.name: "overflow-menu"
0030         //        onClicked: swipe.position < 0 ? swipe.close() : swipe.open(SwipeDelegate.Right)
0031 
0032     }
0033 
0034     Rectangle
0035     {
0036         id: _cover
0037         anchors.fill: parent
0038         radius: Maui.Style.radiusV
0039         color: Maui.Theme.backgroundColor
0040         //        {
0041         //            var c = Qt.rgba(Math.random(),Math.random(),Math.random(),1)
0042         //            return Qt.hsla(c.hslHue, 0.7, c.hslLightness, c.a);
0043         //        }
0044 
0045         Loader
0046         {
0047             id: _contactPicLoader
0048             anchors.fill: parent
0049             sourceComponent: model.photo ? _imgComponent : _iconComponent
0050         }
0051 
0052         Component
0053         {
0054             id: _imgComponent
0055 
0056             Image
0057             {
0058                 id: _img
0059                 width: parent.width
0060                 height: width
0061 
0062                 anchors.centerIn: parent
0063 
0064                 sourceSize.width: parent.width
0065                 sourceSize.height: parent.height
0066 
0067                 fillMode: Image.PreserveAspectCrop
0068                 cache: true
0069                 antialiasing: true
0070                 smooth: true
0071                 asynchronous: true
0072 
0073                 source: "image://contact/"+ model.id
0074             }
0075         }
0076         Component
0077         {
0078             id: _iconComponent
0079 
0080             Label
0081             {
0082                 anchors.fill: parent
0083                 anchors.centerIn: parent
0084                 horizontalAlignment: Qt.AlignHCenter
0085                 verticalAlignment: Qt.AlignVCenter
0086 
0087                 color: "#fff"
0088                 font.pointSize: Maui.Style.fontSizes.enormous * 3
0089                 font.bold: true
0090                 font.weight: Font.Bold
0091                 text: model.n[0].toUpperCase()
0092             }
0093         }
0094 
0095         Item
0096         {
0097             id: _labelBg
0098             height: Math.min (parent.height * 0.3, _labelsLayout.implicitHeight ) + Maui.Style.space.big
0099             width: parent.width
0100             anchors.bottom: parent.bottom
0101 
0102             Rectangle
0103             {
0104                 anchors.fill: parent
0105                 color: control.isCurrentItem ? Maui.Theme.highlightColor : _labelBg.Maui.Theme.backgroundColor
0106                 opacity: control.isCurrentItem || control.hovered ? 1 : 0.7
0107             }
0108 
0109             Maui.ListItemTemplate
0110             {
0111                 id: _labelsLayout
0112                 anchors.centerIn: parent
0113                 width: parent.width * 0.9
0114                 height: Math.min(parent.height * 0.9, implicitHeight)
0115                 implicitHeight: label1.implicitHeight + label2.implicitHeight + spacing
0116 
0117                 label1.font.pointSize: Maui.Style.fontSizes.big
0118                 label1.text: model.n
0119                 //                label2.text: model.tel
0120 
0121                 label1.visible: label1.text && control.width > 50
0122                 label1.font.bold: true
0123                 label1.font.weight: Font.Bold
0124                 label1.wrapMode: Text.WordWrap
0125 
0126                 label2.visible: label2.text && (control.width > 70)
0127                 label2.font.pointSize: Maui.Style.fontSizes.medium
0128                 label2.wrapMode: Text.NoWrap
0129             }
0130         }
0131 
0132         layer.enabled: true
0133         layer.effect: OpacityMask
0134         {
0135             maskSource: Item
0136             {
0137                 width: _cover.width
0138                 height: _cover.height
0139 
0140                 Rectangle
0141                 {
0142                     anchors.centerIn: parent
0143                     width: _cover.width
0144                     height: _cover.height
0145                     radius: Maui.Style.radiusV
0146                 }
0147             }
0148         }
0149     }
0150 }