Update image loader dialog

- Changed the slider to a Cura.Spinbox
- Use Cura-styled buttons

CURA-8688
This commit is contained in:
casper 2022-02-18 14:02:09 +01:00
parent 5134a071b1
commit 67c80e8a37

View file

@ -11,26 +11,25 @@ import Cura 1.0 as Cura
UM.Dialog UM.Dialog
{ {
title: catalog.i18nc("@title:window", "Convert Image...") title: catalog.i18nc("@title:window", "Convert Image")
minimumWidth: grid.width + 2 * UM.Theme.getSize("default_margin").height minimumWidth: grid.width + 2 * UM.Theme.getSize("default_margin").height
minimumHeight: UM.Theme.getSize("modal_window_minimum").height minimumHeight: UM.Theme.getSize("modal_window_minimum").height
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
GridLayout GridLayout
{ {
UM.I18nCatalog { id: catalog; name: "cura" } UM.I18nCatalog { id: catalog; name: "cura" }
id: grid id: grid
columnSpacing: UM.Theme.getSize("default_margin").width columnSpacing: UM.Theme.getSize("narrow_margin").width
rowSpacing: UM.Theme.getSize("thin_margin").height rowSpacing: UM.Theme.getSize("narrow_margin").height
columns: 2 columns: 2
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: catalog.i18nc("@action:label", "Height (mm)") text: catalog.i18nc("@action:label", "Height (mm)")
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -45,6 +44,7 @@ UM.Dialog
{ {
id: peak_height id: peak_height
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
selectByMouse: true selectByMouse: true
objectName: "Peak_Height" objectName: "Peak_Height"
validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ } validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
@ -62,6 +62,7 @@ UM.Dialog
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: catalog.i18nc("@action:label", "Base (mm)") text: catalog.i18nc("@action:label", "Base (mm)")
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -78,6 +79,7 @@ UM.Dialog
id: base_height id: base_height
selectByMouse: true selectByMouse: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
objectName: "Base_Height" objectName: "Base_Height"
validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ } validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
onTextChanged: manager.onBaseHeightChanged(text) onTextChanged: manager.onBaseHeightChanged(text)
@ -94,6 +96,7 @@ UM.Dialog
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: catalog.i18nc("@action:label", "Width (mm)") text: catalog.i18nc("@action:label", "Width (mm)")
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -110,6 +113,7 @@ UM.Dialog
selectByMouse: true selectByMouse: true
objectName: "Width" objectName: "Width"
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
focus: true focus: true
validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onWidthChanged(text) onTextChanged: manager.onWidthChanged(text)
@ -126,6 +130,7 @@ UM.Dialog
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: catalog.i18nc("@action:label", "Depth (mm)") text: catalog.i18nc("@action:label", "Depth (mm)")
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -140,6 +145,7 @@ UM.Dialog
{ {
id: depth id: depth
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
selectByMouse: true selectByMouse: true
objectName: "Depth" objectName: "Depth"
focus: true focus: true
@ -158,6 +164,7 @@ UM.Dialog
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: "" text: ""
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -172,9 +179,14 @@ UM.Dialog
{ {
id: lighter_is_higher id: lighter_is_higher
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height Layout.minimumWidth: UM.Theme.getSize("setting_control").width
Layout.preferredHeight: UM.Theme.getSize("setting_control").height
objectName: "Lighter_Is_Higher" objectName: "Lighter_Is_Higher"
model: [catalog.i18nc("@item:inlistbox", "Darker is higher"), catalog.i18nc("@item:inlistbox", "Lighter is higher")] textRole: "text"
model: [
{ text: catalog.i18nc("@item:inlistbox", "Darker is higher") },
{ text: catalog.i18nc("@item:inlistbox", "Lighter is higher") }
]
onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) }
} }
@ -189,6 +201,7 @@ UM.Dialog
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: catalog.i18nc("@action:label", "Color Model") text: catalog.i18nc("@action:label", "Color Model")
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -203,10 +216,15 @@ UM.Dialog
{ {
id: color_model id: color_model
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
Layout.preferredHeight: UM.Theme.getSize("setting_control").height
objectName: "ColorModel" objectName: "ColorModel"
model: [catalog.i18nc("@item:inlistbox", "Linear"), catalog.i18nc("@item:inlistbox", "Translucency")] textRole: "text"
model: [
{ text: catalog.i18nc("@item:inlistbox", "Linear") },
{ text: catalog.i18nc("@item:inlistbox", "Translucency") }
]
onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) } onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) }
Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height
} }
Cura.ToolTip Cura.ToolTip
@ -220,6 +238,7 @@ UM.Dialog
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: catalog.i18nc("@action:label", "1mm Transmittance (%)") text: catalog.i18nc("@action:label", "1mm Transmittance (%)")
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -232,25 +251,26 @@ UM.Dialog
Cura.TextField Cura.TextField
{ {
id: transmittance
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
selectByMouse: true selectByMouse: true
objectName: "Transmittance" objectName: "Transmittance"
validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ } validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onTransmittanceChanged(text) onTextChanged: manager.onTransmittanceChanged(text)
}
Cura.ToolTip Cura.ToolTip
{ {
text: catalog.i18nc("@info:tooltip", "The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.") text: catalog.i18nc("@info:tooltip", "The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.")
visible: transmittance.hovered || transmittance_label.containsMouse visible: parent.hovered || transmittance_label.containsMouse
targetPoint: Qt.point(transmittance.x + Math.round(transmittance.width / 2), 0) targetPoint: Qt.point(parent.x + Math.round(parent.width / 2), 0)
y: transmittance.y + transmittance.height + UM.Theme.getSize("default_margin").height y: parent.y + parent.height + UM.Theme.getSize("default_margin").height
}
} }
UM.Label UM.Label
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
text: catalog.i18nc("@action:label", "Smoothing") text: catalog.i18nc("@action:label", "Smoothing")
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -262,14 +282,15 @@ UM.Dialog
} }
} }
Slider Cura.SpinBox
{ {
id: smoothing id: smoothing
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: UM.Theme.getSize("setting_control").width
objectName: "Smoothing" objectName: "Smoothing"
to: 100.0 to: 100.0
stepSize: 1.0 stepSize: 1.0
onValueChanged: { manager.onSmoothingChanged(value) } onValueChanged: manager.onSmoothingChanged(value)
} }
Cura.ToolTip Cura.ToolTip
@ -293,18 +314,20 @@ UM.Dialog
onAccepted: manager.onOkButtonClicked() onAccepted: manager.onOkButtonClicked()
onRejected: manager.onCancelButtonClicked() onRejected: manager.onCancelButtonClicked()
buttonSpacing: UM.Theme.getSize("default_margin").width
rightButtons: [ rightButtons: [
Button Cura.TertiaryButton
{
id: ok_button
text: catalog.i18nc("@action:button", "OK")
onClicked: manager.onOkButtonClicked()
},
Button
{ {
id: cancel_button id: cancel_button
text: catalog.i18nc("@action:button", "Cancel") text: catalog.i18nc("@action:button", "Cancel")
onClicked: manager.onCancelButtonClicked() onClicked: manager.onCancelButtonClicked()
},
Cura.PrimaryButton
{
id: ok_button
text: catalog.i18nc("@action:button", "OK")
onClicked: manager.onOkButtonClicked()
} }
] ]
} }