Merge pull request #11336 from Ultimaker/CURA-8684_QtControls_replacement_Buttons,_Actions_&_'Exclusivity'

Cura 8684 qt controls replacement buttons, actions & 'exclusivity'
This commit is contained in:
Jaime van Kessel 2022-01-31 17:33:15 +01:00 committed by GitHub
commit 2294214bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 691 additions and 1131 deletions

View File

@ -1,8 +1,8 @@
// Copyright (C) 2021 Ultimaker B.V. //Copyright (C) 2022 Ultimaker B.V.
//Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import UM 1.2 as UM import UM 1.2 as UM

View File

@ -1,8 +1,8 @@
// Copyright (C) 2021 Ultimaker B.V. //Copyright (C) 2022 Ultimaker B.V.
//Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import UM 1.2 as UM import UM 1.2 as UM

View File

@ -1,8 +1,8 @@
// Copyright (C) 2021 Ultimaker B.V. //Copyright (C) 2022 Ultimaker B.V.
//Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import UM 1.2 as UM import UM 1.2 as UM

View File

@ -1,9 +1,8 @@
// Copyright (C) 2021 Ultimaker B.V. //Copyright (C) 2022 Ultimaker B.V.
// 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.10 import QtQuick 2.10
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1

View File

@ -2,273 +2,307 @@
// 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 1.1 as OldControls
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
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
{
Layout.fillWidth:true
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","The maximum distance of each pixel from \"Base.\"")
Row
{
width: parent.width
Label Label
{ {
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Height (mm)") text: catalog.i18nc("@action:label", "Height (mm)")
width: 150 * screenScaleFactor Layout.alignment: Qt.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
MouseArea {
id: peak_height_label
anchors.fill: parent
hoverEnabled: true
}
} }
OldControls.TextField TextField
{ {
id: peak_height id: peak_height
Layout.fillWidth: true
selectByMouse: true
objectName: "Peak_Height" objectName: "Peak_Height"
validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/} validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
width: 180 * screenScaleFactor onTextChanged: manager.onPeakHeightChanged(text)
onTextChanged: { manager.onPeakHeightChanged(text) }
}
}
} }
UM.TooltipArea Cura.ToolTip
{ {
Layout.fillWidth:true text: catalog.i18nc("@info:tooltip", "The maximum distance of each pixel from \"Base.\"")
height: childrenRect.height visible: peak_height.hovered || peak_height_label.containsMouse
text: catalog.i18nc("@info:tooltip","The base height from the build plate in millimeters.") targetPoint: Qt.point(peak_height.x + Math.round(peak_height.width / 2), 0)
Row y: peak_height.y + peak_height.height + UM.Theme.getSize("default_margin").height
{ }
width: parent.width
Label Label
{ {
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Base (mm)") text: catalog.i18nc("@action:label", "Base (mm)")
width: 150 * screenScaleFactor Layout.alignment: Qt.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
MouseArea
{
id: base_height_label
anchors.fill: parent
hoverEnabled: true
}
} }
OldControls.TextField TextField
{ {
id: base_height id: base_height
selectByMouse: true
Layout.fillWidth: true
objectName: "Base_Height" objectName: "Base_Height"
validator: RegExpValidator {regExp: /^\d{0,3}([\,|\.]\d*)?$/} validator: RegExpValidator { regExp: /^\d{0,3}([\,|\.]\d*)?$/ }
width: 180 * screenScaleFactor onTextChanged: manager.onBaseHeightChanged(text)
onTextChanged: { manager.onBaseHeightChanged(text) }
}
}
} }
UM.TooltipArea Cura.ToolTip
{ {
Layout.fillWidth:true text: catalog.i18nc("@info:tooltip", "The base height from the build plate in millimeters.")
height: childrenRect.height visible: base_height.hovered || base_height_label.containsMouse
text: catalog.i18nc("@info:tooltip","The width in millimeters on the build plate.") targetPoint: Qt.point(base_height.x + Math.round(base_height.width / 2), 0)
Row y: base_height.y + base_height.height + UM.Theme.getSize("default_margin").height
{ }
width: parent.width
Label Label
{ {
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Width (mm)") text: catalog.i18nc("@action:label", "Width (mm)")
width: 150 * screenScaleFactor Layout.alignment: Qt.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
MouseArea {
id: width_label
anchors.fill: parent
hoverEnabled: true
}
} }
OldControls.TextField TextField
{ {
id: width id: width
selectByMouse: true
objectName: "Width" objectName: "Width"
Layout.fillWidth: true
focus: true focus: true
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
width: 180 * screenScaleFactor onTextChanged: manager.onWidthChanged(text)
onTextChanged: { manager.onWidthChanged(text) }
}
}
} }
UM.TooltipArea Cura.ToolTip
{ {
Layout.fillWidth:true text: catalog.i18nc("@info:tooltip", "The width in millimeters on the build plate")
height: childrenRect.height visible: width.hovered || width_label.containsMouse
text: catalog.i18nc("@info:tooltip","The depth in millimeters on the build plate") targetPoint: Qt.point(width.x + Math.round(width.width / 2), 0)
Row y: width.y + width.height + UM.Theme.getSize("default_margin").height
{ }
width: parent.width
Label Label
{ {
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Depth (mm)") text: catalog.i18nc("@action:label", "Depth (mm)")
width: 150 * screenScaleFactor Layout.alignment: Qt.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
MouseArea {
id: depth_label
anchors.fill: parent
hoverEnabled: true
} }
OldControls.TextField }
TextField
{ {
id: depth id: depth
Layout.fillWidth: true
selectByMouse: true
objectName: "Depth" objectName: "Depth"
focus: true focus: true
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
width: 180 * screenScaleFactor onTextChanged: manager.onDepthChanged(text)
onTextChanged: { manager.onDepthChanged(text) }
}
}
} }
UM.TooltipArea Cura.ToolTip
{ {
Layout.fillWidth:true text: catalog.i18nc("@info:tooltip", "The depth in millimeters on the build plate")
height: childrenRect.height visible: depth.hovered || depth_label.containsMouse
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.") targetPoint: Qt.point(depth.x + Math.round(depth.width / 2), 0)
Row y: depth.y + depth.height + UM.Theme.getSize("default_margin").height
{ }
width: parent.width
//Empty label so 2 column layout works.
Label Label
{ {
Layout.fillWidth: true
text: "" text: ""
width: 150 * screenScaleFactor Layout.alignment: Qt.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
MouseArea {
id: lighter_is_higher_label
anchors.fill: parent
hoverEnabled: true
} }
OldControls.ComboBox }
ComboBox
{ {
id: lighter_is_higher id: lighter_is_higher
Layout.fillWidth: true
Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height
objectName: "Lighter_Is_Higher" objectName: "Lighter_Is_Higher"
model: [ catalog.i18nc("@item:inlistbox","Darker is higher"), catalog.i18nc("@item:inlistbox","Lighter is higher") ] model: [catalog.i18nc("@item:inlistbox", "Darker is higher"), catalog.i18nc("@item:inlistbox", "Lighter is higher")]
width: 180 * screenScaleFactor
onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) } onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) }
} }
}
}
UM.TooltipArea Cura.ToolTip
{ {
Layout.fillWidth:true 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.")
height: childrenRect.height visible: lighter_is_higher.hovered || lighter_is_higher_label.containsMouse
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.") targetPoint: Qt.point(lighter_is_higher.x + Math.round(lighter_is_higher.width / 2), 0)
Row y: lighter_is_higher.y + lighter_is_higher.height + UM.Theme.getSize("default_margin").height
{ }
width: parent.width
Label Label
{ {
text: "Color Model" Layout.fillWidth: true
width: 150 * screenScaleFactor text: catalog.i18nc("@action:label", "Color Model")
anchors.verticalCenter: parent.verticalCenter Layout.alignment: Qt.AlignVCenter
MouseArea {
id: color_model_label
anchors.fill: parent
hoverEnabled: true
} }
OldControls.ComboBox }
ComboBox
{ {
id: color_model id: color_model
Layout.fillWidth: true
objectName: "ColorModel" objectName: "ColorModel"
model: [ catalog.i18nc("@item:inlistbox","Linear"), catalog.i18nc("@item:inlistbox","Translucency") ] model: [catalog.i18nc("@item:inlistbox", "Linear"), catalog.i18nc("@item:inlistbox", "Translucency")]
width: 180 * screenScaleFactor
onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) } onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) }
} Layout.preferredHeight: UM.Theme.getSize("toolbox_action_button").height
}
} }
UM.TooltipArea Cura.ToolTip
{ {
Layout.fillWidth:true 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.")
height: childrenRect.height visible: color_model.hovered || color_model_label.containsMouse
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.") targetPoint: Qt.point(color_model.x + Math.round(color_model.width / 2), 0)
visible: color_model.currentText == catalog.i18nc("@item:inlistbox","Translucency") y: color_model.y + color_model.height + UM.Theme.getSize("default_margin").height
Row }
{
width: parent.width
Label Label
{ {
Layout.fillWidth: true
text: catalog.i18nc("@action:label", "1mm Transmittance (%)") text: catalog.i18nc("@action:label", "1mm Transmittance (%)")
width: 150 * screenScaleFactor Layout.alignment: Qt.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
MouseArea {
id: transmittance_label
anchors.fill: parent
hoverEnabled: true
} }
OldControls.TextField }
TextField
{ {
id: transmittance id: transmittance
Layout.fillWidth: true
selectByMouse: true
objectName: "Transmittance" objectName: "Transmittance"
focus: true validator: RegExpValidator { regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
validator: RegExpValidator {regExp: /^[1-9]\d{0,2}([\,|\.]\d*)?$/} onTextChanged: manager.onTransmittanceChanged(text)
width: 180 * screenScaleFactor
onTextChanged: { manager.onTransmittanceChanged(text) }
}
}
} }
UM.TooltipArea Cura.ToolTip
{ {
Layout.fillWidth:true 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.")
height: childrenRect.height visible: transmittance.hovered || transmittance_label.containsMouse
text: catalog.i18nc("@info:tooltip","The amount of smoothing to apply to the image.") targetPoint: Qt.point(transmittance.x + Math.round(transmittance.width / 2), 0)
Row y: transmittance.y + transmittance.height + UM.Theme.getSize("default_margin").height
{ }
width: parent.width
Label Label
{ {
text: catalog.i18nc("@action:label", "Smoothing")
width: 150 * screenScaleFactor
anchors.verticalCenter: parent.verticalCenter
}
Item
{
width: 180 * screenScaleFactor
height: 20 * screenScaleFactor
Layout.fillWidth: true Layout.fillWidth: true
text: catalog.i18nc("@action:label", "Smoothing")
Layout.alignment: Qt.AlignVCenter
MouseArea
{
id: smoothing_label
anchors.fill: parent
hoverEnabled: true
}
}
Slider Slider
{ {
id: smoothing id: smoothing
Layout.fillWidth: true
objectName: "Smoothing" objectName: "Smoothing"
from: 0.0
to: 100.0 to: 100.0
stepSize: 1.0 stepSize: 1.0
width: 180
onValueChanged: { manager.onSmoothingChanged(value) } 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
{
ButtonGroup
{
buttons: [ok_button, cancel_button]
checkedButton: ok_button
}
}
onAccepted: manager.onOkButtonClicked()
onRejected: manager.onCancelButtonClicked()
rightButtons: [ rightButtons: [
OldControls.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()
enabled: true
}, },
OldControls.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()
enabled: true
} }
] ]
} }

