slight changes to clipboard history preview and item delegate
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,111 +133,103 @@ 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
|
||||||
spacing: Appearance.spacing.small
|
implicitWidth: view.width
|
||||||
width: view.width
|
radius: textLayer.pressed ? (Appearance.rounding.small / 2) : Appearance.rounding.small
|
||||||
|
|
||||||
CustomClippingRect {
|
Behavior on radius {
|
||||||
id: textRect
|
Anim {
|
||||||
|
type: Anim.FastEffects
|
||||||
Layout.fillHeight: 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 {
|
RowLayout {
|
||||||
id: textWrapper
|
anchors.fill: parent
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
anchors.fill: parent
|
CustomClippingRect {
|
||||||
layer.enabled: true
|
id: textRect
|
||||||
|
|
||||||
layer.effect: OpacityMask {
|
Layout.fillHeight: true
|
||||||
maskSource: fadeMask
|
Layout.fillWidth: true
|
||||||
}
|
|
||||||
|
|
||||||
MaterialIcon {
|
Item {
|
||||||
id: icon
|
id: textWrapper
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.fill: parent
|
||||||
anchors.margins: Appearance.padding.normal
|
layer.enabled: true
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
font.pointSize: Appearance.font.size.large
|
|
||||||
text: clipItem.isImage ? "image" : "text_fields"
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
layer.effect: OpacityMask {
|
||||||
id: text
|
maskSource: fadeMask
|
||||||
|
|
||||||
anchors.left: icon.right
|
|
||||||
anchors.margins: Appearance.spacing.normal
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
elide: Text.ElideRight
|
|
||||||
text: clipItem.isImage ? qsTr("Image") : ClipHistory.displayText(clipItem.modelData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomRect {
|
|
||||||
id: fadeMask
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
layer.enabled: true
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
gradient: Gradient {
|
|
||||||
orientation: Gradient.Horizontal
|
|
||||||
|
|
||||||
GradientStop {
|
|
||||||
color: Qt.rgba(1, 1, 1, 1.0)
|
|
||||||
position: 0.85
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GradientStop {
|
MaterialIcon {
|
||||||
color: Qt.rgba(1, 1, 1, 0)
|
id: icon
|
||||||
position: 1.0
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.margins: Appearance.padding.normal
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
text: clipItem.isImage ? "image" : "text_fields"
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
anchors.left: icon.right
|
||||||
|
anchors.margins: Appearance.spacing.normal
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
text: clipItem.isImage ? qsTr("Image") : ClipHistory.displayText(clipItem.modelData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomRect {
|
||||||
|
id: fadeMask
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
layer.enabled: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
gradient: Gradient {
|
||||||
|
orientation: Gradient.Horizontal
|
||||||
|
|
||||||
|
GradientStop {
|
||||||
|
color: Qt.rgba(1, 1, 1, 1.0)
|
||||||
|
position: 0.85
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientStop {
|
||||||
|
color: Qt.rgba(1, 1, 1, 0)
|
||||||
|
position: 1.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StateLayer {
|
IconButton {
|
||||||
id: textLayer
|
Layout.fillHeight: true
|
||||||
|
Layout.margins: Appearance.padding.normal
|
||||||
|
Layout.preferredWidth: height
|
||||||
|
icon: "delete"
|
||||||
|
inactiveColor: Qt.alpha(DynamicColors.palette.m3error, 0.8)
|
||||||
|
inactiveOnColor: DynamicColors.palette.m3onError
|
||||||
|
isToggle: false
|
||||||
|
|
||||||
onClicked: ClipHistory.copy(clipItem.modelData)
|
onClicked: ClipHistory.deleteEntry(clipItem.modelData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton {
|
StateLayer {
|
||||||
Layout.bottomMargin: Appearance.padding.normal
|
id: textLayer
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.preferredWidth: height
|
|
||||||
Layout.topMargin: Appearance.padding.normal
|
|
||||||
icon: "content_copy"
|
|
||||||
isToggle: false
|
|
||||||
}
|
|
||||||
|
|
||||||
IconButton {
|
onClicked: ClipHistory.copy(clipItem.modelData)
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.margins: Appearance.padding.normal
|
|
||||||
Layout.preferredWidth: height
|
|
||||||
icon: "delete"
|
|
||||||
inactiveColor: Qt.alpha(DynamicColors.palette.m3error, 0.8)
|
|
||||||
inactiveOnColor: DynamicColors.palette.m3onError
|
|
||||||
isToggle: false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
highlight: CustomRect {
|
highlight: CustomRect {
|
||||||
|
|||||||
Reference in New Issue
Block a user