Update DiscardOrKeepProfileChangesDialog

CURA 8687
This commit is contained in:
casper 2022-02-09 13:05:48 +01:00
parent 72c038a8b1
commit 6ca14ecbae

View File

@ -4,10 +4,8 @@
import Qt.labs.qmlmodels 1.0 import Qt.labs.qmlmodels 1.0
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1
import UM 1.2 as UM import UM 1.5 as UM
import Cura 1.6 as Cura import Cura 1.6 as Cura
UM.Dialog UM.Dialog
@ -22,7 +20,9 @@ UM.Dialog
minimumHeight: UM.Theme.getSize("popup_dialog").height minimumHeight: UM.Theme.getSize("popup_dialog").height
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
property var changesModel: Cura.UserChangesModel{ id: userChangesModel}
property var changesModel: Cura.UserChangesModel { id: userChangesModel }
onVisibilityChanged: onVisibilityChanged:
{ {
if(visible) if(visible)
@ -46,7 +46,6 @@ UM.Dialog
{ {
id: infoTextRow id: infoTextRow
height: childrenRect.height height: childrenRect.height
anchors.margins: UM.Theme.getSize("default_margin").width
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
@ -57,32 +56,27 @@ UM.Dialog
name: "cura" name: "cura"
} }
Label UM.Label
{ {
text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings.\nWould you like to Keep these changed settings after switching profiles?\nAlternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMap["main"]) text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings.\nWould you like to Keep these changed settings after switching profiles?\nAlternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMap["main"])
anchors.margins: UM.Theme.getSize("default_margin").width anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
} }
Item Item
{ {
anchors.margins: UM.Theme.getSize("default_margin").width anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.top: infoTextRow.bottom anchors.top: infoTextRow.bottom
anchors.bottom: optionRow.top anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Cura.TableView Cura.TableView
{ {
id: tableView id: tableView
anchors anchors.fill: parent
{
top: parent.top
left: parent.left
right: parent.right
}
height: base.height - 150
columnHeaders: [ columnHeaders: [
catalog.i18nc("@title:column", "Profile settings"), catalog.i18nc("@title:column", "Profile settings"),
@ -100,15 +94,9 @@ UM.Dialog
} }
} }
Item buttonSpacing: UM.Theme.getSize("thin_margin").width
{
id: optionRow
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: UM.Theme.getSize("default_margin").width
height: childrenRect.height
leftButtons: [
ComboBox ComboBox
{ {
id: discardOrKeepProfileChangesDropDownButton id: discardOrKeepProfileChangesDropDownButton
@ -145,37 +133,21 @@ UM.Dialog
} }
} }
} }
} ]
Item rightButtons:
{ [
ButtonGroup Cura.PrimaryButton
{
buttons: [discardButton, keepButton]
checkedButton: discardButton
}
}
rightButtons: [
Button
{ {
id: discardButton id: discardButton
text: catalog.i18nc("@action:button", "Discard changes"); text: catalog.i18nc("@action:button", "Discard changes")
onClicked: onClicked: base.accept()
{
CuraApplication.discardOrKeepProfileChangesClosed("discard")
base.hide()
}
}, },
Button Cura.SecondaryButton
{ {
id: keepButton id: keepButton
text: catalog.i18nc("@action:button", "Keep changes"); text: catalog.i18nc("@action:button", "Keep changes")
onClicked: onClicked: base.reject()
{
CuraApplication.discardOrKeepProfileChangesClosed("keep")
base.hide()
}
} }
] ]
} }