2021-07-29 13:33:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.3
|
2021-08-02 07:11:28 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import "../../imports"
|
2021-07-29 13:33:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: root
|
2021-08-02 07:11:28 +00:00
|
|
|
spacing: 8
|
2021-07-29 13:33:22 +00:00
|
|
|
property alias gifList: repeater
|
|
|
|
property var gifWidth: 0
|
|
|
|
property var gifSelected: function () {}
|
2021-08-03 08:48:06 +00:00
|
|
|
property var toggleFavorite: function () {}
|
2021-07-29 13:33:22 +00:00
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: repeater
|
|
|
|
|
|
|
|
delegate: Rectangle {
|
2021-08-02 07:11:28 +00:00
|
|
|
height: animation.status != Image.Ready ? loader.height : animation.height
|
2021-07-29 13:33:22 +00:00
|
|
|
width: root.gifWidth
|
2021-08-02 07:11:28 +00:00
|
|
|
color: Style.current.background
|
|
|
|
border.color: Style.current.border
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: loader
|
|
|
|
height: 100
|
|
|
|
width: root.gifWidth
|
|
|
|
visible: animation.status != Image.Ready
|
|
|
|
radius: Style.current.radius
|
|
|
|
rotation: 90
|
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop { position: 0.0; color: "transparent" }
|
|
|
|
GradientStop { position: 1.0; color: "#E6EEF2" }
|
|
|
|
}
|
|
|
|
}
|
2021-07-29 13:33:22 +00:00
|
|
|
|
2021-08-03 08:48:06 +00:00
|
|
|
StatusIconButton {
|
|
|
|
id: starButton
|
|
|
|
icon.name: "star-icon"
|
|
|
|
iconColor: {
|
|
|
|
if (model.isFavorite) {
|
|
|
|
return Style.current.yellow
|
|
|
|
}
|
|
|
|
return Style.current.secondaryText
|
|
|
|
}
|
|
|
|
hoveredIconColor: {
|
|
|
|
if (iconColor === Style.current.yellow) {
|
|
|
|
return Style.current.secondaryText
|
|
|
|
}
|
|
|
|
return Style.current.yellow
|
|
|
|
}
|
|
|
|
highlightedBackgroundOpacity: 0
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
width: 24
|
|
|
|
height: 24
|
|
|
|
z: 1
|
|
|
|
padding: 10
|
|
|
|
onClicked: {
|
|
|
|
root.toggleFavorite(model)
|
|
|
|
if (starButton.iconColor === Style.current.yellow) {
|
|
|
|
starButton.iconColor = Style.current.secondaryText
|
|
|
|
} else {
|
|
|
|
starButton.iconColor = Style.current.yellow
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-29 13:33:22 +00:00
|
|
|
AnimatedImage {
|
|
|
|
id: animation
|
2021-08-02 07:11:28 +00:00
|
|
|
visible: animation.status == Image.Ready
|
|
|
|
source: model.tinyUrl
|
2021-07-29 13:33:22 +00:00
|
|
|
width: root.gifWidth
|
|
|
|
fillMode: Image.PreserveAspectFit
|
2021-08-03 08:48:06 +00:00
|
|
|
z: 0
|
2021-08-02 07:11:28 +00:00
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: OpacityMask {
|
|
|
|
maskSource: Rectangle {
|
|
|
|
width: animation.width
|
|
|
|
height: animation.height
|
|
|
|
radius: Style.current.radius
|
|
|
|
color: Style.current.background
|
|
|
|
border.color: Style.current.border
|
|
|
|
}
|
|
|
|
}
|
2021-07-29 13:33:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
2021-08-03 08:48:06 +00:00
|
|
|
id: mouseArea
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2021-07-29 13:33:22 +00:00
|
|
|
anchors.fill: parent
|
2021-08-03 08:48:06 +00:00
|
|
|
hoverEnabled: true
|
2021-07-29 13:33:22 +00:00
|
|
|
onClicked: function (event) {
|
|
|
|
root.gifSelected(event, model.url)
|
2021-08-03 08:48:06 +00:00
|
|
|
chatsModel.gif.addToRecents(model.id)
|
2021-07-29 13:33:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorColor:"#ffffff";height:440;width:360}
|
|
|
|
}
|
|
|
|
##^##*/
|