Files
nearby/sharing/linux/app/ShareTarget.qml
T

95 lines
2.7 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import "."
Rectangle {
id: rootItem
// Explicit sizes so parent containers know how to space them
width: 100
height: 110 // Reduced slightly since the progress outer bounds are gone
color: "transparent"
// --- CUSTOM ARGUMENTS (PROPERTIES) ---
property string deviceName: "Unknown Device"
property string iconSource: "qrc:icons/smartphone.svg"
property var shareTargetId: 0
property bool interactionEnabled: true
property bool hovered: interactionEnabled && targetMouseArea.containsMouse
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 5
// --- ICON CONTAINER ---
Item {
id: iconContainer
implicitWidth: 60
implicitHeight: 60
Layout.alignment: Qt.AlignHCenter
// Icon Circle Background
Rectangle {
id: iconCircle
anchors.fill: parent
color: rootItem.hovered ? "#195871" : "#6EA7B6"
radius: width / 2
Behavior on color {
ColorAnimation {
duration: 80
easing.type: Easing.OutQuad
}
}
Button {
id: iconButton
enabled: rootItem.interactionEnabled
icon.source: rootItem.iconSource
anchors.fill: parent
anchors.margins: 5
icon.color: "white"
icon.height: iconCircle.height
icon.width: iconCircle.width
background: Rectangle {
color: "transparent"
}
}
}
MouseArea {
id: targetMouseArea
anchors.fill: parent
enabled: rootItem.interactionEnabled
hoverEnabled: true
cursorShape: rootItem.interactionEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: {
EventBus.shareTargetSelected(rootItem.shareTargetId);
}
}
}
// --- TEXT COMPONENT ---
Text {
text: rootItem.deviceName
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
color: rootItem.hovered ? "#06384C" : "#1A1C1E"
Behavior on color {
ColorAnimation {
duration: 120
easing.type: Easing.OutQuad
}
}
}
}
}