Alexandra Betouni 4ee21ada05 feat(desktop) Added image function in Style
Introduced Style.svg() Style.png() Style.emoji() and
Style.icon() in Style.qml. Those should be used to
set the source in Images instead of using relative
paths. Usage:
Image {
   source: Style.svg("check)
   ....

Also moved all Singletons inside a new "utils"
folder and made it a QML module, to use
import utils 1.0 instead of relative paths

Closes #3678
2021-09-28 15:28:00 -04:00

96 lines
2.8 KiB
QML

import QtQuick 2.13
import QtGraphicalEffects 1.13
import QtQuick.Layouts 1.13
import "./" as MessageComponents
import utils 1.0
import "../../../../../shared"
Item {
id: root
default property alias inner: contents.children
property bool isCurrentUser: false
readonly property int smallCorner: Style.current.radius / 2
readonly property int bigCorner: Style.current.radius * 2
readonly property int fakeCornerSize: bigCorner * 2
Rectangle {
width: parent.width + 2
height: parent.height + 2
anchors.top: parent.top
anchors.left: parent.left
anchors.topMargin: -1
anchors.leftMargin: -1
radius: root.bigCorner
border.width: 2
border.color: Style.current.border
}
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.bottomMargin: -1
anchors.leftMargin: -1
width: root.fakeCornerSize
height: root.fakeCornerSize
radius: root.smallCorner
visible: !root.isCurrentUser
border.width: 2
border.color: Style.current.border
}
Rectangle {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.bottomMargin: -1
anchors.rightMargin: -1
width: root.fakeCornerSize
height: root.fakeCornerSize
radius: root.smallCorner
visible: root.isCurrentUser
border.width: 2
border.color: Style.current.border
}
Rectangle {
anchors.fill: parent
color: Style.current.background
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Item {
width: root.width
height: root.height
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
width: parent.width
height: parent.height
radius: root.bigCorner
}
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
width: root.fakeCornerSize
height: root.fakeCornerSize
radius: root.smallCorner
visible: !root.isCurrentUser
}
Rectangle {
anchors.bottom: parent.bottom
anchors.right: parent.right
width: root.fakeCornerSize
height: root.fakeCornerSize
radius: root.smallCorner
visible: root.isCurrentUser
}
}
}
Item {
id: contents
width: root.width
height: root.height
}
}
}