View File

@ -1,10 +1,8 @@
// Copyright (c) 2015 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.1 as UM import UM 1.1 as UM
@ -13,9 +11,9 @@ import ".."
Button { Button {
id: base; id: base;
style: ButtonStyle {
background: Item { } background: Item { }
label: Row
contentItem: Row
{ {
spacing: UM.Theme.getSize("default_lining").width spacing: UM.Theme.getSize("default_lining").width
@ -24,36 +22,34 @@ Button {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
height: (label.height / 2) | 0 height: (label.height / 2) | 0
width: height width: height
source: control.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight"); source: base.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight");
color: control.hovered ? palette.highlight : palette.buttonText color: base.hovered ? palette.highlight : palette.buttonText
} }
UM.RecolorImage UM.RecolorImage
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
height: label.height height: label.height
width: height width: height
source: control.iconSource source: UM.Theme.getIcon(definition.icon)
color: control.hovered ? palette.highlight : palette.buttonText color: base.hovered ? palette.highlight : palette.buttonText
} }
Label Label
{ {
id: label id: label
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: control.text text: base.text
color: control.hovered ? palette.highlight : palette.buttonText color: base.hovered ? palette.highlight : palette.buttonText
font.bold: true font.bold: true
} }
SystemPalette { id: palette } SystemPalette { id: palette }
} }
}
signal showTooltip(string text); signal showTooltip(string text);
signal hideTooltip(); signal hideTooltip();
signal contextMenuRequested() signal contextMenuRequested()
text: definition.label text: definition.label
iconSource: UM.Theme.getIcon(definition.icon)
checkable: true checkable: true
checked: definition.expanded checked: definition.expanded

View File

