2020-10-27 20:53:22 +00:00
|
|
|
import QtQuick 2.13
|
2021-08-17 17:03:03 +00:00
|
|
|
|
|
|
|
import StatusQ.Components 0.1 as StatusQ
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-10-27 20:53:22 +00:00
|
|
|
|
|
|
|
Item {
|
2021-08-17 17:03:03 +00:00
|
|
|
property url webUrl
|
2020-10-30 15:46:47 +00:00
|
|
|
property url source
|
2020-10-27 20:53:22 +00:00
|
|
|
property string text
|
2020-10-29 20:07:52 +00:00
|
|
|
signal clicked(mouse: var)
|
|
|
|
signal rightClicked(mouse: var)
|
2020-10-27 20:53:22 +00:00
|
|
|
|
|
|
|
id: root
|
|
|
|
width: 74
|
2021-08-17 17:03:03 +00:00
|
|
|
height: 48 + Style.current.halfPadding
|
2020-10-27 20:53:22 +00:00
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: bookmarkImage
|
|
|
|
width: 48
|
|
|
|
height: 48
|
2021-08-17 17:03:03 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-09-28 15:04:06 +00:00
|
|
|
source: !!root.source && !!root.source.toString() ? root.source : Style.svg("compassActive")
|
2021-08-17 17:03:03 +00:00
|
|
|
visible: root.source && root.source.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusQ.StatusRoundIcon {
|
|
|
|
id: addButton
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: "add"
|
|
|
|
asset.color: Theme.palette.baseColor1
|
2021-08-17 17:03:03 +00:00
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
visible: !webUrl.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusQ.StatusLetterIdenticon {
|
|
|
|
id: identicon
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
identiconText.text: text.charAt(0)
|
|
|
|
identiconText.color: Theme.palette.baseColor1
|
|
|
|
visible: !bookmarkImage.visible && !addButton.visible
|
2020-10-27 20:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: bookmarkName
|
|
|
|
text: root.text
|
2021-08-17 17:03:03 +00:00
|
|
|
width: 67
|
2020-10-27 20:53:22 +00:00
|
|
|
anchors.top: bookmarkImage.bottom
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2021-08-17 17:03:03 +00:00
|
|
|
font.pixelSize: Style.current.additionalTextSize
|
2020-10-27 20:53:22 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
2021-08-17 17:03:03 +00:00
|
|
|
maximumLineCount: 2
|
|
|
|
elide: Text.ElideRight
|
2022-03-17 17:59:00 +00:00
|
|
|
textFormat: Text.PlainText
|
2020-10-27 20:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2020-10-29 20:07:52 +00:00
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
onClicked: {
|
2020-12-29 17:10:22 +00:00
|
|
|
if (mouse.button === Qt.RightButton) {
|
2020-10-29 20:07:52 +00:00
|
|
|
root.rightClicked(mouse)
|
|
|
|
} else {
|
|
|
|
root.clicked(mouse)
|
|
|
|
}
|
|
|
|
}
|
2020-10-27 20:53:22 +00:00
|
|
|
}
|
|
|
|
}
|