mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-21 05:13:04 +03:00
3be820d9a3
Signed-off-by: alex-z <blackslayer4@gmail.com>
95 lines
3.4 KiB
QML
95 lines
3.4 KiB
QML
import QtQml 2.15
|
|
import QtQuick 2.9
|
|
import QtQuick.Controls 2.3
|
|
import QtQuick.Layouts 1.2
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import Style 1.0
|
|
|
|
RowLayout {
|
|
id: unifiedSearchResultItemDetails
|
|
|
|
property string title: ""
|
|
property string subline: ""
|
|
property string icons: ""
|
|
property string iconPlaceholder: ""
|
|
|
|
property bool iconsIsThumbnail: false
|
|
property bool isRounded: false
|
|
|
|
property int iconWidth: iconsIsThumbnail && icons !== "" ? Style.unifiedSearchResultIconWidth : Style.unifiedSearchResultSmallIconWidth
|
|
property int titleFontSize: Style.unifiedSearchResultTitleFontSize
|
|
property int sublineFontSize: Style.unifiedSearchResultSublineFontSize
|
|
|
|
property color titleColor: Style.ncTextColor
|
|
property color sublineColor: Style.ncSecondaryTextColor
|
|
|
|
|
|
Accessible.role: Accessible.ListItem
|
|
Accessible.name: resultTitle
|
|
Accessible.onPressAction: unifiedSearchResultMouseArea.clicked()
|
|
|
|
spacing: Style.trayHorizontalMargin
|
|
|
|
Item {
|
|
id: unifiedSearchResultImageContainer
|
|
|
|
property int whiteSpace: (Style.trayListItemIconSize - unifiedSearchResultItemDetails.iconWidth)
|
|
|
|
Layout.preferredWidth: unifiedSearchResultItemDetails.iconWidth
|
|
Layout.preferredHeight: unifiedSearchResultItemDetails.iconWidth
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
|
Layout.leftMargin: Style.trayHorizontalMargin + (whiteSpace * (0.5 - Style.thumbnailImageSizeReduction))
|
|
Layout.rightMargin: whiteSpace * (0.5 + Style.thumbnailImageSizeReduction)
|
|
|
|
Image {
|
|
id: unifiedSearchResultThumbnail
|
|
anchors.fill: parent
|
|
visible: false
|
|
asynchronous: true
|
|
source: "image://tray-image-provider/" + unifiedSearchResultItemDetails.icons
|
|
cache: true
|
|
verticalAlignment: Qt.AlignVCenter
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
sourceSize.width: width
|
|
sourceSize.height: height
|
|
}
|
|
Rectangle {
|
|
id: mask
|
|
anchors.fill: unifiedSearchResultThumbnail
|
|
visible: false
|
|
radius: unifiedSearchResultItemDetails.isRounded ? width / 2 : 3
|
|
}
|
|
OpacityMask {
|
|
id: imageData
|
|
anchors.fill: unifiedSearchResultThumbnail
|
|
visible: unifiedSearchResultItemDetails.icons !== ""
|
|
source: unifiedSearchResultThumbnail
|
|
maskSource: mask
|
|
}
|
|
Image {
|
|
id: unifiedSearchResultThumbnailPlaceholder
|
|
anchors.fill: parent
|
|
verticalAlignment: Qt.AlignVCenter
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
cache: true
|
|
source: "image://tray-image-provider/" + unifiedSearchResultItemDetails.iconPlaceholder
|
|
visible: unifiedSearchResultItemDetails.iconPlaceholder !== "" && unifiedSearchResultItemDetails.icons === ""
|
|
sourceSize.height: unifiedSearchResultItemDetails.iconWidth
|
|
sourceSize.width: unifiedSearchResultItemDetails.iconWidth
|
|
}
|
|
}
|
|
|
|
ListItemLineAndSubline {
|
|
id: unifiedSearchResultTextContainer
|
|
|
|
spacing: Style.standardSpacing
|
|
|
|
Layout.fillWidth: true
|
|
Layout.rightMargin: Style.trayHorizontalMargin
|
|
|
|
lineText: unifiedSearchResultItemDetails.title.replace(/[\r\n]+/g, " ")
|
|
sublineText: unifiedSearchResultItemDetails.subline.replace(/[\r\n]+/g, " ")
|
|
}
|
|
|
|
}
|