status-desktop/ui/shared/status/StatusWalletColorSelect.qml
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

61 lines
1.7 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "../../shared"
import "../../shared/status"
Item {
id: control
property string selectedColor
//% "Account color"
property string label: qsTrId("account-color")
property var model: Style.current.accountColors
height: childrenRect.height
StyledText {
id: label
text: control.label
font.weight: Font.Medium
anchors.left: parent.left
anchors.top: parent.top
font.pixelSize: 13
height: 18
}
RowLayout {
id: colors
spacing: 6
anchors.top: label.bottom
anchors.topMargin: Style.current.halfPadding
anchors.left: parent.left
anchors.right: parent.right
Repeater {
model: control.model
StatusWalletColorButton {
id: colorBtn
icon.color: modelData
selected: {
const upperCaseColor = control.selectedColor.toUpperCase()
const upperCaseModelDataColor = modelData.toString().toUpperCase()
if (upperCaseColor === upperCaseModelDataColor) {
return true
}
// Check the colors in the other theme
const currentColor = Utils.getCurrentThemeAccountColor(upperCaseColor)
if (!currentColor) {
return false
}
return currentColor === upperCaseModelDataColor
}
onClicked: {
control.selectedColor = modelData.toUpperCase()
}
}
}
}
}