slight changes to clipboard history preview and item delegate
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 10s
Python / lint-format (pull_request) Successful in 16s
Python / test (pull_request) Successful in 32s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m10s

This commit is contained in:
2026-06-14 23:33:12 +02:00
parent 2a50732bc2
commit 7e38f3f428
2 changed files with 85 additions and 88 deletions
+9 -4
View File
@@ -27,8 +27,7 @@ Text {
enabled: root.animate enabled: root.animate
SequentialAnimation { SequentialAnimation {
Anim { TAnim {
property: root.animateProp
target: root target: root
to: root.animateFrom to: root.animateFrom
type: Anim.FastEffects type: Anim.FastEffects
@@ -37,12 +36,18 @@ Text {
PropertyAction { PropertyAction {
} }
Anim { TAnim {
property: root.animateProp
target: root target: root
to: root.animateTo to: root.animateTo
type: Anim.DefaultEffects type: Anim.DefaultEffects
} }
} }
} }
component TAnim: Anim {
duration: root.animateDuration / 2
properties: root.animateProp.split(",").length > 1 ? root.animateProp : ""
property: root.animateProp.split(",").length === 1 ? root.animateProp : ""
target: root
}
} }
+25 -33
View File
@@ -71,7 +71,7 @@ Item {
anchors.leftMargin: Appearance.spacing.normal anchors.leftMargin: Appearance.spacing.normal
anchors.top: parent.top anchors.top: parent.top
color: DynamicColors.tPalette.m3surfaceContainer color: DynamicColors.tPalette.m3surfaceContainer
implicitWidth: ClipHistory.previewIsImage ? Math.max(Math.min(imagePreview.sourceSize.width + imagePreview.anchors.margins * 2, Config.clipboard.sizes.previewWidth), Config.clipboard.sizes.minPreviewWidth) : Math.max(Math.min(textPreview.paintedWidth + textPreview.anchors.margins * 2, Config.clipboard.sizes.previewWidth), Config.clipboard.sizes.minPreviewWidth) implicitWidth: ClipHistory.previewIsImage ? Math.max(Math.min(imagePreview.sourceSize.width + Appearance.padding.large * 2, Config.clipboard.sizes.previewWidth), Config.clipboard.sizes.minPreviewWidth) : Math.max(Math.min(textPreview.paintedWidth + textPreview.anchors.margins * 2, Config.clipboard.sizes.previewWidth), Config.clipboard.sizes.minPreviewWidth)
radius: 25 radius: 25
Behavior on implicitWidth { Behavior on implicitWidth {
@@ -96,8 +96,7 @@ Item {
Image { Image {
id: imagePreview id: imagePreview
anchors.fill: parent anchors.centerIn: parent
anchors.margins: Appearance.padding.large
asynchronous: true asynchronous: true
cache: false cache: false
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@@ -106,6 +105,7 @@ Item {
smooth: true smooth: true
source: ClipHistory.previewImageSource source: ClipHistory.previewImageSource
visible: ClipHistory.previewIsImage && ClipHistory.previewImageSource !== "" visible: ClipHistory.previewIsImage && ClipHistory.previewImageSource !== ""
width: Math.min(sourceSize.width, Config.clipboard.sizes.previewWidth)
} }
} }
@@ -133,33 +133,31 @@ Item {
flickable: view flickable: view
minimumSize: 0.1 minimumSize: 0.1
} }
delegate: RowLayout { delegate: CustomRect {
id: clipItem id: clipItem
readonly property bool isImage: ClipHistory.entryIsImage(modelData) readonly property bool isImage: ClipHistory.entryIsImage(modelData)
required property string modelData required property string modelData
height: root.itemHeight implicitHeight: root.itemHeight
implicitWidth: view.width
radius: textLayer.pressed ? (Appearance.rounding.small / 2) : Appearance.rounding.small
Behavior on radius {
Anim {
type: Anim.FastEffects
}
}
RowLayout {
anchors.fill: parent
spacing: Appearance.spacing.small spacing: Appearance.spacing.small
width: view.width
CustomClippingRect { CustomClippingRect {
id: textRect id: textRect
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
radius: textLayer.pressed ? (Appearance.rounding.small / 2) : Appearance.rounding.small
Behavior on Layout.preferredWidth {
Anim {
type: Anim.FastEffects
}
}
Behavior on radius {
Anim {
type: Anim.FastEffects
}
}
Item { Item {
id: textWrapper id: textWrapper
@@ -213,21 +211,6 @@ Item {
} }
} }
} }
StateLayer {
id: textLayer
onClicked: ClipHistory.copy(clipItem.modelData)
}
}
IconButton {
Layout.bottomMargin: Appearance.padding.normal
Layout.fillHeight: true
Layout.preferredWidth: height
Layout.topMargin: Appearance.padding.normal
icon: "content_copy"
isToggle: false
} }
IconButton { IconButton {
@@ -238,6 +221,15 @@ Item {
inactiveColor: Qt.alpha(DynamicColors.palette.m3error, 0.8) inactiveColor: Qt.alpha(DynamicColors.palette.m3error, 0.8)
inactiveOnColor: DynamicColors.palette.m3onError inactiveOnColor: DynamicColors.palette.m3onError
isToggle: false isToggle: false
onClicked: ClipHistory.deleteEntry(clipItem.modelData)
}
}
StateLayer {
id: textLayer
onClicked: ClipHistory.copy(clipItem.modelData)
} }
} }
highlight: CustomRect { highlight: CustomRect {