@ -1,10 +1,9 @@
// Copyright (c) 2022 Ultimaker B.V. //Copyright (c) 2022 Ultimaker B.V.
// 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.2 import QtQuick 2.2
import QtQuick.Controls 1.2 as OldControls
import QtQuick.Controls.Styles 1.2
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls.Styles 1.2
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -77,51 +76,63 @@ Item
id: meshTypeButtons id: meshTypeButtons
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
OldControls.Button Cura.ToolbarButton
{ {
id: normalButton id: normalButton
text: catalog.i18nc("@label", "Normal model") text: catalog.i18nc("@label", "Normal model")
iconSource: UM.Theme.getIcon("Infill0"); toolItem: UM.RecolorImage
{
source: UM.Theme.getIcon("Infill0")
color: UM.Theme.getColor("icon")
}
property bool needBorder: true property bool needBorder: true
checkable: true checkable: true
onClicked: setMeshType(normalMeshType); onClicked: setMeshType(normalMeshType);
style: UM.Theme.styles.tool_button;
z: 4 z: 4
} }
OldControls.Button Cura.ToolbarButton
{ {
id: supportMeshButton id: supportMeshButton
text: catalog.i18nc("@label", "Print as support") text: catalog.i18nc("@label", "Print as support")
iconSource: UM.Theme.getIcon("MeshTypeSupport"); toolItem: UM.RecolorImage
{
source: UM.Theme.getIcon("MeshTypeSupport")
color: UM.Theme.getColor("icon")
}
property bool needBorder: true property bool needBorder: true
checkable:true checkable:true
onClicked: setMeshType(supportMeshType) onClicked: setMeshType(supportMeshType)
style: UM.Theme.styles.tool_button;
z: 3 z: 3
} }
OldControls.Button Cura.ToolbarButton
{ {
id: overlapMeshButton id: overlapMeshButton
text: catalog.i18nc("@label", "Modify settings for overlaps") text: catalog.i18nc("@label", "Modify settings for overlaps")
iconSource: UM.Theme.getIcon("MeshTypeIntersect"); toolItem: UM.RecolorImage
{
source: UM.Theme.getIcon("MeshTypeIntersect")
color: UM.Theme.getColor("icon")
}
property bool needBorder: true property bool needBorder: true
checkable:true checkable:true
onClicked: setMeshType(infillMeshType) onClicked: setMeshType(infillMeshType)
style: UM.Theme.styles.tool_button;
z: 2 z: 2
} }
OldControls.Button Cura.ToolbarButton
{ {
id: antiOverhangMeshButton id: antiOverhangMeshButton
text: catalog.i18nc("@label", "Don't support overlaps") text: catalog.i18nc("@label", "Don't support overlaps")
iconSource: UM.Theme.getIcon("BlockSupportOverlaps"); toolItem: UM.RecolorImage
{
source: UM.Theme.getIcon("BlockSupportOverlaps")
color: UM.Theme.getColor("icon")
}
property bool needBorder: true property bool needBorder: true
checkable: true checkable: true
onClicked: setMeshType(antiOverhangMeshType) onClicked: setMeshType(antiOverhangMeshType)
style: UM.Theme.styles.tool_button;
z: 1 z: 1
} }
@ -285,15 +296,13 @@ Item
} }
} }
OldControls.Button Button
{ {
width: Math.round(UM.Theme.getSize("setting").height / 2) width: Math.round(UM.Theme.getSize("setting").height / 2)
height: UM.Theme.getSize("setting").height height: UM.Theme.getSize("setting").height
onClicked: addedSettingsModel.setVisible(model.key, false) onClicked: addedSettingsModel.setVisible(model.key, false)
style: ButtonStyle
{
background: Item background: Item
{ {
UM.RecolorImage UM.RecolorImage
@ -302,12 +311,11 @@ Item
width: parent.width width: parent.width
height: width height: width
sourceSize.height: width sourceSize.height: width
color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") color: parent.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button")
source: UM.Theme.getIcon("Minus") source: UM.Theme.getIcon("Minus")
} }
} }
} }
}
// Specialty provider that only watches global_inherits (we can't filter on what property changed we get events // Specialty provider that only watches global_inherits (we can't filter on what property changed we get events
// so we bypass that to make a dedicated provider). // so we bypass that to make a dedicated provider).

View File

@ -1,5 +1,5 @@
// Copyright (c) 2022 Ultimaker B.V. //Copyright (c) 2022 Ultimaker B.V.
// 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.2 import QtQuick 2.2
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
@ -45,6 +45,7 @@ UM.Dialog
TextField TextField
{ {
id: filterInput id: filterInput
selectByMouse: true
anchors anchors
{ {

View File

@ -1,5 +1,6 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.5 import QtQuick 2.5
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
@ -62,6 +63,7 @@ UM.PointingRectangle
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
renderType: Text.NativeRendering renderType: Text.NativeRendering
background: Item {} background: Item {}
selectByMouse: true
onEditingFinished: { onEditingFinished: {

View File

@ -1,10 +1,9 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.4 import QtQuick 2.4
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls 1.0 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import UM 1.5 as UM import UM 1.5 as UM
@ -94,7 +93,8 @@ Cura.ExpandableComponent
spacing: UM.Theme.getSize("layerview_row_spacing").height spacing: UM.Theme.getSize("layerview_row_spacing").height
ListModel // matches SimulationView.py // matches SimulationView.py
ListModel
{ {
id: layerViewTypes id: layerViewTypes
} }
@ -127,18 +127,17 @@ Cura.ExpandableComponent
}) })
} }
ComboBox Cura.ComboBox
{ {
id: layerTypeCombobox id: layerTypeCombobox
textRole: "text"
valueRole: "type_id"
width: parent.width width: parent.width
implicitHeight: UM.Theme.getSize("setting_control").height
model: layerViewTypes model: layerViewTypes
visible: !UM.SimulationView.compatibilityMode visible: !UM.SimulationView.compatibilityMode
style: UM.Theme.styles.combobox
onActivated: onActivated: UM.Preferences.setValue("layerview/layer_view_type", index)
{
UM.Preferences.setValue("layerview/layer_view_type", index);
}
Component.onCompleted: Component.onCompleted:
{ {

View File

@ -1,10 +1,9 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.7 import QtQuick 2.7
import QtQuick.Controls 2.1 import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4 as Controls1
import UM 1.4 as UM import UM 1.4 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -122,7 +121,9 @@ Column
tooltip: catalog.i18nc("@label", "Start the slicing process") tooltip: catalog.i18nc("@label", "Start the slicing process")
enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
onClicked: sliceOrStopSlicing() onClicked: {
sliceOrStopSlicing()
}
} }
Cura.SecondaryButton Cura.SecondaryButton
@ -136,7 +137,9 @@ Column
text: catalog.i18nc("@button", "Cancel") text: catalog.i18nc("@button", "Cancel")
enabled: sliceButton.enabled enabled: sliceButton.enabled
visible: !sliceButton.visible visible: !sliceButton.visible
onClicked: sliceOrStopSlicing() onClicked: {
sliceOrStopSlicing()
}
} }
} }
@ -165,7 +168,7 @@ Column
} }
// Shortcut for "slice/stop" // Shortcut for "slice/stop"
Controls1.Action Action
{ {
shortcut: "Ctrl+P" shortcut: "Ctrl+P"
onTriggered: onTriggered:

View File

@ -1,8 +1,8 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1 import QtQuick.Window 2.1
@ -97,29 +97,32 @@ UM.Dialog
text: catalog.i18nc("@text:window", "Remember my choice") text: catalog.i18nc("@text:window", "Remember my choice")
checked: UM.Preferences.getValue("cura/choice_on_open_project") != "always_ask" checked: UM.Preferences.getValue("cura/choice_on_open_project") != "always_ask"
} }
}
// Buttons Item
Item { {
id: buttonBar ButtonGroup
anchors.right: parent.right {
anchors.left: parent.left buttons: [openAsProjectButton, importModelsButton]
height: childrenRect.height checkedButton: openAsProjectButton
}
}
Button { onAccepted: loadProjectFile()
onRejected: loadModelFiles()
rightButtons: [
Button
{
id: openAsProjectButton id: openAsProjectButton
text: catalog.i18nc("@action:button", "Open as project") text: catalog.i18nc("@action:button", "Open as project")
anchors.right: importModelsButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
isDefault: true
onClicked: loadProjectFile() onClicked: loadProjectFile()
} },
Button
Button { {
id: importModelsButton id: importModelsButton
text: catalog.i18nc("@action:button", "Import models") text: catalog.i18nc("@action:button", "Import models")
anchors.right: parent.right
onClicked: loadModelFiles() onClicked: loadModelFiles()
} }
} ]
}
} }

View File

