Update styling in image loader plugin

CURA-8684
This commit is contained in:
casper 2022-01-31 13:43:08 +01:00
parent 264ce3bdd1
commit 1ecc1ad753

View file

@ -2,227 +2,279 @@
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 2.0 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.3
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import UM 1.1 as UM import UM 1.5 as UM
import Cura 1.0 as Cura
UM.Dialog UM.Dialog
{ {
width: minimumWidth;
minimumWidth: 350 * screenScaleFactor;
height: minimumHeight;
minimumHeight: 250 * screenScaleFactor;
title: catalog.i18nc("@title:window", "Convert Image...") title: catalog.i18nc("@title:window", "Convert Image...")
minimumWidth: grid.width + 2 * UM.Theme.getSize("default_margin").height
minimumHeight: UM.Theme.getSize("modal_window_minimum").height
width: minimumWidth
height: minimumHeight
GridLayout GridLayout
{ {
UM.I18nCatalog{id: catalog; name: "cura"} UM.I18nCatalog { id: catalog; name: "cura" }
anchors.fill: parent; id: grid
Layout.fillWidth: true columnSpacing: UM.Theme.getSize("default_margin").width
columnSpacing: 16 * screenScaleFactor rowSpacing: UM.Theme.getSize("thin_margin").height
rowSpacing: 4 * screenScaleFactor columns: 2
columns: 1
UM.TooltipArea { Label
Layout.fillWidth:true {
height: childrenRect.height Layout.fillWidth: true
text: catalog.i18nc("@info:tooltip","The maximum distance of each pixel from \"Base.\"") text: catalog.i18nc("@action:label", "Height (mm)")
Row { Layout.alignment: Qt.AlignVCenter
width: parent.width
Label { MouseArea {
text: catalog.i18nc("@action:label", "Height (mm)") id: peak_height_label
width: 150 * screenScaleFactor anchors.fill: parent
anchors.verticalCenter: parent.verticalCenter hoverEnabled: true
}
TextField {
id: peak_height
selectByMouse: true
objectName: "Peak_Height"
validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/}
width: 180 * screenScaleFactor
onTextChanged: { manager.onPeakHeightChanged(text) }
}
} }
} }
UM.TooltipArea { TextField
Layout.fillWidth:true {
height: childrenRect.height id: peak_height
text: catalog.i18nc("@info:tooltip","The base height from the build plate in millimeters.") Layout.fillWidth: true
Row { selectByMouse: true
width: parent.width objectName: "Peak_Height"
// validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
onTextChanged: manager.onPeakHeightChanged(text)
}
Label { Cura.ToolTip
text: catalog.i18nc("@action:label", "Base (mm)") {
width: 150 * screenScaleFactor text: catalog.i18nc("@info:tooltip", "The maximum distance of each pixel from \"Base.\"")
anchors.verticalCenter: parent.verticalCenter visible: peak_height.hovered || peak_height_label.containsMouse
} targetPoint: Qt.point(peak_height.x + Math.round(peak_height.width / 2), 0)
y: peak_height.y + peak_height.height + UM.Theme.getSize("default_margin").height
}
TextField { Label
id: base_height {
selectByMouse: true Layout.fillWidth: true
objectName: "Base_Height" text: catalog.i18nc("@action:label", "Base (mm)")
validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/} Layout.alignment: Qt.AlignVCenter
width: 180 * screenScaleFactor
onTextChanged: { manager.onBaseHeightChanged(text) } MouseArea {
} id: base_height_label
anchors.fill: parent
hoverEnabled: true
} }
} }
UM.TooltipArea { TextField
Layout.fillWidth:true {
height: childrenRect.height id: base_height
text: catalog.i18nc("@info:tooltip","The width in millimeters on the build plate.") selectByMouse: true
Row { Layout.fillWidth: true
width: parent.width objectName: "Base_Height"
// validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
onTextChanged: manager.onBaseHeightChanged(text)
}
Label { Cura.ToolTip
text: catalog.i18nc("@action:label", "Width (mm)") {
width: 150 * screenScaleFactor text: catalog.i18nc("@info:tooltip", "The base height from the build plate in millimeters.")
anchors.verticalCenter: parent.verticalCenter visible: base_height.hovered || base_height_label.containsMouse
} targetPoint: Qt.point(base_height.x + Math.round(base_height.width / 2), 0)
y: base_height.y + base_height.height + UM.Theme.getSize("default_margin").height
}
TextField { Label
id: width {
selectByMouse: true Layout.fillWidth: true
objectName: "Width" text: catalog.i18nc("@action:label", "Width (mm)")
focus: true Layout.alignment: Qt.AlignVCenter
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/}
width: 180 * screenScaleFactor MouseArea {
onTextChanged: { manager.onWidthChanged(text) } id: width_label
} anchors.fill: parent
hoverEnabled: true
} }
} }
UM.TooltipArea { TextField
Layout.fillWidth:true {
height: childrenRect.height id: width
text: catalog.i18nc("@info:tooltip","The depth in millimeters on the build plate") selectByMouse: true
Row { objectName: "Width"
width: parent.width Layout.fillWidth: true
focus: true
// validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onWidthChanged(text)
}
Label { Cura.ToolTip
text: catalog.i18nc("@action:label", "Depth (mm)") {
width: 150 * screenScaleFactor text: catalog.i18nc("@info:tooltip", "The width in millimeters on the build plate")
anchors.verticalCenter: parent.verticalCenter visible: width.hovered || width_label.containsMouse
} targetPoint: Qt.point(width.x + Math.round(width.width / 2), 0)
TextField { y: width.y + width.height + UM.Theme.getSize("default_margin").height
id: depth }
selectByMouse: true
objectName: "Depth" Label
focus: true {
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} Layout.fillWidth: true
width: 180 * screenScaleFactor text: catalog.i18nc("@action:label", "Depth (mm)")
onTextChanged: { manager.onDepthChanged(text) } Layout.alignment: Qt.AlignVCenter
}
MouseArea {
id: depth_label
anchors.fill: parent
hoverEnabled: true
} }
} }
UM.TooltipArea { TextField
Layout.fillWidth:true {
height: childrenRect.height id: depth
text: catalog.i18nc("@info:tooltip","For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.") Layout.fillWidth: true
Row { selectByMouse: true
width: parent.width objectName: "Depth"
focus: true
// validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onDepthChanged(text)
}
//Empty label so 2 column layout works. Cura.ToolTip
Label { {
text: "" text: catalog.i18nc("@info:tooltip", "The depth in millimeters on the build plate")
width: 150 * screenScaleFactor visible: depth.hovered || depth_label.containsMouse
anchors.verticalCenter: parent.verticalCenter targetPoint: Qt.point(depth.x + Math.round(depth.width / 2), 0)
} y: depth.y + depth.height + UM.Theme.getSize("default_margin").height
ComboBox { }
id: lighter_is_higher
objectName: "Lighter_Is_Higher" Label
model: [ catalog.i18nc("@item:inlistbox","Darker is higher"), catalog.i18nc("@item:inlistbox","Lighter is higher") ] {
width: 180 * screenScaleFactor Layout.fillWidth: true
onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } text: ""
} Layout.alignment: Qt.AlignVCenter
MouseArea {
id: lighter_is_higher_label
anchors.fill: parent
hoverEnabled: true
} }
} }
UM.TooltipArea { ComboBox
Layout.fillWidth:true {
height: childrenRect.height id: lighter_is_higher
text: catalog.i18nc("@info:tooltip","For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.") Layout.fillWidth: true
Row { Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height
width: parent.width objectName: "Lighter_Is_Higher"
model: [catalog.i18nc("@item:inlistbox", "Darker is higher"), catalog.i18nc("@item:inlistbox", "Lighter is higher")]
onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) }
}
Label { Cura.ToolTip
text: "Color Model" {
width: 150 * screenScaleFactor text: catalog.i18nc("@info:tooltip", "For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.")
anchors.verticalCenter: parent.verticalCenter visible: lighter_is_higher.hovered || lighter_is_higher_label.containsMouse
} targetPoint: Qt.point(lighter_is_higher.x + Math.round(lighter_is_higher.width / 2), 0)
ComboBox { y: lighter_is_higher.y + lighter_is_higher.height + UM.Theme.getSize("default_margin").height
id: color_model }
objectName: "ColorModel"
model: [ catalog.i18nc("@item:inlistbox","Linear"), catalog.i18nc("@item:inlistbox","Translucency") ] Label
width: 180 * screenScaleFactor {
onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) } Layout.fillWidth: true
} text: catalog.i18nc("@action:label", "Color Model")
Layout.alignment: Qt.AlignVCenter
MouseArea {
id: color_model_label
anchors.fill: parent
hoverEnabled: true
} }
} }
UM.TooltipArea { ComboBox
Layout.fillWidth:true {
height: childrenRect.height id: color_model
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.") Layout.fillWidth: true
visible: color_model.currentText == catalog.i18nc("@item:inlistbox","Translucency") objectName: "ColorModel"
Row { model: [catalog.i18nc("@item:inlistbox", "Linear"), catalog.i18nc("@item:inlistbox", "Translucency")]
width: parent.width onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) }
Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height
}
Label { Cura.ToolTip
text: catalog.i18nc("@action:label", "1mm Transmittance (%)") {
width: 150 * screenScaleFactor text: catalog.i18nc("@info:tooltip", "For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.")
anchors.verticalCenter: parent.verticalCenter visible: color_model.hovered || color_model_label.containsMouse
} targetPoint: Qt.point(color_model.x + Math.round(color_model.width / 2), 0)
TextField { y: color_model.y + color_model.height + UM.Theme.getSize("default_margin").height
id: transmittance }
selectByMouse: true
objectName: "Transmittance" Label
focus: true {
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} Layout.fillWidth: true
width: 180 * screenScaleFactor text: catalog.i18nc("@action:label", "1mm Transmittance (%)")
onTextChanged: { manager.onTransmittanceChanged(text) } Layout.alignment: Qt.AlignVCenter
}
MouseArea {
id: transmittance_label
anchors.fill: parent
hoverEnabled: true
} }
} }
UM.TooltipArea { TextField
Layout.fillWidth:true {
height: childrenRect.height id: transmittance
text: catalog.i18nc("@info:tooltip","The amount of smoothing to apply to the image.") Layout.fillWidth: true
Row { selectByMouse: true
width: parent.width objectName: "Transmittance"
// validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
onTextChanged: manager.onTransmittanceChanged(text)
}
Label { Cura.ToolTip
text: catalog.i18nc("@action:label", "Smoothing") {
width: 150 * screenScaleFactor 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.")
anchors.verticalCenter: parent.verticalCenter visible: transmittance.hovered || transmittance_label.containsMouse
} targetPoint: Qt.point(transmittance.x + Math.round(transmittance.width / 2), 0)
y: transmittance.y + transmittance.height + UM.Theme.getSize("default_margin").height
}
Item { Label
width: 180 * screenScaleFactor {
height: 20 * screenScaleFactor Layout.fillWidth: true
Layout.fillWidth: true text: catalog.i18nc("@action:label", "Smoothing")
Layout.alignment: Qt.AlignVCenter
Slider { MouseArea {
id: smoothing id: smoothing_label
objectName: "Smoothing" anchors.fill: parent
to: 100.0 hoverEnabled: true
stepSize: 1.0
width: 180
onValueChanged: { manager.onSmoothingChanged(value) }
}
}
} }
} }
Slider
{
id: smoothing
Layout.fillWidth: true
objectName: "Smoothing"
to: 100.0
stepSize: 1.0
onValueChanged: { manager.onSmoothingChanged(value) }
}
Cura.ToolTip
{
text: catalog.i18nc("@info:tooltip", "The amount of smoothing to apply to the image.")
visible: smoothing.hovered || smoothing_label.containsMouse
targetPoint: Qt.point(smoothing.x + Math.round(smoothing.width / 2), 0)
y: smoothing.y + smoothing.height + UM.Theme.getSize("default_margin").height
}
} }
Item Item
@ -240,14 +292,14 @@ UM.Dialog
rightButtons: [ rightButtons: [
Button Button
{ {
id:ok_button id: ok_button
text: catalog.i18nc("@action:button","OK"); text: catalog.i18nc("@action:button", "OK")
onClicked: manager.onOkButtonClicked() onClicked: manager.onOkButtonClicked()
}, },
Button 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()
} }
] ]