uiux(StatusButton): introduce warn type

Fixes #1603
This commit is contained in:
staked-smart-ace 2021-01-14 00:26:30 +04:00 committed by Pascal Precht
parent 3f012dbf00
commit 086c868bdc
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
8 changed files with 14 additions and 5 deletions

View File

@ -192,6 +192,7 @@ Rectangle {
ConfirmationDialog {
id: deleteChatConfirmationDialog
btnType: "warn"
onConfirmButtonClicked: {
chatsModel.leaveActiveChat()
deleteChatConfirmationDialog.close()

View File

@ -60,6 +60,7 @@ ListView {
// TODO: Make ConfirmationDialog a dynamic component on a future refactor
ConfirmationDialog {
id: removeContactConfirmationDialog
btnType: "warn"
title: qsTrId("remove-contact")
//% "Are you sure you want to remove this contact?"
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")

View File

@ -57,6 +57,7 @@ Theme {
property color buttonSecondaryColor: darkGrey
property color buttonDisabledForegroundColor: buttonSecondaryColor
property color buttonDisabledBackgroundColor: evenDarkerGrey
property color buttonWarnBackgroundColor: "#FFEAEE"
property color roundedButtonForegroundColor: white
property color roundedButtonBackgroundColor: secondaryBackground

View File

@ -56,6 +56,7 @@ Theme {
property color buttonSecondaryColor: darkGrey
property color buttonDisabledForegroundColor: buttonSecondaryColor
property color buttonDisabledBackgroundColor: grey
property color buttonWarnBackgroundColor: "#FFEAEE"
property color roundedButtonForegroundColor: buttonForegroundColor
property color roundedButtonBackgroundColor: secondaryBackground

View File

@ -44,6 +44,7 @@ QtObject {
property color buttonSecondaryColor
property color buttonDisabledForegroundColor
property color buttonDisabledBackgroundColor
property color buttonWarnBackgroundColor
property color roundedButtonForegroundColor
property color roundedButtonBackgroundColor
property color roundedButtonSecondaryBackgroundColor

View File

@ -9,6 +9,7 @@ ModalPopup {
id: confirmationDialog
property Popup parentPopup
property string btnType: "primary"
height: 186
@ -39,6 +40,7 @@ ModalPopup {
height: children[0].height
StatusButton {
type: confirmationDialog.btnType
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
color: Style.current.danger

View File

@ -9,7 +9,7 @@ Button {
property string type: "primary"
property string size: "large"
property string state: "default"
property color color: Style.current.buttonForegroundColor
property color color: type === "warn" ? Style.current.danger : Style.current.buttonForegroundColor
property color bgColor: Style.current.buttonBackgroundColor
property color borderColor: color
property color bgHoverColor: Qt.darker(control.bgColor, 1.1)
@ -69,7 +69,7 @@ Button {
anchors.left: iconLoader.active ? iconLoader.right : parent.left
anchors.leftMargin: iconLoader.active ? Style.current.smallPadding : 0
color: !enabled ? Style.current.buttonDisabledForegroundColor :
(hovered || highlighted) ? Style.current.blue : control.color
(type !== "warn" && (hovered || highlighted)) ? Style.current.blue : control.color
visible: !loadingIndicator.active
}
@ -106,8 +106,11 @@ Button {
return hovered ? control.bgColor : "transparent"
}
return !enabled ? Style.current.buttonDisabledBackgroundColor :
hovered ? control.bgHoverColor :
control.bgColor
hovered ?
type === "warn" ? Qt.darker(Style.current.buttonWarnBackgroundColor, 1.1) :
control.bgHoverColor :
type === "warn" ? Style.current.buttonWarnBackgroundColor :
control.bgColor
}
}

View File

@ -654,7 +654,6 @@ Rectangle {
background: Rectangle {
color: "transparent"
}
selectionColor: Style.current.primarySelectionColor
}
Action {
shortcut: StandardKey.Bold