@ -3,7 +3,6 @@
import Qt.labs.qmlmodels 1.0 import Qt.labs.qmlmodels 1.0
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 as OldControls
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1 import QtQuick.Window 2.1
@ -16,6 +15,9 @@ UM.Dialog
id: base id: base
title: catalog.i18nc("@title:window", "Discard or Keep changes") title: catalog.i18nc("@title:window", "Discard or Keep changes")
onAccepted: CuraApplication.discardOrKeepProfileChangesClosed("discard")
onRejected: CuraApplication.discardOrKeepProfileChangesClosed("keep")
minimumWidth: UM.Theme.getSize("popup_dialog").width minimumWidth: UM.Theme.getSize("popup_dialog").width
minimumHeight: UM.Theme.getSize("popup_dialog").height minimumHeight: UM.Theme.getSize("popup_dialog").height
width: minimumWidth width: minimumWidth
@ -47,7 +49,6 @@ UM.Dialog
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
UM.I18nCatalog UM.I18nCatalog
@ -102,7 +103,7 @@ UM.Dialog
Item Item
{ {
id: optionRow id: optionRow
anchors.bottom: buttonsRow.top anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
@ -148,37 +149,33 @@ UM.Dialog
Item Item
{ {
id: buttonsRow ButtonGroup
anchors.bottom: parent.bottom {
anchors.right: parent.right buttons: [discardButton, keepButton]
anchors.left: parent.left checkedButton: discardButton
anchors.margins: UM.Theme.getSize("default_margin").width }
height: childrenRect.height }
OldControls.Button rightButtons: [
Button
{ {
id: discardButton id: discardButton
text: catalog.i18nc("@action:button", "Discard changes"); text: catalog.i18nc("@action:button", "Discard changes");
anchors.right: parent.right
onClicked: onClicked:
{ {
CuraApplication.discardOrKeepProfileChangesClosed("discard") CuraApplication.discardOrKeepProfileChangesClosed("discard")
base.hide() base.hide()
} }
isDefault: true },
} Button
OldControls.Button
{ {
id: keepButton id: keepButton
text: catalog.i18nc("@action:button", "Keep changes"); text: catalog.i18nc("@action:button", "Keep changes");
anchors.right: discardButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
onClicked: onClicked:
{ {
CuraApplication.discardOrKeepProfileChangesClosed("keep") CuraApplication.discardOrKeepProfileChangesClosed("keep")
base.hide() base.hide()
} }
} }
} ]
} }

View File

@ -1,9 +1,8 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1 import QtQuick.Window 2.1
@ -69,45 +68,44 @@ UM.Dialog
width: height width: height
} }
// Buttons
Item
{
anchors.right: parent.right
anchors.left: parent.left
height: childrenRect.height
Button
{
id: cancelButton
text: catalog.i18nc("@action:button", "Cancel");
anchors.right: importAllAsModelsButton.left
onClicked:
{
// cancel
base.hide();
}
}
Button
{
id: importAllAsModelsButton
text: catalog.i18nc("@action:button", "Import all as models");
anchors.right: parent.right
isDefault: true
onClicked:
{
// load models from all selected file
loadModelFiles(base.fileUrls);
base.hide();
}
}
}
UM.I18nCatalog UM.I18nCatalog
{ {
id: catalog id: catalog
name: "cura" name: "cura"
} }
ButtonGroup
{
buttons: [cancelButton, importAllAsModelsButton]
checkedButton: importAllAsModelsButton
} }
}
onAccepted: loadModelFiles(base.fileUrls)
// Buttons
rightButtons:
[
Button
{
id: cancelButton
text: catalog.i18nc("@action:button", "Cancel");
onClicked:
{
// cancel
base.hide();
}
},
Button
{
id: importAllAsModelsButton
text: catalog.i18nc("@action:button", "Import all as models");
onClicked:
{
// load models from all selected file
loadModelFiles(base.fileUrls);
base.hide();
}
}
]
} }

View File

@ -3,11 +3,13 @@
import QtQuick 2.6 import QtQuick 2.6
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Controls 1.1 as OldControls
import Cura 1.0 as Cura import Cura 1.0 as Cura
import UM 1.5 as UM import UM 1.5 as UM
// Simple button for displaying text and changes appearance for various states: enabled, valueError, valueWarning
// - and hovered. Mainly used in CustomConfiguration.qml
Item Item
{ {
UM.I18nCatalog UM.I18nCatalog
@ -263,7 +265,7 @@ Item
width: selectors.textWidth width: selectors.textWidth
} }
OldControls.ToolButton Cura.PrintSetupHeaderButton
{ {
id: materialSelection id: materialSelection
@ -277,18 +279,15 @@ Item
width: selectors.controlWidth width: selectors.controlWidth
height: parent.height height: parent.height
style: UM.Theme.styles.print_setup_header_button focusPolicy: Qt.ClickFocus
activeFocusOnPress: true
Cura.MaterialMenu Cura.MaterialMenu
{ {
id: materialsMenu id: materialsMenu
extruderIndex: Cura.ExtruderManager.activeExtruderIndex extruderIndex: Cura.ExtruderManager.activeExtruderIndex
updateModels: materialSelection.visible updateModels: materialSelection.visible
} }
onClicked: onClicked: materialsMenu.popup()
{
materialsMenu.popup();
}
} }
Item Item
{ {
@ -325,15 +324,14 @@ Item
width: selectors.textWidth width: selectors.textWidth
} }
OldControls.ToolButton Cura.PrintSetupHeaderButton
{ {
id: variantSelection id: variantSelection
text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.variant.name : "" text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.variant.name : ""
tooltip: text tooltip: text
height: parent.height height: parent.height
width: selectors.controlWidth width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button focusPolicy: Qt.ClickFocus
activeFocusOnPress: true
enabled: enabledCheckbox.checked enabled: enabledCheckbox.checked
Cura.NozzleMenu Cura.NozzleMenu
@ -341,10 +339,7 @@ Item
id: nozzlesMenu id: nozzlesMenu
extruderIndex: Cura.ExtruderManager.activeExtruderIndex extruderIndex: Cura.ExtruderManager.activeExtruderIndex
} }
onClicked: onClicked: nozzlesMenu.popup()
{
nozzlesMenu.popup();
}
} }
} }

View File

@ -266,7 +266,7 @@ Item
} }
} }
Button Cura.SecondaryButton
{ {
id: pauseResumeButton id: pauseResumeButton
@ -309,11 +309,9 @@ Item
activePrintJob.setState("pause"); activePrintJob.setState("pause");
} }
} }
style: UM.Theme.styles.print_setup_action_button
} }
Button Cura.SecondaryButton
{ {
id: abortButton id: abortButton
@ -325,8 +323,6 @@ Item
text: catalog.i18nc("@label", "Abort Print") text: catalog.i18nc("@label", "Abort Print")
onClicked: confirmationDialog.visible = true onClicked: confirmationDialog.visible = true
style: UM.Theme.styles.print_setup_action_button
} }
MessageDialog MessageDialog

View File

