2021-09-09 14:33:57 +03:00
|
|
|
import QtQml 2.15
|
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
import Style 1.0
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: unifiedSearchResultItemDetails
|
|
|
|
|
|
|
|
property string title: ""
|
|
|
|
property string subline: ""
|
|
|
|
property string icons: ""
|
|
|
|
property string iconPlaceholder: ""
|
|
|
|
property bool isRounded: false
|
|
|
|
|
|
|
|
|
2022-07-11 19:56:35 +03:00
|
|
|
property int textLeftMargin: Style.unifiedSearchResultTextLeftMargin
|
|
|
|
property int textRightMargin: Style.unifiedSearchResultTextRightMargin
|
|
|
|
property int iconWidth: Style.unifiedSearchResultIconWidth
|
|
|
|
property int iconLeftMargin: Style.unifiedSearchResultIconLeftMargin
|
2021-09-09 14:33:57 +03:00
|
|
|
|
2022-07-11 19:56:35 +03:00
|
|
|
property int titleFontSize: Style.unifiedSearchResultTitleFontSize
|
|
|
|
property int sublineFontSize: Style.unifiedSearchResultSublineFontSize
|
2021-09-09 14:33:57 +03:00
|
|
|
|
2022-02-04 05:39:38 +03:00
|
|
|
property color titleColor: Style.ncTextColor
|
|
|
|
property color sublineColor: Style.ncSecondaryTextColor
|
2021-09-09 14:33:57 +03:00
|
|
|
|
|
|
|
Accessible.role: Accessible.ListItem
|
|
|
|
Accessible.name: resultTitle
|
|
|
|
Accessible.onPressAction: unifiedSearchResultMouseArea.clicked()
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: unifiedSearchResultImageContainer
|
|
|
|
visible: true
|
|
|
|
Layout.preferredWidth: unifiedSearchResultItemDetails.iconWidth + 10
|
|
|
|
Layout.preferredHeight: unifiedSearchResultItemDetails.height
|
|
|
|
Image {
|
|
|
|
id: unifiedSearchResultThumbnail
|
|
|
|
visible: false
|
|
|
|
asynchronous: true
|
2022-01-20 14:54:36 +03:00
|
|
|
source: "image://tray-image-provider/" + icons
|
2021-09-09 14:33:57 +03:00
|
|
|
cache: true
|
|
|
|
sourceSize.width: imageData.width
|
|
|
|
sourceSize.height: imageData.height
|
|
|
|
width: imageData.width
|
|
|
|
height: imageData.height
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
id: mask
|
|
|
|
visible: false
|
|
|
|
radius: isRounded ? width / 2 : 0
|
|
|
|
width: imageData.width
|
|
|
|
height: imageData.height
|
|
|
|
}
|
|
|
|
OpacityMask {
|
|
|
|
id: imageData
|
|
|
|
visible: !unifiedSearchResultThumbnailPlaceholder.visible && icons
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
|
|
|
Layout.leftMargin: iconLeftMargin
|
|
|
|
Layout.preferredWidth: unifiedSearchResultItemDetails.iconWidth
|
|
|
|
Layout.preferredHeight: unifiedSearchResultItemDetails.iconWidth
|
|
|
|
source: unifiedSearchResultThumbnail
|
|
|
|
maskSource: mask
|
|
|
|
}
|
|
|
|
Image {
|
|
|
|
id: unifiedSearchResultThumbnailPlaceholder
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
|
|
|
Layout.leftMargin: iconLeftMargin
|
|
|
|
verticalAlignment: Qt.AlignCenter
|
|
|
|
cache: true
|
2022-08-09 17:19:29 +03:00
|
|
|
source: "image://tray-image-provider/" + iconPlaceholder
|
2022-02-04 05:39:38 +03:00
|
|
|
visible: false
|
2021-09-09 14:33:57 +03:00
|
|
|
sourceSize.height: unifiedSearchResultItemDetails.iconWidth
|
|
|
|
sourceSize.width: unifiedSearchResultItemDetails.iconWidth
|
|
|
|
Layout.preferredWidth: unifiedSearchResultItemDetails.iconWidth
|
|
|
|
Layout.preferredHeight: unifiedSearchResultItemDetails.iconWidth
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: unifiedSearchResultTextContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: unifiedSearchResultTitleText
|
|
|
|
text: title.replace(/[\r\n]+/g, " ")
|
|
|
|
Layout.leftMargin: textLeftMargin
|
|
|
|
Layout.rightMargin: textRightMargin
|
|
|
|
Layout.fillWidth: true
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.pixelSize: unifiedSearchResultItemDetails.titleFontSize
|
|
|
|
color: unifiedSearchResultItemDetails.titleColor
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: unifiedSearchResultTextSubline
|
|
|
|
text: subline.replace(/[\r\n]+/g, " ")
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.pixelSize: unifiedSearchResultItemDetails.sublineFontSize
|
|
|
|
Layout.leftMargin: textLeftMargin
|
|
|
|
Layout.rightMargin: textRightMargin
|
|
|
|
Layout.fillWidth: true
|
|
|
|
color: unifiedSearchResultItemDetails.sublineColor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|