123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- import QtQuick 2.3
- import QtQuick.Controls 2.0
- import UM 1.5 as UM
- import Cura 1.0 as Cura
- Item
- {
- id: base
-
- property var printer: null
- property var borderSize: 1 * screenScaleFactor
-
-
- property var enabled: true
-
-
- property bool cloudConnection: Cura.MachineManager.activeMachineIsUsingCloudConnection
- width: 834 * screenScaleFactor
- height: childrenRect.height
- Rectangle
- {
- id: background
- anchors.fill: parent
- color: UM.Theme.getColor("monitor_card_background")
- border
- {
- color: UM.Theme.getColor("monitor_card_border")
- width: borderSize
- }
- radius: 2 * screenScaleFactor
- }
-
- Item
- {
- id: printerInfo
- width: parent.width
- height: 144 * screenScaleFactor
- Row
- {
- anchors
- {
- left: parent.left
- leftMargin: 36 * screenScaleFactor
- verticalCenter: parent.verticalCenter
- }
- spacing: UM.Theme.getSize("default_margin").width
- Rectangle
- {
- id: printerImage
- width: 108 * screenScaleFactor
- height: 108 * screenScaleFactor
- color: printer ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading")
- radius: 8
- Image
- {
- anchors.fill: parent
- fillMode: Image.PreserveAspectFit
- source: printer ? "../png/" + printer.type + ".png" : ""
- mipmap: true
- }
- }
- Item
- {
- anchors
- {
- verticalCenter: parent.verticalCenter
- }
- width: 180 * screenScaleFactor
- height: childrenRect.height
- Rectangle
- {
- id: printerNameLabel
- color: printer ? "transparent" : UM.Theme.getColor("monitor_skeleton_loading")
- height: UM.Theme.getSize("default_margin").width
- width: parent.width
- radius: UM.Theme.getSize("default_radius").width
- UM.Label
- {
- text: printer && printer.name ? printer.name : ""
- elide: Text.ElideRight
- font: UM.Theme.getFont("large")
- width: parent.width
- visible: printer
- height: parent.height
- }
- }
- Rectangle
- {
- color: UM.Theme.getColor("monitor_skeleton_loading")
- height: 18 * screenScaleFactor
- radius: UM.Theme.getSize("default_radius").width
- visible: !printer
- width: 48 * screenScaleFactor
- }
- MonitorPrinterPill
- {
- id: printerFamilyPill
- anchors
- {
- top: printerNameLabel.bottom
- topMargin: UM.Theme.getSize("narrow_margin").height
- left: printerNameLabel.left
- }
- text: printer ? printer.type : ""
- }
- Item
- {
- id: managePrinterLink
- anchors
- {
- top: printerFamilyPill.bottom
- topMargin: UM.Theme.getSize("narrow_margin").height
- }
- height: 18 * screenScaleFactor
- width: childrenRect.width
-
- UM.Label
- {
- id: managePrinterText
- anchors.verticalCenter: managePrinterLink.verticalCenter
- color: UM.Theme.getColor("text_link")
- text: catalog.i18nc("@label link to Connect and Cloud interfaces", "Manage printer")
- }
- UM.ColorImage
- {
- id: externalLinkIcon
- anchors
- {
- left: managePrinterText.right
- leftMargin: UM.Theme.getSize("narrow_margin").width
- verticalCenter: managePrinterText.verticalCenter
- }
- color: UM.Theme.getColor("text_link")
- source: UM.Theme.getIcon("LinkExternal")
- width: UM.Theme.getSize("icon").width
- height: UM.Theme.getSize("icon").height
- }
- }
- MouseArea
- {
- anchors.fill: managePrinterLink
- onClicked: OutputDevice.openPrinterControlPanel()
- onEntered: manageQueueText.font.underline = true
- onExited: manageQueueText.font.underline = false
- }
- }
- MonitorPrinterConfiguration
- {
- id: printerConfiguration
- anchors.verticalCenter: parent.verticalCenter
- configurations:
- {
- var configs = []
- if (printer)
- {
- configs = configs.concat(printer.printerConfiguration.extruderConfigurations)
- }
- else
- {
- configs.push(null, null)
- }
- return configs
- }
- height: 72 * screenScaleFactor
- }
- }
- MonitorContextMenuButton
- {
- id: contextMenuButton
- anchors
- {
- right: parent.right
- rightMargin: 12 * screenScaleFactor
- top: parent.top
- topMargin: 12 * screenScaleFactor
- }
- width: 36 * screenScaleFactor
- height: 36 * screenScaleFactor
- enabled: OutputDevice.supportsPrintJobActions
- onClicked: enabled ? contextMenu.switchPopupState() : {}
- visible:
- {
- if(!printer || !printer.activePrintJob)
- {
- return false;
- }
- if(!contextMenu.hasItems)
- {
- return false;
- }
- var states = ["queued", "error", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"]
- return states.indexOf(printer.activePrintJob.state) !== -1
- }
- }
- MonitorContextMenu
- {
- id: contextMenu
- printJob: printer ? printer.activePrintJob : null
- target: contextMenuButton
- }
-
- 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", "Please update your printer's firmware to manage the queue remotely.")
- target: contextMenuButton
- }
- CameraButton
- {
- id: cameraButton
- anchors
- {
- right: parent.right
- rightMargin: 20 * screenScaleFactor
- bottom: parent.bottom
- bottomMargin: 20 * screenScaleFactor
- }
- iconSource: Qt.resolvedUrl("../svg/icons/CameraPhoto.svg")
- enabled: !cloudConnection
- visible: printer
- }
-
-
- 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", "Webcam feeds for cloud printers cannot be viewed from UltiMaker Cura." +
- " Click \"Manage printer\" to visit Ultimaker Digital Factory and view this webcam.")
- target: cameraButton
- }
- }
-
- Rectangle
- {
- anchors
- {
- top: printJobInfo.top
- left: printJobInfo.left
- right: printJobInfo.right
- }
- height: borderSize
- color: background.border.color
- }
-
- Rectangle
- {
- id: printJobInfo
- anchors
- {
- top: printerInfo.bottom
- topMargin: -borderSize * screenScaleFactor
- }
- border
- {
- color: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 ? UM.Theme.getColor("warning") : "transparent"
- width: borderSize
- }
- color: "transparent"
- height: 84 * screenScaleFactor + borderSize
- width: parent.width
- Row
- {
- anchors
- {
- fill: parent
- topMargin: 12 * screenScaleFactor + borderSize
- bottomMargin: 12 * screenScaleFactor
- leftMargin: 36 * screenScaleFactor
- }
- height: childrenRect.height
- spacing: UM.Theme.getSize("default_margin").width
- UM.Label
- {
- id: printerStatus
- anchors
- {
- verticalCenter: parent.verticalCenter
- }
- color: printer ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
- font: UM.Theme.getFont("large_bold")
- text: {
- if (!printer) {
- return catalog.i18nc("@label:status", "Loading...")
- }
- if (printer.state == "disabled")
- {
- return catalog.i18nc("@label:status", "Unavailable")
- }
- if (printer.state == "unreachable")
- {
- return catalog.i18nc("@label:status", "Unreachable")
- }
- if (!printer.activePrintJob && printer.state == "idle")
- {
- return catalog.i18nc("@label:status", "Idle")
- }
- if (!printer.activePrintJob && printer.state == "pre_print")
- {
- return catalog.i18nc("@label:status", "Preparing...")
- }
- if (!printer.activePrintJob && printer.state == "printing")
- {
-
- return catalog.i18nc("@label:status", "Printing")
- }
- return ""
- }
- visible: text !== ""
- }
- Item
- {
- anchors
- {
- verticalCenter: parent.verticalCenter
- }
- width: printerImage.width
- height: 60 * screenScaleFactor
- MonitorPrintJobPreview
- {
- anchors.centerIn: parent
- printJob: printer ? printer.activePrintJob : null
- size: parent.height
- }
- visible: printer && printer.activePrintJob && !printerStatus.visible
- }
- Item
- {
- anchors
- {
- verticalCenter: parent.verticalCenter
- }
- width: 180 * screenScaleFactor
- height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor
- visible: printer && printer.activePrintJob && !printerStatus.visible
- UM.Label
- {
- id: printerJobNameLabel
- color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
- elide: Text.ElideRight
- wrapMode: Text.NoWrap
- font: UM.Theme.getFont("large")
- text: printer && printer.activePrintJob ? printer.activePrintJob.name : catalog.i18nc("@label", "Untitled")
- width: parent.width
- }
- UM.Label
- {
- id: printerJobOwnerLabel
- anchors
- {
- top: printerJobNameLabel.bottom
- topMargin: UM.Theme.getSize("narrow_margin").height
- left: printerJobNameLabel.left
- }
- color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
- elide: Text.ElideRight
- text: printer && printer.activePrintJob ? printer.activePrintJob.owner : catalog.i18nc("@label", "Anonymous")
- width: parent.width
- }
- }
- MonitorPrintJobProgressBar
- {
- anchors
- {
- verticalCenter: parent.verticalCenter
- }
- printJob: printer && printer.activePrintJob
- visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length === 0 && !printerStatus.visible
- }
- UM.Label
- {
- anchors
- {
- verticalCenter: parent.verticalCenter
- }
- text: catalog.i18nc("@label:status", "Requires configuration changes")
- visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible
- }
- }
- Cura.SecondaryButton
- {
- id: detailsButton
- anchors
- {
- verticalCenter: parent.verticalCenter
- right: parent.right
- rightMargin: UM.Theme.getSize("default_margin").width
- }
- text: catalog.i18nc("@action:button", "Details")
- visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible
- onClicked: base.enabled ? overrideConfirmationDialog.open() : {}
- enabled: OutputDevice.supportsPrintJobActions
- }
-
- MouseArea
- {
- id: detailsButtonDisabledButtonArea
- anchors.fill: detailsButton
- hoverEnabled: detailsButton.visible && !detailsButton.enabled
- onEntered: overrideButtonDisabledInfo.open()
- onExited: overrideButtonDisabledInfo.close()
- enabled: !detailsButton.enabled
- }
- MonitorInfoBlurb
- {
- id: overrideButtonDisabledInfo
- text: catalog.i18nc("@info", "Please update your printer's firmware to manage the queue remotely.")
- target: detailsButton
- }
- }
- MonitorConfigOverrideDialog
- {
- id: overrideConfirmationDialog
- printer: base.printer
- }
- }
|