2023-05-11 10:29:19 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtGraphicalEffects 1.12
|
|
|
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
2023-05-22 15:55:47 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2023-05-11 10:29:19 +00:00
|
|
|
Loader {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var overview
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
sourceComponent: root.overview && root.overview.isAllAccounts ? multipleAccountsGradient : singleAccountGradient
|
2023-05-11 10:29:19 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: singleAccountGradient
|
|
|
|
Rectangle {
|
|
|
|
implicitHeight: 115
|
|
|
|
gradient: Gradient {
|
2023-07-18 09:10:48 +00:00
|
|
|
GradientStop { position: 0.0; color: overview && overview.colorId ? Theme.palette.alphaColor(Utils.getColorForId(overview.colorId), 0.1) : "" }
|
2023-05-11 10:29:19 +00:00
|
|
|
GradientStop { position: 1.0; color: "transparent" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id: multipleAccountsGradient
|
|
|
|
Item {
|
|
|
|
implicitHeight: 115
|
|
|
|
Rectangle {
|
|
|
|
id: base
|
|
|
|
anchors.fill: parent
|
|
|
|
Component.onCompleted: {
|
2023-05-22 15:55:47 +00:00
|
|
|
let splitWords = root.overview.colorIds.split(';')
|
2023-05-11 10:29:19 +00:00
|
|
|
|
|
|
|
var stops = []
|
|
|
|
let numOfColors = splitWords.length
|
|
|
|
let gap = 1/splitWords.length
|
|
|
|
let startPosition = gap
|
|
|
|
for (const word of splitWords) {
|
2023-05-22 15:55:47 +00:00
|
|
|
stops.push(stopComponent.createObject(base, {"position":startPosition, "color": Theme.palette.alphaColor(Utils.getColorForId(word), 0.1)}))
|
2023-05-11 10:29:19 +00:00
|
|
|
startPosition += gap
|
|
|
|
}
|
|
|
|
gradient.stops = stops
|
|
|
|
}
|
|
|
|
|
|
|
|
gradient: Gradient {
|
|
|
|
id: gradient
|
|
|
|
orientation: Gradient.Horizontal
|
|
|
|
}
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: mask
|
|
|
|
anchors.fill: parent
|
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop { position: 0.0; color: Theme.palette.statusAppLayout.rightPanelBackgroundColor}
|
|
|
|
GradientStop { position: 1.0; color: "transparent" }
|
|
|
|
}
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
|
|
|
OpacityMask {
|
|
|
|
anchors.fill: base
|
|
|
|
source: base
|
|
|
|
maskSource: mask
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component {
|
|
|
|
id:stopComponent
|
|
|
|
GradientStop {}
|
|
|
|
}
|
|
|
|
}
|