Update usb printing menu to qt controls 2

CURA-8688
This commit is contained in:
casper 2022-03-01 11:36:47 +01:00
parent e131c596df
commit bd1b0fb34c
5 changed files with 65 additions and 55 deletions

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.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -35,17 +34,17 @@ Item
id: background id: background
anchors.fill: parent anchors.fill: parent
Label //Extruder name. // Extruder name.
UM.Label
{ {
text: Cura.MachineManager.activeMachine.extruderList[position].name !== "" ? Cura.MachineManager.activeMachine.extruderList[position].name : catalog.i18nc("@label", "Extruder") text: Cura.MachineManager.activeMachine.extruderList[position].name !== "" ? Cura.MachineManager.activeMachine.extruderList[position].name : catalog.i18nc("@label", "Extruder")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
} }
Label //Target temperature. // Target temperature.
UM.Label
{ {
id: extruderTargetTemperature id: extruderTargetTemperature
text: Math.round(extruderModel.targetHotendTemperature) + "°C" text: Math.round(extruderModel.targetHotendTemperature) + "°C"
@ -55,7 +54,8 @@ Item
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.bottom: extruderCurrentTemperature.bottom anchors.bottom: extruderCurrentTemperature.bottom
MouseArea //For tooltip. //For tooltip.
MouseArea
{ {
id: extruderTargetTemperatureTooltipArea id: extruderTargetTemperatureTooltipArea
hoverEnabled: true hoverEnabled: true
@ -77,17 +77,20 @@ Item
} }
} }
} }
Label //Temperature indication.
//Temperature indication.
UM.Label
{ {
id: extruderCurrentTemperature id: extruderCurrentTemperature
text: Math.round(extruderModel.hotendTemperature) + "°C" text: Math.round(extruderModel.hotendTemperature) + "°C"
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
anchors.right: extruderTargetTemperature.left anchors.right: extruderTargetTemperature.left
anchors.top: parent.top anchors.top: parent.top
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
MouseArea //For tooltip.
//For tooltip.
MouseArea
{ {
id: extruderCurrentTemperatureTooltipArea id: extruderCurrentTemperatureTooltipArea
hoverEnabled: true hoverEnabled: true
@ -110,7 +113,8 @@ Item
} }
} }
Rectangle //Input field for pre-heat temperature. //Input field for pre-heat temperature.
Rectangle
{ {
id: preheatTemperatureControl id: preheatTemperatureControl
color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok") color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok")
@ -152,14 +156,16 @@ Item
width: UM.Theme.getSize("monitor_preheat_temperature_control").width width: UM.Theme.getSize("monitor_preheat_temperature_control").width
height: UM.Theme.getSize("monitor_preheat_temperature_control").height height: UM.Theme.getSize("monitor_preheat_temperature_control").height
visible: extruderModel != null ? enabled && extruderModel.canPreHeatHotends && !extruderModel.isPreheating : true visible: extruderModel != null ? enabled && extruderModel.canPreHeatHotends && !extruderModel.isPreheating : true
Rectangle //Highlight of input field. //Highlight of input field.
Rectangle
{ {
anchors.fill: parent anchors.fill: parent
anchors.margins: UM.Theme.getSize("default_lining").width anchors.margins: UM.Theme.getSize("default_lining").width
color: UM.Theme.getColor("setting_control_highlight") color: UM.Theme.getColor("setting_control_highlight")
opacity: preheatTemperatureControl.hovered ? 1.0 : 0 opacity: preheatTemperatureControl.hovered ? 1.0 : 0
} }
MouseArea //Change cursor on hovering. //Change cursor on hovering.
MouseArea
{ {
id: preheatTemperatureInputMouseArea id: preheatTemperatureInputMouseArea
hoverEnabled: true hoverEnabled: true
@ -182,7 +188,7 @@ Item
} }
} }
} }
Label UM.Label
{ {
id: unit id: unit
anchors.right: parent.right anchors.right: parent.right
@ -191,7 +197,6 @@ Item
text: "°C"; text: "°C";
color: UM.Theme.getColor("setting_unit") color: UM.Theme.getColor("setting_unit")
font: UM.Theme.getFont("default")
} }
TextInput TextInput
{ {
@ -299,7 +304,8 @@ Item
} }
} }
Rectangle //Material colour indication. //Material colour indication.
Rectangle
{ {
id: materialColor id: materialColor
width: Math.floor(materialName.height * 0.75) width: Math.floor(materialName.height * 0.75)
@ -313,7 +319,8 @@ Item
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: materialName.verticalCenter anchors.verticalCenter: materialName.verticalCenter
MouseArea //For tooltip. //For tooltip.
MouseArea
{ {
id: materialColorTooltipArea id: materialColorTooltipArea
hoverEnabled: true hoverEnabled: true
@ -335,17 +342,17 @@ Item
} }
} }
} }
Label //Material name. //Material name.
UM.Label
{ {
id: materialName id: materialName
text: extruderModel.activeMaterial != null ? extruderModel.activeMaterial.type : "" text: extruderModel.activeMaterial != null ? extruderModel.activeMaterial.type : ""
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
anchors.left: materialColor.right anchors.left: materialColor.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
MouseArea //For tooltip. //For tooltip.
MouseArea
{ {
id: materialNameTooltipArea id: materialNameTooltipArea
hoverEnabled: true hoverEnabled: true
@ -367,17 +374,18 @@ Item
} }
} }
} }
Label //Variant name.
//Variant name.
UM.Label
{ {
id: variantName id: variantName
text: extruderModel.hotendID text: extruderModel.hotendID
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
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
MouseArea //For tooltip. //For tooltip.
MouseArea
{ {
id: variantNameTooltipArea id: variantNameTooltipArea
hoverEnabled: true hoverEnabled: true
@ -388,7 +396,7 @@ Item
{ {
base.showTooltip( base.showTooltip(
base, base,
{x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y}, { x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y },
catalog.i18nc("@tooltip", "The nozzle inserted in this extruder.") catalog.i18nc("@tooltip", "The nozzle inserted in this extruder.")
); );
} }

View file

@ -1,9 +1,8 @@
// Copyright (c) 2017 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.4
import QtQuick.Layouts 1.3
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -20,17 +19,17 @@ Item
color: UM.Theme.getColor("main_background") color: UM.Theme.getColor("main_background")
anchors.fill: parent anchors.fill: parent
Label //Build plate label. // Build plate label.
UM.Label
{ {
text: catalog.i18nc("@label", "Build plate") text: catalog.i18nc("@label", "Build plate")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
} }
Label //Target temperature. // Target temperature.
UM.Label
{ {
id: bedTargetTemperature id: bedTargetTemperature
text: printerModel != null ? printerModel.targetBedTemperature + "°C" : "" text: printerModel != null ? printerModel.targetBedTemperature + "°C" : ""
@ -40,7 +39,8 @@ Item
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.bottom: bedCurrentTemperature.bottom anchors.bottom: bedCurrentTemperature.bottom
MouseArea //For tooltip. // For tooltip.
MouseArea
{ {
id: bedTargetTemperatureTooltipArea id: bedTargetTemperatureTooltipArea
hoverEnabled: true hoverEnabled: true
@ -62,17 +62,18 @@ Item
} }
} }
} }
Label //Current temperature. // Current temperature.
UM.Label
{ {
id: bedCurrentTemperature id: bedCurrentTemperature
text: printerModel != null ? printerModel.bedTemperature + "°C" : "" text: printerModel != null ? printerModel.bedTemperature + "°C" : ""
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
color: UM.Theme.getColor("text")
anchors.right: bedTargetTemperature.left anchors.right: bedTargetTemperature.left
anchors.top: parent.top anchors.top: parent.top
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
MouseArea //For tooltip. //For tooltip.
MouseArea
{ {
id: bedTemperatureTooltipArea id: bedTemperatureTooltipArea
hoverEnabled: true hoverEnabled: true
@ -94,7 +95,8 @@ Item
} }
} }
} }
Rectangle //Input field for pre-heat temperature. //Input field for pre-heat temperature.
Rectangle
{ {
id: preheatTemperatureControl id: preheatTemperatureControl
color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok") color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok")
@ -166,7 +168,7 @@ Item
} }
} }
} }
Label UM.Label
{ {
id: unit id: unit
anchors.right: parent.right anchors.right: parent.right
@ -175,7 +177,6 @@ Item
text: "°C"; text: "°C";
color: UM.Theme.getColor("setting_unit") color: UM.Theme.getColor("setting_unit")
font: UM.Theme.getFont("default")
} }
TextInput TextInput
{ {
@ -213,7 +214,8 @@ Item
} }
} }
Cura.SecondaryButton // The pre-heat 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
@ -248,14 +250,15 @@ Item
text: text:
{ {
if(printerModel == null) if (printerModel == null)
{ {
return "" return ""
} }
if(printerModel.isPreheating ) if (printerModel.isPreheating )
{ {
return catalog.i18nc("@button Cancel pre-heating", "Cancel") return catalog.i18nc("@button Cancel pre-heating", "Cancel")
} else }
else
{ {
return catalog.i18nc("@button", "Pre-heat") return catalog.i18nc("@button", "Pre-heat")
} }
@ -279,7 +282,7 @@ Item
{ {
base.showTooltip( base.showTooltip(
base, base,
{x: 0, y: preheatButton.mapToItem(base, 0, 0).y}, { x: 0, y: preheatButton.mapToItem(base, 0, 0).y },
catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.")
); );
} }

View file

@ -3,7 +3,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View file

@ -1,8 +1,7 @@
// Copyright (c) 2017 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.Layouts 1.1
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View file

@ -1,7 +1,9 @@
// Copyright (c) 2022 Ultimaker B.V.
// 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 UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -27,7 +29,7 @@ Item
height: childrenRect.height height: childrenRect.height
color: UM.Theme.getColor("setting_category") color: UM.Theme.getColor("setting_category")
Label UM.Label
{ {
id: outputDeviceNameLabel id: outputDeviceNameLabel
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
@ -38,7 +40,7 @@ Item
text: outputDevice != null ? outputDevice.activePrinter.name : "" text: outputDevice != null ? outputDevice.activePrinter.name : ""
} }
Label UM.Label
{ {
id: outputDeviceAddressLabel id: outputDeviceAddressLabel
text: (outputDevice != null && outputDevice.address != null) ? outputDevice.address : "" text: (outputDevice != null && outputDevice.address != null) ? outputDevice.address : ""
@ -49,11 +51,10 @@ Item
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
} }
Label UM.Label
{ {
text: outputDevice != null ? "" : catalog.i18nc("@info:status", "The printer is not connected.") text: outputDevice != null ? "" : catalog.i18nc("@info:status", "The printer is not connected.")
color: outputDevice != null && outputDevice.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") color: outputDevice != null && outputDevice.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
font: UM.Theme.getFont("default")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width