From e7b60a529059772be8e70e69bc59a2c82038c726 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 16:29:57 +0100 Subject: [PATCH 01/34] Create GenericPopUp.qml Contributes to CL-1165 --- .../resources/qml/GenericPopUp.qml | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml new file mode 100644 index 0000000000..442de3cd7a --- /dev/null +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -0,0 +1,202 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 2.0 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.1 +import QtGraphicalEffects 1.0 +import UM 1.3 as UM + +/** + * This is a generic pop-up element which can be supplied with a target and a content + * item. The content item will appear to the left, right, above, or below the target + * depending on the value of the direction property + */ +Popup +{ + id: base + + /** + * The target item is what the pop-up is "tied" to, usually a button + */ + property var target + + /** + * Which side of the target should the contentItem appear on? + * Possible values include: + * - "top" + * - "bottom" + * - "left" + * - "right" + */ + property string direction: "bottom" + + /** + * Should the popup close when you click outside it? For example, this is + * disabled by the InfoBlurb component since it's opened and closed using mouse + * hovers, not clicks. + */ + property bool closeOnClick: true + + /** + * Use white for context menus, dark grey for info blurbs! + */ + property var color: "#ffffff" // TODO: Theme! + + background: Item + { + anchors.fill: parent + + DropShadow + { + anchors.fill: pointedRectangle + color: UM.Theme.getColor("monitor_shadow") + radius: UM.Theme.getSize("monitor_shadow_radius").width + source: pointedRectangle + transparentBorder: true + verticalOffset: 2 * screenScaleFactor + } + + Item + { + id: pointedRectangle + anchors + { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + height: parent.height - 10 * screenScaleFactor // Because of the shadow + width: parent.width - 10 * screenScaleFactor // Because of the shadow + + Rectangle + { + id: point + anchors + { + horizontalCenter: + { + switch(direction) + { + case "left": + return bloop.left + case "right": + return bloop.right + default: + return bloop.horizontalCenter + } + } + verticalCenter: + { + switch(direction) + { + case "top": + return bloop.top + case "bottom": + return bloop.bottom + default: + return bloop.verticalCenter + } + } + } + color: base.color + height: 12 * screenScaleFactor + transform: Rotation + { + angle: 45 + origin.x: point.width / 2 + origin.y: point.height / 2 + } + width: height + } + + Rectangle + { + id: bloop + anchors + { + fill: parent + leftMargin: direction == "left" ? 8 * screenScaleFactor : 0 + rightMargin: direction == "right" ? 8 * screenScaleFactor : 0 + topMargin: direction == "top" ? 8 * screenScaleFactor : 0 + bottomMargin: direction == "bottom" ? 8 * screenScaleFactor : 0 + } + color: base.color + width: parent.width + } + } + } + + onClosed: visible = false + onOpened: visible = true + closePolicy: closeOnClick ? Popup.CloseOnPressOutside : Popup.NoAutoClose + enter: Transition + { + NumberAnimation + { + duration: 75 + property: "visible" + } + } + exit: Transition + { + NumberAnimation + { + duration: 75 + property: "visible" + } + } + + clip: true + + padding: UM.Theme.getSize("monitor_shadow_radius").width + topPadding: direction == "top" ? padding + 8 * screenScaleFactor : padding + bottomPadding: direction == "bottom" ? padding + 8 * screenScaleFactor : padding + leftPadding: direction == "left" ? padding + 8 * screenScaleFactor : padding + rightPadding: direction == "right" ? padding + 8 * screenScaleFactor : padding + + transformOrigin: + { + switch(direction) + { + case "top": + return Popup.Top + case "bottom": + return Popup.Bottom + case "right": + return Popup.Right + case "left": + return Popup.Left + default: + direction = "bottom" + return Popup.Bottom + } + } + + visible: false; + + x: + { + switch(direction) + { + case "left": + return target.x + target.width + 4 * screenScaleFactor + case "right": + return target.x - base.width - 4 * screenScaleFactor + default: + return target.x + target.width / 2 - base.width / 2 + } + } + y: + { + switch(direction) + { + case "top": + return target.y + target.height + 4 * screenScaleFactor + case "bottom": + return target.y - base.height - 4 * screenScaleFactor + default: + return target.y + target.height / 2 - base.height / 2 + } + } +} From 920b7b6706d70760808c374bacd551d0c994ef9d Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 16:30:11 +0100 Subject: [PATCH 02/34] Create MonitorInfoBlurb.qml Contributes to CL-1165 --- .../resources/qml/MonitorInfoBlurb.qml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml new file mode 100644 index 0000000000..f7d37b989a --- /dev/null +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml @@ -0,0 +1,54 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.3 +import QtQuick.Controls 2.0 +import QtQuick.Dialogs 1.1 +import UM 1.3 as UM + +/** + * A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context + * menus). It accepts some text (text), an item to link to to (target), and a specification of which side of the target + * to appear on (direction). It also sets the GenericPopUp's color to black, to differentiate itself from a menu. + */ +Item +{ + property alias text: innerLabel.text + property alias target: popUp.target + property alias direction: popUp.direction + + GenericPopUp + { + id: popUp + + // If the pop-up won't fit in the window, flip it + direction: target.y + target.height + contentWrapper.implicitHeight < monitorFrame.height ? "top" : "bottom" + + // Use dark grey for info blurbs and white for context menus + color: "#191919" // TODO: Theme! + + contentItem: Item + { + id: contentWrapper + implicitWidth: childrenRect.width + implicitHeight: innerLabel.contentHeight + 2 * innerLabel.padding + Label + { + id: innerLabel + padding: 12 * screenScaleFactor // TODO: Theme! + text: "" + wrapMode: Text.WordWrap + width: 240 * screenScaleFactor // TODO: Theme! + color: "white" // TODO: Theme! + font: UM.Theme.getFont("default") + } + } + } + + function open() { + popUp.open() + } + function close() { + popUp.close() + } +} From 4ce244362c19421552d17a3e31dc3faf306e22f7 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 16:30:39 +0100 Subject: [PATCH 03/34] Make camera button grey if disabled Contributes to CL-1165 --- plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml index 6f054f9c19..afc295858f 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml @@ -9,12 +9,14 @@ import Cura 1.0 as Cura Rectangle { id: base + + property var enabled: true + property var iconSource: null; - color: "#0a0850" // TODO: Theme! + color: !enabled ? "#cccccc" : "#0a0850" // TODO: Theme! height: width; radius: Math.round(0.5 * width); width: 24 * screenScaleFactor; - property var enabled: true UM.RecolorImage { id: icon; From f6c754c57f068637139ec818190114b9c2e66637 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 16:31:26 +0100 Subject: [PATCH 04/34] Remove PropertyAnimation test --- .../UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index facfaaaaaf..909c7f143e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -156,9 +156,6 @@ Item } height: 72 * screenScaleFactor // TODO: Theme!te theRect's x property } - - // TODO: Make this work. - PropertyAnimation { target: printerConfiguration; property: "visible"; to: 0; loops: Animation.Infinite; duration: 500 } } From 4248deeb763ceeb7a7f9f43cbea1b3f66dfab95d Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 16:31:49 +0100 Subject: [PATCH 05/34] Line-length fixes --- .../resources/qml/MonitorPrinterCard.qml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 909c7f143e..d88230320e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -7,13 +7,11 @@ import QtQuick.Dialogs 1.1 import UM 1.3 as UM /** - * A Printer Card is has two main components: the printer portion and the print - * job portion, the latter being paired in the UI when a print job is paired - * a printer in-cluster. + * A Printer Card is has two main components: the printer portion and the print job portion, the latter being paired in + * the UI when a print job is paired a printer in-cluster. * - * NOTE: For most labels, a fixed height with vertical alignment is used to make - * layouts more deterministic (like the fixed-size textboxes used in original - * mock-ups). This is also a stand-in for CSS's 'line-height' property. Denoted + * NOTE: For most labels, a fixed height with vertical alignment is used to make layouts more deterministic (like the + * fixed-size textboxes used in original mock-ups). This is also a stand-in for CSS's 'line-height' property. Denoted * with '// FIXED-LINE-HEIGHT:'. */ Item @@ -25,9 +23,8 @@ Item property var borderSize: 1 * screenScaleFactor // TODO: Theme, and remove from here - // If the printer card's controls are enabled. This is used by the carousel - // to prevent opening the context menu or camera while the printer card is not - // "in focus" + // If the printer card's controls are enabled. This is used by the carousel to prevent opening the context menu or + // camera while the printer card is not "in focus" property var enabled: true width: 834 * screenScaleFactor // TODO: Theme! @@ -217,6 +214,7 @@ Item } border { + // TODO: Fix line length color: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 ? "#f5a623" : "transparent" // TODO: Theme! width: borderSize // TODO: Remove once themed } From 5a78eb05415d6eedb052e3d01e5780d41aa6df45 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 16:32:26 +0100 Subject: [PATCH 06/34] Temporarily disable context menu and camera button Contributes to CL-1165 --- .../UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index d88230320e..0951cf1c2a 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -170,7 +170,8 @@ Item printJob: printer ? printer.activePrintJob : null width: 36 * screenScaleFactor // TODO: Theme! height: 36 * screenScaleFactor // TODO: Theme! - enabled: base.enabled + // enabled: base.enabled + enabled: false visible: printer } CameraButton @@ -184,7 +185,8 @@ Item bottomMargin: 20 * screenScaleFactor // TODO: Theme! } iconSource: "../svg/icons/camera.svg" - enabled: base.enabled + // enabled: base.enabled + enabled: false visible: printer } } From 5a15ffc09097ab3b175cfa08a63bac9b451bde31 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 17:03:41 +0100 Subject: [PATCH 07/34] Create MonitorContextMenuButton.qml Contributes to CL-1165 --- .../qml/MonitorContextMenuButton.qml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml new file mode 100644 index 0000000000..5cd3404870 --- /dev/null +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml @@ -0,0 +1,31 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.3 +import QtQuick.Controls 2.0 +import UM 1.3 as UM +import Cura 1.0 as Cura + +Button +{ + id: base + background: Rectangle + { + color: UM.Theme.getColor("viewport_background") // TODO: Theme! + height: base.height + opacity: base.down || base.hovered ? 1 : 0 + radius: Math.round(0.5 * width) + width: base.width + } + contentItem: Label { + color: UM.Theme.getColor("monitor_context_menu_dots") + font.pixelSize: 32 * screenScaleFactor + horizontalAlignment: Text.AlignHCenter + text: base.text + verticalAlignment: Text.AlignVCenter + } + height: width + hoverEnabled: enabled + text: "\u22EE" //Unicode Three stacked points. + width: 36 * screenScaleFactor // TODO: Theme! +} \ No newline at end of file From cdc24081a5f5abedd49818994cf32dd733abe307 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 17:03:56 +0100 Subject: [PATCH 08/34] Create MonitorPrinterContextMenu.qml Contributes to CL-1165 --- .../qml/MonitorPrinterContextMenu.qml | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml new file mode 100644 index 0000000000..1015824ea4 --- /dev/null +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml @@ -0,0 +1,92 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.3 +import QtQuick.Controls 2.0 +import QtQuick.Dialogs 1.1 +import UM 1.3 as UM + +/** + * A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context + * menus). It accepts some text (text), an item to link to to (target), and a specification of which side of the target + * to appear on (direction). It also sets the GenericPopUp's color to black, to differentiate itself from a menu. + */ +Item +{ + property alias target: popUp.target + + property var printJob: null + + GenericPopUp + { + id: popUp + + // If the pop-up won't fit in the window, flip it + direction: + { + var availableSpace = monitorFrame.height + var targetPosition = target.mapToItem(null, 0, 0) + var requiredSpace = targetPosition.y + target.height + contentWrapper.implicitHeight + return requiredSpace < availableSpace ? "top" : "bottom" + } + + // Use dark grey for info blurbs and white for context menus + color: "#ffffff" // TODO: Theme! + + contentItem: Item + { + id: contentWrapper + implicitWidth: childrenRect.width + implicitHeight: innerLabel.contentHeight + Label + { + id: innerLabel + text: "The future of context menus starts here!" + wrapMode: Text.WordWrap + width: 182 * screenScaleFactor // TODO: Theme! + color: "white" // TODO: Theme! + font: UM.Theme.getFont("default") + } + } + } + + MessageDialog { + id: sendToTopConfirmationDialog + Component.onCompleted: visible = false + icon: StandardIcon.Warning + onYes: OutputDevice.sendJobToTop(printJob.key) + standardButtons: StandardButton.Yes | StandardButton.No + text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "" + title: catalog.i18nc("@window:title", "Move print job to top") + } + + MessageDialog { + id: deleteConfirmationDialog + Component.onCompleted: visible = false + icon: StandardIcon.Warning + onYes: OutputDevice.deleteJobFromQueue(printJob.key) + standardButtons: StandardButton.Yes | StandardButton.No + text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "" + title: catalog.i18nc("@window:title", "Delete print job") + } + + MessageDialog { + id: abortConfirmationDialog + Component.onCompleted: visible = false + icon: StandardIcon.Warning + onYes: printJob.setState("abort") + standardButtons: StandardButton.Yes | StandardButton.No + text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "" + title: catalog.i18nc("@window:title", "Abort print") + } + + function switchPopupState() { + popUp.visible ? popUp.close() : popUp.open() + } + function open() { + popUp.open() + } + function close() { + popUp.close() + } +} From 548882e398591fae2f5e27312fd7f07530aeea6c Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 17:04:33 +0100 Subject: [PATCH 09/34] Use new context menu Contributes to CL-1165 --- .../resources/qml/MonitorPrinterCard.qml | 62 +++++++++++++++++-- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 0951cf1c2a..7e5b42a48e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -156,10 +156,9 @@ Item } - - PrintJobContextMenu + MonitorContextMenuButton { - id: contextButton + id: contextMenuButton anchors { right: parent.right @@ -167,16 +166,49 @@ Item top: parent.top topMargin: 12 * screenScaleFactor // TODO: Theme! } - printJob: printer ? printer.activePrintJob : null width: 36 * screenScaleFactor // TODO: Theme! height: 36 * screenScaleFactor // TODO: Theme! // enabled: base.enabled enabled: false - visible: printer + onClicked: enabled ? contextMenu.switchPopupState() : {} + visible: + { + if (!printer || !printer.activePrintJob) { + return false + } + var states = ["queued", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"] + return states.indexOf(printer.activePrintJob.state) !== -1 + } } + + MonitorPrinterContextMenu + { + id: contextMenu + printJob: printer ? printer.activePrintJob : null + target: contextMenuButton + } + + // For cloud printing, add this mouse area over the disabled contextButton to indicate that it's not available + MouseArea + { + id: contextMenuDisabledButtonArea + anchors.fill: contextMenuButton + hoverEnabled: contextMenuButton.visible && !contextMenuButton.enabled + onEntered: contextMenuDisabledInfo.open() + onExited: contextMenuDisabledInfo.close() + enabled: !contextMenuButton.enabled + } + + MonitorInfoBlurb + { + id: contextMenuDisabledInfo + text: catalog.i18nc("@info", "These options are not available because you are monitoring a cloud printer.") + target: contextMenuButton + } + CameraButton { - id: cameraButton; + id: cameraButton anchors { right: parent.right @@ -189,6 +221,24 @@ Item enabled: false visible: printer } + + // For cloud printing, add this mouse area over the disabled cameraButton to indicate that it's not available + MouseArea + { + id: cameraDisabledButtonArea + anchors.fill: cameraButton + hoverEnabled: cameraButton.visible && !cameraButton.enabled + onEntered: cameraDisabledInfo.open() + onExited: cameraDisabledInfo.close() + enabled: !cameraButton.enabled + } + + MonitorInfoBlurb + { + id: cameraDisabledInfo + text: catalog.i18nc("@info", "The webcam is not available because you are monitoring a cloud printer.") + target: cameraButton + } } From 669f6d8f0cb782a7bcd71943d9ab87fe9846d419 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 9 Jan 2019 17:04:51 +0100 Subject: [PATCH 10/34] Fix available space bug Contributes to CL-1165 --- .../resources/qml/MonitorInfoBlurb.qml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml index f7d37b989a..58b354afcf 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml @@ -3,7 +3,6 @@ import QtQuick 2.3 import QtQuick.Controls 2.0 -import QtQuick.Dialogs 1.1 import UM 1.3 as UM /** @@ -22,7 +21,13 @@ Item id: popUp // If the pop-up won't fit in the window, flip it - direction: target.y + target.height + contentWrapper.implicitHeight < monitorFrame.height ? "top" : "bottom" + direction: + { + var availableSpace = monitorFrame.height + var targetPosition = target.mapToItem(null, 0, 0) + var requiredSpace = targetPosition.y + target.height + contentWrapper.implicitHeight + return requiredSpace < availableSpace ? "top" : "bottom" + } // Use dark grey for info blurbs and white for context menus color: "#191919" // TODO: Theme! From 0622c5cb8b9582cd3e0cd49edcb89a8e98f5b9b2 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 10 Jan 2019 09:22:27 +0100 Subject: [PATCH 11/34] Rename MonitorPrinterContextMenu to MonitorContextMenu --- .../resources/qml/MonitorContextMenu.qml | 183 ++++++++++++++++++ .../resources/qml/MonitorPrinterCard.qml | 3 +- .../qml/MonitorPrinterContextMenu.qml | 92 --------- 3 files changed, 184 insertions(+), 94 deletions(-) create mode 100644 plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml new file mode 100644 index 0000000000..fecb5e3162 --- /dev/null +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml @@ -0,0 +1,183 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.3 +import QtQuick.Controls 2.0 +import QtQuick.Dialogs 1.1 +import UM 1.3 as UM + +/** + * A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context + * menus). It accepts some text (text), an item to link to to (target), and a specification of which side of the target + * to appear on (direction). It also sets the GenericPopUp's color to black, to differentiate itself from a menu. + */ +Item +{ + property alias target: popUp.target + + property var printJob: null + + GenericPopUp + { + id: popUp + + // If the pop-up won't fit in the window, flip it + direction: + { + var availableSpace = monitorFrame.height + var targetPosition = target.mapToItem(null, 0, 0) + var requiredSpace = targetPosition.y + target.height + contentWrapper.implicitHeight + console.log("available space", availableSpace - targetPosition.y + target.height) + return requiredSpace < availableSpace ? "top" : "bottom" + } + + // Use dark grey for info blurbs and white for context menus + color: "#ffffff" // TODO: Theme! + + contentItem: Item + { + id: contentWrapper + implicitWidth: childrenRect.width + implicitHeight: menuItems.height + UM.Theme.getSize("default_margin").height + + Column + { + id: menuItems + width: 144 * screenScaleFactor + + anchors + { + top: parent.top + topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2) + } + + spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2) + + PrintJobContextMenuItem { + onClicked: { + sendToTopConfirmationDialog.visible = true; + popUp.close(); + } + text: catalog.i18nc("@label", "Move to top"); + visible: { + if (printJob && printJob.state == "queued" && !assigned) { + if (OutputDevice && OutputDevice.queuedPrintJobs[0]) { + return OutputDevice.queuedPrintJobs[0].key != printJob.key; + } + } + return false; + } + } + + PrintJobContextMenuItem { + onClicked: { + deleteConfirmationDialog.visible = true; + popUp.close(); + } + text: catalog.i18nc("@label", "Delete"); + visible: { + if (!printJob) { + return false; + } + var states = ["queued", "sent_to_printer"]; + return states.indexOf(printJob.state) !== -1; + } + } + + PrintJobContextMenuItem { + enabled: visible && !(printJob.state == "pausing" || printJob.state == "resuming"); + onClicked: { + if (printJob.state == "paused") { + printJob.setState("print"); + popUp.close(); + return; + } + if (printJob.state == "printing") { + printJob.setState("pause"); + popUp.close(); + return; + } + } + text: { + if (!printJob) { + return ""; + } + switch(printJob.state) { + case "paused": + return catalog.i18nc("@label", "Resume"); + case "pausing": + return catalog.i18nc("@label", "Pausing..."); + case "resuming": + return catalog.i18nc("@label", "Resuming..."); + default: + catalog.i18nc("@label", "Pause"); + } + } + visible: { + if (!printJob) { + return false; + } + var states = ["printing", "pausing", "paused", "resuming"]; + return states.indexOf(printJob.state) !== -1; + } + } + + PrintJobContextMenuItem { + enabled: visible && printJob.state !== "aborting"; + onClicked: { + abortConfirmationDialog.visible = true; + popUp.close(); + } + text: printJob && printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort"); + visible: { + if (!printJob) { + return false; + } + var states = ["pre_print", "printing", "pausing", "paused", "resuming"]; + return states.indexOf(printJob.state) !== -1; + } + } + } + } + } + + MessageDialog { + id: sendToTopConfirmationDialog + Component.onCompleted: visible = false + icon: StandardIcon.Warning + onYes: OutputDevice.sendJobToTop(printJob.key) + standardButtons: StandardButton.Yes | StandardButton.No + text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "" + title: catalog.i18nc("@window:title", "Move print job to top") + } + + MessageDialog { + id: deleteConfirmationDialog + Component.onCompleted: visible = false + icon: StandardIcon.Warning + onYes: OutputDevice.deleteJobFromQueue(printJob.key) + standardButtons: StandardButton.Yes | StandardButton.No + text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "" + title: catalog.i18nc("@window:title", "Delete print job") + } + + MessageDialog { + id: abortConfirmationDialog + Component.onCompleted: visible = false + icon: StandardIcon.Warning + onYes: printJob.setState("abort") + standardButtons: StandardButton.Yes | StandardButton.No + text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "" + title: catalog.i18nc("@window:title", "Abort print") + } + + function switchPopupState() { + popUp.visible ? popUp.close() : popUp.open() + } + function open() { + popUp.open() + } + function close() { + popUp.close() + } +} diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 7e5b42a48e..517b696db8 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -155,7 +155,6 @@ Item } } - MonitorContextMenuButton { id: contextMenuButton @@ -181,7 +180,7 @@ Item } } - MonitorPrinterContextMenu + MonitorContextMenu { id: contextMenu printJob: printer ? printer.activePrintJob : null diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml deleted file mode 100644 index 1015824ea4..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterContextMenu.qml +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.3 -import QtQuick.Controls 2.0 -import QtQuick.Dialogs 1.1 -import UM 1.3 as UM - -/** - * A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context - * menus). It accepts some text (text), an item to link to to (target), and a specification of which side of the target - * to appear on (direction). It also sets the GenericPopUp's color to black, to differentiate itself from a menu. - */ -Item -{ - property alias target: popUp.target - - property var printJob: null - - GenericPopUp - { - id: popUp - - // If the pop-up won't fit in the window, flip it - direction: - { - var availableSpace = monitorFrame.height - var targetPosition = target.mapToItem(null, 0, 0) - var requiredSpace = targetPosition.y + target.height + contentWrapper.implicitHeight - return requiredSpace < availableSpace ? "top" : "bottom" - } - - // Use dark grey for info blurbs and white for context menus - color: "#ffffff" // TODO: Theme! - - contentItem: Item - { - id: contentWrapper - implicitWidth: childrenRect.width - implicitHeight: innerLabel.contentHeight - Label - { - id: innerLabel - text: "The future of context menus starts here!" - wrapMode: Text.WordWrap - width: 182 * screenScaleFactor // TODO: Theme! - color: "white" // TODO: Theme! - font: UM.Theme.getFont("default") - } - } - } - - MessageDialog { - id: sendToTopConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: OutputDevice.sendJobToTop(printJob.key) - standardButtons: StandardButton.Yes | StandardButton.No - text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "" - title: catalog.i18nc("@window:title", "Move print job to top") - } - - MessageDialog { - id: deleteConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: OutputDevice.deleteJobFromQueue(printJob.key) - standardButtons: StandardButton.Yes | StandardButton.No - text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "" - title: catalog.i18nc("@window:title", "Delete print job") - } - - MessageDialog { - id: abortConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: printJob.setState("abort") - standardButtons: StandardButton.Yes | StandardButton.No - text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "" - title: catalog.i18nc("@window:title", "Abort print") - } - - function switchPopupState() { - popUp.visible ? popUp.close() : popUp.open() - } - function open() { - popUp.open() - } - function close() { - popUp.close() - } -} From 9c711cc8aa3729d7c6d97568b569ddfd14ed0c42 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 10 Jan 2019 15:27:04 +0100 Subject: [PATCH 12/34] Pop-up flips directions Contributes to CL-1165 --- .../resources/qml/GenericPopUp.qml | 127 +++++++++++------- .../resources/qml/MonitorInfoBlurb.qml | 9 +- .../resources/qml/MonitorPrintJobCard.qml | 58 +++++++- 3 files changed, 131 insertions(+), 63 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml index 442de3cd7a..15a88ef3fd 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -44,6 +44,8 @@ Popup */ property var color: "#ffffff" // TODO: Theme! + Component.onCompleted: recalculatePosition() + background: Item { anchors.fill: parent @@ -127,25 +129,61 @@ Popup } } + visible: false onClosed: visible = false - onOpened: visible = true + onOpened: + { + // Flip direction if there is not enough screen space + var availableSpace + + var targetPosition = target.mapToItem(monitorFrame, 0, 0) + + var requiredSpace = contentItem.implicitHeight + 2 * padding + 8 * screenScaleFactor + + switch(direction) + { + case "top": + availableSpace = monitorFrame.height - (targetPosition.y + target.height) + // console.log("Needs", requiredSpace, "has got", availableSpace) + if (availableSpace < requiredSpace) + { + // console.log("putting point on bottom") + direction = "bottom" + } + break + case "bottom": + availableSpace = targetPosition.y + // console.log("Needs", requiredSpace, "has got", availableSpace) + if (availableSpace < requiredSpace) + { + // console.log("putting point on top") + direction = "top" + } + break + } + + recalculatePosition() + + // Show the pop up + visible = true + } closePolicy: closeOnClick ? Popup.CloseOnPressOutside : Popup.NoAutoClose - enter: Transition - { - NumberAnimation - { - duration: 75 - property: "visible" - } - } - exit: Transition - { - NumberAnimation - { - duration: 75 - property: "visible" - } - } + // enter: Transition + // { + // NumberAnimation + // { + // duration: 75 + // property: "visible" + // } + // } + // exit: Transition + // { + // NumberAnimation + // { + // duration: 75 + // property: "visible" + // } + // } clip: true @@ -155,48 +193,35 @@ Popup leftPadding: direction == "left" ? padding + 8 * screenScaleFactor : padding rightPadding: direction == "right" ? padding + 8 * screenScaleFactor : padding - transformOrigin: - { - switch(direction) - { - case "top": - return Popup.Top - case "bottom": - return Popup.Bottom - case "right": - return Popup.Right - case "left": - return Popup.Left - default: - direction = "bottom" - return Popup.Bottom + function recalculatePosition() { + + // Stupid pop-up logic causes the pop-up to resize, so let's compute what it SHOULD be + const realWidth = contentItem.implicitWidth + leftPadding + rightPadding + const realHeight = contentItem.implicitHeight + topPadding + bottomPadding + + var centered = { + x: target.x + target.width / 2 - realWidth / 2, + y: target.y + target.height / 2 - realHeight / 2 } - } - visible: false; - - x: - { switch(direction) { case "left": - return target.x + target.width + 4 * screenScaleFactor + x = target.x + target.width + y = centered.y + break case "right": - return target.x - base.width - 4 * screenScaleFactor - default: - return target.x + target.width / 2 - base.width / 2 - } - } - y: - { - switch(direction) - { + x = target.x - realWidth + y = centered.y + break case "top": - return target.y + target.height + 4 * screenScaleFactor + x = centered.x + y = target.y + target.height + break case "bottom": - return target.y - base.height - 4 * screenScaleFactor - default: - return target.y + target.height / 2 - base.height / 2 + x = centered.x + y = target.y - realHeight + break } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml index 58b354afcf..7491f6c415 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml @@ -20,14 +20,7 @@ Item { id: popUp - // If the pop-up won't fit in the window, flip it - direction: - { - var availableSpace = monitorFrame.height - var targetPosition = target.mapToItem(null, 0, 0) - var requiredSpace = targetPosition.y + target.height + contentWrapper.implicitHeight - return requiredSpace < availableSpace ? "top" : "bottom" - } + direction: "top" // Use dark grey for info blurbs and white for context menus color: "#191919" // TODO: Theme! diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index f2b9c3cff7..9493ed33e6 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -198,18 +198,68 @@ Item } } - PrintJobContextMenu + // PrintJobContextMenu + // { + // id: contextButton + // anchors + // { + // right: parent.right; + // rightMargin: 8 * screenScaleFactor // TODO: Theme! + // top: parent.top + // topMargin: 8 * screenScaleFactor // TODO: Theme! + // } + // printJob: base.printJob + // width: 32 * screenScaleFactor // TODO: Theme! + // height: 32 * screenScaleFactor // TODO: Theme! + // } + + MonitorContextMenuButton { - id: contextButton + id: contextMenuButton anchors { - right: parent.right; + right: parent.right rightMargin: 8 * screenScaleFactor // TODO: Theme! top: parent.top topMargin: 8 * screenScaleFactor // TODO: Theme! } - printJob: base.printJob width: 32 * screenScaleFactor // TODO: Theme! height: 32 * screenScaleFactor // TODO: Theme! + // enabled: base.enabled + enabled: false + onClicked: enabled ? contextMenu.switchPopupState() : {} + visible: + { + if (!printJob) { + return false + } + var states = ["queued", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"] + return states.indexOf(printJob.state) !== -1 + } + } + + MonitorContextMenu + { + id: contextMenu + printJob: printer ? printer.activePrintJob : null + target: contextMenuButton + } + + // For cloud printing, add this mouse area over the disabled contextButton to indicate that it's not available + MouseArea + { + id: contextMenuDisabledButtonArea + anchors.fill: contextMenuButton + hoverEnabled: contextMenuButton.visible && !contextMenuButton.enabled + onEntered: contextMenuDisabledInfo.open() + onExited: contextMenuDisabledInfo.close() + enabled: !contextMenuButton.enabled + } + + MonitorInfoBlurb + { + id: contextMenuDisabledInfo + text: catalog.i18nc("@info", "These options are not available because you are monitoring a cloud printer.") + target: contextMenuButton } } \ No newline at end of file From 292d04f3eaad4143cdc558f6d14253a42d240843 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 10 Jan 2019 15:27:31 +0100 Subject: [PATCH 13/34] Remove transitions which caused graphical glitches Contributes to CL-1165 --- .../resources/qml/GenericPopUp.qml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml index 15a88ef3fd..7bdec1087c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -168,22 +168,6 @@ Popup visible = true } closePolicy: closeOnClick ? Popup.CloseOnPressOutside : Popup.NoAutoClose - // enter: Transition - // { - // NumberAnimation - // { - // duration: 75 - // property: "visible" - // } - // } - // exit: Transition - // { - // NumberAnimation - // { - // duration: 75 - // property: "visible" - // } - // } clip: true From 612b0d0165a8775756c58955154d88a19912a4dc Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 10 Jan 2019 15:54:58 +0100 Subject: [PATCH 14/34] Reset pop-up orientation if it moved Contributes to CL-1165 --- .../resources/qml/GenericPopUp.qml | 121 +++++++++++------- .../resources/qml/MonitorInfoBlurb.qml | 3 +- 2 files changed, 75 insertions(+), 49 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml index 7bdec1087c..4bcfade1f5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -9,9 +9,9 @@ import QtGraphicalEffects 1.0 import UM 1.3 as UM /** - * This is a generic pop-up element which can be supplied with a target and a content - * item. The content item will appear to the left, right, above, or below the target - * depending on the value of the direction property + * This is a generic pop-up element which can be supplied with a target and a content item. The + * content item will appear to the left, right, above, or below the target depending on the value of + * the direction property */ Popup { @@ -23,14 +23,20 @@ Popup property var target /** - * Which side of the target should the contentItem appear on? + * Which direction should the pop-up "point"? * Possible values include: - * - "top" - * - "bottom" + * - "up" + * - "down" * - "left" * - "right" */ - property string direction: "bottom" + property string direction: "down" + + /** + * We save the default direction so that if a pop-up was flipped but later has space (i.e. it + * moved), we can unflip it back to the default direction. + */ + property string originalDirection: "" /** * Should the popup close when you click outside it? For example, this is @@ -44,7 +50,13 @@ Popup */ property var color: "#ffffff" // TODO: Theme! - Component.onCompleted: recalculatePosition() + Component.onCompleted: + { + recalculatePosition() + + // Set the direction here so it's only set once and never mutated + originalDirection = (' ' + direction).slice(1) + } background: Item { @@ -92,9 +104,9 @@ Popup { switch(direction) { - case "top": + case "up": return bloop.top - case "bottom": + case "down": return bloop.bottom default: return bloop.verticalCenter @@ -118,10 +130,10 @@ Popup anchors { fill: parent - leftMargin: direction == "left" ? 8 * screenScaleFactor : 0 - rightMargin: direction == "right" ? 8 * screenScaleFactor : 0 - topMargin: direction == "top" ? 8 * screenScaleFactor : 0 - bottomMargin: direction == "bottom" ? 8 * screenScaleFactor : 0 + leftMargin: direction == "left" ? 8 * screenScaleFactor : 0 + rightMargin: direction == "right" ? 8 * screenScaleFactor : 0 + topMargin: direction == "up" ? 8 * screenScaleFactor : 0 + bottomMargin: direction == "down" ? 8 * screenScaleFactor : 0 } color: base.color width: parent.width @@ -133,35 +145,10 @@ Popup onClosed: visible = false onOpened: { - // Flip direction if there is not enough screen space - var availableSpace - - var targetPosition = target.mapToItem(monitorFrame, 0, 0) - - var requiredSpace = contentItem.implicitHeight + 2 * padding + 8 * screenScaleFactor - - switch(direction) - { - case "top": - availableSpace = monitorFrame.height - (targetPosition.y + target.height) - // console.log("Needs", requiredSpace, "has got", availableSpace) - if (availableSpace < requiredSpace) - { - // console.log("putting point on bottom") - direction = "bottom" - } - break - case "bottom": - availableSpace = targetPosition.y - // console.log("Needs", requiredSpace, "has got", availableSpace) - if (availableSpace < requiredSpace) - { - // console.log("putting point on top") - direction = "top" - } - break - } + // Flip orientation if necessary + recalculateOrientation() + // Fix position if necessary recalculatePosition() // Show the pop up @@ -172,10 +159,10 @@ Popup clip: true padding: UM.Theme.getSize("monitor_shadow_radius").width - topPadding: direction == "top" ? padding + 8 * screenScaleFactor : padding - bottomPadding: direction == "bottom" ? padding + 8 * screenScaleFactor : padding - leftPadding: direction == "left" ? padding + 8 * screenScaleFactor : padding - rightPadding: direction == "right" ? padding + 8 * screenScaleFactor : padding + topPadding: direction == "up" ? padding + 8 * screenScaleFactor : padding + bottomPadding: direction == "down" ? padding + 8 * screenScaleFactor : padding + leftPadding: direction == "left" ? padding + 8 * screenScaleFactor : padding + rightPadding: direction == "right" ? padding + 8 * screenScaleFactor : padding function recalculatePosition() { @@ -198,14 +185,52 @@ Popup x = target.x - realWidth y = centered.y break - case "top": + case "up": x = centered.x y = target.y + target.height break - case "bottom": + case "down": x = centered.x y = target.y - realHeight break } } + + function recalculateOrientation() { + // Flip direction if there is not enough screen space + var availableSpace + + var targetPosition = target.mapToItem(monitorFrame, 0, 0) + + // Stupid pop-up logic causes the pop-up to resize, so let's compute what it SHOULD be + const realWidth = contentItem.implicitWidth + leftPadding + rightPadding + const realHeight = contentItem.implicitHeight + topPadding + bottomPadding + + switch(originalDirection) + { + case "up": + availableSpace = monitorFrame.height - (targetPosition.y + target.height) + direction = availableSpace < realHeight ? "down" : originalDirection + break + case "down": + availableSpace = targetPosition.y + // if (availableSpace < realHeight) + // { + // if (direction != originalDirection) + // { + + // } + // } + direction = availableSpace < realHeight ? "up" : originalDirection + break + case "right": + availableSpace = targetPosition.x + direction = availableSpace < realWidth ? "left" : originalDirection + break + case "left": + availableSpace = monitorFrame.width - (targetPosition.x + target.width) + direction = availableSpace < realWidth ? "right" : originalDirection + break + } + } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml index 7491f6c415..3a6800e999 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml @@ -20,7 +20,8 @@ Item { id: popUp - direction: "top" + // Which way should the pop-up point? Default is up, but will flip when required + direction: "up" // Use dark grey for info blurbs and white for context menus color: "#191919" // TODO: Theme! From 3377ed0e6e6ee712339d1574e5405605c2145881 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 10 Jan 2019 15:55:25 +0100 Subject: [PATCH 15/34] Remove some unused code Contributes to CL-1165 --- plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml index 4bcfade1f5..4430a6a30a 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -214,13 +214,6 @@ Popup break case "down": availableSpace = targetPosition.y - // if (availableSpace < realHeight) - // { - // if (direction != originalDirection) - // { - - // } - // } direction = availableSpace < realHeight ? "up" : originalDirection break case "right": From 8d76bd86786e701131970960a75b0426040ec830 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 10 Jan 2019 16:04:57 +0100 Subject: [PATCH 16/34] Small clean-up of log warnings Contributes to CL-1165 --- .../resources/qml/GenericPopUp.qml | 2 -- .../resources/qml/MonitorContextMenu.qml | 19 +++++++++---------- .../resources/qml/MonitorPrintJobCard.qml | 7 +++---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml index 4430a6a30a..74d9377f3e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -197,9 +197,7 @@ Popup } function recalculateOrientation() { - // Flip direction if there is not enough screen space var availableSpace - var targetPosition = target.mapToItem(monitorFrame, 0, 0) // Stupid pop-up logic causes the pop-up to resize, so let's compute what it SHOULD be diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml index fecb5e3162..00b575173e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml @@ -21,15 +21,8 @@ Item { id: popUp - // If the pop-up won't fit in the window, flip it - direction: - { - var availableSpace = monitorFrame.height - var targetPosition = target.mapToItem(null, 0, 0) - var requiredSpace = targetPosition.y + target.height + contentWrapper.implicitHeight - console.log("available space", availableSpace - targetPosition.y + target.height) - return requiredSpace < availableSpace ? "top" : "bottom" - } + // Which way should the pop-up point? Default is up, but will flip when required + direction: "up" // Use dark grey for info blurbs and white for context menus color: "#ffffff" // TODO: Theme! @@ -60,7 +53,7 @@ Item } text: catalog.i18nc("@label", "Move to top"); visible: { - if (printJob && printJob.state == "queued" && !assigned) { + if (printJob && printJob.state == "queued" && !isAssigned(printJob)) { if (OutputDevice && OutputDevice.queuedPrintJobs[0]) { return OutputDevice.queuedPrintJobs[0].key != printJob.key; } @@ -180,4 +173,10 @@ Item function close() { popUp.close() } + function isAssigned(job) { + if (!job) { + return false; + } + return job.assignedPrinter ? true : false; + } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index 9493ed33e6..14817d7dfb 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -27,7 +27,7 @@ Item ExpandableCard { enabled: printJob != null - borderColor: printJob.configurationChanges.length !== 0 ? "#f5a623" : "#CCCCCC" // TODO: Theme! + borderColor: printJob && printJob.configurationChanges.length !== 0 ? "#f5a623" : "#CCCCCC" // TODO: Theme! headerItem: Row { height: 48 * screenScaleFactor // TODO: Theme! @@ -177,8 +177,7 @@ Item id: printerConfiguration anchors.verticalCenter: parent.verticalCenter buildplate: "Glass" - configurations: - [ + configurations: !base.printJob ? [null, null] : [ base.printJob.configuration.extruderConfigurations[0], base.printJob.configuration.extruderConfigurations[1] ] @@ -241,7 +240,7 @@ Item MonitorContextMenu { id: contextMenu - printJob: printer ? printer.activePrintJob : null + printJob: base.printJob ? base.printJob : null target: contextMenuButton } From 616d5a1f438388d2ac03d81fa146035a8b12a5c0 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 11 Jan 2019 10:43:50 +0100 Subject: [PATCH 17/34] Update MonitorPrintJobCard.qml Contributes to CL-1165 --- .../resources/qml/MonitorPrintJobCard.qml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index 14817d7dfb..99b27c5ade 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -197,21 +197,6 @@ Item } } - // PrintJobContextMenu - // { - // id: contextButton - // anchors - // { - // right: parent.right; - // rightMargin: 8 * screenScaleFactor // TODO: Theme! - // top: parent.top - // topMargin: 8 * screenScaleFactor // TODO: Theme! - // } - // printJob: base.printJob - // width: 32 * screenScaleFactor // TODO: Theme! - // height: 32 * screenScaleFactor // TODO: Theme! - // } - MonitorContextMenuButton { id: contextMenuButton @@ -224,8 +209,7 @@ Item } width: 32 * screenScaleFactor // TODO: Theme! height: 32 * screenScaleFactor // TODO: Theme! - // enabled: base.enabled - enabled: false + enabled: base.enabled // TODO: Add cloud logic here! onClicked: enabled ? contextMenu.switchPopupState() : {} visible: { From f3d0010b87fdbd7188bb1a544a8ad0bdb4ff503b Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 17 Jan 2019 15:44:37 +0100 Subject: [PATCH 18/34] Add cloud connection condition Contributes to CL-1165 --- .../resources/qml/MonitorPrintJobCard.qml | 7 ++++++- .../resources/qml/MonitorPrinterCard.qml | 12 ++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index 99b27c5ade..c3d98fcb40 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -4,6 +4,7 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 import UM 1.3 as UM +import Cura 1.0 as Cura /** * A Print Job Card is essentially just a filled-in Expandable Card item. All @@ -21,6 +22,10 @@ Item // The print job which all other data is derived from property var printJob: null + // If the printer is a cloud printer or not. Other items base their enabled state off of this boolean. In the future + // they might not need to though. + property bool cloudConnection: Cura.MachineManager.activeMachineHasActiveCloudConnection + width: parent.width height: childrenRect.height @@ -209,7 +214,7 @@ Item } width: 32 * screenScaleFactor // TODO: Theme! height: 32 * screenScaleFactor // TODO: Theme! - enabled: base.enabled // TODO: Add cloud logic here! + enabled: !cloudConnection onClicked: enabled ? contextMenu.switchPopupState() : {} visible: { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 517b696db8..ec40f3d921 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -5,6 +5,7 @@ import QtQuick 2.3 import QtQuick.Controls 2.0 import QtQuick.Dialogs 1.1 import UM 1.3 as UM +import Cura 1.0 as Cura /** * A Printer Card is has two main components: the printer portion and the print job portion, the latter being paired in @@ -27,6 +28,10 @@ Item // camera while the printer card is not "in focus" property var enabled: true + // If the printer is a cloud printer or not. Other items base their enabled state off of this boolean. In the future + // they might not need to though. + property bool cloudConnection: Cura.MachineManager.activeMachineHasActiveCloudConnection + width: 834 * screenScaleFactor // TODO: Theme! height: childrenRect.height @@ -167,8 +172,8 @@ Item } width: 36 * screenScaleFactor // TODO: Theme! height: 36 * screenScaleFactor // TODO: Theme! - // enabled: base.enabled - enabled: false + enabled: !cloudConnection + onClicked: enabled ? contextMenu.switchPopupState() : {} visible: { @@ -216,8 +221,7 @@ Item bottomMargin: 20 * screenScaleFactor // TODO: Theme! } iconSource: "../svg/icons/camera.svg" - // enabled: base.enabled - enabled: false + enabled: !cloudConnection visible: printer } From 2e5eb611442b992ca0da60dc22a9e16538c48fa9 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 21 Jan 2019 13:07:16 +0100 Subject: [PATCH 19/34] Add theme colors Contributes to CL-1212 --- .../resources/qml/CameraButton.qml | 41 +++++++++++-------- .../resources/qml/ExpandableCard.qml | 21 +++++----- .../qml/MonitorBuildplateConfiguration.qml | 4 +- .../resources/qml/MonitorCarousel.qml | 12 +++--- .../qml/MonitorExtruderConfiguration.qml | 10 ++--- .../resources/qml/MonitorPrintJobCard.qml | 14 +++---- .../resources/qml/MonitorPrintJobPreview.qml | 2 +- .../qml/MonitorPrintJobProgressBar.qml | 8 ++-- .../resources/qml/MonitorPrinterCard.qml | 6 +-- .../qml/MonitorPrinterConfiguration.qml | 2 +- .../resources/qml/MonitorPrinterPill.qml | 4 +- .../resources/qml/MonitorQueue.qml | 6 +-- .../resources/qml/PrintJobContextMenu.qml | 2 +- resources/themes/cura-light/theme.json | 1 + 14 files changed, 70 insertions(+), 63 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml index 6f054f9c19..eded3f4db6 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml @@ -9,30 +9,35 @@ import Cura 1.0 as Cura Rectangle { id: base - property var iconSource: null; - color: "#0a0850" // TODO: Theme! - height: width; - radius: Math.round(0.5 * width); - width: 24 * screenScaleFactor; property var enabled: true + property var iconSource: null - UM.RecolorImage { - id: icon; - anchors { - horizontalCenter: parent.horizontalCenter; - verticalCenter: parent.verticalCenter; + color: UM.Theme.getColor("small_button_active") + height: UM.Theme.getSize("small_button").height + radius: Math.round(0.5 * width) + width: UM.Theme.getSize("small_button").width + + UM.RecolorImage + { + id: icon + anchors + { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter } - color: UM.Theme.getColor("primary_text"); - height: width; - source: iconSource; - width: Math.round(parent.width / 2); + color: UM.Theme.getColor("small_button_text_active") + height: Math.round(parent.height / 2) + source: iconSource + width: Math.round(parent.width / 2) } - MouseArea { - id: clickArea; - anchors.fill: parent; + MouseArea + { + id: clickArea + anchors.fill: parent hoverEnabled: base.enabled - onClicked: { + onClicked: + { if (base.enabled) { if (OutputDevice.activeCameraUrl != "") diff --git a/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml b/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml index d4c123652d..4af505a989 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml @@ -6,21 +6,22 @@ import QtQuick.Controls 2.0 import UM 1.3 as UM import Cura 1.0 as Cura -// TODO: Theme & documentation! -// The expandable component has 3 major sub components: -// * The headerItem Always visible and should hold some info about what happens if the component is expanded -// * The popupItem The content that needs to be shown if the component is expanded. +/** + * The expandable component has 3 major sub components: + * - The headerItem Always visible and should hold some info about what happens if the component is expanded + * - The popupItem The content that needs to be shown if the component is expanded. + */ Item { id: base property bool expanded: false property bool enabled: true - property var borderWidth: 1 - property color borderColor: "#CCCCCC" - property color headerBackgroundColor: "white" - property color headerHoverColor: "#e8f2fc" - property color drawerBackgroundColor: "white" + property var borderWidth: UM.Theme.getSize("default_lining") + property color borderColor: UM.Theme.getColor("wide_lining") + property color headerBackgroundColor: UM.Theme.getColor("main_background") + property color headerHoverColor: UM.Theme.getColor("action_button_hovered") + property color drawerBackgroundColor: UM.Theme.getColor("main_background") property alias headerItem: header.children property alias drawerItem: drawer.children @@ -65,7 +66,7 @@ Item anchors { top: header.bottom - topMargin: -1 + topMargin: UM.Theme.getSize("default_lining") * -1 } border { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml index 192a5a7f76..8813be7217 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml @@ -49,7 +49,7 @@ Item { id: buildplateIcon anchors.centerIn: parent - color: "#0a0850" // TODO: Theme! (Standard purple) + color: UM.Theme.getColor("small_button_active") height: parent.height source: "../svg/icons/buildplate.svg" width: height @@ -60,7 +60,7 @@ Item Label { id: buildplateLabel - color: "#191919" // TODO: Theme! + color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular text: buildplate ? buildplate : "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml index de24ee5a8c..024f4f61e0 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml @@ -82,9 +82,9 @@ Item onClicked: navigateTo(currentIndex - 1) background: Rectangle { - color: leftButton.hovered ? "#e8f2fc" : "#ffffff" // TODO: Theme! + color: leftButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") border.width: 1 * screenScaleFactor // TODO: Theme! - border.color: "#cccccc" // TODO: Theme! + border.color: UM.Theme.getColor("wide_lining") radius: 2 * screenScaleFactor // TODO: Theme! } contentItem: Item @@ -94,10 +94,10 @@ Item { anchors.centerIn: parent width: 18 // TODO: Theme! - height: width // TODO: Theme! - sourceSize.width: width // TODO: Theme! - sourceSize.height: width // TODO: Theme! - color: "#152950" // TODO: Theme! + height: width + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("text") source: UM.Theme.getIcon("arrow_left") } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml index 17c0fa8651..3fce4cf5ee 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml @@ -36,7 +36,7 @@ Item MonitorIconExtruder { id: extruderIcon - color: "#eeeeee" // TODO: Theme! + color: UM.Theme.getColor("secondary") position: 0 } @@ -48,8 +48,8 @@ Item left: extruderIcon.right leftMargin: 12 * screenScaleFactor // TODO: Theme! } - color: materialLabel.visible > 0 ? "transparent" : "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! + color: materialLabel.visible > 0 ? "transparent" : UM.Theme.getColor("secondary") width: Math.max(materialLabel.contentWidth, 60 * screenScaleFactor) // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! @@ -57,7 +57,7 @@ Item { id: materialLabel - color: "#191919" // TODO: Theme! + color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular text: "" @@ -77,8 +77,8 @@ Item left: materialLabelWrapper.left bottom: parent.bottom } - color: printCoreLabel.visible > 0 ? "transparent" : "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! + color: printCoreLabel.visible > 0 ? "transparent" : UM.Theme.getColor("secondary") width: Math.max(printCoreLabel.contentWidth, 36 * screenScaleFactor) // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! @@ -86,7 +86,7 @@ Item { id: printCoreLabel - color: "#191919" // TODO: Theme! + color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("default_bold") // 12pt, bold text: "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index f2b9c3cff7..b11055f603 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -49,7 +49,7 @@ Item width: 216 * screenScaleFactor // TODO: Theme! (Should match column size) Rectangle { - color: "#eeeeee" + color: UM.Theme.getColor("secondary") width: Math.round(parent.width / 2) height: parent.height visible: !printJob @@ -57,7 +57,7 @@ Item Label { text: printJob && printJob.name ? printJob.name : "" - color: "#374355" + color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob @@ -75,7 +75,7 @@ Item width: 216 * screenScaleFactor // TODO: Theme! (Should match column size) Rectangle { - color: "#eeeeee" + color: UM.Theme.getColor("secondary") width: Math.round(parent.width / 3) height: parent.height visible: !printJob @@ -83,7 +83,7 @@ Item Label { text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : "" - color: "#374355" + color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob @@ -102,7 +102,7 @@ Item Rectangle { - color: "#eeeeee" + color: UM.Theme.getColor("secondary") width: 72 * screenScaleFactor // TODO: Theme! height: parent.height visible: !printJob @@ -112,7 +112,7 @@ Item { id: printerAssignmentLabel anchors.verticalCenter: parent.verticalCenter - color: "#374355" + color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular text: { @@ -186,7 +186,7 @@ Item } Label { text: printJob && printJob.owner ? printJob.owner : "" - color: "#374355" // TODO: Theme! + color: UM.Theme.getColor("text") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.top: printerConfiguration.top diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index d0bad63258..616a23c1dc 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -19,7 +19,7 @@ Item Rectangle { anchors.fill: parent - color: printJob ? "transparent" : "#eeeeee" // TODO: Theme! + color: printJob ? "transparent" : UM.Theme.getColor("secondary") radius: 8 // TODO: Theme! Image { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index d5d4705a36..5b284fd2e1 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -34,16 +34,16 @@ Item { background: Rectangle { - color: "#f5f5f5" // TODO: Theme! implicitHeight: visible ? 8 * screenScaleFactor : 0 // TODO: Theme! + color: UM.Theme.getColor("progressbar_background") implicitWidth: 180 * screenScaleFactor // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! } progress: Rectangle { id: progressItem; - color: printJob && printJob.isActive ? "#3282ff" : "#CCCCCC" // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! + color: printJob && printJob.isActive ? UM.Theme.getColor("progressbar_control") : UM.Theme.getColor("progressbar_disabled") } } } @@ -56,7 +56,7 @@ Item leftMargin: 18 * screenScaleFactor // TODO: Theme! } text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%" - color: printJob && printJob.isActive ? "#374355" : "#babac1" // TODO: Theme! + color: printJob && printJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("text_inactive") width: contentWidth font: UM.Theme.getFont("medium") // 14pt, regular @@ -72,7 +72,7 @@ Item left: percentLabel.right leftMargin: 18 * screenScaleFactor // TODO: Theme! } - color: "#374355" // TODO: Theme! + color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") // 14pt, regular text: { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index facfaaaaaf..a312caf124 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -69,7 +69,7 @@ Item id: printerImage width: 108 * screenScaleFactor // TODO: Theme! height: 108 * screenScaleFactor // TODO: Theme! - color: printer ? "transparent" : "#eeeeee" // TODO: Theme! + color: printer ? "transparent" : UM.Theme.getColor("secondary") radius: 8 // TODO: Theme! Image { @@ -94,8 +94,8 @@ Item { id: printerNameLabel // color: "#414054" // TODO: Theme! - color: printer ? "transparent" : "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! + color: printer ? "transparent" : UM.Theme.getColor("secondary") width: parent.width radius: 2 * screenScaleFactor // TODO: Theme! @@ -116,8 +116,8 @@ Item Rectangle { - color: "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! + color: UM.Theme.getColor("secondary") radius: 2 * screenScaleFactor // TODO: Theme! visible: !printer width: 48 * screenScaleFactor // TODO: Theme! diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml index debc8b7959..9c30fec3fc 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml @@ -37,7 +37,7 @@ Item MonitorExtruderConfiguration { - color: modelData && modelData.activeMaterial ? modelData.activeMaterial.color : "#eeeeee" // TODO: Theme! + color: modelData && modelData.activeMaterial ? modelData.activeMaterial.color : UM.Theme.getColor("secondary") material: modelData && modelData.activeMaterial ? modelData.activeMaterial.name : "" position: modelData && typeof(modelData.position) === "number" ? modelData.position : -1 // Use negative one to create empty extruder number printCore: modelData ? modelData.hotendID : "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml index 2408089e1e..1d2bb5a923 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml @@ -32,14 +32,14 @@ Item Rectangle { id: background anchors.fill: parent - color: printerNameLabel.visible ? "#e4e4f2" : "#eeeeee"// TODO: Theme! + color: printerNameLabel.visible ? UM.Theme.getColor("printer_type_label_background") : UM.Theme.getColor("secondary") radius: 2 * screenScaleFactor // TODO: Theme! } Label { id: printerNameLabel anchors.centerIn: parent - color: "#535369" // TODO: Theme! + color: UM.Theme.getColor("text") text: tagText font.pointSize: 10 // TODO: Theme! visible: text !== "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml index f2dc09de95..2a0e1cab7b 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml @@ -94,7 +94,7 @@ Item Label { text: catalog.i18nc("@label", "Print jobs") - color: "#666666" + color: UM.Theme.getColor("text_scene") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter @@ -108,7 +108,7 @@ Item Label { text: catalog.i18nc("@label", "Total print time") - color: "#666666" + color: UM.Theme.getColor("text_scene") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter @@ -122,7 +122,7 @@ Item Label { text: catalog.i18nc("@label", "Waiting for") - color: "#666666" + color: UM.Theme.getColor("text_scene") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml index 5c5c892dad..0d10fe0e7c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml @@ -18,7 +18,7 @@ Item { Button { id: button; background: Rectangle { - color: UM.Theme.getColor("viewport_background"); // TODO: Theme! + color: UM.Theme.getColor("viewport_background") height: button.height; opacity: button.down || button.hovered ? 1 : 0; radius: Math.round(0.5 * width); diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2b42778df4..00ecd99dbc 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -298,6 +298,7 @@ "progressbar_background": [245, 245, 245, 255], "progressbar_control": [50, 130, 255, 255], + "progressbar_disabled": [204, 204, 204, 255], "slider_groove": [223, 223, 223, 255], "slider_groove_fill": [8, 7, 63, 255], From 406ef208020f99fde6306948f4da493233051890 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 21 Jan 2019 14:05:24 +0100 Subject: [PATCH 20/34] Revert "Add theme colors" This reverts commit 2e5eb611442b992ca0da60dc22a9e16538c48fa9. --- .../resources/qml/CameraButton.qml | 41 ++++++++----------- .../resources/qml/ExpandableCard.qml | 21 +++++----- .../qml/MonitorBuildplateConfiguration.qml | 4 +- .../resources/qml/MonitorCarousel.qml | 12 +++--- .../qml/MonitorExtruderConfiguration.qml | 10 ++--- .../resources/qml/MonitorPrintJobCard.qml | 14 +++---- .../resources/qml/MonitorPrintJobPreview.qml | 2 +- .../qml/MonitorPrintJobProgressBar.qml | 8 ++-- .../resources/qml/MonitorPrinterCard.qml | 6 +-- .../qml/MonitorPrinterConfiguration.qml | 2 +- .../resources/qml/MonitorPrinterPill.qml | 4 +- .../resources/qml/MonitorQueue.qml | 6 +-- .../resources/qml/PrintJobContextMenu.qml | 2 +- resources/themes/cura-light/theme.json | 1 - 14 files changed, 63 insertions(+), 70 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml index eded3f4db6..6f054f9c19 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml @@ -9,35 +9,30 @@ import Cura 1.0 as Cura Rectangle { id: base + property var iconSource: null; + color: "#0a0850" // TODO: Theme! + height: width; + radius: Math.round(0.5 * width); + width: 24 * screenScaleFactor; property var enabled: true - property var iconSource: null - color: UM.Theme.getColor("small_button_active") - height: UM.Theme.getSize("small_button").height - radius: Math.round(0.5 * width) - width: UM.Theme.getSize("small_button").width - - UM.RecolorImage - { - id: icon - anchors - { - horizontalCenter: parent.horizontalCenter - verticalCenter: parent.verticalCenter + UM.RecolorImage { + id: icon; + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter; } - color: UM.Theme.getColor("small_button_text_active") - height: Math.round(parent.height / 2) - source: iconSource - width: Math.round(parent.width / 2) + color: UM.Theme.getColor("primary_text"); + height: width; + source: iconSource; + width: Math.round(parent.width / 2); } - MouseArea - { - id: clickArea - anchors.fill: parent + MouseArea { + id: clickArea; + anchors.fill: parent; hoverEnabled: base.enabled - onClicked: - { + onClicked: { if (base.enabled) { if (OutputDevice.activeCameraUrl != "") diff --git a/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml b/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml index 4af505a989..d4c123652d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml @@ -6,22 +6,21 @@ import QtQuick.Controls 2.0 import UM 1.3 as UM import Cura 1.0 as Cura -/** - * The expandable component has 3 major sub components: - * - The headerItem Always visible and should hold some info about what happens if the component is expanded - * - The popupItem The content that needs to be shown if the component is expanded. - */ +// TODO: Theme & documentation! +// The expandable component has 3 major sub components: +// * The headerItem Always visible and should hold some info about what happens if the component is expanded +// * The popupItem The content that needs to be shown if the component is expanded. Item { id: base property bool expanded: false property bool enabled: true - property var borderWidth: UM.Theme.getSize("default_lining") - property color borderColor: UM.Theme.getColor("wide_lining") - property color headerBackgroundColor: UM.Theme.getColor("main_background") - property color headerHoverColor: UM.Theme.getColor("action_button_hovered") - property color drawerBackgroundColor: UM.Theme.getColor("main_background") + property var borderWidth: 1 + property color borderColor: "#CCCCCC" + property color headerBackgroundColor: "white" + property color headerHoverColor: "#e8f2fc" + property color drawerBackgroundColor: "white" property alias headerItem: header.children property alias drawerItem: drawer.children @@ -66,7 +65,7 @@ Item anchors { top: header.bottom - topMargin: UM.Theme.getSize("default_lining") * -1 + topMargin: -1 } border { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml index 8813be7217..192a5a7f76 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml @@ -49,7 +49,7 @@ Item { id: buildplateIcon anchors.centerIn: parent - color: UM.Theme.getColor("small_button_active") + color: "#0a0850" // TODO: Theme! (Standard purple) height: parent.height source: "../svg/icons/buildplate.svg" width: height @@ -60,7 +60,7 @@ Item Label { id: buildplateLabel - color: UM.Theme.getColor("text") + color: "#191919" // TODO: Theme! elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular text: buildplate ? buildplate : "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml index 024f4f61e0..de24ee5a8c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml @@ -82,9 +82,9 @@ Item onClicked: navigateTo(currentIndex - 1) background: Rectangle { - color: leftButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") + color: leftButton.hovered ? "#e8f2fc" : "#ffffff" // TODO: Theme! border.width: 1 * screenScaleFactor // TODO: Theme! - border.color: UM.Theme.getColor("wide_lining") + border.color: "#cccccc" // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! } contentItem: Item @@ -94,10 +94,10 @@ Item { anchors.centerIn: parent width: 18 // TODO: Theme! - height: width - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text") + height: width // TODO: Theme! + sourceSize.width: width // TODO: Theme! + sourceSize.height: width // TODO: Theme! + color: "#152950" // TODO: Theme! source: UM.Theme.getIcon("arrow_left") } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml index 3fce4cf5ee..17c0fa8651 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml @@ -36,7 +36,7 @@ Item MonitorIconExtruder { id: extruderIcon - color: UM.Theme.getColor("secondary") + color: "#eeeeee" // TODO: Theme! position: 0 } @@ -48,8 +48,8 @@ Item left: extruderIcon.right leftMargin: 12 * screenScaleFactor // TODO: Theme! } + color: materialLabel.visible > 0 ? "transparent" : "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! - color: materialLabel.visible > 0 ? "transparent" : UM.Theme.getColor("secondary") width: Math.max(materialLabel.contentWidth, 60 * screenScaleFactor) // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! @@ -57,7 +57,7 @@ Item { id: materialLabel - color: UM.Theme.getColor("text") + color: "#191919" // TODO: Theme! elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular text: "" @@ -77,8 +77,8 @@ Item left: materialLabelWrapper.left bottom: parent.bottom } + color: printCoreLabel.visible > 0 ? "transparent" : "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! - color: printCoreLabel.visible > 0 ? "transparent" : UM.Theme.getColor("secondary") width: Math.max(printCoreLabel.contentWidth, 36 * screenScaleFactor) // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! @@ -86,7 +86,7 @@ Item { id: printCoreLabel - color: UM.Theme.getColor("text") + color: "#191919" // TODO: Theme! elide: Text.ElideRight font: UM.Theme.getFont("default_bold") // 12pt, bold text: "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index b11055f603..f2b9c3cff7 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -49,7 +49,7 @@ Item width: 216 * screenScaleFactor // TODO: Theme! (Should match column size) Rectangle { - color: UM.Theme.getColor("secondary") + color: "#eeeeee" width: Math.round(parent.width / 2) height: parent.height visible: !printJob @@ -57,7 +57,7 @@ Item Label { text: printJob && printJob.name ? printJob.name : "" - color: UM.Theme.getColor("text") + color: "#374355" elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob @@ -75,7 +75,7 @@ Item width: 216 * screenScaleFactor // TODO: Theme! (Should match column size) Rectangle { - color: UM.Theme.getColor("secondary") + color: "#eeeeee" width: Math.round(parent.width / 3) height: parent.height visible: !printJob @@ -83,7 +83,7 @@ Item Label { text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : "" - color: UM.Theme.getColor("text") + color: "#374355" elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob @@ -102,7 +102,7 @@ Item Rectangle { - color: UM.Theme.getColor("secondary") + color: "#eeeeee" width: 72 * screenScaleFactor // TODO: Theme! height: parent.height visible: !printJob @@ -112,7 +112,7 @@ Item { id: printerAssignmentLabel anchors.verticalCenter: parent.verticalCenter - color: UM.Theme.getColor("text") + color: "#374355" elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular text: { @@ -186,7 +186,7 @@ Item } Label { text: printJob && printJob.owner ? printJob.owner : "" - color: UM.Theme.getColor("text") + color: "#374355" // TODO: Theme! elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.top: printerConfiguration.top diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index 616a23c1dc..d0bad63258 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -19,7 +19,7 @@ Item Rectangle { anchors.fill: parent - color: printJob ? "transparent" : UM.Theme.getColor("secondary") + color: printJob ? "transparent" : "#eeeeee" // TODO: Theme! radius: 8 // TODO: Theme! Image { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index 5b284fd2e1..d5d4705a36 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -34,16 +34,16 @@ Item { background: Rectangle { + color: "#f5f5f5" // TODO: Theme! implicitHeight: visible ? 8 * screenScaleFactor : 0 // TODO: Theme! - color: UM.Theme.getColor("progressbar_background") implicitWidth: 180 * screenScaleFactor // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! } progress: Rectangle { id: progressItem; + color: printJob && printJob.isActive ? "#3282ff" : "#CCCCCC" // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! - color: printJob && printJob.isActive ? UM.Theme.getColor("progressbar_control") : UM.Theme.getColor("progressbar_disabled") } } } @@ -56,7 +56,7 @@ Item leftMargin: 18 * screenScaleFactor // TODO: Theme! } text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%" - color: printJob && printJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("text_inactive") + color: printJob && printJob.isActive ? "#374355" : "#babac1" // TODO: Theme! width: contentWidth font: UM.Theme.getFont("medium") // 14pt, regular @@ -72,7 +72,7 @@ Item left: percentLabel.right leftMargin: 18 * screenScaleFactor // TODO: Theme! } - color: UM.Theme.getColor("text") + color: "#374355" // TODO: Theme! font: UM.Theme.getFont("medium") // 14pt, regular text: { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index a312caf124..facfaaaaaf 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -69,7 +69,7 @@ Item id: printerImage width: 108 * screenScaleFactor // TODO: Theme! height: 108 * screenScaleFactor // TODO: Theme! - color: printer ? "transparent" : UM.Theme.getColor("secondary") + color: printer ? "transparent" : "#eeeeee" // TODO: Theme! radius: 8 // TODO: Theme! Image { @@ -94,8 +94,8 @@ Item { id: printerNameLabel // color: "#414054" // TODO: Theme! + color: printer ? "transparent" : "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! - color: printer ? "transparent" : UM.Theme.getColor("secondary") width: parent.width radius: 2 * screenScaleFactor // TODO: Theme! @@ -116,8 +116,8 @@ Item Rectangle { + color: "#eeeeee" // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme! - color: UM.Theme.getColor("secondary") radius: 2 * screenScaleFactor // TODO: Theme! visible: !printer width: 48 * screenScaleFactor // TODO: Theme! diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml index 9c30fec3fc..debc8b7959 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml @@ -37,7 +37,7 @@ Item MonitorExtruderConfiguration { - color: modelData && modelData.activeMaterial ? modelData.activeMaterial.color : UM.Theme.getColor("secondary") + color: modelData && modelData.activeMaterial ? modelData.activeMaterial.color : "#eeeeee" // TODO: Theme! material: modelData && modelData.activeMaterial ? modelData.activeMaterial.name : "" position: modelData && typeof(modelData.position) === "number" ? modelData.position : -1 // Use negative one to create empty extruder number printCore: modelData ? modelData.hotendID : "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml index 1d2bb5a923..2408089e1e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml @@ -32,14 +32,14 @@ Item Rectangle { id: background anchors.fill: parent - color: printerNameLabel.visible ? UM.Theme.getColor("printer_type_label_background") : UM.Theme.getColor("secondary") + color: printerNameLabel.visible ? "#e4e4f2" : "#eeeeee"// TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! } Label { id: printerNameLabel anchors.centerIn: parent - color: UM.Theme.getColor("text") + color: "#535369" // TODO: Theme! text: tagText font.pointSize: 10 // TODO: Theme! visible: text !== "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml index 2a0e1cab7b..f2dc09de95 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml @@ -94,7 +94,7 @@ Item Label { text: catalog.i18nc("@label", "Print jobs") - color: UM.Theme.getColor("text_scene") + color: "#666666" elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter @@ -108,7 +108,7 @@ Item Label { text: catalog.i18nc("@label", "Total print time") - color: UM.Theme.getColor("text_scene") + color: "#666666" elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter @@ -122,7 +122,7 @@ Item Label { text: catalog.i18nc("@label", "Waiting for") - color: UM.Theme.getColor("text_scene") + color: "#666666" elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml index 0d10fe0e7c..5c5c892dad 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml @@ -18,7 +18,7 @@ Item { Button { id: button; background: Rectangle { - color: UM.Theme.getColor("viewport_background") + color: UM.Theme.getColor("viewport_background"); // TODO: Theme! height: button.height; opacity: button.down || button.hovered ? 1 : 0; radius: Math.round(0.5 * width); diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 00ecd99dbc..2b42778df4 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -298,7 +298,6 @@ "progressbar_background": [245, 245, 245, 255], "progressbar_control": [50, 130, 255, 255], - "progressbar_disabled": [204, 204, 204, 255], "slider_groove": [223, 223, 223, 255], "slider_groove_fill": [8, 7, 63, 255], From bc9831abd1c4af4bd90ebf8681bbfe1e6d10dc45 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 21 Jan 2019 17:10:41 +0100 Subject: [PATCH 21/34] Add color theming to monitor tab Contributes to CL-1212 --- .../resources/qml/CameraButton.qml | 4 +- .../resources/qml/ExpandableCard.qml | 17 ++++--- .../qml/MonitorBuildplateConfiguration.qml | 6 +-- .../resources/qml/MonitorCarousel.qml | 22 ++++---- .../qml/MonitorExtruderConfiguration.qml | 10 ++-- .../resources/qml/MonitorIconExtruder.qml | 1 + .../resources/qml/MonitorPrintJobCard.qml | 18 +++---- .../resources/qml/MonitorPrintJobPreview.qml | 2 +- .../qml/MonitorPrintJobProgressBar.qml | 10 ++-- .../resources/qml/MonitorPrinterCard.qml | 30 +++++------ .../qml/MonitorPrinterConfiguration.qml | 2 +- .../resources/qml/MonitorPrinterPill.qml | 4 +- .../resources/qml/MonitorQueue.qml | 14 ++--- .../resources/qml/MonitorStage.qml | 21 +------- .../resources/qml/PrintJobContextMenu.qml | 8 +-- .../resources/qml/PrintJobContextMenuItem.qml | 4 +- resources/themes/cura-dark/theme.json | 51 ++++++++++++------- resources/themes/cura-light/theme.json | 51 ++++++++++++------- 18 files changed, 144 insertions(+), 131 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml index 6f054f9c19..4f90d31f0b 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/CameraButton.qml @@ -10,7 +10,7 @@ import Cura 1.0 as Cura Rectangle { id: base property var iconSource: null; - color: "#0a0850" // TODO: Theme! + color: UM.Theme.getColor("monitor_icon_primary") height: width; radius: Math.round(0.5 * width); width: 24 * screenScaleFactor; @@ -22,7 +22,7 @@ Rectangle { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter; } - color: UM.Theme.getColor("primary_text"); + color: UM.Theme.getColor("monitor_icon_accent"); height: width; source: iconSource; width: Math.round(parent.width / 2); diff --git a/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml b/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml index d4c123652d..c839e52892 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ExpandableCard.qml @@ -6,10 +6,11 @@ import QtQuick.Controls 2.0 import UM 1.3 as UM import Cura 1.0 as Cura -// TODO: Theme & documentation! -// The expandable component has 3 major sub components: -// * The headerItem Always visible and should hold some info about what happens if the component is expanded -// * The popupItem The content that needs to be shown if the component is expanded. +/** + * The expandable component has 3 major sub components: + * - The headerItem Always visible and should hold some info about what happens if the component is expanded + * - The popupItem The content that needs to be shown if the component is expanded. + */ Item { id: base @@ -17,10 +18,10 @@ Item property bool expanded: false property bool enabled: true property var borderWidth: 1 - property color borderColor: "#CCCCCC" - property color headerBackgroundColor: "white" - property color headerHoverColor: "#e8f2fc" - property color drawerBackgroundColor: "white" + property color borderColor: UM.Theme.getColor("monitor_card_border") + property color headerBackgroundColor: UM.Theme.getColor("monitor_icon_accent") + property color headerHoverColor: UM.Theme.getColor("monitor_card_hover") + property color drawerBackgroundColor: UM.Theme.getColor("monitor_icon_accent") property alias headerItem: header.children property alias drawerItem: drawer.children diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml index 192a5a7f76..d1a0c207c5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorBuildplateConfiguration.qml @@ -41,7 +41,7 @@ Item anchors.centerIn: parent height: parent.height width: height - color: buildplateIcon.visible > 0 ? "transparent" : "#eeeeee" // TODO: Theme! + color: buildplateIcon.visible > 0 ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") radius: Math.floor(height / 2) } @@ -49,7 +49,7 @@ Item { id: buildplateIcon anchors.centerIn: parent - color: "#0a0850" // TODO: Theme! (Standard purple) + color: UM.Theme.getColor("monitor_icon_primary") height: parent.height source: "../svg/icons/buildplate.svg" width: height @@ -60,7 +60,7 @@ Item Label { id: buildplateLabel - color: "#191919" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular text: buildplate ? buildplate : "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml index de24ee5a8c..0d7a177dd3 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorCarousel.qml @@ -49,12 +49,12 @@ Item GradientStop { position: 0.0 - color: "#fff6f6f6" // TODO: Theme! + color: UM.Theme.getColor("monitor_stage_background") } GradientStop { position: 1.0 - color: "#66f6f6f6" // TODO: Theme! + color: UM.Theme.getColor("monitor_stage_background_fade") } } } @@ -82,9 +82,9 @@ Item onClicked: navigateTo(currentIndex - 1) background: Rectangle { - color: leftButton.hovered ? "#e8f2fc" : "#ffffff" // TODO: Theme! + color: leftButton.hovered ? UM.Theme.getColor("monitor_card_hover") : UM.Theme.getColor("monitor_card_background") border.width: 1 * screenScaleFactor // TODO: Theme! - border.color: "#cccccc" // TODO: Theme! + border.color: UM.Theme.getColor("monitor_card_border") radius: 2 * screenScaleFactor // TODO: Theme! } contentItem: Item @@ -97,7 +97,7 @@ Item height: width // TODO: Theme! sourceSize.width: width // TODO: Theme! sourceSize.height: width // TODO: Theme! - color: "#152950" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") source: UM.Theme.getIcon("arrow_left") } } @@ -161,9 +161,9 @@ Item hoverEnabled: true background: Rectangle { - color: rightButton.hovered ? "#e8f2fc" : "#ffffff" // TODO: Theme! + color: rightButton.hovered ? UM.Theme.getColor("monitor_card_hover") : UM.Theme.getColor("monitor_card_background") border.width: 1 * screenScaleFactor // TODO: Theme! - border.color: "#cccccc" // TODO: Theme! + border.color: UM.Theme.getColor("monitor_card_border") radius: 2 * screenScaleFactor // TODO: Theme! } contentItem: Item @@ -176,7 +176,7 @@ Item height: width // TODO: Theme! sourceSize.width: width // TODO: Theme! sourceSize.height: width // TODO: Theme! - color: "#152950" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") source: UM.Theme.getIcon("arrow_right") } } @@ -204,12 +204,12 @@ Item GradientStop { position: 0.0 - color: "#66f6f6f6" // TODO: Theme! + color: UM.Theme.getColor("monitor_stage_background_fade") } GradientStop { position: 1.0 - color: "#fff6f6f6" // TODO: Theme! + color: UM.Theme.getColor("monitor_stage_background") } } } @@ -238,7 +238,7 @@ Item { background: Rectangle { - color: model.index == currentIndex ? "#777777" : "#d8d8d8" // TODO: Theme! + color: model.index == currentIndex ? UM.Theme.getColor("monitor_carousel_dot_current") : UM.Theme.getColor("monitor_carousel_dot") radius: Math.floor(width / 2) width: 12 * screenScaleFactor // TODO: Theme! height: width // TODO: Theme! diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml index 17c0fa8651..4079f23b0a 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorExtruderConfiguration.qml @@ -36,7 +36,7 @@ Item MonitorIconExtruder { id: extruderIcon - color: "#eeeeee" // TODO: Theme! + color: UM.Theme.getColor("monitor_skeleton_loading") position: 0 } @@ -48,7 +48,7 @@ Item left: extruderIcon.right leftMargin: 12 * screenScaleFactor // TODO: Theme! } - color: materialLabel.visible > 0 ? "transparent" : "#eeeeee" // TODO: Theme! + color: materialLabel.visible > 0 ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") height: 18 * screenScaleFactor // TODO: Theme! width: Math.max(materialLabel.contentWidth, 60 * screenScaleFactor) // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! @@ -57,7 +57,7 @@ Item { id: materialLabel - color: "#191919" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular text: "" @@ -77,7 +77,7 @@ Item left: materialLabelWrapper.left bottom: parent.bottom } - color: printCoreLabel.visible > 0 ? "transparent" : "#eeeeee" // TODO: Theme! + color: printCoreLabel.visible > 0 ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") height: 18 * screenScaleFactor // TODO: Theme! width: Math.max(printCoreLabel.contentWidth, 36 * screenScaleFactor) // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! @@ -86,7 +86,7 @@ Item { id: printCoreLabel - color: "#191919" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("default_bold") // 12pt, bold text: "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml index f7d123ada7..c3e78317c5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml @@ -39,6 +39,7 @@ Item { id: positionLabel font: UM.Theme.getFont("small") + color: UM.Theme.getColor("monitor_text_primary") height: Math.round(size / 2) horizontalAlignment: Text.AlignHCenter text: position + 1 diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index f2b9c3cff7..ab3668a5e4 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -27,7 +27,7 @@ Item ExpandableCard { enabled: printJob != null - borderColor: printJob.configurationChanges.length !== 0 ? "#f5a623" : "#CCCCCC" // TODO: Theme! + borderColor: printJob && printJob.configurationChanges.length !== 0 ? UM.Theme.getColor("warning") : UM.Theme.getColor("monitor_card_border") headerItem: Row { height: 48 * screenScaleFactor // TODO: Theme! @@ -49,7 +49,7 @@ Item width: 216 * screenScaleFactor // TODO: Theme! (Should match column size) Rectangle { - color: "#eeeeee" + color: UM.Theme.getColor("monitor_skeleton_loading") width: Math.round(parent.width / 2) height: parent.height visible: !printJob @@ -57,7 +57,7 @@ Item Label { text: printJob && printJob.name ? printJob.name : "" - color: "#374355" + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob @@ -75,7 +75,7 @@ Item width: 216 * screenScaleFactor // TODO: Theme! (Should match column size) Rectangle { - color: "#eeeeee" + color: UM.Theme.getColor("monitor_skeleton_loading") width: Math.round(parent.width / 3) height: parent.height visible: !printJob @@ -83,7 +83,7 @@ Item Label { text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : "" - color: "#374355" + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular visible: printJob @@ -102,7 +102,7 @@ Item Rectangle { - color: "#eeeeee" + color: UM.Theme.getColor("monitor_skeleton_loading") width: 72 * screenScaleFactor // TODO: Theme! height: parent.height visible: !printJob @@ -112,7 +112,7 @@ Item { id: printerAssignmentLabel anchors.verticalCenter: parent.verticalCenter - color: "#374355" + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular text: { @@ -176,7 +176,7 @@ Item { id: printerConfiguration anchors.verticalCenter: parent.verticalCenter - buildplate: "Glass" + buildplate: "Glass" // TODO: I18N configurations: [ base.printJob.configuration.extruderConfigurations[0], @@ -186,7 +186,7 @@ Item } Label { text: printJob && printJob.owner ? printJob.owner : "" - color: "#374355" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.top: printerConfiguration.top diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index d0bad63258..a392571757 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -19,7 +19,7 @@ Item Rectangle { anchors.fill: parent - color: printJob ? "transparent" : "#eeeeee" // TODO: Theme! + color: printJob ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") radius: 8 // TODO: Theme! Image { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml index d5d4705a36..2ba70268b2 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobProgressBar.qml @@ -34,15 +34,15 @@ Item { background: Rectangle { - color: "#f5f5f5" // TODO: Theme! - implicitHeight: visible ? 8 * screenScaleFactor : 0 // TODO: Theme! + color: UM.Theme.getColor("monitor_progress_bar_empty") + implicitHeight: visible ? 12 * screenScaleFactor : 0 // TODO: Theme! implicitWidth: 180 * screenScaleFactor // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! } progress: Rectangle { id: progressItem; - color: printJob && printJob.isActive ? "#3282ff" : "#CCCCCC" // TODO: Theme! + color: printJob && printJob.isActive ? UM.Theme.getColor("monitor_progress_bar_fill") : UM.Theme.getColor("monitor_progress_bar_deactive") radius: 2 * screenScaleFactor // TODO: Theme! } } @@ -56,7 +56,7 @@ Item leftMargin: 18 * screenScaleFactor // TODO: Theme! } text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%" - color: printJob && printJob.isActive ? "#374355" : "#babac1" // TODO: Theme! + color: printJob && printJob.isActive ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled") width: contentWidth font: UM.Theme.getFont("medium") // 14pt, regular @@ -72,7 +72,7 @@ Item left: percentLabel.right leftMargin: 18 * screenScaleFactor // TODO: Theme! } - color: "#374355" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") font: UM.Theme.getFont("medium") // 14pt, regular text: { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index facfaaaaaf..93f9dca76d 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -37,10 +37,10 @@ Item { id: background anchors.fill: parent - color: "#FFFFFF" // TODO: Theme! + color: UM.Theme.getColor("monitor_card_background") border { - color: "#CCCCCC" // TODO: Theme! + color: UM.Theme.getColor("monitor_card_border") width: borderSize // TODO: Remove once themed } radius: 2 * screenScaleFactor // TODO: Theme! @@ -69,7 +69,7 @@ Item id: printerImage width: 108 * screenScaleFactor // TODO: Theme! height: 108 * screenScaleFactor // TODO: Theme! - color: printer ? "transparent" : "#eeeeee" // TODO: Theme! + color: printer ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") radius: 8 // TODO: Theme! Image { @@ -94,7 +94,7 @@ Item { id: printerNameLabel // color: "#414054" // TODO: Theme! - color: printer ? "transparent" : "#eeeeee" // TODO: Theme! + color: printer ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") height: 18 * screenScaleFactor // TODO: Theme! width: parent.width radius: 2 * screenScaleFactor // TODO: Theme! @@ -102,7 +102,7 @@ Item Label { text: printer && printer.name ? printer.name : "" - color: "#414054" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("large") // 16pt, bold width: parent.width @@ -116,7 +116,7 @@ Item Rectangle { - color: "#eeeeee" // TODO: Theme! + color: UM.Theme.getColor("monitor_skeleton_loading") height: 18 * screenScaleFactor // TODO: Theme! radius: 2 * screenScaleFactor // TODO: Theme! visible: !printer @@ -220,7 +220,7 @@ Item } border { - color: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 ? "#f5a623" : "transparent" // TODO: Theme! + color: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 ? UM.Theme.getColor("warning") : "transparent" // TODO: Theme! width: borderSize // TODO: Remove once themed } color: "transparent" // TODO: Theme! @@ -246,7 +246,7 @@ Item { verticalCenter: parent.verticalCenter } - color: printer ? "#414054" : "#aaaaaa" // TODO: Theme! + color: printer ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled") font: UM.Theme.getFont("large_bold") // 16pt, bold text: { if (!printer) { @@ -299,7 +299,7 @@ Item Label { id: printerJobNameLabel - color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? "#414054" : "#babac1" // TODO: Theme! + color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled") elide: Text.ElideRight font: UM.Theme.getFont("large") // 16pt, bold text: printer && printer.activePrintJob ? printer.activePrintJob.name : "Untitled" // TODO: I18N @@ -319,7 +319,7 @@ Item topMargin: 6 * screenScaleFactor // TODO: Theme! left: printerJobNameLabel.left } - color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? "#53657d" : "#babac1" // TODO: Theme! + color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled") elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular text: printer && printer.activePrintJob ? printer.activePrintJob.owner : "Anonymous" // TODO: I18N @@ -348,7 +348,7 @@ Item verticalCenter: parent.verticalCenter } font: UM.Theme.getFont("default") - text: "Requires configuration changes" + text: "Requires configuration changes" // TODO: I18N visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible // FIXED-LINE-HEIGHT: @@ -368,13 +368,13 @@ Item } background: Rectangle { - color: "#d8d8d8" // TODO: Theme! + color: UM.Theme.getColor("monitor_secondary_button_shadow") radius: 2 * screenScaleFactor // Todo: Theme! Rectangle { anchors.fill: parent anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme! - color: detailsButton.hovered ? "#e4e4e4" : "#f0f0f0" // TODO: Theme! + color: detailsButton.hovered ? UM.Theme.getColor("monitor_secondary_button_hover") : UM.Theme.getColor("monitor_secondary_button") radius: 2 * screenScaleFactor // Todo: Theme! } } @@ -382,9 +382,9 @@ Item { anchors.fill: parent anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme! - color: "#1e66d7" // TODO: Theme! + color: UM.Theme.getColor("monitor_secondary_button_text") font: UM.Theme.getFont("medium") // 14pt, regular - text: "Details" // TODO: I18NC! + text: catalog.i18nc("@action:button","Details"); verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter height: 18 * screenScaleFactor // TODO: Theme! diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml index debc8b7959..dbe085e18e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterConfiguration.qml @@ -37,7 +37,7 @@ Item MonitorExtruderConfiguration { - color: modelData && modelData.activeMaterial ? modelData.activeMaterial.color : "#eeeeee" // TODO: Theme! + color: modelData && modelData.activeMaterial ? modelData.activeMaterial.color : UM.Theme.getColor("monitor_skeleton_loading") material: modelData && modelData.activeMaterial ? modelData.activeMaterial.name : "" position: modelData && typeof(modelData.position) === "number" ? modelData.position : -1 // Use negative one to create empty extruder number printCore: modelData ? modelData.hotendID : "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml index 2408089e1e..2aeecd5a92 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterPill.qml @@ -32,14 +32,14 @@ Item Rectangle { id: background anchors.fill: parent - color: printerNameLabel.visible ? "#e4e4f2" : "#eeeeee"// TODO: Theme! + color: printerNameLabel.visible ? UM.Theme.getColor("monitor_printer_family_tag") : UM.Theme.getColor("monitor_skeleton_loading") radius: 2 * screenScaleFactor // TODO: Theme! } Label { id: printerNameLabel anchors.centerIn: parent - color: "#535369" // TODO: Theme! + color: UM.Theme.getColor("monitor_text_primary") text: tagText font.pointSize: 10 // TODO: Theme! visible: text !== "" diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml index f2dc09de95..c9996849fb 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml @@ -22,7 +22,7 @@ Item left: queuedPrintJobs.left top: parent.top } - color: UM.Theme.getColor("text") + color: UM.Theme.getColor("monitor_text_primary") font: UM.Theme.getFont("large") text: catalog.i18nc("@label", "Queued") } @@ -42,7 +42,7 @@ Item { id: externalLinkIcon anchors.verticalCenter: manageQueueLabel.verticalCenter - color: UM.Theme.getColor("text_link") + color: UM.Theme.getColor("monitor_text_link") source: UM.Theme.getIcon("external_link") width: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!) height: 16 * screenScaleFactor // TODO: Theme! (Y U NO USE 18 LIKE ALL OTHER ICONS?!) @@ -56,9 +56,9 @@ Item leftMargin: 6 * screenScaleFactor // TODO: Theme! verticalCenter: externalLinkIcon.verticalCenter } - color: UM.Theme.getColor("text_link") + color: UM.Theme.getColor("monitor_text_link") font: UM.Theme.getFont("default") // 12pt, regular - linkColor: UM.Theme.getColor("text_link") + linkColor: UM.Theme.getColor("monitor_text_link") text: catalog.i18nc("@label link to connect manager", "Manage queue in Cura Connect") renderType: Text.NativeRendering } @@ -94,7 +94,7 @@ Item Label { text: catalog.i18nc("@label", "Print jobs") - color: "#666666" + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter @@ -108,7 +108,7 @@ Item Label { text: catalog.i18nc("@label", "Total print time") - color: "#666666" + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter @@ -122,7 +122,7 @@ Item Label { text: catalog.i18nc("@label", "Waiting for") - color: "#666666" + color: UM.Theme.getColor("monitor_text_primary") elide: Text.ElideRight font: UM.Theme.getFont("medium") // 14pt, regular anchors.verticalCenter: parent.verticalCenter diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml index 8723e6f46e..59cbda7172 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml @@ -11,7 +11,7 @@ import QtGraphicalEffects 1.0 // This is the root component for the monitor stage. Component { - Item + Rectangle { id: monitorFrame @@ -24,6 +24,7 @@ Component } } width: maximumWidth + color: UM.Theme.getColor("monitor_stage_background") // Enable keyboard navigation. NOTE: This is done here so that we can also potentially // forward to the queue items in the future. (Deleting selected print job, etc.) @@ -36,24 +37,6 @@ Component name: "cura" } - LinearGradient - { - anchors.fill: parent - gradient: Gradient - { - GradientStop - { - position: 0.0 - color: "#f6f6f6" // TODO: Theme! - } - GradientStop - { - position: 1.0 - color: "#ffffff" // TODO: Theme! - } - } - } - Item { id: printers diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml index 5c5c892dad..59d7b85862 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml @@ -18,14 +18,14 @@ Item { Button { id: button; background: Rectangle { - color: UM.Theme.getColor("viewport_background"); // TODO: Theme! + color: UM.Theme.getColor("monitor_card_hover"); // TODO: Theme! height: button.height; opacity: button.down || button.hovered ? 1 : 0; radius: Math.round(0.5 * width); width: button.width; } contentItem: Label { - color: UM.Theme.getColor("monitor_context_menu_dots"); + color: UM.Theme.getColor("monitor_text_primary") font.pixelSize: 32 * screenScaleFactor; horizontalAlignment: Text.AlignHCenter; text: button.text; @@ -74,7 +74,7 @@ Item { right: bloop.right; rightMargin: 24 * screenScaleFactor; } - color: UM.Theme.getColor("monitor_context_menu_background"); + color: UM.Theme.getColor("monitor_context_menu") height: 14 * screenScaleFactor; transform: Rotation { angle: 45; @@ -91,7 +91,7 @@ Item { top: parent.top; topMargin: 8 * screenScaleFactor; // Because of the shadow + point } - color: UM.Theme.getColor("monitor_context_menu_background"); + color: UM.Theme.getColor("monitor_context_menu"); width: parent.width; } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml index eea8fac3e1..67c82db320 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml @@ -9,10 +9,10 @@ import UM 1.3 as UM Button { background: Rectangle { opacity: parent.down || parent.hovered ? 1 : 0; - color: UM.Theme.getColor("monitor_context_menu_highlight"); + color: UM.Theme.getColor("monitor_context_menu_hover") } contentItem: Label { - color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_inactive"); + color: enabled ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled"); text: parent.text horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter; diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 6b29073475..56369b9508 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -215,24 +215,39 @@ "toolbox_header_button_text_inactive": [128, 128, 128, 255], "toolbox_header_button_text_hovered": [255, 255, 255, 255], - "monitor_card_background_inactive": [43, 48, 52, 255], - "monitor_card_background": [43, 48, 52, 255], - "monitor_context_menu_background": [80, 84, 87, 255], - "monitor_context_menu_dots": [0, 167, 233, 255], - "monitor_context_menu_highlight": [0, 167, 233, 255], - "monitor_image_overlay": [255, 255, 255, 255], - "monitor_lining_heavy": [255, 255, 255, 255], - "monitor_lining_light": [102, 102, 102, 255], - "monitor_pill_background": [102, 102, 102, 255], + "monitor_printer_family_tag": [86, 86, 106, 255], + "monitor_text_primary": [229, 229, 229, 255], + "monitor_text_disabled": [102, 102, 102, 255], + "monitor_text_link": [103, 160, 252, 255], + "monitor_icon_primary": [229, 229, 229, 255], + "monitor_icon_accent": [51, 53, 54, 255], + + "monitor_secondary_button_hover": [80, 80, 80, 255], + "monitor_secondary_button": [92, 92, 92, 255], + "monitor_secondary_button_text": [250, 250, 250, 255], + "monitor_secondary_button_shadow": [74, 74, 74, 255], + + "monitor_card_border": [102, 102, 102, 255], + "monitor_card_background": [51, 53, 54, 255], + "monitor_card_hover": [84, 89, 95, 255], + + "monitor_stage_background": [30, 36, 39, 255], + "monitor_stage_background_fade": [30, 36, 39, 102], + + "monitor_progress_bar_fill": [50, 130, 255, 255], + "monitor_progress_bar_deactive": [102, 102, 102, 255], + "monitor_progress_bar_empty": [67, 67, 67, 255], + + "monitor_tooltips": [25, 25, 25, 255], + "monitor_context_menu": [67, 67, 67, 255], + "monitor_context_menu_hover": [30, 102, 215, 255], + + "monitor_skeleton_loading": [102, 102, 102, 255], "monitor_placeholder_image": [102, 102, 102, 255], - "monitor_printer_icon": [255, 255, 255, 255], - "monitor_progress_background_text": [102, 102, 102, 255], - "monitor_progress_background": [80, 84, 87, 255], - "monitor_progress_fill_inactive": [216, 216, 216, 255], - "monitor_progress_fill_text": [0, 0, 0, 255], - "monitor_progress_fill": [216, 216, 216, 255], - "monotir_printer_icon_inactive": [154, 154, 154, 255], - "monitor_skeleton_fill": [31, 36, 39, 255], - "monitor_skeleton_fill_dark": [31, 36, 39, 255] + "monitor_image_overlay": [0, 0, 0, 255], + "monitor_shadow": [4, 10, 13, 255], + + "monitor_carousel_dot": [119, 119, 119, 255], + "monitor_carousel_dot_current": [216, 216, 216, 255] } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2b42778df4..607711c2f3 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -399,27 +399,40 @@ "favorites_header_text_hover": [31, 36, 39, 255], "favorites_row_selected": [196, 239, 255, 255], - "monitor_card_background_inactive": [240, 240, 240, 255], + "monitor_printer_family_tag": [228, 228, 242, 255], + "monitor_text_primary": [65, 64, 84, 255], + "monitor_text_disabled": [238, 238, 238, 255], + "monitor_text_link": [50, 130, 255, 255], + "monitor_icon_primary": [10, 8, 80, 255], + "monitor_icon_accent": [255, 255, 255, 255], + + "monitor_secondary_button_hover": [228, 228, 228, 255], + "monitor_secondary_button": [240, 240, 240, 255], + "monitor_secondary_button_text": [30, 102, 215, 255], + "monitor_secondary_button_shadow": [216, 216, 216, 255], + + "monitor_card_border": [192, 193, 194, 255], "monitor_card_background": [255, 255, 255, 255], - "monitor_context_menu_background": [255, 255, 255, 255], - "monitor_context_menu_dots": [154, 154, 154, 255], - "monitor_context_menu_highlight": [245, 245, 245, 255], - "monitor_image_overlay": [0, 0, 0, 255], - "monitor_lining_heavy": [0, 0, 0, 255], - "monitor_lining_light": [230, 230, 230, 255], - "monitor_pill_background": [245, 245, 245, 255], + "monitor_card_hover": [232, 242, 252, 255], + + "monitor_stage_background": [246, 246, 246, 255], + "monitor_stage_background_fade": [246, 246, 246, 102], + + "monitor_progress_bar_fill": [50, 130, 255, 255], + "monitor_progress_bar_deactive": [192, 193, 194, 255], + "monitor_progress_bar_empty": [245, 245, 245, 255], + + "monitor_tooltips": [25, 25, 25, 255], + "monitor_context_menu": [255, 255, 255, 255], + "monitor_context_menu_hover": [245, 245, 245, 255], + + "monitor_skeleton_loading": [238, 238, 238, 255], "monitor_placeholder_image": [230, 230, 230, 255], - "monitor_printer_icon_inactive": [154, 154, 154, 255], - "monitor_printer_icon": [50, 130, 255, 255], - "monitor_progress_background_text": [0,0,0,255], - "monitor_progress_background": [245, 245, 245, 255], - "monitor_progress_fill_inactive": [154, 154, 154, 255], - "monitor_progress_fill_text": [255,255,255,255], - "monitor_progress_fill": [50, 130, 255, 255], - "monitor_shadow": [0, 0, 0, 63], - "monitor_skeleton_fill": [245, 245, 245, 255], - "monitor_skeleton_fill_dark": [216, 216, 216, 255], - "monitor_text_inactive": [154, 154, 154, 255] + "monitor_image_overlay": [0, 0, 0, 255], + "monitor_shadow": [220, 220, 220, 255], + + "monitor_carousel_dot": [216, 216, 216, 255], + "monitor_carousel_dot_current": [119, 119, 119, 255] }, "sizes": { From e212bbfb01b6caa8d20d45c854c809d863a3839e Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 21 Jan 2019 17:13:34 +0100 Subject: [PATCH 22/34] Add some translations which were forgotten --- .../resources/qml/MonitorPrintJobCard.qml | 2 +- .../UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index ab3668a5e4..34167c6988 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -176,7 +176,7 @@ Item { id: printerConfiguration anchors.verticalCenter: parent.verticalCenter - buildplate: "Glass" // TODO: I18N + buildplate: catalog.i18nc("@label", "Glass") configurations: [ base.printJob.configuration.extruderConfigurations[0], diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 93f9dca76d..28d01a4dc4 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -302,7 +302,7 @@ Item color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled") elide: Text.ElideRight font: UM.Theme.getFont("large") // 16pt, bold - text: printer && printer.activePrintJob ? printer.activePrintJob.name : "Untitled" // TODO: I18N + text: printer && printer.activePrintJob ? printer.activePrintJob.name : catalog.i18nc("@label", "Untitled") width: parent.width // FIXED-LINE-HEIGHT: @@ -322,7 +322,7 @@ Item color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled") elide: Text.ElideRight font: UM.Theme.getFont("default") // 12pt, regular - text: printer && printer.activePrintJob ? printer.activePrintJob.owner : "Anonymous" // TODO: I18N + text: printer && printer.activePrintJob ? printer.activePrintJob.owner : catalog.i18nc("@label", "Anonymous") width: parent.width // FIXED-LINE-HEIGHT: @@ -348,7 +348,7 @@ Item verticalCenter: parent.verticalCenter } font: UM.Theme.getFont("default") - text: "Requires configuration changes" // TODO: I18N + text: catalog.i18nc("@label:status", "Requires configuration changes") visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible // FIXED-LINE-HEIGHT: From 76240bb458dcdfd0aef2c4b30b0ade01ecec607b Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 22 Jan 2019 11:13:27 +0100 Subject: [PATCH 23/34] Remove unused comment Contributes to CL-1212 --- plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 28d01a4dc4..f16be094a3 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -93,7 +93,6 @@ Item Rectangle { id: printerNameLabel - // color: "#414054" // TODO: Theme! color: printer ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading") height: 18 * screenScaleFactor // TODO: Theme! width: parent.width From 283de789c2d3fd79c714d4e81f60bfee975db2cb Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 22 Jan 2019 12:00:50 +0100 Subject: [PATCH 24/34] Remove comment Contributes to CL-1212 --- .../UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml index 59d7b85862..41cee9c30a 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml @@ -18,7 +18,7 @@ Item { Button { id: button; background: Rectangle { - color: UM.Theme.getColor("monitor_card_hover"); // TODO: Theme! + color: UM.Theme.getColor("monitor_card_hover") height: button.height; opacity: button.down || button.hovered ? 1 : 0; radius: Math.round(0.5 * width); From 551111bd60fcd7d0a199fd2390d5dd7017cd6bb5 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 23 Jan 2019 11:24:28 +0100 Subject: [PATCH 25/34] Close the configuration panel when the user syncs with a configuration --- resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 058c1ff4c2..296ae62366 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -218,7 +218,8 @@ Button { if(isValidMaterial) { - Cura.MachineManager.applyRemoteConfiguration(configuration); + toggleContent() + Cura.MachineManager.applyRemoteConfiguration(configuration) } } } From 1097f16011375270be1ca44d10b1ef0af7ffadcc Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 23 Jan 2019 12:08:20 +0100 Subject: [PATCH 26/34] Add theme (and dark mode) Contributes to CL-1165 --- plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml | 4 ++-- resources/themes/cura-light/theme.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml index 3a6800e999..21000b8bff 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorInfoBlurb.qml @@ -24,7 +24,7 @@ Item direction: "up" // Use dark grey for info blurbs and white for context menus - color: "#191919" // TODO: Theme! + color: UM.Theme.getColor("monitor_tooltip") contentItem: Item { @@ -38,7 +38,7 @@ Item text: "" wrapMode: Text.WordWrap width: 240 * screenScaleFactor // TODO: Theme! - color: "white" // TODO: Theme! + color: UM.Theme.getColor("monitor_tooltip_text") font: UM.Theme.getFont("default") } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 607711c2f3..b12385c962 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -422,7 +422,8 @@ "monitor_progress_bar_deactive": [192, 193, 194, 255], "monitor_progress_bar_empty": [245, 245, 245, 255], - "monitor_tooltips": [25, 25, 25, 255], + "monitor_tooltip": [25, 25, 25, 255], + "monitor_tooltip_text": [255, 255, 255, 255], "monitor_context_menu": [255, 255, 255, 255], "monitor_context_menu_hover": [245, 245, 245, 255], From e204696b618c9961db9f46b3de3518292e4782b0 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 23 Jan 2019 12:10:06 +0100 Subject: [PATCH 27/34] Add dark theme Contributes to CL-1165 --- resources/themes/cura-dark/theme.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index 56369b9508..6211320f10 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -238,7 +238,8 @@ "monitor_progress_bar_deactive": [102, 102, 102, 255], "monitor_progress_bar_empty": [67, 67, 67, 255], - "monitor_tooltips": [25, 25, 25, 255], + "monitor_tooltip": [25, 25, 25, 255], + "monitor_tooltip_text": [229, 229, 229, 255], "monitor_context_menu": [67, 67, 67, 255], "monitor_context_menu_hover": [30, 102, 215, 255], From e19323d38b3187251eacbd78b3fb2419c02bfff6 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 23 Jan 2019 14:47:59 +0100 Subject: [PATCH 28/34] Fix mising theme key --- .../resources/qml/MonitorContextMenuButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml index 5cd3404870..3e4f1839b6 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenuButton.qml @@ -18,7 +18,7 @@ Button width: base.width } contentItem: Label { - color: UM.Theme.getColor("monitor_context_menu_dots") + color: UM.Theme.getColor("monitor_text_primary") font.pixelSize: 32 * screenScaleFactor horizontalAlignment: Text.AlignHCenter text: base.text From f5379dda55f50af4026d8e13824e93ebaffb6c66 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 23 Jan 2019 14:48:38 +0100 Subject: [PATCH 29/34] Fix improperly removed method --- plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index b48f9380e1..052dd0b979 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -13,6 +13,7 @@ from UM.FileHandler.WriteFileJob import WriteFileJob # To call the file writer from UM.Logger import Logger from UM.Settings.ContainerRegistry import ContainerRegistry from UM.i18n import i18nCatalog +from UM.Qt.Duration import Duration, DurationFormat from UM.Message import Message from UM.Scene.SceneNode import SceneNode # For typing. @@ -346,6 +347,10 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): def getDateCompleted(self, time_remaining: int) -> str: return formatDateCompleted(time_remaining) + @pyqtSlot(int, result = str) + def formatDuration(self, seconds: int) -> str: + return Duration(seconds).getDisplayString(DurationFormat.Format.Short) + @pyqtSlot(str) def sendJobToTop(self, print_job_uuid: str) -> None: # This function is part of the output device (and not of the printjob output model) as this type of operation From 4438f0d9a3cc3ea69d88befdefec65c29c8ad597 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 23 Jan 2019 15:34:28 +0100 Subject: [PATCH 30/34] Add dark mode to new context menu Contributes to CL-1212 --- .../resources/qml/MonitorContextMenu.qml | 2 +- .../resources/qml/PrintJobContextMenu.qml | 274 ------------------ 2 files changed, 1 insertion(+), 275 deletions(-) delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml index 00b575173e..07eaa4f051 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml @@ -25,7 +25,7 @@ Item direction: "up" // Use dark grey for info blurbs and white for context menus - color: "#ffffff" // TODO: Theme! + color: UM.Theme.getColor("monitor_context_menu") contentItem: Item { diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml deleted file mode 100644 index 41cee9c30a..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Dialogs 1.1 -import QtGraphicalEffects 1.0 -import UM 1.3 as UM - -Item { - id: root; - property var printJob: null; - property var started: isStarted(printJob); - property var assigned: isAssigned(printJob); - property var enabled: true - - Button { - id: button; - background: Rectangle { - color: UM.Theme.getColor("monitor_card_hover") - height: button.height; - opacity: button.down || button.hovered ? 1 : 0; - radius: Math.round(0.5 * width); - width: button.width; - } - contentItem: Label { - color: UM.Theme.getColor("monitor_text_primary") - font.pixelSize: 32 * screenScaleFactor; - horizontalAlignment: Text.AlignHCenter; - text: button.text; - verticalAlignment: Text.AlignVCenter; - } - height: width; - hoverEnabled: base.enabled - onClicked: base.enabled ? parent.switchPopupState() : {} - text: "\u22EE"; //Unicode; Three stacked points. - visible: { - if (!printJob) { - return false; - } - var states = ["queued", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"]; - return states.indexOf(printJob.state) !== -1; - } - width: 36 * screenScaleFactor; // TODO: Theme! - } - - Popup { - id: popup; - background: Item { - anchors.fill: parent; - - DropShadow { - anchors.fill: pointedRectangle; - color: UM.Theme.getColor("monitor_shadow"); - radius: UM.Theme.getSize("monitor_shadow_radius").width; - source: pointedRectangle; - transparentBorder: true; - verticalOffset: 2 * screenScaleFactor; - } - - Item { - id: pointedRectangle; - anchors { - horizontalCenter: parent.horizontalCenter; - verticalCenter: parent.verticalCenter; - } - height: parent.height - 10 * screenScaleFactor; // Because of the shadow - width: parent.width - 10 * screenScaleFactor; // Because of the shadow - - Rectangle { - id: point; - anchors { - right: bloop.right; - rightMargin: 24 * screenScaleFactor; - } - color: UM.Theme.getColor("monitor_context_menu") - height: 14 * screenScaleFactor; - transform: Rotation { - angle: 45; - } - width: 14 * screenScaleFactor; - y: 1 * screenScaleFactor; - } - - Rectangle { - id: bloop; - anchors { - bottom: parent.bottom; - bottomMargin: 8 * screenScaleFactor; // Because of the shadow - top: parent.top; - topMargin: 8 * screenScaleFactor; // Because of the shadow + point - } - color: UM.Theme.getColor("monitor_context_menu"); - width: parent.width; - } - } - } - clip: true; - closePolicy: Popup.CloseOnPressOutside; - contentItem: Column { - id: popupOptions; - anchors { - top: parent.top; - topMargin: UM.Theme.getSize("default_margin").height + 10 * screenScaleFactor; // Account for the point of the box - } - height: childrenRect.height + spacing * popupOptions.children.length + UM.Theme.getSize("default_margin").height; - spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2); - width: parent.width; - - PrintJobContextMenuItem { - onClicked: { - sendToTopConfirmationDialog.visible = true; - popup.close(); - } - text: catalog.i18nc("@label", "Move to top"); - visible: { - if (printJob && printJob.state == "queued" && !assigned) { - if (OutputDevice && OutputDevice.queuedPrintJobs[0]) { - return OutputDevice.queuedPrintJobs[0].key != printJob.key; - } - } - return false; - } - } - - PrintJobContextMenuItem { - onClicked: { - deleteConfirmationDialog.visible = true; - popup.close(); - } - text: catalog.i18nc("@label", "Delete"); - visible: { - if (!printJob) { - return false; - } - var states = ["queued", "sent_to_printer"]; - return states.indexOf(printJob.state) !== -1; - } - } - - PrintJobContextMenuItem { - enabled: visible && !(printJob.state == "pausing" || printJob.state == "resuming"); - onClicked: { - if (printJob.state == "paused") { - printJob.setState("print"); - popup.close(); - return; - } - if (printJob.state == "printing") { - printJob.setState("pause"); - popup.close(); - return; - } - } - text: { - if (!printJob) { - return ""; - } - switch(printJob.state) { - case "paused": - return catalog.i18nc("@label", "Resume"); - case "pausing": - return catalog.i18nc("@label", "Pausing..."); - case "resuming": - return catalog.i18nc("@label", "Resuming..."); - default: - catalog.i18nc("@label", "Pause"); - } - } - visible: { - if (!printJob) { - return false; - } - var states = ["printing", "pausing", "paused", "resuming"]; - return states.indexOf(printJob.state) !== -1; - } - } - - PrintJobContextMenuItem { - enabled: visible && printJob.state !== "aborting"; - onClicked: { - abortConfirmationDialog.visible = true; - popup.close(); - } - text: printJob && printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort"); - visible: { - if (!printJob) { - return false; - } - var states = ["pre_print", "printing", "pausing", "paused", "resuming"]; - return states.indexOf(printJob.state) !== -1; - } - } - } - enter: Transition { - NumberAnimation { - duration: 75; - property: "visible"; - } - } - exit: Transition { - NumberAnimation { - duration: 75; - property: "visible"; - } - } - height: contentItem.height + 2 * padding; - onClosed: visible = false; - onOpened: visible = true; - padding: UM.Theme.getSize("monitor_shadow_radius").width; - transformOrigin: Popup.Top; - visible: false; - width: 182 * screenScaleFactor; - x: (button.width - width) + 26 * screenScaleFactor; - y: button.height + 5 * screenScaleFactor; // Because shadow - } - - MessageDialog { - id: sendToTopConfirmationDialog; - Component.onCompleted: visible = false; - icon: StandardIcon.Warning; - onYes: OutputDevice.sendJobToTop(printJob.key); - standardButtons: StandardButton.Yes | StandardButton.No; - text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : ""; - title: catalog.i18nc("@window:title", "Move print job to top"); - } - - MessageDialog { - id: deleteConfirmationDialog; - Component.onCompleted: visible = false; - icon: StandardIcon.Warning; - onYes: OutputDevice.deleteJobFromQueue(printJob.key); - standardButtons: StandardButton.Yes | StandardButton.No; - text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : ""; - title: catalog.i18nc("@window:title", "Delete print job"); - } - - MessageDialog { - id: abortConfirmationDialog; - Component.onCompleted: visible = false; - icon: StandardIcon.Warning; - onYes: printJob.setState("abort"); - standardButtons: StandardButton.Yes | StandardButton.No; - text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : ""; - title: catalog.i18nc("@window:title", "Abort print"); - } - - // Utils - function switchPopupState() { - popup.visible ? popup.close() : popup.open(); - } - function isStarted(job) { - if (!job) { - return false; - } - return ["pre_print", "printing", "pausing", "paused", "resuming", "aborting"].indexOf(job.state) !== -1; - } - function isAssigned(job) { - if (!job) { - return false; - } - return job.assignedPrinter ? true : false; - } - function getMenuLength() { - var visible = 0; - for (var i = 0; i < popupOptions.children.length; i++) { - if (popupOptions.children[i].visible) { - visible++; - } - } - return visible; - } -} From 5d2a9141809d201cc9d0db0a02abef617d2e59be Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 23 Jan 2019 15:54:11 +0100 Subject: [PATCH 31/34] Always show context menu for print jobs Contributes to CL-1175 --- .../resources/qml/MonitorPrintJobCard.qml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index 3a724bb731..eadcc04329 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -217,14 +217,6 @@ Item height: 32 * screenScaleFactor // TODO: Theme! enabled: !cloudConnection onClicked: enabled ? contextMenu.switchPopupState() : {} - visible: - { - if (!printJob) { - return false - } - var states = ["queued", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"] - return states.indexOf(printJob.state) !== -1 - } } MonitorContextMenu From cbed8038e9046a1e65afa695b5aa80a43aad2882 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 23 Jan 2019 17:29:30 +0100 Subject: [PATCH 32/34] Don't say that creating a profile needs to provide a 'new' name It's weird to ask for a new name if the profile is completely new. Made together with a change in Uranium for CURA-6086. --- resources/qml/Preferences/ProfilesPage.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index f23a04d800..52c69b780e 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -173,6 +173,7 @@ Item id: createQualityDialog title: catalog.i18nc("@title:window", "Create Profile") object: "" + explanation: catalog.i18nc("@info", "Please provide a name for this profile.") onAccepted: { base.newQualityNameToSelect = newName; // We want to switch to the new profile once it's created From 673734ee12d554058929b66593eb8bf92bb84e79 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Thu, 24 Jan 2019 09:52:56 +0100 Subject: [PATCH 33/34] Show print job context menu if state == "error" Contributes to CL-1175 --- .../resources/qml/MonitorContextMenu.qml | 4 ++-- .../resources/qml/MonitorPrintJobCard.qml | 8 ++++++++ .../resources/qml/MonitorPrinterCard.qml | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml index 07eaa4f051..771bd4b8cf 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml @@ -53,7 +53,7 @@ Item } text: catalog.i18nc("@label", "Move to top"); visible: { - if (printJob && printJob.state == "queued" && !isAssigned(printJob)) { + if (printJob && (printJob.state == "queued" || printJob.state == "error") && !isAssigned(printJob)) { if (OutputDevice && OutputDevice.queuedPrintJobs[0]) { return OutputDevice.queuedPrintJobs[0].key != printJob.key; } @@ -72,7 +72,7 @@ Item if (!printJob) { return false; } - var states = ["queued", "sent_to_printer"]; + var states = ["queued", "error", "sent_to_printer"]; return states.indexOf(printJob.state) !== -1; } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index eadcc04329..c7588b83bc 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -217,6 +217,14 @@ Item height: 32 * screenScaleFactor // TODO: Theme! enabled: !cloudConnection onClicked: enabled ? contextMenu.switchPopupState() : {} + visible: + { + if (!printJob) { + return false + } + var states = ["queued", "error", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"] + return states.indexOf(printJob.state) !== -1 + } } MonitorContextMenu diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 085bf774b5..e56e22e40f 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -179,7 +179,7 @@ Item if (!printer || !printer.activePrintJob) { return false } - var states = ["queued", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"] + var states = ["queued", "error", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"] return states.indexOf(printer.activePrintJob.state) !== -1 } } From 91dc3713ae6f5a5cab495084b33b6b9556d89fe3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 25 Jan 2019 12:03:01 +0100 Subject: [PATCH 34/34] Initialise idle count properly This is a field so it should always get initialised in the __init__ function. Fixes #5218. --- plugins/USBPrinting/USBPrinterOutputDevice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 19a703e605..32203ffa6c 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -55,6 +55,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._update_thread = Thread(target = self._update, daemon = True) self._last_temperature_request = None # type: Optional[int] + self._firmware_idle_count = 0 self._is_printing = False # A print is being sent.