diff options
author | Casper Lamboo <c.lamboo@ultimaker.com> | 2022-09-13 11:42:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 11:42:36 +0300 |
commit | 6abce2a81a367742a47f617c6548ddde6e882ad0 (patch) | |
tree | 043af455958924e410ce22b76fcf4979d2c9562d /resources | |
parent | d31cc5baf0769415e233423e61696ee7152e2441 (diff) | |
parent | d97dddcfe2db72e9397a3ab2b3e078e4e7cba001 (diff) |
Merge pull request #13195 from Ultimaker/CURA-9278_choose_printer_dialog
[CURA-9278] Press print on abstract cloud printer. User should see dialog.
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/Dialogs/ChoosePrinterDialog.qml | 94 | ||||
-rw-r--r-- | resources/qml/ExtruderIcon.qml | 16 | ||||
-rw-r--r-- | resources/qml/PrinterSelector/PrintSelectorCard.qml | 143 | ||||
-rw-r--r-- | resources/qml/qmldir | 1 |
4 files changed, 246 insertions, 8 deletions
diff --git a/resources/qml/Dialogs/ChoosePrinterDialog.qml b/resources/qml/Dialogs/ChoosePrinterDialog.qml new file mode 100644 index 0000000000..b7079fcabd --- /dev/null +++ b/resources/qml/Dialogs/ChoosePrinterDialog.qml @@ -0,0 +1,94 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 2.9 +import QtQuick.Layouts 2.10 + +import UM 1.5 as UM +import Cura 1.0 as Cura + +UM.Dialog +{ + property var manager + + id: base + + title: catalog.i18nc("@title:window", "Select Printer") + + backgroundColor: UM.Theme.getColor("background_2") + + width: minimumWidth + minimumWidth: 550 * screenScaleFactor + height: minimumHeight + minimumHeight: 550 * screenScaleFactor + + modality: Qt.ApplicationModal + + ScrollView + { + // Workaround for Windowing bugs in Qt: + width: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").width + height: 550 * screenScaleFactor - 3 * UM.Theme.getSize("default_margin").height + + UM.I18nCatalog + { + id: catalog + name: "cura" + } + + anchors.fill: parent + Column + { + anchors.fill: parent + spacing: UM.Theme.getSize("default_margin").height + + Item + { + width: parent.width + height: childrenRect.height + + UM.Label + { + anchors.left: parent.left + text: catalog.i18nc("@title:label", "Compatible Printers") + font: UM.Theme.getFont("large") + } + + UM.SimpleButton + { + anchors.right: parent.right + + width: UM.Theme.getSize("small_button").width + height: UM.Theme.getSize("small_button").height + iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") + color: UM.Theme.getColor("text_link") + hoverColor: UM.Theme.getColor("text_scene_hover") + + onClicked: manager.refresh() + } + } + + Repeater + { + id: contents + + model: Cura.CompatibleMachineModel {} + + delegate: Cura.PrintSelectorCard + { + name: model.name + unique_id: model.unique_id + extruders: model.extruders + manager: base.manager + } + } + + UM.Label + { + visible: contents.count < 1 + text: catalog.i18nc("@description", "No compatible printers, that are currently online, where found.") + } + } + } +} diff --git a/resources/qml/ExtruderIcon.qml b/resources/qml/ExtruderIcon.qml index fb3269ca78..718f1bcd87 100644 --- a/resources/qml/ExtruderIcon.qml +++ b/resources/qml/ExtruderIcon.qml @@ -8,16 +8,16 @@ Item { id: extruderIconItem - implicitWidth: UM.Theme.getSize("extruder_icon").width - implicitHeight: UM.Theme.getSize("extruder_icon").height - property bool checked: true property color materialColor property alias textColor: extruderNumberText.color property bool extruderEnabled: true - property var iconSize + property var iconSize: UM.Theme.getSize("extruder_icon").width property string iconVariant: "medium" + implicitWidth: iconSize + implicitHeight: iconSize + Item { opacity: extruderEnabled ? 1 : UM.Theme.getColor("extruder_disabled").a @@ -27,8 +27,8 @@ Item UM.ColorImage { anchors.fill: parent - width: mainIcon.width - height: mainIcon.height + width: iconSize + height: iconSize source: UM.Theme.getIcon("ExtruderColor", iconVariant) color: materialColor @@ -37,8 +37,8 @@ Item { id: mainIcon anchors.fill: parent - width: UM.Theme.getSize("extruder_icon").width - height: UM.Theme.getSize("extruder_icon").height + width: iconSize + height: iconSize source: UM.Theme.getIcon("Extruder", iconVariant) color: extruderNumberText.color diff --git a/resources/qml/PrinterSelector/PrintSelectorCard.qml b/resources/qml/PrinterSelector/PrintSelectorCard.qml new file mode 100644 index 0000000000..517a0e164a --- /dev/null +++ b/resources/qml/PrinterSelector/PrintSelectorCard.qml @@ -0,0 +1,143 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 2.9 +import QtQuick.Layouts 2.10 + +import UM 1.5 as UM +import Cura 1.0 as Cura + +Rectangle +{ + property alias name: printerTitle.text + property string unique_id + property var extruders + property var manager + + width: parent.width + height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height + + color: UM.Theme.getColor("background_1") + border.color: UM.Theme.getColor("border_main") + border.width: UM.Theme.getSize("default_lining").width + + RowLayout + { + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: UM.Theme.getSize("default_margin").width + + Cura.IconWithText + { + id: printerTitle + + Layout.preferredWidth: parent.width / 3 + Layout.fillWidth: true + Layout.alignment: Qt.AlignTop + Layout.fillHeight: false + + source: UM.Theme.getIcon("Printer") + spacing: UM.Theme.getSize("thin_margin").width + iconSize: UM.Theme.getSize("medium_button_icon").width + font: UM.Theme.getFont("medium_bold") + } + + ColumnLayout + { + id: extruderInformation + Layout.fillWidth: true + Layout.preferredWidth: parent.width / 2 + Layout.alignment: Qt.AlignTop + spacing: UM.Theme.getSize("default_margin").width + + Repeater + { + model: extruders + + Item + { + height: childrenRect.height + + Cura.ExtruderIcon + { + id: extruderIcon + anchors.top: parent.top + anchors.left: parent.left + materialColor: modelData.materials.length == 1 ? modelData.materials[0].hexcolor : "white" + iconSize: UM.Theme.getSize("medium_button_icon").width + } + + UM.Label + { + id: extruderCore + anchors.verticalCenter: extruderIcon.verticalCenter + anchors.left: extruderIcon.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: modelData.core + font: UM.Theme.getFont("default_bold") + } + + UM.Label + { + id: singleMaterialText + anchors.left: extruderCore.right + anchors.verticalCenter: extruderCore.verticalCenter + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: modelData.materials.length == 1 ? `${modelData.materials[0].brand} ${modelData.materials[0].name}` : "" + visible: modelData.materials.length == 1 + } + + ColumnLayout + { + id: multiMaterialText + anchors.top: extruderCore.bottom + anchors.left: extruderCore.left + anchors.topMargin: UM.Theme.getSize("narrow_margin").height + visible: modelData.materials.length > 1 + Repeater + { + model: modelData.materials + UM.Label + { + text: `${modelData.brand} ${modelData.name}` + } + } + } + } + } + } + + Button + { + id: printButton + + implicitWidth: UM.Theme.getSize("medium_button").width + implicitHeight: implicitWidth + Layout.alignment: Qt.AlignTop + padding: 0 + + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("border_accent_1") + color: printButton.hovered ? UM.Theme.getColor("toolbar_button_hover"): UM.Theme.getColor("background_1") + } + + contentItem: Item + { + UM.ColorImage + { + anchors.centerIn: parent + source: UM.Theme.getIcon("Printer") + color: UM.Theme.getColor("border_accent_1") + width: UM.Theme.getSize("small_button_icon").width + height: width + } + } + + onClicked: manager.printerSelected(unique_id) + } + } +} diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 6ec3ca91c8..d5184f1d8c 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -17,6 +17,7 @@ PrinterTypeLabel 1.0 PrinterTypeLabel.qml ViewsSelector 1.0 ViewsSelector.qml SettingView 1.0 SettingView.qml ProfileMenu 1.0 ProfileMenu.qml +PrintSelectorCard 1.0 PrintSelectorCard.qml # Cura/WelcomePages |