From e5d77a46d6aa3509449085b52905846ad199d49d Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 30 Jun 2021 17:04:55 +0200 Subject: [PATCH] Remove 'roundedness' and 'shadow' from action-buttons. Per the new UI design. Keep them as deprecated properties, so we may not need a major API/SDK increase just yet. contributes to CURA-8012 --- resources/qml/ActionButton.qml | 67 +++++++++++++------ .../ActionPanel/OutputDevicesActionButton.qml | 7 +- resources/qml/PrimaryButton.qml | 4 +- resources/qml/SecondaryButton.qml | 4 +- resources/qml/TertiaryButton.qml | 4 +- 5 files changed, 50 insertions(+), 36 deletions(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 0c1be007b5..c5c0c0be08 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2020 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -18,7 +18,6 @@ Button property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.tooltipText - property alias cornerSide: backgroundRect.cornerSide property color color: UM.Theme.getColor("primary") property color hoverColor: UM.Theme.getColor("primary_hover") @@ -29,8 +28,6 @@ Button property color outlineColor: color property color outlineHoverColor: hoverColor property color outlineDisabledColor: outlineColor - property alias shadowColor: shadow.color - property alias shadowEnabled: shadow.visible property alias busy: busyIndicator.visible property bool underlineTextOnHover: false @@ -46,6 +43,49 @@ Button // but it can exceed a maximum, then this value have to be set. property int maximumWidth: 0 + // These properties are deprecated. + // To (maybe) prevent a major SDK upgrade, mark them as deprecated instead of just outright removing them. + // Note, if you still want rounded corners, use (something based on) Cura.RoundedRectangle. + property alias cornerSide: deprecatedProperties.cornerSide + property alias shadowColor: deprecatedProperties.shadowColor + property alias shadowEnabled: deprecatedProperties.shadowEnabled + + Item + { + id: deprecatedProperties + + visible: false + enabled: false + width: 0 + height: 0 + + property var cornerSide: null + property var shadowColor: null + property var shadowEnabled: null + + onCornerSideChanged: + { + if (cornerSide != null) + { + CuraApplication.writeToLog("w", "'ActionButton.cornerSide' is deprecated since 4.11. Rounded corners can still be made with 'Cura.RoundedRectangle'."); + } + } + onShadowColorChanged: + { + if (shadowColor != null) + { + CuraApplication.writeToLog("w", "'ActionButton.shadowColor' is deprecated since 4.11.") + } + } + onShadowEnabledChanged: + { + if (shadowEnabled != null) + { + CuraApplication.writeToLog("w", "'ActionButton.shadowEnabled' is deprecated since 4.11.") + } + } + } + leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("action_button").height @@ -127,29 +167,14 @@ Button } } - background: Cura.RoundedRectangle + background: Rectangle { id: backgroundRect - cornerSide: Cura.RoundedRectangle.Direction.All color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor - radius: UM.Theme.getSize("action_button_radius").width border.width: UM.Theme.getSize("default_lining").width border.color: button.enabled ? (button.hovered ? button.outlineHoverColor : button.outlineColor) : button.outlineDisabledColor } - DropShadow - { - id: shadow - // Don't blur the shadow - radius: 0 - anchors.fill: backgroundRect - source: backgroundRect - verticalOffset: 2 - visible: false - // Should always be drawn behind the background. - z: backgroundRect.z - 1 - } - Cura.ToolTip { id: tooltip @@ -189,4 +214,4 @@ Button duration: 2500 } } -} \ No newline at end of file +} diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index 6d1a1d83dd..0a49c59c77 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.7 @@ -23,7 +23,6 @@ Item id: saveToButton height: parent.height fixedWidthMode: true - cornerSide: deviceSelectionMenu.visible ? Cura.RoundedRectangle.Direction.Left : Cura.RoundedRectangle.Direction.All anchors { @@ -48,10 +47,6 @@ Item id: deviceSelectionMenu height: parent.height - shadowEnabled: true - shadowColor: UM.Theme.getColor("primary_shadow") - cornerSide: Cura.RoundedRectangle.Direction.Right - anchors { top: parent.top diff --git a/resources/qml/PrimaryButton.qml b/resources/qml/PrimaryButton.qml index fca63d2cdb..52c460bde4 100644 --- a/resources/qml/PrimaryButton.qml +++ b/resources/qml/PrimaryButton.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -9,8 +9,6 @@ import Cura 1.1 as Cura Cura.ActionButton { - shadowEnabled: true - shadowColor: enabled ? UM.Theme.getColor("primary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") color: UM.Theme.getColor("primary_button") textColor: UM.Theme.getColor("primary_button_text") outlineColor: "transparent" diff --git a/resources/qml/SecondaryButton.qml b/resources/qml/SecondaryButton.qml index f03d8acdfa..09c4efa025 100644 --- a/resources/qml/SecondaryButton.qml +++ b/resources/qml/SecondaryButton.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -9,8 +9,6 @@ import Cura 1.1 as Cura Cura.ActionButton { - shadowEnabled: true - shadowColor: enabled ? UM.Theme.getColor("secondary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") color: UM.Theme.getColor("secondary_button") textColor: UM.Theme.getColor("secondary_button_text") outlineColor: "transparent" diff --git a/resources/qml/TertiaryButton.qml b/resources/qml/TertiaryButton.qml index eb714c22f6..76684b6ef2 100644 --- a/resources/qml/TertiaryButton.qml +++ b/resources/qml/TertiaryButton.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2020 Ultimaker B.V. +// Copyright (c) 2021 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 @@ -9,8 +9,6 @@ import Cura 1.1 as Cura Cura.ActionButton { - shadowEnabled: true - shadowColor: enabled ? UM.Theme.getColor("secondary_button_shadow"): UM.Theme.getColor("action_button_disabled_shadow") color: "transparent" textColor: UM.Theme.getColor("text_link") outlineColor: "transparent"