@ -82,7 +82,7 @@ Button
right: parent.right right: parent.right
rightMargin: 0 rightMargin: 0
} }
width: contentItem.width width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width
height: parent.height height: parent.height
padding: 0 padding: 0
leftPadding: UM.Theme.getSize("thin_margin").width leftPadding: UM.Theme.getSize("thin_margin").width
@ -131,7 +131,7 @@ Button
contentItem: Item contentItem: Item
{ {
height: parent.height height: parent.height
width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width width: perObjectSettingsInfo.width
Cura.NotificationIcon Cura.NotificationIcon
{ {

View File

@ -2,7 +2,6 @@
// 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.10 import QtQuick 2.10
import QtQuick.Controls 1.1 as OldControls
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
@ -243,6 +242,7 @@ UM.PreferencesPage
TextField TextField
{ {
id: currencyField id: currencyField
selectByMouse: true
text: UM.Preferences.getValue("cura/currency") text: UM.Preferences.getValue("cura/currency")
onTextChanged: UM.Preferences.setValue("cura/currency", text) onTextChanged: UM.Preferences.setValue("cura/currency", text)
} }
@ -869,7 +869,12 @@ UM.PreferencesPage
} }
} }
OldControls.ExclusiveGroup { id: curaUpdatesGroup } ButtonGroup
{
id: curaUpdatesGroup
buttons: [checkUpdatesOptionBeta, checkUpdatesOptionStable]
}
UM.TooltipArea UM.TooltipArea
{ {
width: childrenRect.width width: childrenRect.width
@ -877,10 +882,10 @@ UM.PreferencesPage
text: catalog.i18nc("@info:tooltip", "When checking for updates, only check for stable releases.") text: catalog.i18nc("@info:tooltip", "When checking for updates, only check for stable releases.")
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
OldControls.RadioButton RadioButton
{ {
id: checkUpdatesOptionStable
text: catalog.i18nc("@option:radio", "Stable releases only") text: catalog.i18nc("@option:radio", "Stable releases only")
exclusiveGroup: curaUpdatesGroup
enabled: checkUpdatesCheckbox.checked enabled: checkUpdatesCheckbox.checked
checked: UM.Preferences.getValue("info/latest_update_source") == "stable" checked: UM.Preferences.getValue("info/latest_update_source") == "stable"
onClicked: UM.Preferences.setValue("info/latest_update_source", "stable") onClicked: UM.Preferences.setValue("info/latest_update_source", "stable")
@ -893,10 +898,10 @@ UM.PreferencesPage
text: catalog.i18nc("@info:tooltip", "When checking for updates, check for both stable and for beta releases.") text: catalog.i18nc("@info:tooltip", "When checking for updates, check for both stable and for beta releases.")
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
OldControls.RadioButton RadioButton
{ {
id: checkUpdatesOptionBeta
text: catalog.i18nc("@option:radio", "Stable and Beta releases") text: catalog.i18nc("@option:radio", "Stable and Beta releases")
exclusiveGroup: curaUpdatesGroup
enabled: checkUpdatesCheckbox.checked enabled: checkUpdatesCheckbox.checked
checked: UM.Preferences.getValue("info/latest_update_source") == "beta" checked: UM.Preferences.getValue("info/latest_update_source") == "beta"
onClicked: UM.Preferences.setValue("info/latest_update_source", "beta") onClicked: UM.Preferences.setValue("info/latest_update_source", "beta")

View File

@ -1,8 +1,8 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.7 import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 2.1
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import UM 1.5 as UM import UM 1.5 as UM
@ -38,7 +38,7 @@ UM.ManagementPage
{ {
id: activateMenuButton id: activateMenuButton
text: catalog.i18nc("@action:button", "Activate"); text: catalog.i18nc("@action:button", "Activate");
iconName: "list-activate"; icon.name: "list-activate"
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id
onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id) onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id)
}, },
@ -46,14 +46,14 @@ UM.ManagementPage
{ {
id: addMenuButton id: addMenuButton
text: catalog.i18nc("@action:button", "Add"); text: catalog.i18nc("@action:button", "Add");
iconName: "list-add"; icon.name: "list-add"
onClicked: Cura.Actions.addMachine.trigger() onClicked: Cura.Actions.addMachine.trigger()
}, },
Button Button
{ {
id: removeMenuButton id: removeMenuButton
text: catalog.i18nc("@action:button", "Remove"); text: catalog.i18nc("@action:button", "Remove");
iconName: "list-remove"; icon.name: "list-remove"
enabled: base.currentItem != null && model.count > 1 enabled: base.currentItem != null && model.count > 1
onClicked: confirmDialog.open(); onClicked: confirmDialog.open();
}, },
@ -61,7 +61,7 @@ UM.ManagementPage
{ {
id: renameMenuButton id: renameMenuButton
text: catalog.i18nc("@action:button", "Rename"); text: catalog.i18nc("@action:button", "Rename");
iconName: "edit-rename"; icon.name: "edit-rename"
enabled: base.currentItem != null && base.currentItem.metadata.group_name == null enabled: base.currentItem != null && base.currentItem.metadata.group_name == null
onClicked: renameDialog.open(); onClicked: renameDialog.open();
} }
@ -125,7 +125,7 @@ UM.ManagementPage
rightButtons: Button rightButtons: Button
{ {
text: catalog.i18nc("@action:button", "Close") text: catalog.i18nc("@action:button", "Close")
iconName: "dialog-close" icon.name: "dialog-close"
onClicked: actionDialog.reject() onClicked: actionDialog.reject()
} }
} }

View File

@ -3,7 +3,6 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
@ -103,11 +102,11 @@ Item
height: childrenRect.height height: childrenRect.height
// Activate button // Activate button
OldControls.Button Button
{ {
id: activateMenuButton id: activateMenuButton
text: catalog.i18nc("@action:button", "Activate") text: catalog.i18nc("@action:button", "Activate")
iconName: "list-activate" icon.name: "list-activate"
enabled: !isCurrentItemActivated && Cura.MachineManager.activeMachine.hasMaterials enabled: !isCurrentItemActivated && Cura.MachineManager.activeMachine.hasMaterials
onClicked: onClicked:
{ {
@ -121,11 +120,11 @@ Item
} }
// Create button // Create button
OldControls.Button Button
{ {
id: createMenuButton id: createMenuButton
text: catalog.i18nc("@action:button", "Create") text: catalog.i18nc("@action:button", "Create")
iconName: "list-add" icon.name: "list-add"
enabled: Cura.MachineManager.activeMachine.hasMaterials enabled: Cura.MachineManager.activeMachine.hasMaterials
onClicked: onClicked:
{ {
@ -136,11 +135,11 @@ Item
} }
// Duplicate button // Duplicate button
OldControls.Button Button
{ {
id: duplicateMenuButton id: duplicateMenuButton
text: catalog.i18nc("@action:button", "Duplicate"); text: catalog.i18nc("@action:button", "Duplicate");
iconName: "list-add" icon.name: "list-add"
enabled: base.hasCurrentItem enabled: base.hasCurrentItem
onClicked: onClicked:
{ {
@ -151,11 +150,11 @@ Item
} }
// Remove button // Remove button
OldControls.Button Button
{ {
id: removeMenuButton id: removeMenuButton
text: catalog.i18nc("@action:button", "Remove") text: catalog.i18nc("@action:button", "Remove")
iconName: "list-remove" icon.name: "list-remove"
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && base.materialManagementModel.canMaterialBeRemoved(base.currentItem.container_node) enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && base.materialManagementModel.canMaterialBeRemoved(base.currentItem.container_node)
onClicked: onClicked:
@ -166,11 +165,11 @@ Item
} }
// Import button // Import button
OldControls.Button Button
{ {
id: importMenuButton id: importMenuButton
text: catalog.i18nc("@action:button", "Import") text: catalog.i18nc("@action:button", "Import")
iconName: "document-import" icon.name: "document-import"
onClicked: onClicked:
{ {
forceActiveFocus(); forceActiveFocus();
@ -180,11 +179,11 @@ Item
} }
// Export button // Export button
OldControls.Button Button
{ {
id: exportMenuButton id: exportMenuButton
text: catalog.i18nc("@action:button", "Export") text: catalog.i18nc("@action:button", "Export")
iconName: "document-export" icon.name: "document-export"
onClicked: onClicked:
{ {
forceActiveFocus(); forceActiveFocus();
@ -194,11 +193,11 @@ Item
} }
//Sync button. //Sync button.
OldControls.Button Button
{ {
id: syncMaterialsButton id: syncMaterialsButton
text: catalog.i18nc("@action:button Sending materials to printers", "Sync with Printers") text: catalog.i18nc("@action:button Sending materials to printers", "Sync with Printers")
iconName: "sync-synchronizing" icon.name: "sync-synchronizing"
onClicked: onClicked:
{ {
forceActiveFocus(); forceActiveFocus();

View File

@ -1,8 +1,8 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.7 import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2

View File

@ -3,7 +3,6 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import UM 1.5 as UM import UM 1.5 as UM
@ -284,32 +283,69 @@ Item
} }
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") } Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") }
OldControls.SpinBox SpinBox
{ {
id: spoolCostSpinBox id: spoolCostSpinBox
width: informationPage.columnWidth width: informationPage.columnWidth
value: base.getMaterialPreferenceValue(properties.guid, "spool_cost") value: base.getMaterialPreferenceValue(properties.guid, "spool_cost")
prefix: base.currency + " " to: 100000000
decimals: 2 editable: true
maximumValue: 100000000
contentItem: TextField
{
text: spoolCostSpinBox.textFromValue(spoolCostSpinBox.value, spoolCostSpinBox.locale)
selectByMouse: true
background: Item {}
validator: RegExpValidator { regExp: new RegExp("^" + base.currency + " ([0-9]+[.]?[0-9]*)?$") }
}
property int decimals: 2
valueFromText: function(text) {
// remove all non-number tokens from input string so value can be parsed correctly
var value = Number(text.replace(",", ".").replace(/[^0-9.]+/g, ""));
var precision = Math.pow(10, spoolCostSpinBox.decimals);
return Math.round(value * precision) / precision;
}
textFromValue: function(value) {
return base.currency + " " + value.toFixed(spoolCostSpinBox.decimals)
}
onValueChanged: onValueChanged:
{ {
base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value)) base.setMaterialPreferenceValue(properties.guid, "spool_cost", parseFloat(value, decimals))
updateCostPerMeter() updateCostPerMeter()
} }
} }
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") } Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") }
OldControls.SpinBox SpinBox
{ {
id: spoolWeightSpinBox id: spoolWeightSpinBox
width: informationPage.columnWidth width: informationPage.columnWidth
value: base.getMaterialPreferenceValue(properties.guid, "spool_weight", Cura.ContainerManager.getContainerMetaDataEntry(properties.container_id, "properties/weight")) value: base.getMaterialPreferenceValue(properties.guid, "spool_weight", Cura.ContainerManager.getContainerMetaDataEntry(properties.container_id, "properties/weight"))
suffix: " g"
stepSize: 100 stepSize: 100
decimals: 0 to: 10000
maximumValue: 10000 editable: true
contentItem: TextField
{
text: spoolWeightSpinBox.textFromValue(spoolWeightSpinBox.value, spoolWeightSpinBox.locale)
selectByMouse: true
background: Item {}
validator: RegExpValidator { regExp: new RegExp("^([0-9]+[.]?[0-9]*)? g$") }
}
valueFromText: function(text, locale) {
// remove all non-number tokens from input string so value can be parsed correctly
var value = Number(text.replace(",", ".").replace(/[^0-9.]+/g, ""));
return Math.round(value);
}
textFromValue: function(value, locale) {
return value + " g"
}
onValueChanged: onValueChanged:
{ {
@ -345,7 +381,7 @@ Item
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: unlinkMaterialButton.visible visible: unlinkMaterialButton.visible
} }
OldControls.Button Button
{ {
id: unlinkMaterialButton id: unlinkMaterialButton
text: catalog.i18nc("@label", "Unlink Material") text: catalog.i18nc("@label", "Unlink Material")

View File

@ -3,7 +3,6 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
@ -79,11 +78,11 @@ Item
height: childrenRect.height height: childrenRect.height
// Activate button // Activate button
OldControls.Button Button
{ {
id: activateMenuButton id: activateMenuButton
text: catalog.i18nc("@action:button", "Activate") text: catalog.i18nc("@action:button", "Activate")
iconName: "list-activate" icon.name: "list-activate"
enabled: !isCurrentItemActivated && base.currentItem enabled: !isCurrentItemActivated && base.currentItem
onClicked: onClicked:
{ {
@ -99,11 +98,11 @@ Item
} }
// Create button // Create button
OldControls.Button Button
{ {
id: createMenuButton id: createMenuButton
text: catalog.i18nc("@label", "Create") text: catalog.i18nc("@label", "Create")
iconName: "list-add" icon.name: "list-add"
enabled: base.canCreateProfile && !Cura.MachineManager.stacksHaveErrors enabled: base.canCreateProfile && !Cura.MachineManager.stacksHaveErrors
visible: base.canCreateProfile visible: base.canCreateProfile
@ -116,11 +115,11 @@ Item
} }
// Duplicate button // Duplicate button
OldControls.Button Button
{ {
id: duplicateMenuButton id: duplicateMenuButton
text: catalog.i18nc("@label", "Duplicate") text: catalog.i18nc("@label", "Duplicate")
iconName: "list-add" icon.name: "list-add"
enabled: !base.canCreateProfile enabled: !base.canCreateProfile
visible: !base.canCreateProfile visible: !base.canCreateProfile
@ -133,11 +132,11 @@ Item
} }
// Remove button // Remove button
OldControls.Button Button
{ {
id: removeMenuButton id: removeMenuButton
text: catalog.i18nc("@action:button", "Remove") text: catalog.i18nc("@action:button", "Remove")
iconName: "list-remove" icon.name: "list-remove"
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated
onClicked: onClicked:
{ {
@ -147,11 +146,11 @@ Item
} }
// Rename button // Rename button
OldControls.Button Button
{ {
id: renameMenuButton id: renameMenuButton
text: catalog.i18nc("@action:button", "Rename") text: catalog.i18nc("@action:button", "Rename")
iconName: "edit-rename" icon.name: "edit-rename"
enabled: base.hasCurrentItem && !base.currentItem.is_read_only enabled: base.hasCurrentItem && !base.currentItem.is_read_only
onClicked: onClicked:
{ {
@ -162,11 +161,11 @@ Item
} }
// Import button // Import button
OldControls.Button Button
{ {
id: importMenuButton id: importMenuButton
text: catalog.i18nc("@action:button", "Import") text: catalog.i18nc("@action:button", "Import")
iconName: "document-import" icon.name: "document-import"
onClicked: onClicked:
{ {
importDialog.open(); importDialog.open();
@ -174,11 +173,11 @@ Item
} }
// Export button // Export button
OldControls.Button Button
{ {
id: exportMenuButton id: exportMenuButton
text: catalog.i18nc("@action:button", "Export") text: catalog.i18nc("@action:button", "Export")
iconName: "document-export" icon.name: "document-export"
enabled: base.hasCurrentItem && !base.currentItem.is_read_only enabled: base.hasCurrentItem && !base.currentItem.is_read_only
onClicked: onClicked:
{ {

View File

@ -0,0 +1,122 @@
// Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
// Button with a label-like appearance that displays different states (these can be displayed by setting the
// `valueError` or `valueWarning` properties). Mainly used within the `CustomConfiguration` component.
import QtQuick 2.1
import QtQuick.Controls 2.1
import Cura 1.0 as Cura
import UM 1.5 as UM
ToolButton
{
id: base
property alias tooltip: tooltip.text
property bool valueError: false;
property bool valueWarning: false;
Cura.ToolTip
{
id: tooltip
visible: base.hovered
targetPoint: Qt.point(parent.x, Math.round(parent.y + parent.height / 2))
}
states:
[
State
{
name: "disabled"
when: !base.enabled;
PropertyChanges
{
target: background
color: UM.Theme.getColor("setting_control_disabled")
border.color: UM.Theme.getColor("setting_control_disabled_border")
}
},
State
{
name: "value_error"
when: base.enabled && base.valueError
PropertyChanges
{
target: background
color: UM.Theme.getColor("setting_validation_error_background")
border.color: UM.Theme.getColor("setting_validation_error")
}
},
State
{
name: "value_warning"
when: base.enabled && base.valueWarning
PropertyChanges
{
target: background
color: UM.Theme.getColor("setting_validation_warning_background")
border.color: UM.Theme.getColor("setting_validation_warning")
}
},
State
{
name: "highlight"
when: base.enabled && base.hovered
PropertyChanges
{
target: background
color: UM.Theme.getColor("setting_control")
border.color: UM.Theme.getColor("setting_control_border_highlight")
}
},
State
{
name: "neutral"
when: base.enabled && !base.hovered && !base.valueWarning && !base.valueError
PropertyChanges
{
target: background
color: UM.Theme.getColor("setting_control")
border.color: UM.Theme.getColor("setting_control_border")
}
}
]
background: Rectangle
{
id: background
radius: UM.Theme.getSize("setting_control_radius").width
border.width: UM.Theme.getSize("default_lining").width
color: UM.Theme.getColor("setting_control")
border.color: UM.Theme.getColor("setting_control_border")
UM.RecolorImage
{
id: downArrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.height: width
color: base.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text")
source: UM.Theme.getIcon("ChevronSingleDown")
}
}
contentItem: UM.Label
{
id: printSetupComboBoxLabel
text: base.text
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.right: downArrow.lef
anchors.rightMargin: base.rightMargin
anchors.verticalCenter: parent.verticalCenter
}
}

View File

@ -3,7 +3,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import UM 1.5 as UM import UM 1.5 as UM

View File

@ -2,7 +2,6 @@
// 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.10 import QtQuick 2.10
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import UM 1.5 as UM import UM 1.5 as UM

View File

@ -223,7 +223,7 @@ Item
} }
} }
Button //The pre-heat button. Cura.SecondaryButton
{ {
id: preheatButton id: preheatButton
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -255,81 +255,7 @@ Item
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
style: ButtonStyle {
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
else
{
return UM.Theme.getColor("action_button_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
else
{
return UM.Theme.getColor("action_button");
}
}
Behavior on color
{
ColorAnimation
{
duration: 50
}
}
Label
{
id: actualLabel
anchors.centerIn: parent
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
else
{
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("medium")
text: text:
{ {
if(extruderModel == null) if(extruderModel == null)
@ -344,9 +270,6 @@ Item
return catalog.i18nc("@button", "Pre-heat") return catalog.i18nc("@button", "Pre-heat")
} }
} }
}
}
}
onClicked: onClicked:
{ {

View File

@ -214,7 +214,7 @@ Item
} }
} }
Button // The pre-heat button. Cura.SecondaryButton // The pre-heat button.
{ {
id: preheatButton id: preheatButton
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -246,81 +246,7 @@ Item
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
style: ButtonStyle {
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
else
{
return UM.Theme.getColor("action_button_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
else
{
return UM.Theme.getColor("action_button");
}
}
Behavior on color
{
ColorAnimation
{
duration: 50
}
}
Label
{
id: actualLabel
anchors.centerIn: parent
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
else
{
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("medium")
text: text:
{ {
if(printerModel == null) if(printerModel == null)
@ -335,9 +261,6 @@ Item
return catalog.i18nc("@button", "Pre-heat") return catalog.i18nc("@button", "Pre-heat")
} }
} }
}
}
}
onClicked: onClicked:
{ {

View File

@ -1,9 +1,8 @@
// Copyright (c) 2019 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// 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.10 import QtQuick 2.10
import QtQuick.Controls 1.4 import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import UM 1.5 as UM import UM 1.5 as UM
@ -92,14 +91,13 @@ Item
Layout.preferredHeight: height Layout.preferredHeight: height
} }
Button Cura.SecondaryButton
{ {
Layout.row: 1 Layout.row: 1
Layout.column: 1 Layout.column: 1
Layout.preferredWidth: width Layout.preferredWidth: width
Layout.preferredHeight: height Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("ChevronSingleUp"); iconSource: UM.Theme.getIcon("ChevronSingleUp");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -109,14 +107,13 @@ Item
} }
} }
Button Cura.SecondaryButton
{ {
Layout.row: 2 Layout.row: 2
Layout.column: 0 Layout.column: 0
Layout.preferredWidth: width Layout.preferredWidth: width
Layout.preferredHeight: height Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("ChevronSingleLeft"); iconSource: UM.Theme.getIcon("ChevronSingleLeft");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -126,14 +123,13 @@ Item
} }
} }
Button Cura.SecondaryButton
{ {
Layout.row: 2 Layout.row: 2
Layout.column: 2 Layout.column: 2
Layout.preferredWidth: width Layout.preferredWidth: width
Layout.preferredHeight: height Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("ChevronSingleRight"); iconSource: UM.Theme.getIcon("ChevronSingleRight");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -143,14 +139,13 @@ Item
} }
} }
Button Cura.SecondaryButton
{ {
Layout.row: 3 Layout.row: 3
Layout.column: 1 Layout.column: 1
Layout.preferredWidth: width Layout.preferredWidth: width
Layout.preferredHeight: height Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("ChevronSingleDown"); iconSource: UM.Theme.getIcon("ChevronSingleDown");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -160,14 +155,13 @@ Item
} }
} }
Button Cura.SecondaryButton
{ {
Layout.row: 2 Layout.row: 2
Layout.column: 1 Layout.column: 1
Layout.preferredWidth: width Layout.preferredWidth: width
Layout.preferredHeight: height Layout.preferredHeight: height
iconSource: UM.Theme.getIcon("House"); iconSource: UM.Theme.getIcon("House");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -192,10 +186,9 @@ Item
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
Button Cura.SecondaryButton
{ {
iconSource: UM.Theme.getIcon("ChevronSingleUp"); iconSource: UM.Theme.getIcon("ChevronSingleUp");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -205,10 +198,9 @@ Item
} }
} }
Button Cura.SecondaryButton
{ {
iconSource: UM.Theme.getIcon("House"); iconSource: UM.Theme.getIcon("House");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -218,10 +210,9 @@ Item
} }
} }
Button Cura.SecondaryButton
{ {
iconSource: UM.Theme.getIcon("ChevronSingleDown"); iconSource: UM.Theme.getIcon("ChevronSingleDown");
style: UM.Theme.styles.monitor_button_style
width: height width: height
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
@ -266,12 +257,10 @@ Item
width: height + UM.Theme.getSize("default_margin").width width: height + UM.Theme.getSize("default_margin").width
text: model.label text: model.label
exclusiveGroup: distanceGroup ButtonGroup.group: distanceGroup
checkable: true checkable: true
checked: distancesRow.currentDistance == model.value checked: distancesRow.currentDistance == model.value
onClicked: distancesRow.currentDistance = model.value onClicked: distancesRow.currentDistance = model.value
style: UM.Theme.styles.monitor_checkable_button_style
} }
} }
} }
@ -400,6 +389,6 @@ Item
ListElement { label: "10"; value: 10 } ListElement { label: "10"; value: 10 }
ListElement { label: "100"; value: 100 } ListElement { label: "100"; value: 100 }
} }
ExclusiveGroup { id: distanceGroup } ButtonGroup { id: distanceGroup }
} }
} }

