Add the 'safe to profile' button itself.

Currently only works for creating a new profile from current changes (when on top of a built-in profile). Only does the compare (not the safe yet) in the other circumstance. Also already anticipate the next commits by being able to hide the text and icon (because this will be added to the custom mode view as well).

part of CURA-9347
This commit is contained in:
Remco Burema 2022-11-29 22:54:30 +01:00
parent fb917a88fb
commit 0ea2830108
3 changed files with 47 additions and 9 deletions

View File

@ -710,6 +710,7 @@ class CuraApplication(QtApplication):
showDiscardOrKeepProfileChanges = pyqtSignal() showDiscardOrKeepProfileChanges = pyqtSignal()
@pyqtSlot()
def discardOrKeepProfileChanges(self) -> bool: def discardOrKeepProfileChanges(self) -> bool:
has_user_interaction = False has_user_interaction = False
choice = self.getPreferences().getValue("cura/choice_on_profile_override") choice = self.getPreferences().getValue("cura/choice_on_profile_override")

View File

@ -1,3 +1,6 @@
//Copyright (C) 2022 UltiMaker B.V.
//Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import UM 1.6 as UM import UM 1.6 as UM
@ -5,15 +8,18 @@ import Cura 1.6 as Cura
Item Item
{ {
property bool fullWarning: true // <- Can you see the warning icon and the text, or is it just the buttons?
height: visible ? UM.Theme.getSize("action_button_icon").height : 0 height: visible ? UM.Theme.getSize("action_button_icon").height : 0
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality
Rectangle Rectangle
{ {
id: warningIcon id: warningIcon
visible: fullWarning
color: UM.Theme.getColor("um_yellow_5") color: UM.Theme.getColor("um_yellow_5")
height: UM.Theme.getSize("action_button_icon").height height: UM.Theme.getSize("action_button_icon").height
width: height width: visible ? height : 0
radius: width radius: width
anchors anchors
{ {
@ -31,7 +37,8 @@ Item
UM.Label UM.Label
{ {
id: warning id: warning
width: parent.width - warningIcon.width - resetToDefaultQualityButton.width visible: fullWarning
width: visible ? parent.width - warningIcon.width - (compareAndSaveButton.width + resetToDefaultQualityButton.width) : 0
anchors anchors
{ {
left: warningIcon.right left: warningIcon.right
@ -80,7 +87,33 @@ Item
} }
} }
] ]
}
UM.SimpleButton
{
id: compareAndSaveButton
height: UM.Theme.getSize("action_button_icon").height
width: height
iconSource: UM.Theme.getIcon("Save")
anchors
{
right: buttonsSpacer.left
verticalCenter: parent.verticalCenter
}
color: enabled ? UM.Theme.getColor("accent_1") : UM.Theme.getColor("disabled")
hoverColor: UM.Theme.getColor("primary_hover")
enabled: Cura.SimpleModeSettingsManager.isProfileCustomized
onClicked: Cura.MachineManager.hasCustomQuality ? CuraApplication.discardOrKeepProfileChanges() : Cura.Actions.addProfile.trigger()
}
// Spacer
Item
{
id: buttonsSpacer
width: UM.Theme.getSize("action_button_icon").height
anchors.right: resetToDefaultQualityButton.left
} }
UM.SimpleButton UM.SimpleButton
@ -95,12 +128,10 @@ Item
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
color: UM.Theme.getColor("accent_1") color: enabled ? UM.Theme.getColor("accent_1") : UM.Theme.getColor("disabled")
hoverColor: UM.Theme.getColor("primary_hover")
onClicked: enabled: Cura.MachineManager.hasCustomQuality || Cura.SimpleModeSettingsManager.isProfileCustomized
{ onClicked: Cura.MachineManager.resetToUseDefaultQuality()
Cura.MachineManager.resetToUseDefaultQuality()
} }
}
} }

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill-rule="evenodd" d="M3 18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V8L16 3H6C4.34315 3 3 4.34315 3 6V18ZM5 5H15.1716L19 8.82843V19H5V5Z"/>
<path fill-rule="evenodd" d="M7 5H15V9H7V5ZM9 5V7H13V5H9Z"/>
<path fill-rule="evenodd" d="M15 15H9V19H15V15ZM7 13V20H17V13H7Z"/>
</svg>

After

Width:  |  Height:  |  Size: 413 B