Cura/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml
Ghostkeeper 6db4a55f6e
Merge branch 'replace_controls_1_for_controls_2' into CURA-8684_QtControls_replacement_Buttons,_Actions_&_'Exclusivity'
Conflicts:
	plugins/ImageReader/ConfigUI.qml
	plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml
	plugins/PerObjectSettingsTool/SettingPickDialog.qml
	resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml
	resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml
	resources/qml/Preferences/GeneralPage.qml
	resources/qml/Preferences/Materials/MaterialsPage.qml
	resources/qml/Preferences/Materials/MaterialsView.qml
	resources/qml/Preferences/ProfilesPage.qml

These conflicts are all arising from headers/includes being updated at the same time, or from the two branches marking the other one's components as needing OldControls.
This introduced more OldControls markers which don't get marked as merge conflicts by Git. This happens when an element could just be left as the original name but from the new import (e.g. a Button stays a Button in Controls 2, but should be marked as from OldControls on the branch that doesn't update the Button).
2022-01-31 16:53:45 +01:00

182 lines
5.6 KiB
QML

//Copyright (c) 2022 Ultimaker B.V.
//Cura is released under the terms of the LGPLv3 or higher.
import Qt.labs.qmlmodels 1.0
import QtQuick 2.1
import QtQuick.Controls 1.1 as OldControls
import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1
import UM 1.2 as UM
import Cura 1.6 as Cura
UM.Dialog
{
id: base
title: catalog.i18nc("@title:window", "Discard or Keep changes")
onAccepted: CuraApplication.discardOrKeepProfileChangesClosed("discard")
onRejected: CuraApplication.discardOrKeepProfileChangesClosed("keep")
minimumWidth: UM.Theme.getSize("popup_dialog").width
minimumHeight: UM.Theme.getSize("popup_dialog").height
width: minimumWidth
height: minimumHeight
property var changesModel: Cura.UserChangesModel{ id: userChangesModel}
onVisibilityChanged:
{
if(visible)
{
changesModel.forceUpdate()
discardOrKeepProfileChangesDropDownButton.currentIndex = 0;
for (var i = 0; i < discardOrKeepProfileChangesDropDownButton.model.count; ++i)
{
var code = discardOrKeepProfileChangesDropDownButton.model.get(i).code;
if (code == UM.Preferences.getValue("cura/choice_on_profile_override"))
{
discardOrKeepProfileChangesDropDownButton.currentIndex = i;
break;
}
}
}
}
Row
{
id: infoTextRow
height: childrenRect.height
anchors.margins: UM.Theme.getSize("default_margin").width
anchors.left: parent.left
anchors.right: parent.right
spacing: UM.Theme.getSize("default_margin").width
UM.I18nCatalog
{
id: catalog;
name: "cura"
}
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"])
anchors.margins: UM.Theme.getSize("default_margin").width
wrapMode: Text.WordWrap
}
}
Item
{
anchors.margins: UM.Theme.getSize("default_margin").width
anchors.top: infoTextRow.bottom
anchors.bottom: optionRow.top
anchors.left: parent.left
anchors.right: parent.right
Cura.TableView
{
id: tableView
anchors
{
top: parent.top
left: parent.left
right: parent.right
}
height: base.height - 150
columnHeaders: [
catalog.i18nc("@title:column", "Profile settings"),
Cura.MachineManager.activeQualityDisplayNameMap["main"],
catalog.i18nc("@title:column", "Current changes")
]
model: TableModel
{
TableModelColumn { display: "label" }
TableModelColumn { display: "original_value" }
TableModelColumn { display: "user_value" }
rows: userChangesModel.items
}
sectionRole: "category"
}
}
Item
{
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
ComboBox
{
id: discardOrKeepProfileChangesDropDownButton
width: 300
textRole: "text"
model: ListModel
{
id: discardOrKeepProfileListModel
Component.onCompleted: {
append({ text: catalog.i18nc("@option:discardOrKeep", "Always ask me this"), code: "always_ask" })
append({ text: catalog.i18nc("@option:discardOrKeep", "Discard and never ask again"), code: "always_discard" })
append({ text: catalog.i18nc("@option:discardOrKeep", "Keep and never ask again"), code: "always_keep" })
}
}
onActivated:
{
var code = model.get(index).code;
UM.Preferences.setValue("cura/choice_on_profile_override", code);
if (code == "always_keep") {
keepButton.enabled = true;
discardButton.enabled = false;
}
else if (code == "always_discard") {
keepButton.enabled = false;
discardButton.enabled = true;
}
else {
keepButton.enabled = true;
discardButton.enabled = true;
}
}
}
}
Item
{
ButtonGroup
{
buttons: [discardButton, keepButton]
checkedButton: discardButton
}
}
rightButtons: [
Button
{
id: discardButton
text: catalog.i18nc("@action:button", "Discard changes");
onClicked:
{
CuraApplication.discardOrKeepProfileChangesClosed("discard")
base.hide()
}
},
Button
{
id: keepButton
text: catalog.i18nc("@action:button", "Keep changes");
onClicked:
{
CuraApplication.discardOrKeepProfileChangesClosed("keep")
base.hide()
}
}
]
}