fix(Community): Use design color picker

Close #2395
This commit is contained in:
mishkarogachev 2022-05-18 15:21:03 +03:00 committed by Mikhail Rogachev
parent c3c82bd6ac
commit 491abb7fda
4 changed files with 37 additions and 29 deletions

@ -1 +1 @@
Subproject commit 485647d1c36a6bd87ac8715f3989f0052621b816 Subproject commit 81cbab3f66480da7ba6b27ee433d4d4d43abde76

View File

@ -12,15 +12,17 @@ import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
import StatusQ.Layout 0.1 import StatusQ.Layout 0.1
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Popups 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1 import StatusQ.Controls.Validators 0.1
Flickable { Flickable {
id: root id: root
property color color: Theme.palette.primaryColor1
property alias name: nameInput.text property alias name: nameInput.text
property alias description: descriptionTextInput.text property alias description: descriptionTextInput.text
property alias color: colorDialog.color
property alias image: addImageButton.selectedImage property alias image: addImageButton.selectedImage
readonly property alias imageAx: imageCropperModal.aX readonly property alias imageAx: imageCropperModal.aX
readonly property alias imageAy: imageCropperModal.aY readonly property alias imageAy: imageCropperModal.aY
@ -220,25 +222,29 @@ Flickable {
property string validationError: "" property string validationError: ""
bgColor: colorDialog.colorSelected ? colorDialog.color : Theme.palette.baseColor2 bgColor: root.color
contentColor: colorDialog.colorSelected ? Theme.palette.indirectColor1 : Theme.palette.baseColor1 contentColor: Theme.palette.indirectColor1
text: colorDialog.colorSelected ? colorDialog.color.toString( text: root.color.toString()
).toUpperCase() : qsTr("Pick a color")
onClicked: colorDialog.open() onClicked: {
colorDialog.color = root.color;
colorDialog.open();
}
onTextChanged: { onTextChanged: {
if (colorDialog.colorSelected) { validationError = Utils.validateAndReturnError(text,
validationError = Utils.validateAndReturnError( Utils.Validate.NoEmpty |
text, Utils.Validate.TextHexColor);
Utils.Validate.NoEmpty | Utils.Validate.TextHexColor)
}
} }
ColorDialog { StatusColorDialog {
id: colorDialog id: colorDialog
property bool colorSelected: true anchors.centerIn: parent
color: Theme.palette.primaryColor1 header.title: qsTr("Community Colour")
onAccepted: colorSelected = true previewText: qsTr("White text should be legable on top of this colour")
acceptText: qsTr("Select Community Colour")
onAccepted: {
root.color = color;
}
} }
} }
} }

View File

@ -185,14 +185,15 @@ StatusModal {
validationError = Utils.validateAndReturnError(text, communityColorValidator) validationError = Utils.validateAndReturnError(text, communityColorValidator)
} }
} }
}
ColorDialog { StatusColorDialog {
id: colorDialog id: colorDialog
property bool colorSelected: popup.isEdit && popup.channelColor anchors.centerIn: parent
color: popup.isEdit && popup.channelColor ? popup.channelColor : property bool colorSelected: popup.isEdit && popup.channelColor
Theme.palette.primaryColor1 color: popup.isEdit && popup.channelColor ? popup.channelColor :
onAccepted: colorSelected = true Theme.palette.primaryColor1
} onAccepted: colorSelected = true
} }
StatusBaseText { StatusBaseText {

View File

@ -274,13 +274,14 @@ StatusModal {
validationError = Utils.validateAndReturnError(text, communityColorValidator) validationError = Utils.validateAndReturnError(text, communityColorValidator)
} }
} }
}
ColorDialog { StatusColorDialog {
id: colorDialog id: colorDialog
property bool colorSelected: false anchors.centerIn: parent
color: Theme.palette.primaryColor1 property bool colorSelected: false
onAccepted: colorSelected = true color: Theme.palette.primaryColor1
} onAccepted: colorSelected = true
} }
StatusBaseText { StatusBaseText {