shift-shell/containments/homescreens/folio/qml/delegate/DelegateFolderIcon.qml
Marco Allegretti a37734b74a Move homescreens to shared motion
Use Motion wrappers and state layers across Folio and Halcyon delegates, drawers, folders, resize handles, and dock feedback. Also align Folio edit/drop highlights with theme colors instead of fixed white overlays.
2026-05-21 11:13:36 +02:00

71 lines
2.2 KiB
QML

// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as Controls
import QtQuick.Effects
import org.kde.kirigami as Kirigami
import plasma.applet.org.kde.plasma.mobile.homescreen.folio as Folio
import org.kde.plasma.private.mobileshell as MobileShell
Item {
id: root
property Folio.HomeScreen folio
property MobileShell.MaskManager maskManager
property Folio.FolioApplicationFolder folder
property bool expandBackground: false
readonly property int longAnimationDuration: MobileShell.Motion.duration(MobileShell.Motion.Standard)
readonly property color folderFeedbackColor: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.28)
height: folio.FolioSettings.delegateIconSize
width: folio.FolioSettings.delegateIconSize
Rectangle {
id: rect
radius: Kirigami.Units.cornerRadius
color: root.folderFeedbackColor
anchors.fill: parent
Component.onCompleted: {
if (maskManager) {
maskManager.assignToMask(this)
}
}
property real scaleAmount: root.expandBackground ? 1.08 : 1.0
Behavior on scaleAmount { MobileShell.MotionNumberAnimation { type: MobileShell.Motion.Standard; duration: root.longAnimationDuration } }
transform: Scale {
origin.x: root.width / 2
origin.y: root.height / 2
xScale: rect.scaleAmount
yScale: rect.scaleAmount
}
}
Grid {
id: previewGrid
anchors.fill: parent
anchors.margins: Kirigami.Units.smallSpacing * 2
columns: 2
spacing: Kirigami.Units.smallSpacing
property var previews: root.folder.appPreviews
Repeater {
model: previewGrid.previews
delegate: Kirigami.Icon {
implicitWidth: Math.round((previewGrid.width - previewGrid.spacing) / 2)
implicitHeight: Math.round((previewGrid.width - previewGrid.spacing) / 2)
source: modelData.icon
}
}
}
}