Replace checkboxes in save project to DL dialog with a combobox

CURA-8555
This commit is contained in:
c.lamboo 2022-06-14 16:19:56 +02:00
parent 90bb02acae
commit a315171d7c

View file

@ -14,6 +14,9 @@ import DigitalFactory 1.0 as DF
Item Item
{ {
id: base id: base
property variant catalog: UM.I18nCatalog { name: "cura" }
width: parent.width width: parent.width
height: parent.height height: parent.height
@ -63,7 +66,7 @@ Item
anchors.topMargin: UM.Theme.getSize("thin_margin").height anchors.topMargin: UM.Theme.getSize("thin_margin").height
validator: RegularExpressionValidator validator: RegularExpressionValidator
{ {
regularExpression: /^[\w\-\. ()]{0,255}$/ // regularExpression: /^[\w\-\. ()]{0,255}$/
} }
text: PrintInformation.jobName text: PrintInformation.jobName
@ -190,53 +193,29 @@ Item
text: "Save" text: "Save"
enabled: (asProjectCheckbox.checked || asSlicedCheckbox.checked) && dfFilenameTextfield.text.length >= 1 && dfFilenameTextfield.state !== 'invalid' enabled: (asProjectCheckbox.checked || asSlicedCheckbox.checked) && dfFilenameTextfield.text.length >= 1 && dfFilenameTextfield.state !== 'invalid'
onClicked: onClicked: manager.saveFileToSelectedProject(dfFilenameTextfield.text, asProjectComboBox.currentValue)
{
let saveAsFormats = [];
if (asProjectCheckbox.checked)
{
saveAsFormats.push("3mf");
}
if (asSlicedCheckbox.checked)
{
saveAsFormats.push("ufp");
}
manager.saveFileToSelectedProject(dfFilenameTextfield.text, saveAsFormats);
}
busy: false busy: false
} }
Row Cura.ComboBox
{ {
id: asProjectComboBox
id: saveAsFormatRow width: UM.Theme.getSize("combobox_wide").width
height: saveButton.height
anchors.verticalCenter: saveButton.verticalCenter anchors.verticalCenter: saveButton.verticalCenter
anchors.right: saveButton.left anchors.right: saveButton.left
anchors.rightMargin: UM.Theme.getSize("thin_margin").height anchors.rightMargin: UM.Theme.getSize("thin_margin").height
width: childrenRect.width
spacing: UM.Theme.getSize("default_margin").width
UM.CheckBox enabled: UM.Backend.state == UM.Backend.Done
{ currentIndex: UM.Backend.state == UM.Backend.Done ? 0 : 1
id: asProjectCheckbox textRole: "text"
height: UM.Theme.getSize("checkbox").height valueRole: "value"
anchors.verticalCenter: parent.verticalCenter
checked: true
text: "Save Cura project"
font: UM.Theme.getFont("medium")
}
UM.CheckBox model: [
{ { text: catalog.i18nc("@option", "Save Cura project and print file"), key: "3mf_ufp", value: ["3mf", "ufp"] },
id: asSlicedCheckbox { text: catalog.i18nc("@option", "Save Cura project"), key: "3mf", value: ["3mf"] },
height: UM.Theme.getSize("checkbox").height ]
anchors.verticalCenter: parent.verticalCenter
enabled: UM.Backend.state == UM.Backend.Done
checked: UM.Backend.state == UM.Backend.Done
text: "Save print file"
font: UM.Theme.getFont("medium")
}
} }
Component.onCompleted: Component.onCompleted: