diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml index c8c40541bc..4b78448a8d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml @@ -4,46 +4,37 @@ import QtQuick 2.3 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.3 -import QtQuick.Controls 2.0 as Controls2 -import QtGraphicalEffects 1.0 - import UM 1.3 as UM import Cura 1.0 as Cura -Rectangle -{ - property var iconSource: null +Rectangle { + property var iconSource: null; + color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary"); + height: width; + radius: 0.5 * width; + width: 36 * screenScaleFactor; - width: 36 * screenScaleFactor - height: width - radius: 0.5 * width - color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary") - - UM.RecolorImage - { - id: icon - width: parent.width / 2 - height: width - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: UM.Theme.getColor("primary_text") - source: iconSource + UM.RecolorImage { + id: icon; + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter; + } + color: UM.Theme.getColor("primary_text"); + height: width; + source: iconSource; + width: parent.width / 2; } - MouseArea - { - id: clickArea - anchors.fill:parent - hoverEnabled: true - onClicked: - { - if (OutputDevice.activeCamera !== null) - { + MouseArea { + id: clickArea; + anchors.fill: parent; + hoverEnabled: true; + onClicked: { + if (OutputDevice.activeCamera !== null) { OutputDevice.setActiveCamera(null) - } - else - { - OutputDevice.setActiveCamera(modelData.camera) + } else { + OutputDevice.setActiveCamera(modelData.camera); } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml index a42d8a2d6c..3da155cfad 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml @@ -2,130 +2,108 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.3 -import QtQuick.Dialogs 1.1 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.3 -import QtGraphicalEffects 1.0 - -import QtQuick.Controls 2.0 as Controls2 - import UM 1.3 as UM import Cura 1.0 as Cura +Component { + Rectangle { + id: base; + property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme. + property var shadowRadius: 5 * screenScaleFactor; + property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme. + anchors.fill: parent; + color: "white"; + visible: OutputDevice != null; -Component -{ - Rectangle - { - id: base - property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. - property var shadowRadius: 5 * screenScaleFactor - property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme. - visible: OutputDevice != null - anchors.fill: parent - color: "white" - - UM.I18nCatalog - { - id: catalog - name: "cura" + UM.I18nCatalog { + id: catalog; + name: "cura"; } - Label - { - id: printingLabel - font: UM.Theme.getFont("large") - anchors - { - margins: 2 * UM.Theme.getSize("default_margin").width - leftMargin: 4 * UM.Theme.getSize("default_margin").width - top: parent.top - left: parent.left - right: parent.right + Label { + id: printingLabel; + anchors { + left: parent.left; + leftMargin: 4 * UM.Theme.getSize("default_margin").width; + margins: 2 * UM.Theme.getSize("default_margin").width; + right: parent.right; + top: parent.top; } - - text: catalog.i18nc("@label", "Printing") - elide: Text.ElideRight + elide: Text.ElideRight; + font: UM.Theme.getFont("large"); + text: catalog.i18nc("@label", "Printing"); } - Label - { - id: managePrintersLabel - anchors.rightMargin: 4 * UM.Theme.getSize("default_margin").width - anchors.right: printerScrollView.right - anchors.bottom: printingLabel.bottom - text: catalog.i18nc("@label link to connect manager", "Manage printers") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("primary") - linkColor: UM.Theme.getColor("primary") + Label { + id: managePrintersLabel; + anchors { + bottom: printingLabel.bottom; + right: printerScrollView.right; + rightMargin: 4 * UM.Theme.getSize("default_margin").width; + } + color: UM.Theme.getColor("primary"); + font: UM.Theme.getFont("default"); + linkColor: UM.Theme.getColor("primary"); + text: catalog.i18nc("@label link to connect manager", "Manage printers"); } - MouseArea - { - anchors.fill: managePrintersLabel - hoverEnabled: true - onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel() - onEntered: managePrintersLabel.font.underline = true - onExited: managePrintersLabel.font.underline = false + MouseArea { + anchors.fill: managePrintersLabel; + hoverEnabled: true; + onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel(); + onEntered: managePrintersLabel.font.underline = true; + onExited: managePrintersLabel.font.underline = false; } // Skeleton loading - Column - { - id: skeletonLoader + Column { + id: skeletonLoader; + anchors { + left: parent.left; + leftMargin: UM.Theme.getSize("wide_margin").width; + right: parent.right; + rightMargin: UM.Theme.getSize("wide_margin").width; + top: printingLabel.bottom; + topMargin: UM.Theme.getSize("default_margin").height; + } + spacing: UM.Theme.getSize("default_margin").height - 10; visible: printerList.count === 0; - anchors - { - top: printingLabel.bottom - topMargin: UM.Theme.getSize("default_margin").height - left: parent.left - leftMargin: UM.Theme.getSize("wide_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("wide_margin").width - } - spacing: UM.Theme.getSize("default_margin").height - 10 - PrinterCard - { - printer: null + PrinterCard { + printer: null; } - PrinterCard - { - printer: null + PrinterCard { + printer: null; } } // Actual content - ScrollView - { - id: printerScrollView - anchors - { - top: printingLabel.bottom - topMargin: UM.Theme.getSize("default_margin").height - left: parent.left - right: parent.right + ScrollView { + id: printerScrollView; + anchors { bottom: parent.bottom; + left: parent.left; + right: parent.right; + top: printingLabel.bottom; + topMargin: UM.Theme.getSize("default_margin").height; } + style: UM.Theme.styles.scrollview; - style: UM.Theme.styles.scrollview - - ListView - { - id: printerList - property var currentIndex: -1 - anchors - { - fill: parent - leftMargin: UM.Theme.getSize("wide_margin").width - rightMargin: UM.Theme.getSize("wide_margin").width + ListView { + id: printerList; + property var currentIndex: -1; + anchors { + fill: parent; + leftMargin: UM.Theme.getSize("wide_margin").width; + rightMargin: UM.Theme.getSize("wide_margin").width; } - spacing: UM.Theme.getSize("default_margin").height - 10 - model: OutputDevice.printers - delegate: PrinterCard - { - printer: modelData + delegate: PrinterCard { + printer: modelData; } + model: OutputDevice.printers; + spacing: UM.Theme.getSize("default_margin").height - 10; } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml index 06b8e9f2be..778a6da2eb 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml @@ -4,141 +4,129 @@ import QtQuick 2.2 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 - import UM 1.3 as UM import Cura 1.0 as Cura -Component -{ - Rectangle - { - id: monitorFrame - width: maximumWidth - height: maximumHeight - color: UM.Theme.getColor("viewport_background") - property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight") - property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. - property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme. - - UM.I18nCatalog - { - id: catalog - name: "cura" - } - - Label - { - id: manageQueueLabel - anchors.rightMargin: 3 * UM.Theme.getSize("default_margin").width - anchors.right: queuedPrintJobs.right - anchors.bottom: queuedLabel.bottom - text: catalog.i18nc("@label link to connect manager", "Manage queue") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("primary") - linkColor: UM.Theme.getColor("primary") - } - - MouseArea - { - anchors.fill: manageQueueLabel - hoverEnabled: true - onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel() - onEntered: manageQueueLabel.font.underline = true - onExited: manageQueueLabel.font.underline = false - } - - Label - { - id: queuedLabel - anchors.left: queuedPrintJobs.left - anchors.top: parent.top - anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height - anchors.leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5 - text: catalog.i18nc("@label", "Queued") - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - } - - Column - { - id: skeletonLoader - visible: printJobList.count === 0; - width: Math.min(800 * screenScaleFactor, maximumWidth) - anchors - { - top: queuedLabel.bottom - topMargin: UM.Theme.getSize("default_margin").height - horizontalCenter: parent.horizontalCenter - bottomMargin: UM.Theme.getSize("default_margin").height - bottom: parent.bottom - } - PrintJobInfoBlock - { - printJob: null // Use as skeleton - anchors - { - left: parent.left - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - leftMargin: UM.Theme.getSize("default_margin").width - } - } - PrintJobInfoBlock - { - printJob: null // Use as skeleton - anchors - { - left: parent.left - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - leftMargin: UM.Theme.getSize("default_margin").width - } +Component { + Rectangle { + id: monitorFrame; + property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight"); + property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme. + property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme. + color: UM.Theme.getColor("viewport_background"); + height: maximumHeight; + onVisibleChanged: { + if (monitorFrame != null && !monitorFrame.visible) { + OutputDevice.setActiveCamera(null); } } + width: maximumWidth; - ScrollView - { - id: queuedPrintJobs + UM.I18nCatalog { + id: catalog; + name: "cura"; + } + + Label { + id: manageQueueLabel; anchors { - top: queuedLabel.bottom - topMargin: UM.Theme.getSize("default_margin").height - horizontalCenter: parent.horizontalCenter - bottomMargin: UM.Theme.getSize("default_margin").height - bottom: parent.bottom + bottom: queuedLabel.bottom; + right: queuedPrintJobs.right; + rightMargin: 3 * UM.Theme.getSize("default_margin").width; } - style: UM.Theme.styles.scrollview - width: Math.min(800 * screenScaleFactor, maximumWidth) + color: UM.Theme.getColor("primary"); + font: UM.Theme.getFont("default"); + linkColor: UM.Theme.getColor("primary"); + text: catalog.i18nc("@label link to connect manager", "Manage queue"); + } - ListView - { - id: printJobList; - anchors.fill: parent - spacing: UM.Theme.getSize("default_margin").height - 10 // 2x the shadow radius - model: OutputDevice.queuedPrintJobs - delegate: PrintJobInfoBlock - { - printJob: modelData - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.leftMargin: UM.Theme.getSize("default_margin").width + MouseArea { + anchors.fill: manageQueueLabel; + hoverEnabled: true; + onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel(); + onEntered: manageQueueLabel.font.underline = true; + onExited: manageQueueLabel.font.underline = false; + } + + Label { + id: queuedLabel; + anchors { + left: queuedPrintJobs.left; + leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5; + top: parent.top; + topMargin: 2 * UM.Theme.getSize("default_margin").height; + } + color: UM.Theme.getColor("text"); + font: UM.Theme.getFont("large"); + text: catalog.i18nc("@label", "Queued"); + } + + Column { + id: skeletonLoader; + anchors { + bottom: parent.bottom; + bottomMargin: UM.Theme.getSize("default_margin").height; + horizontalCenter: parent.horizontalCenter; + top: queuedLabel.bottom; + topMargin: UM.Theme.getSize("default_margin").height; + } + visible: printJobList.count === 0; + width: Math.min(800 * screenScaleFactor, maximumWidth); + + PrintJobInfoBlock { + anchors { + left: parent.left; + leftMargin: UM.Theme.getSize("default_margin").width; + right: parent.right; + rightMargin: UM.Theme.getSize("default_margin").width; } + printJob: null; // Use as skeleton + } + + PrintJobInfoBlock { + anchors { + left: parent.left; + leftMargin: UM.Theme.getSize("default_margin").width; + right: parent.right; + rightMargin: UM.Theme.getSize("default_margin").width; + } + printJob: null; // Use as skeleton } } - PrinterVideoStream - { - visible: OutputDevice.activeCamera != null - anchors.fill: parent - camera: OutputDevice.activeCamera + ScrollView { + id: queuedPrintJobs; + anchors { + top: queuedLabel.bottom; + topMargin: UM.Theme.getSize("default_margin").height; + horizontalCenter: parent.horizontalCenter; + bottomMargin: UM.Theme.getSize("default_margin").height; + bottom: parent.bottom; + } + style: UM.Theme.styles.scrollview; + width: Math.min(800 * screenScaleFactor, maximumWidth); + + ListView { + id: printJobList; + anchors.fill: parent; + delegate: PrintJobInfoBlock; { + anchors { + left: parent.left; + leftMargin: UM.Theme.getSize("default_margin").width; + right: parent.right; + rightMargin: UM.Theme.getSize("default_margin").width; + } + printJob: modelData; + } + model: OutputDevice.queuedPrintJobs; + spacing: UM.Theme.getSize("default_margin").height - 10; // 2x the shadow radius + } } - onVisibleChanged: - { - if (monitorFrame != null && !monitorFrame.visible) - { - OutputDevice.setActiveCamera(null) - } + PrinterVideoStream { + anchors.fill: parent; + camera: OutputDevice.activeCamera; + visible: OutputDevice.activeCamera != null; } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml index f4eda3f75c..250449a763 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ConfigurationChangeBlock.qml @@ -10,7 +10,7 @@ import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.1 import UM 1.3 as UM -Rectangle { +Item { id: root; property var job: null; property var materialsAreKnown: { @@ -24,7 +24,6 @@ Rectangle { } return true; } - color: "pink"; width: parent.width; height: childrenRect.height; @@ -34,6 +33,11 @@ Rectangle { // Config change toggle Rectangle { + anchors { + left: parent.left; + right: parent.right; + top: parent.top; + } color: { if(configurationChangeToggle.containsMouse) { return UM.Theme.getColor("viewport_background"); // TODO: Theme! @@ -41,32 +45,29 @@ Rectangle { return "transparent"; } } - width: parent.width; height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme! - anchors { - left: parent.left; - right: parent.right; - top: parent.top; - } + width: parent.width; Rectangle { - width: parent.width; - height: UM.Theme.getSize("default_lining").height; color: "#e6e6e6"; // TODO: Theme! + height: UM.Theme.getSize("default_lining").height; + width: parent.width; } UM.RecolorImage { - width: 23; // TODO: Theme! - height: 23; // TODO: Theme! anchors { right: configChangeToggleLabel.left; rightMargin: UM.Theme.getSize("default_margin").width; verticalCenter: parent.verticalCenter; } - sourceSize.width: width; - sourceSize.height: height; - source: "../svg/warning-icon.svg"; color: UM.Theme.getColor("text"); + height: 23 * screenScaleFactor; // TODO: Theme! + source: "../svg/warning-icon.svg"; + sourceSize { + width: width; + height: height; + } + width: 23 * screenScaleFactor; // TODO: Theme! } Label { @@ -79,15 +80,13 @@ Rectangle { } UM.RecolorImage { - width: 15; // TODO: Theme! - height: 15; // TODO: Theme! anchors { left: configChangeToggleLabel.right; leftMargin: UM.Theme.getSize("default_margin").width; verticalCenter: parent.verticalCenter; } - sourceSize.width: width; - sourceSize.height: height; + color: UM.Theme.getColor("text"); + height: 15 * screenScaleFactor; // TODO: Theme! source: { if (configChangeDetails.visible) { return UM.Theme.getIcon("arrow_top"); @@ -95,7 +94,11 @@ Rectangle { return UM.Theme.getIcon("arrow_bottom"); } } - color: UM.Theme.getColor("text"); + sourceSize { + width: width; + height: height; + } + width: 15 * screenScaleFactor; // TODO: Theme! } MouseArea { @@ -111,26 +114,25 @@ Rectangle { // Config change details Rectangle { id: configChangeDetails - color: "transparent"; - width: parent.width; - visible: false; - height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0; Behavior on height { NumberAnimation { duration: 100 } } + color: "transparent"; + height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0; + visible: false; + width: parent.width; Rectangle { - color: "transparent"; - clip: true; anchors { - fill: parent; - topMargin: UM.Theme.getSize("wide_margin").height; bottomMargin: UM.Theme.getSize("wide_margin").height; + fill: parent; leftMargin: UM.Theme.getSize("wide_margin").height * 4; rightMargin: UM.Theme.getSize("wide_margin").height * 4; + topMargin: UM.Theme.getSize("wide_margin").height; } + color: "transparent"; + clip: true; Label { anchors.fill: parent; - wrapMode: Text.WordWrap; elide: Text.ElideRight; font: UM.Theme.getFont("large_nonbold"); text: { @@ -167,6 +169,7 @@ Rectangle { } return result; } + wrapMode: Text.WordWrap; } Button { @@ -174,6 +177,10 @@ Rectangle { bottom: parent.bottom; left: parent.left; } + onClicked: { + overrideConfirmationDialog.visible = true; + } + text: catalog.i18nc("@label", "Override"); visible: { var length = root.job.configurationChanges.length; for (var i = 0; i < length; i++) { @@ -184,10 +191,6 @@ Rectangle { } return true; } - text: catalog.i18nc("@label", "Override"); - onClicked: { - overrideConfirmationDialog.visible = true; - } } } } @@ -195,16 +198,16 @@ Rectangle { MessageDialog { id: overrideConfirmationDialog; - title: catalog.i18nc("@window:title", "Override configuration configuration and start print"); + Component.onCompleted: visible = false; icon: StandardIcon.Warning; + onYes: OutputDevice.forceSendJob(root.job.key); + standardButtons: StandardButton.Yes | StandardButton.No; text: { var printJobName = formatPrintJobName(root.job.name); var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName); return confirmText; } - standardButtons: StandardButton.Yes | StandardButton.No; - Component.onCompleted: visible = false; - onYes: OutputDevice.forceSendJob(root.job.key); + title: catalog.i18nc("@window:title", "Override configuration configuration and start print"); } // Utils diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml index 091b1fc1fa..4b863ff9ed 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml @@ -2,56 +2,45 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 - - import UM 1.3 as UM import Cura 1.0 as Cura -Component -{ - Item - { - width: maximumWidth - height: maximumHeight - Image - { - id: cameraImage - width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth) - height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width) - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - z: 1 - Component.onCompleted: - { - if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) - { - OutputDevice.activePrinter.camera.start() +Component { + Item { + height: maximumHeight; + width: maximumWidth; + + Image { + id: cameraImage; + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter; + } + Component.onCompleted: { + if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) { + OutputDevice.activePrinter.camera.start(); } } - onVisibleChanged: - { - if(visible) - { - if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) - { - OutputDevice.activePrinter.camera.start() + height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width); + onVisibleChanged: { + if (visible) { + if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) { + OutputDevice.activePrinter.camera.start(); } - } else - { - if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) - { - OutputDevice.activePrinter.camera.stop() + } else { + if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) { + OutputDevice.activePrinter.camera.stop(); } } } - source: - { - if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) - { + source: { + if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) { return OutputDevice.activePrinter.camera.latestImage; } return ""; } + width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth); + z: 1; } } } \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml index 151ae7ab36..bede597287 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml @@ -7,34 +7,29 @@ import QtQuick.Controls.Styles 1.4 import UM 1.2 as UM Item { - id: extruderInfo - + id: extruderInfo; property var printCoreConfiguration: null; - - width: Math.round(parent.width / 2); height: childrenRect.height; + width: Math.round(parent.width / 2); // Extruder circle Item { - id: extruderCircle - - width: UM.Theme.getSize("monitor_tab_extruder_circle").width; - height: UM.Theme.getSize("monitor_tab_extruder_circle").height; + id: extruderCircle; anchors.verticalCenter: parent.verticalCenter; + height: UM.Theme.getSize("monitor_tab_extruder_circle").height; + width: UM.Theme.getSize("monitor_tab_extruder_circle").width; // Loading skeleton Rectangle { - visible: !printCoreConfiguration; anchors.fill: parent; - radius: Math.round(width / 2); color: UM.Theme.getColor("viewport_background"); + radius: Math.round(width / 2); + visible: !printCoreConfiguration; } // Actual content Rectangle { - visible: printCoreConfiguration; anchors.fill: parent; - radius: Math.round(width / 2); border.width: UM.Theme.getSize("monitor_tab_thick_lining").width; border.color: UM.Theme.getColor("monitor_tab_lining_active"); opacity: { @@ -43,6 +38,8 @@ Item { } return 1; } + radius: Math.round(width / 2); + visible: printCoreConfiguration; Label { anchors.centerIn: parent; @@ -55,68 +52,66 @@ Item { // Print core and material labels Item { id: materialLabel - anchors { left: extruderCircle.right; leftMargin: UM.Theme.getSize("default_margin").width; - top: parent.top; right: parent.right; + top: parent.top; } height: UM.Theme.getSize("monitor_tab_text_line").height; // Loading skeleton Rectangle { - visible: !extruderInfo.printCoreConfiguration; anchors.fill: parent; color: UM.Theme.getColor("viewport_background"); + visible: !extruderInfo.printCoreConfiguration; } // Actual content Label { - visible: extruderInfo.printCoreConfiguration; anchors.fill: parent; + elide: Text.ElideRight; + font: UM.Theme.getFont("default"); text: { if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) { return printCoreConfiguration.activeMaterial.name; } return ""; } - font: UM.Theme.getFont("default"); - elide: Text.ElideRight; + visible: extruderInfo.printCoreConfiguration; } } Item { id: printCoreLabel; - anchors { - right: parent.right; + bottom: parent.bottom; left: extruderCircle.right; leftMargin: UM.Theme.getSize("default_margin").width; - bottom: parent.bottom; + right: parent.right; } height: UM.Theme.getSize("monitor_tab_text_line").height; // Loading skeleton Rectangle { + color: UM.Theme.getColor("viewport_background"); + height: parent.height; visible: !extruderInfo.printCoreConfiguration; width: parent.width / 3; - height: parent.height; - color: UM.Theme.getColor("viewport_background"); } // Actual content Label { - visible: extruderInfo.printCoreConfiguration; + elide: Text.ElideRight; + font: UM.Theme.getFont("default"); + opacity: 0.6; text: { if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) { return printCoreConfiguration.hotendID; } return ""; } - elide: Text.ElideRight; - opacity: 0.6; - font: UM.Theme.getFont("default"); + visible: extruderInfo.printCoreConfiguration; } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml index 0c185386b2..dc613ff9ef 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml @@ -2,17 +2,13 @@ // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 -import QtQuick.Dialogs 1.1 import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 import QtGraphicalEffects 1.0 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 import UM 1.3 as UM Item { id: root; - property var printJob: null; property var running: isRunning(printJob); @@ -55,16 +51,20 @@ Item { } Item { - id: pointedRectangle - width: parent.width - 10 * screenScaleFactor; // Because of the shadow + id: pointedRectangle; + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter; + } height: parent.height - 10 * screenScaleFactor; // Because of the shadow - anchors.horizontalCenter: parent.horizontalCenter; - anchors.verticalCenter: parent.verticalCenter; + width: parent.width - 10 * screenScaleFactor; // Because of the shadow Rectangle { - id: point - anchors.right: bloop.right; - anchors.rightMargin: 24; + id: point; + anchors { + right: bloop.right; + rightMargin: 24; + } color: UM.Theme.getColor("setting_control"); height: 14 * screenScaleFactor; transform: Rotation { @@ -75,7 +75,7 @@ Item { } Rectangle { - id: bloop + id: bloop; anchors { bottom: parent.bottom; bottomMargin: 8 * screenScaleFactor; // Because of the shadow diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml index 4ffcb8342e..335ee2ba47 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml @@ -11,13 +11,11 @@ import QtQuick.Dialogs 1.1 import UM 1.3 as UM Item { - id: root - - property var shadowRadius: 5; - property var shadowOffset: 2; + id: root; + property var shadowRadius: 5 * screenScaleFactor; + property var shadowOffset: 2 * screenScaleFactor; property var debug: false; property var printJob: null; - width: parent.width; // Bubbles downward height: childrenRect.height + shadowRadius * 2; // Bubbles upward @@ -28,87 +26,84 @@ Item { // The actual card (white block) Rectangle { - color: "white"; // TODO: Theme! - height: childrenRect.height; - width: parent.width - shadowRadius * 2; - // 5px margin, but shifted 2px vertically because of the shadow anchors { - topMargin: root.shadowRadius - root.shadowOffset; bottomMargin: root.shadowRadius + root.shadowOffset; leftMargin: root.shadowRadius; rightMargin: root.shadowRadius; + topMargin: root.shadowRadius - root.shadowOffset; } + color: "white"; // TODO: Theme! + height: childrenRect.height; layer.enabled: true layer.effect: DropShadow { radius: root.shadowRadius verticalOffset: 2 * screenScaleFactor color: "#3F000000" // 25% shadow } + width: parent.width - shadowRadius * 2; Column { - width: parent.width; height: childrenRect.height; + width: parent.width; // Main content Item { id: mainContent; + height: 200 * screenScaleFactor; // TODO: Theme! width: parent.width; - height: 200; // TODO: Theme! // Left content Item { anchors { + bottom: parent.bottom; left: parent.left; + margins: UM.Theme.getSize("wide_margin").width; right: parent.horizontalCenter; top: parent.top; - bottom: parent.bottom; - margins: UM.Theme.getSize("wide_margin").width } Item { id: printJobName; - width: parent.width; height: UM.Theme.getSize("monitor_tab_text_line").height; Rectangle { - visible: !printJob; color: UM.Theme.getColor("viewport_background"); // TODO: Theme! height: parent.height; + visible: !printJob; width: parent.width / 3; } Label { - visible: printJob; - text: printJob ? printJob.name : ""; // Supress QML warnings - font: UM.Theme.getFont("default_bold"); - elide: Text.ElideRight; anchors.fill: parent; + elide: Text.ElideRight; + font: UM.Theme.getFont("default_bold"); + text: printJob ? printJob.name : ""; // Supress QML warnings + visible: printJob; } } Item { id: printJobOwnerName; - - width: parent.width; - height: UM.Theme.getSize("monitor_tab_text_line").height; anchors { top: printJobName.bottom; topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2); } + height: UM.Theme.getSize("monitor_tab_text_line").height; + width: parent.width; Rectangle { - visible: !printJob; color: UM.Theme.getColor("viewport_background"); // TODO: Theme! height: parent.height; + visible: !printJob; width: parent.width / 2; } Label { - visible: printJob; - text: printJob ? printJob.owner : ""; // Supress QML warnings - font: UM.Theme.getFont("default"); - elide: Text.ElideRight; anchors.fill: parent; + elide: Text.ElideRight; + font: UM.Theme.getFont("default"); + text: printJob ? printJob.owner : ""; // Supress QML warnings + visible: printJob; } } @@ -116,90 +111,96 @@ Item { id: printJobPreview; property var useUltibot: false; anchors { - top: printJobOwnerName.bottom; - horizontalCenter: parent.horizontalCenter; - topMargin: UM.Theme.getSize("default_margin").height; bottom: parent.bottom; + horizontalCenter: parent.horizontalCenter; + top: printJobOwnerName.bottom; + topMargin: UM.Theme.getSize("default_margin").height; } width: height; // Skeleton Rectangle { - visible: !printJob; anchors.fill: parent; - radius: UM.Theme.getSize("default_margin").width; // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme! + radius: UM.Theme.getSize("default_margin").width; // TODO: Theme! + visible: !printJob; } // Actual content Image { id: previewImage; - visible: printJob; - source: printJob ? printJob.previewImageUrl : ""; - opacity: printJob && printJob.state == "error" ? 0.5 : 1.0; anchors.fill: parent; + opacity: printJob && printJob.state == "error" ? 0.5 : 1.0; + source: printJob ? printJob.previewImageUrl : ""; + visible: printJob; } UM.RecolorImage { id: ultiBotImage; + anchors.centerIn: printJobPreview; + color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme! + height: printJobPreview.height; source: "../svg/ultibot.svg"; + sourceSize { + height: height; + width: width; + } /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or not in order to determine if we show the placeholder (ultibot) image instead. */ visible: printJob && previewImage.status == Image.Error; width: printJobPreview.width; - height: printJobPreview.height; - sourceSize.width: width; - sourceSize.height: height; - color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme! } UM.RecolorImage { id: statusImage; anchors.centerIn: printJobPreview; + color: "black"; + height: 0.5 * printJobPreview.height; source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : ""; + sourceSize { + height: height; + width: width; + } visible: source != ""; width: 0.5 * printJobPreview.width; - height: 0.5 * printJobPreview.height; - sourceSize.width: width; - sourceSize.height: height; - color: "black"; } } } // Divider Rectangle { - height: parent.height - 2 * UM.Theme.getSize("default_margin").height; - width: UM.Theme.getSize("default_lining").width; - color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme! anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter; } + color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme! + height: parent.height - 2 * UM.Theme.getSize("default_margin").height; + width: UM.Theme.getSize("default_lining").width; } // Right content Item { anchors { + bottom: parent.bottom; left: parent.horizontalCenter; + margins: UM.Theme.getSize("wide_margin").width; right: parent.right; top: parent.top; - bottom: parent.bottom; - margins: UM.Theme.getSize("wide_margin").width; } Item { id: targetPrinterLabel; - width: parent.width; height: UM.Theme.getSize("monitor_tab_text_line").height; + width: parent.width; + Rectangle { visible: !printJob; color: UM.Theme.getColor("viewport_background"); // TODO: Theme! anchors.fill: parent; } + Label { - visible: printJob; elide: Text.ElideRight; font: UM.Theme.getFont("default_bold"); text: { @@ -215,13 +216,14 @@ Item { } return ""; } + visible: printJob; } } PrinterInfoBlock { + anchors.bottom: parent.bottom; printer: root.printJob.assignedPrinter; printJob: root.printJob; - anchors.bottom: parent.bottom; } } @@ -240,15 +242,15 @@ Item { Item { id: configChangesBox; - width: parent.width; height: childrenRect.height; visible: printJob && printJob.configurationChanges.length !== 0; + width: parent.width; // Config change toggle Rectangle { id: configChangeToggle; color: { - if(configChangeToggleArea.containsMouse) { + if (configChangeToggleArea.containsMouse) { return UM.Theme.getColor("viewport_background"); // TODO: Theme! } else { return "transparent"; @@ -263,23 +265,25 @@ Item { } Rectangle { - width: parent.width; - height: UM.Theme.getSize("default_lining").height; color: "#e6e6e6"; // TODO: Theme! + height: UM.Theme.getSize("default_lining").height; + width: parent.width; } UM.RecolorImage { - width: 23; // TODO: Theme! - height: 23; // TODO: Theme! anchors { right: configChangeToggleLabel.left; rightMargin: UM.Theme.getSize("default_margin").width; verticalCenter: parent.verticalCenter; } - sourceSize.width: width; - sourceSize.height: height; - source: "../svg/warning-icon.svg"; color: UM.Theme.getColor("text"); + height: 23 * screenScaleFactor; // TODO: Theme! + source: "../svg/warning-icon.svg"; + sourceSize { + height: height; + width: width; + } + width: 23 * screenScaleFactor; // TODO: Theme! } Label { @@ -292,15 +296,13 @@ Item { } UM.RecolorImage { - width: 15; // TODO: Theme! - height: 15; // TODO: Theme! anchors { left: configChangeToggleLabel.right; leftMargin: UM.Theme.getSize("default_margin").width; verticalCenter: parent.verticalCenter; } - sourceSize.width: width; - sourceSize.height: height; + color: UM.Theme.getColor("text"); + height: 15 * screenScaleFactor; // TODO: Theme! source: { if (configChangeDetails.visible) { return UM.Theme.getIcon("arrow_top"); @@ -308,7 +310,11 @@ Item { return UM.Theme.getIcon("arrow_bottom"); } } - color: UM.Theme.getColor("text"); + sourceSize { + width: width; + height: height; + } + width: 15 * screenScaleFactor; // TODO: Theme! } MouseArea { @@ -324,26 +330,25 @@ Item { // Config change details Item { id: configChangeDetails; - width: parent.width; - visible: false; + anchors.top: configChangeToggle.bottom; + Behavior on height { NumberAnimation { duration: 100 } } // In case of really massive multi-line configuration changes height: visible ? Math.max(UM.Theme.getSize("monitor_tab_config_override_box").height, childrenRect.height) : 0; - Behavior on height { NumberAnimation { duration: 100 } } - anchors.top: configChangeToggle.bottom; + visible: false; + width: parent.width; Item { - clip: true; anchors { - fill: parent; - topMargin: UM.Theme.getSize("wide_margin").height; bottomMargin: UM.Theme.getSize("wide_margin").height; + fill: parent; leftMargin: UM.Theme.getSize("wide_margin").height * 4; rightMargin: UM.Theme.getSize("wide_margin").height * 4; + topMargin: UM.Theme.getSize("wide_margin").height; } + clip: true; Label { anchors.fill: parent; - wrapMode: Text.WordWrap; elide: Text.ElideRight; font: UM.Theme.getFont("large_nonbold"); text: { @@ -380,6 +385,7 @@ Item { } return result; } + wrapMode: Text.WordWrap; } Button { @@ -387,6 +393,10 @@ Item { bottom: parent.bottom; left: parent.left; } + onClicked: { + overrideConfirmationDialog.visible = true; + } + text: catalog.i18nc("@label", "Override"); visible: { var length = printJob.configurationChanges.length; for (var i = 0; i < length; i++) { @@ -397,26 +407,22 @@ Item { } return true; } - text: catalog.i18nc("@label", "Override"); - onClicked: { - overrideConfirmationDialog.visible = true; - } } } } MessageDialog { id: overrideConfirmationDialog; - title: catalog.i18nc("@window:title", "Override configuration configuration and start print"); + Component.onCompleted: visible = false; icon: StandardIcon.Warning; + onYes: OutputDevice.forceSendJob(printJob.key); + standardButtons: StandardButton.Yes | StandardButton.No; text: { var printJobName = formatPrintJobName(printJob.name); var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName); return confirmText; } - standardButtons: StandardButton.Yes | StandardButton.No; - Component.onCompleted: visible = false; - onYes: OutputDevice.forceSendJob(printJob.key); + title: catalog.i18nc("@window:title", "Override configuration configuration and start print"); } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml index 2bec0906a8..8d80377e99 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobPreview.qml @@ -14,15 +14,15 @@ import UM 1.3 as UM Item { property var job: null; property var useUltibot: false; - height: 100; + height: 100 * screenScaleFactor; width: height; // Skeleton Rectangle { - visible: !job; anchors.fill: parent; - radius: UM.Theme.getSize("default_margin").width; // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme! + radius: UM.Theme.getSize("default_margin").width; // TODO: Theme! + visible: !job; } // Actual content @@ -46,26 +46,30 @@ Item { UM.RecolorImage { id: ultibotImage; anchors.centerIn: parent; + color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme! + height: parent.height; source: "../svg/ultibot.svg"; + sourceSize { + height: height; + width: width; + } /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or not in order to determine if we show the placeholder (ultibot) image instead. */ visible: job && previewImage.status == Image.Error; width: parent.width; - height: parent.height; - sourceSize.width: width; - sourceSize.height: height; - color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme! } UM.RecolorImage { id: statusImage; anchors.centerIn: parent; + color: "black"; // TODO: Theme! + height: 0.5 * parent.height; source: job && job.state == "error" ? "../svg/aborted-icon.svg" : ""; + sourceSize { + height: height; + width: width; + } visible: source != ""; width: 0.5 * parent.width; - height: 0.5 * parent.height; - sourceSize.width: width; - sourceSize.height: height; - color: "black"; } } \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml index 604b5ce862..9dc7dff62e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobTitle.qml @@ -17,17 +17,18 @@ Column { width: parent.width; Rectangle { - visible: !job; color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color height: parent.height; + visible: !job; width: parent.width / 3; } + Label { - visible: job; - text: job ? job.name : ""; - font: UM.Theme.getFont("default_bold"); - elide: Text.ElideRight; anchors.fill: parent; + elide: Text.ElideRight; + font: UM.Theme.getFont("default_bold"); + text: job ? job.name : ""; + visible: job; } } @@ -37,17 +38,18 @@ Column { width: parent.width; Rectangle { - visible: !job; color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color height: parent.height; + visible: !job; width: parent.width / 2; } + Label { - visible: job; - text: job ? job.owner : ""; - font: UM.Theme.getFont("default"); - elide: Text.ElideRight; anchors.fill: parent; + elide: Text.ElideRight; + font: UM.Theme.getFont("default"); + text: job ? job.owner : ""; + visible: job; } } } \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml index 9793b218fc..a28167d260 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml @@ -4,112 +4,101 @@ import QtQuick 2.2 import QtQuick.Window 2.2 import QtQuick.Controls 1.2 - import UM 1.1 as UM -UM.Dialog -{ +UM.Dialog { id: base; - - minimumWidth: 500 * screenScaleFactor - minimumHeight: 140 * screenScaleFactor - maximumWidth: minimumWidth - maximumHeight: minimumHeight - width: minimumWidth - height: minimumHeight - - visible: true - modality: Qt.ApplicationModal - onVisibleChanged: - { - if(visible) - { - resetPrintersModel() - } - else - { - OutputDevice.cancelPrintSelection() - } + property var printersModel: { + return ListModel{}; } - title: catalog.i18nc("@title:window", "Print over network") - - property var printersModel: ListModel{} - function resetPrintersModel() { - printersModel.clear() - printersModel.append({ name: "Automatic", key: ""}) - - for (var index in OutputDevice.printers) - { - printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key}) - } - } - - Column - { - id: printerSelection - anchors.fill: parent - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.rightMargin: UM.Theme.getSize("default_margin").width - height: 50 * screenScaleFactor - Label - { - id: manualPrinterSelectionLabel - anchors - { - left: parent.left - topMargin: UM.Theme.getSize("default_margin").height - right: parent.right - } - text: catalog.i18nc("@label", "Printer selection") - wrapMode: Text.Wrap - height: 20 * screenScaleFactor - } - - ComboBox - { - id: printerSelectionCombobox - model: base.printersModel - textRole: "name" - - width: parent.width - height: 40 * screenScaleFactor - Behavior on height { NumberAnimation { duration: 100 } } - } - - SystemPalette - { - id: palette - } - - UM.I18nCatalog { id: catalog; name: "cura"; } - } - + height: minimumHeight; leftButtons: [ - Button - { - text: catalog.i18nc("@action:button","Cancel") - enabled: true + Button { + enabled: true; onClicked: { base.visible = false; - printerSelectionCombobox.currentIndex = 0 - OutputDevice.cancelPrintSelection() + printerSelectionCombobox.currentIndex = 0; + OutputDevice.cancelPrintSelection(); } + text: catalog.i18nc("@action:button","Cancel"); } ] - + maximumHeight: minimumHeight; + maximumWidth: minimumWidth; + minimumHeight: 140 * screenScaleFactor; + minimumWidth: 500 * screenScaleFactor; + modality: Qt.ApplicationModal; + onVisibleChanged: { + if (visible) { + resetPrintersModel(); + } else { + OutputDevice.cancelPrintSelection(); + } + } rightButtons: [ - Button - { - text: catalog.i18nc("@action:button","Print") - enabled: true + Button { + enabled: true; onClicked: { base.visible = false; - OutputDevice.selectPrinter(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key) + OutputDevice.selectPrinter(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key); // reset to defaults - printerSelectionCombobox.currentIndex = 0 + printerSelectionCombobox.currentIndex = 0; } + text: catalog.i18nc("@action:button","Print"); } ] + title: catalog.i18nc("@title:window", "Print over network"); + visible: true; + width: minimumWidth; + + Column { + id: printerSelection; + anchors { + fill: parent; + leftMargin: UM.Theme.getSize("default_margin").width; + rightMargin: UM.Theme.getSize("default_margin").width; + top: parent.top; + topMargin: UM.Theme.getSize("default_margin").height; + } + height: 50 * screenScaleFactor; + + SystemPalette { + id: palette; + } + + UM.I18nCatalog { + id: catalog; + name: "cura"; + } + + Label { + id: manualPrinterSelectionLabel; + anchors { + left: parent.left; + right: parent.right; + topMargin: UM.Theme.getSize("default_margin").height; + } + height: 20 * screenScaleFactor; + text: catalog.i18nc("@label", "Printer selection"); + wrapMode: Text.Wrap; + } + + ComboBox { + id: printerSelectionCombobox; + Behavior on height { NumberAnimation { duration: 100 } } + height: 40 * screenScaleFactor; + model: base.printersModel; + textRole: "name"; + width: parent.width; + } + } + + // Utils + function resetPrintersModel() { + printersModel.clear(); + printersModel.append({ name: "Automatic", key: ""}); + for (var index in OutputDevice.printers) { + printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key}); + } + } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml index c13a4c4b93..ebfe160e06 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCard.qml @@ -6,17 +6,14 @@ import QtQuick.Dialogs 1.1 import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.3 import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.4 as LegacyControls import UM 1.3 as UM Item { id: root; - property var shadowRadius: 5; property var shadowOffset: 2; property var printer: null; property var collapsed: true; - height: childrenRect.height + shadowRadius * 2; // Bubbles upward width: parent.width; // Bubbles downward @@ -24,10 +21,10 @@ Item { Rectangle { // 5px margin, but shifted 2px vertically because of the shadow anchors { - topMargin: root.shadowRadius - root.shadowOffset; bottomMargin: root.shadowRadius + root.shadowOffset; leftMargin: root.shadowRadius; rightMargin: root.shadowRadius; + topMargin: root.shadowRadius - root.shadowOffset; } color: { if (printer.state == "disabled") { @@ -46,8 +43,8 @@ Item { width: parent.width - 2 * shadowRadius; Column { - width: parent.width; height: childrenRect.height; + width: parent.width; // Main card Item { @@ -65,15 +62,12 @@ Item { margins: UM.Theme.getSize("default_margin").width; top: parent.top; } - height: 58; - width: 58; + height: 58 * screenScaleFactor; + width: 58 * screenScaleFactor; // Skeleton Rectangle { - anchors { - fill: parent; - // margins: Math.round(UM.Theme.getSize("default_margin").width / 4); - } + anchors.fill: parent; color: UM.Theme.getColor("viewport_background"); // TODO: Theme! radius: UM.Theme.getSize("default_margin").width; // TODO: Theme! visible: !printer; @@ -153,7 +147,6 @@ Item { height: UM.Theme.getSize("monitor_tab_text_line").height; width: parent.width * 0.75; - // Skeleton Rectangle { anchors.fill: parent; @@ -192,12 +185,14 @@ Item { verticalCenter: parent.verticalCenter; } color: UM.Theme.getColor("text"); - height: 15; // TODO: Theme! + height: 15 * screenScaleFactor; // TODO: Theme! source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom"); - sourceSize.height: height; - sourceSize.width: width; + sourceSize { + height: height; + width: width; + } visible: printer; - width: 15; // TODO: Theme! + width: 15 * screenScaleFactor; // TODO: Theme! } MouseArea { @@ -213,7 +208,7 @@ Item { } Connections { - target: printerList + target: printerList; onCurrentIndexChanged: { if (!model) { return; diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml index 7cce0d5c0d..0971776cc6 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml @@ -10,17 +10,14 @@ import QtQuick.Controls 1.4 as LegacyControls import UM 1.3 as UM Item { - property var printer: null; property var printJob: printer ? printer.activePrintJob : null; property var collapsed: true; - Behavior on height { NumberAnimation { duration: 100 } } Behavior on opacity { NumberAnimation { duration: 100 } } - - width: parent.width; height: collapsed ? 0 : childrenRect.height; opacity: collapsed ? 0 : 1; + width: parent.width; Column { id: contentColumn; @@ -44,8 +41,8 @@ Item { HorizontalLine {} Row { - width: parent.width; height: childrenRect.height; + width: parent.width; PrintJobTitle { job: root.printer.activePrintJob; diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml index 809a3c651a..4fac99f7a2 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterCardProgressBar.qml @@ -17,107 +17,90 @@ ProgressBar { } return result; } - value: progress; - width: parent.width; - style: ProgressBarStyle { - property var remainingTime: - { - if(printer.activePrintJob == null) - { - return 0 + property var remainingTime: { + if (printer.activePrintJob == null) { + return 0; } /* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining time from ever being less than 0. Negative durations cause strange behavior such as displaying "-1h -1m". */ - var activeJob = printer.activePrintJob + var activeJob = printer.activePrintJob; return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0); } - property var progressText: - { - if(printer.activePrintJob == null) - { - return "" + property var progressText: { + if (printer.activePrintJob == null) { + return ""; } - switch(printer.activePrintJob.state) - { + switch (printer.activePrintJob.state) { case "wait_cleanup": - if(printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed) - { - return catalog.i18nc("@label:status", "Aborted") + if (printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed) { + return catalog.i18nc("@label:status", "Aborted"); } - return catalog.i18nc("@label:status", "Finished") + return catalog.i18nc("@label:status", "Finished"); case "pre_print": case "sent_to_printer": - return catalog.i18nc("@label:status", "Preparing") + return catalog.i18nc("@label:status", "Preparing"); case "aborted": - return catalog.i18nc("@label:status", "Aborted") + return catalog.i18nc("@label:status", "Aborted"); case "wait_user_action": - return catalog.i18nc("@label:status", "Aborted") + return catalog.i18nc("@label:status", "Aborted"); case "pausing": - return catalog.i18nc("@label:status", "Pausing") + return catalog.i18nc("@label:status", "Pausing"); case "paused": - return OutputDevice.formatDuration( remainingTime ) + return OutputDevice.formatDuration( remainingTime ); case "resuming": - return catalog.i18nc("@label:status", "Resuming") + return catalog.i18nc("@label:status", "Resuming"); case "queued": - return catalog.i18nc("@label:status", "Action required") + return catalog.i18nc("@label:status", "Action required"); default: - return OutputDevice.formatDuration( remainingTime ) + return OutputDevice.formatDuration( remainingTime ); } } - - background: Rectangle - { - implicitWidth: 100 - implicitHeight: visible ? 24 : 0 - color: UM.Theme.getColor("viewport_background") + background: Rectangle { + color: UM.Theme.getColor("viewport_background"); + implicitHeight: visible ? 24 : 0; + implicitWidth: 100; } - - progress: Rectangle - { - color: - { + progress: Rectangle { + id: progressItem; + color: { var state = printer.activePrintJob.state var inactiveStates = [ "pausing", "paused", "resuming", "wait_cleanup" - ] - if(inactiveStates.indexOf(state) > -1 && remainingTime > 0) - { - return UM.Theme.getColor("monitor_tab_text_inactive") - } - else - { - return UM.Theme.getColor("primary") - } - } - id: progressItem - function getTextOffset() - { - if(progressItem.width + progressLabel.width + 16 < control.width) - { - return progressItem.width + UM.Theme.getSize("default_margin").width - } - else - { - return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width + ]; + if (inactiveStates.indexOf(state) > -1 && remainingTime > 0) { + return UM.Theme.getColor("monitor_tab_text_inactive"); + } else { + return UM.Theme.getColor("primary"); } } - Label - { - id: progressLabel - anchors.left: parent.left - anchors.leftMargin: getTextOffset() - text: progressText - anchors.verticalCenter: parent.verticalCenter - color: progressItem.width + progressLabel.width < control.width ? "black" : "white" - width: contentWidth - font: UM.Theme.getFont("default") + Label { + id: progressLabel; + anchors { + left: parent.left; + leftMargin: getTextOffset(); + } + text: progressText; + anchors.verticalCenter: parent.verticalCenter; + color: progressItem.width + progressLabel.width < control.width ? "black" : "white"; + width: contentWidth; + font: UM.Theme.getFont("default"); + } + + function getTextOffset() { + if (progressItem.width + progressLabel.width + 16 < control.width) { + return progressItem.width + UM.Theme.getSize("default_margin").width; + } else { + return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width; + } } } } + value: progress; + width: parent.width; } \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml index 118da2f42b..24de732faf 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml @@ -5,26 +5,27 @@ import QtQuick 2.2 import QtQuick.Controls 1.4 import UM 1.2 as UM -Item -{ - property alias text: familyNameLabel.text +Item { + property alias text: familyNameLabel.text; property var padding: 3 * screenScaleFactor; // TODO: Theme! - implicitHeight: familyNameLabel.contentHeight + 2 * padding // Apply the padding to top and bottom. - implicitWidth: familyNameLabel.contentWidth + implicitHeight // The extra height is added to ensure the radius doesn't cut something off. - Rectangle - { - id: background - height: parent.height - width: parent.width + implicitHeight: familyNameLabel.contentHeight + 2 * padding; // Apply the padding to top and bottom. + implicitWidth: familyNameLabel.contentWidth + implicitHeight; // The extra height is added to ensure the radius doesn't cut something off. + + Rectangle { + id: background; + anchors { + horizontalCenter: parent.horizontalCenter; + right: parent.right; + } color: UM.Theme.getColor("viewport_background"); // TODO: Theme! - anchors.right: parent.right - anchors.horizontalCenter: parent.horizontalCenter - radius: 0.5 * height + height: parent.height; + radius: 0.5 * height; + width: parent.width; } - Label - { - id: familyNameLabel - anchors.centerIn: parent - text: "" + + Label { + id: familyNameLabel; + anchors.centerIn: parent; + text: ""; } } \ No newline at end of file diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml index 51d9e1f462..b054eb458f 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml @@ -13,17 +13,14 @@ import UM 1.3 as UM Item { id: root; - property var printer: null; property var printJob: null; - width: parent.width; height: childrenRect.height; // Printer family pills Row { id: printerFamilyPills; - anchors { left: parent.left; right: parent.right; @@ -35,21 +32,23 @@ Item { Repeater { id: compatiblePills; - visible: printJob; + delegate: PrinterFamilyPill { + text: modelData; + } model: printJob ? printJob.compatibleMachineFamilies : []; - delegate: PrinterFamilyPill { text: modelData; } + visible: printJob; + } PrinterFamilyPill { - visible: !compatiblePills.visible && printer; text: printer.type; + visible: !compatiblePills.visible && printer; } } // Extruder info Row { id: extrudersInfo; - anchors { left: parent.left; right: parent.right; diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml index 5e5c972fbe..b9e2525dd5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml @@ -4,84 +4,66 @@ import QtQuick 2.2 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 - import UM 1.3 as UM +Item { + property var camera: null; -Item -{ - property var camera: null - - Rectangle - { - anchors.fill:parent - color: UM.Theme.getColor("viewport_overlay") - opacity: 0.5 + Rectangle { + anchors.fill:parent; + color: UM.Theme.getColor("viewport_overlay"); + opacity: 0.5; } - MouseArea - { - anchors.fill: parent - onClicked: OutputDevice.setActiveCamera(null) - z: 0 + MouseArea { + anchors.fill: parent; + onClicked: OutputDevice.setActiveCamera(null); + z: 0; } - CameraButton - { - id: closeCameraButton - iconSource: UM.Theme.getIcon("cross1") - anchors - { - top: cameraImage.top - topMargin: UM.Theme.getSize("default_margin").height + CameraButton { + id: closeCameraButton; + anchors { right: cameraImage.right rightMargin: UM.Theme.getSize("default_margin").width + top: cameraImage.top + topMargin: UM.Theme.getSize("default_margin").height } - z: 999 + iconSource: UM.Theme.getIcon("cross1"); + z: 999; } - Image - { + Image { id: cameraImage - width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth) - height: Math.round((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width) - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - z: 1 - onVisibleChanged: - { - if(visible) - { - if(camera != null) - { - camera.start() + anchors.horizontalCenter: parent.horizontalCenter; + anchors.verticalCenter: parent.verticalCenter; + height: Math.round((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width); + onVisibleChanged: { + if (visible) { + if (camera != null) { + camera.start(); } - } else - { - if(camera != null) - { - camera.stop() + } else { + if (camera != null) { + camera.stop(); } } } - - source: - { - if(camera != null && camera.latestImage != null) - { + source: { + if (camera != null && camera.latestImage != null) { return camera.latestImage; } return ""; } - } - - MouseArea - { - anchors.fill: cameraImage - onClicked: - { - OutputDevice.setActiveCamera(null) - } + width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth); z: 1 } + + MouseArea { + anchors.fill: cameraImage; + onClicked: { + OutputDevice.setActiveCamera(null); + } + z: 1; + } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml index 6af4b2c6a6..105143c851 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml @@ -1,128 +1,126 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import UM 1.2 as UM -import Cura 1.0 as Cura - import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 +import UM 1.2 as UM +import Cura 1.0 as Cura -Item -{ - id: base +Item { + id: base; + property string activeQualityDefinitionId: Cura.MachineManager.activeQualityDefinitionId; + property bool isUM3: activeQualityDefinitionId == "ultimaker3" || activeQualityDefinitionId.match("ultimaker_") != null; + property bool printerConnected: Cura.MachineManager.printerConnected; + property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands; + property bool authenticationRequested: printerConnected && (Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 || Cura.MachineManager.printerOutputDevices[0].authenticationState == 5); // AuthState.AuthenticationRequested or AuthenticationReceived. - property string activeQualityDefinitionId: Cura.MachineManager.activeQualityDefinitionId - property bool isUM3: activeQualityDefinitionId == "ultimaker3" || activeQualityDefinitionId.match("ultimaker_") != null - property bool printerConnected: Cura.MachineManager.printerConnected - property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands - property bool authenticationRequested: printerConnected && (Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 || Cura.MachineManager.printerOutputDevices[0].authenticationState == 5) // AuthState.AuthenticationRequested or AuthenticationReceived. + UM.I18nCatalog { + id: catalog; + name: "cura"; + } - Row - { - objectName: "networkPrinterConnectButton" - visible: isUM3 - spacing: UM.Theme.getSize("default_margin").width + Row { + objectName: "networkPrinterConnectButton"; + spacing: UM.Theme.getSize("default_margin").width; + visible: isUM3; - Button - { - height: UM.Theme.getSize("save_button_save_to_button").height - tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer") - text: catalog.i18nc("@action:button", "Request Access") - style: UM.Theme.styles.sidebar_action_button - onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication() - visible: printerConnected && !printerAcceptsCommands && !authenticationRequested + Button { + height: UM.Theme.getSize("save_button_save_to_button").height; + onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication(); + style: UM.Theme.styles.sidebar_action_button; + text: catalog.i18nc("@action:button", "Request Access"); + tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer"); + visible: printerConnected && !printerAcceptsCommands && !authenticationRequested; } - Button - { - height: UM.Theme.getSize("save_button_save_to_button").height - tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer") - text: catalog.i18nc("@action:button", "Connect") - style: UM.Theme.styles.sidebar_action_button - onClicked: connectActionDialog.show() - visible: !printerConnected + Button { + height: UM.Theme.getSize("save_button_save_to_button").height; + onClicked: connectActionDialog.show(); + style: UM.Theme.styles.sidebar_action_button; + text: catalog.i18nc("@action:button", "Connect"); + tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer"); + visible: !printerConnected; } } - UM.Dialog - { - id: connectActionDialog - Loader - { - anchors.fill: parent - source: "DiscoverUM3Action.qml" + UM.Dialog { + id: connectActionDialog; + rightButtons: Button { + iconName: "dialog-close"; + onClicked: connectActionDialog.reject(); + text: catalog.i18nc("@action:button", "Close"); } - rightButtons: Button - { - text: catalog.i18nc("@action:button", "Close") - iconName: "dialog-close" - onClicked: connectActionDialog.reject() + + Loader { + anchors.fill: parent; + source: "DiscoverUM3Action.qml"; } } + Column { + anchors.fill: parent; + objectName: "networkPrinterConnectionInfo"; + spacing: UM.Theme.getSize("default_margin").width; + visible: isUM3; - Column - { - objectName: "networkPrinterConnectionInfo" - visible: isUM3 - spacing: UM.Theme.getSize("default_margin").width - anchors.fill: parent - - Button - { - tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer") - text: catalog.i18nc("@action:button", "Request Access") - onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication() - visible: printerConnected && !printerAcceptsCommands && !authenticationRequested + Button { + onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication(); + text: catalog.i18nc("@action:button", "Request Access"); + tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer"); + visible: printerConnected && !printerAcceptsCommands && !authenticationRequested; } - Row - { - visible: printerConnected - spacing: UM.Theme.getSize("default_margin").width + Row { + anchors { + left: parent.left; + right: parent.right; + } + height: childrenRect.height; + spacing: UM.Theme.getSize("default_margin").width; + visible: printerConnected; - anchors.left: parent.left - anchors.right: parent.right - height: childrenRect.height + Column { + Repeater { + model: Cura.ExtrudersModel { + simpleNames: true; + } - Column - { - Repeater - { - model: Cura.ExtrudersModel { simpleNames: true } - Label { text: model.name } + Label { + text: model.name; + } } } - Column - { - Repeater - { - id: nozzleColumn - model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null - Label { text: nozzleColumn.model[index] } + + Column { + Repeater { + id: nozzleColumn; + model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null; + + Label { + text: nozzleColumn.model[index]; + } } } - Column - { - Repeater - { - id: materialColumn - model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null - Label { text: materialColumn.model[index] } + + Column { + Repeater { + id: materialColumn; + model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null; + + Label { + text: materialColumn.model[index]; + } } } } - Button - { - tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura") - text: catalog.i18nc("@action:button", "Activate Configuration") - visible: false // printerConnected && !isClusterPrinter() - onClicked: manager.loadConfigurationFromPrinter() + Button { + onClicked: manager.loadConfigurationFromPrinter(); + text: catalog.i18nc("@action:button", "Activate Configuration"); + tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura"); + visible: false; // printerConnected && !isClusterPrinter() } } - - UM.I18nCatalog{id: catalog; name:"cura"} }