View File

@ -3,7 +3,6 @@
import Qt.labs.qmlmodels 1.0 import Qt.labs.qmlmodels 1.0
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import UM 1.5 as UM import UM 1.5 as UM

View File

@ -9,186 +9,6 @@ import UM 1.1 as UM
QtObject QtObject
{ {
property Component print_setup_header_button: Component
{
ButtonStyle
{
background: Rectangle
{
color:
{
if(control.enabled)
{
if(control.valueError)
{
return UM.Theme.getColor("setting_validation_error_background");
}
else if(control.valueWarning)
{
return UM.Theme.getColor("setting_validation_warning_background");
}
else
{
return UM.Theme.getColor("setting_control");
}
}
else
{
return UM.Theme.getColor("setting_control_disabled");
}
}
radius: UM.Theme.getSize("setting_control_radius").width
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if (control.enabled)
{
if (control.valueError)
{
return UM.Theme.getColor("setting_validation_error");
}
else if (control.valueWarning)
{
return UM.Theme.getColor("setting_validation_warning");
}
else if (control.hovered)
{
return UM.Theme.getColor("setting_control_border_highlight");
}
else
{
return UM.Theme.getColor("setting_control_border");
}
}
else
{
return UM.Theme.getColor("setting_control_disabled_border");
}
}
UM.RecolorImage
{
id: downArrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.height: width
color: control.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text")
source: UM.Theme.getIcon("ChevronSingleDown")
}
Label
{
id: printSetupComboBoxLabel
color: control.enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
text: control.text;
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("default")
}
}
label: Label{}
}
}
property Component tool_button: Component
{
ButtonStyle
{
background: Item
{
implicitWidth: UM.Theme.getSize("button").width
implicitHeight: UM.Theme.getSize("button").height
UM.PointingRectangle
{
id: button_tooltip
anchors.left: parent.right
anchors.leftMargin: UM.Theme.getSize("button_tooltip_arrow").width * 2
anchors.verticalCenter: parent.verticalCenter
target: Qt.point(parent.x, y + Math.round(height/2))
arrowSize: UM.Theme.getSize("button_tooltip_arrow").width
color: UM.Theme.getColor("button_tooltip")
opacity: control.hovered ? 1.0 : 0.0;
visible: control.text != ""
width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0
height: UM.Theme.getSize("button_tooltip").height
Behavior on width { NumberAnimation { duration: 100; } }
Behavior on opacity { NumberAnimation { duration: 100; } }
Label
{
id: button_tip
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: control.text
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("tooltip_text")
}
}
Rectangle
{
id: buttonFace
anchors.fill: parent
property bool down: control.pressed || (control.checkable && control.checked)
color:
{
if(control.customColor !== undefined && control.customColor !== null)
{
return control.customColor
}
else if(control.checkable && control.checked && control.hovered)
{
return UM.Theme.getColor("toolbar_button_active_hover")
}
else if(control.pressed || (control.checkable && control.checked))
{
return UM.Theme.getColor("toolbar_button_active")
}
else if(control.hovered)
{
return UM.Theme.getColor("toolbar_button_hover")
}
return UM.Theme.getColor("toolbar_background")
}
Behavior on color { ColorAnimation { duration: 50; } }
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? UM.Theme.getSize("default_lining").width : 0
border.color: control.checked ? UM.Theme.getColor("icon") : UM.Theme.getColor("lining")
}
}
label: Item
{
UM.RecolorImage
{
anchors.centerIn: parent
opacity: control.enabled ? 1.0 : 0.2
source: control.iconSource
width: UM.Theme.getSize("medium_button_icon").width
height: UM.Theme.getSize("medium_button_icon").height
color: UM.Theme.getColor("icon")
sourceSize: UM.Theme.getSize("medium_button_icon")
}
}
}
}
property Component progressbar: Component property Component progressbar: Component
{ {
ProgressBarStyle ProgressBarStyle
@ -268,61 +88,6 @@ QtObject
} }
} }
property Component combobox: Component
{
ComboBoxStyle
{
background: Rectangle
{
implicitHeight: UM.Theme.getSize("setting_control").height;
implicitWidth: UM.Theme.getSize("setting_control").width;
color: control.hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control")
Behavior on color { ColorAnimation { duration: 50; } }
border.width: UM.Theme.getSize("default_lining").width;
border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
radius: UM.Theme.getSize("setting_control_radius").width
}
label: Item
{
Label
{
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.right: downArrow.left
anchors.rightMargin: UM.Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter
text: control.currentText
font: UM.Theme.getFont("default");
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
UM.RecolorImage
{
id: downArrow
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
anchors.verticalCenter: parent.verticalCenter
source: UM.Theme.getIcon("ChevronSingleDown")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_button");
}
}
}
}
property Component partially_checkbox: Component property Component partially_checkbox: Component
{ {
CheckBoxStyle CheckBoxStyle
@ -372,233 +137,4 @@ QtObject
} }
} }
} }
property Component print_setup_action_button: Component
{
ButtonStyle
{
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
else
{
return UM.Theme.getColor("action_button_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
else
{
return UM.Theme.getColor("action_button");
}
}
Behavior on color { ColorAnimation { duration: 50 } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2)
Label
{
id: actualLabel
anchors.centerIn: parent
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
else
{
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("medium")
text: control.text
}
}
label: Item { }
}
}
property Component monitor_button_style: Component
{
ButtonStyle
{
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
return UM.Theme.getColor("action_button_border");
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
return UM.Theme.getColor("action_button");
}
Behavior on color
{
ColorAnimation
{
duration: 50
}
}
}
label: Item
{
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: Math.floor(control.width / 2)
height: Math.floor(control.height / 2)
sourceSize.height: width
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
return UM.Theme.getColor("action_button_text");
}
source: control.iconSource
}
}
}
}
property Component monitor_checkable_button_style: Component
{
ButtonStyle {
background: Rectangle {
border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if (control.checked || control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
return UM.Theme.getColor("action_button_border");
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if (control.checked || control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if (control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
return UM.Theme.getColor("action_button");
}
Behavior on color { ColorAnimation { duration: 50; } }
Label {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if (control.checked || control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if (control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
return UM.Theme.getColor("action_button_text");
}
font: UM.Theme.getFont("default")
text: control.text
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
}
}
label: Item { }
}
}
} }