123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- import QtQuick 2.2
- import QtQuick.Controls 2.0
- import UM 1.5 as UM
- import Cura 1.0 as Cura
- Item
- {
- id: base
-
- property var printJob: null
- width: parent.width
- height: childrenRect.height
- ExpandableCard
- {
- enabled: printJob != null
- borderColor: printJob && printJob.configurationChanges.length !== 0 ? UM.Theme.getColor("warning") : UM.Theme.getColor("monitor_card_border")
- headerItem: Row
- {
- height: Math.round(48 * screenScaleFactor)
- anchors.left: parent.left
- anchors.leftMargin: Math.round(24 * screenScaleFactor)
- spacing: Math.round(18 * screenScaleFactor)
- MonitorPrintJobPreview
- {
- printJob: base.printJob
- size: Math.round(32 * screenScaleFactor)
- anchors.verticalCenter: parent.verticalCenter
- }
- Item
- {
- anchors.verticalCenter: parent.verticalCenter
- height: Math.round(18 * screenScaleFactor)
- width: UM.Theme.getSize("monitor_column").width
- Rectangle
- {
- color: UM.Theme.getColor("monitor_skeleton_loading")
- width: Math.round(parent.width / 2)
- height: parent.height
- visible: !printJob
- radius: 2 * screenScaleFactor
- }
- UM.Label
- {
- text: printJob && printJob.name ? printJob.name : ""
- elide: Text.ElideRight
- font: UM.Theme.getFont("medium")
- visible: printJob
-
- width: parent.width
- height: parent.height
- }
- }
- Item
- {
- anchors.verticalCenter: parent.verticalCenter
- height: Math.round(18 * screenScaleFactor)
- width: UM.Theme.getSize("monitor_column").width
- Rectangle
- {
- color: UM.Theme.getColor("monitor_skeleton_loading")
- width: Math.round(parent.width / 3)
- height: parent.height
- visible: !printJob
- radius: 2 * screenScaleFactor
- }
- UM.Label
- {
- text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : ""
- elide: Text.ElideRight
- font: UM.Theme.getFont("medium")
- visible: printJob
-
- height: Math.round(18 * screenScaleFactor)
- }
- }
- Item
- {
- anchors.verticalCenter: parent.verticalCenter
- height: Math.round(18 * screenScaleFactor)
- width: childrenRect.width
- Rectangle
- {
- color: UM.Theme.getColor("monitor_skeleton_loading")
- width: Math.round(72 * screenScaleFactor)
- height: parent.height
- visible: !printJob
- radius: 2 * screenScaleFactor
- }
- UM.Label
- {
- id: printerAssignmentLabel
- anchors.verticalCenter: parent.verticalCenter
- elide: Text.ElideRight
- font: UM.Theme.getFont("medium")
- text: {
- if (printJob !== null)
- {
- if (printJob.assignedPrinter == null)
- {
- if (printJob.state == "error")
- {
- return catalog.i18nc("@label", "Unavailable printer");
- }
- return catalog.i18nc("@label", "First available");
- }
- return printJob.assignedPrinter.name;
- }
- return "";
- }
- visible: printJob
- width: Math.round(120 * screenScaleFactor)
-
- height: parent.height
- }
- Row
- {
- id: printerFamilyPills
- anchors
- {
- left: printerAssignmentLabel.right;
- leftMargin: Math.round(12 * screenScaleFactor)
- verticalCenter: parent.verticalCenter
- }
- height: childrenRect.height
- spacing: Math.round(6 * screenScaleFactor)
- visible: printJob
- MonitorPrinterPill
- {
- text: printJob ? printJob.configuration.printerType : ""
- }
- }
- }
- }
- drawerItem: Row
- {
- anchors
- {
- left: parent.left
- leftMargin: Math.round(74 * screenScaleFactor)
- }
- height: Math.round(108 * screenScaleFactor)
- spacing: Math.round(18 * screenScaleFactor)
- MonitorPrinterConfiguration
- {
- id: printerConfiguration
- anchors.verticalCenter: parent.verticalCenter
- configurations: base.printJob ? base.printJob.configuration.extruderConfigurations : null
- height: Math.round(72 * screenScaleFactor)
- }
- UM.Label
- {
- text: printJob && printJob.owner ? printJob.owner : ""
- elide: Text.ElideRight
- font: UM.Theme.getFont("medium")
- anchors.top: printerConfiguration.top
-
- height: Math.round(18 * screenScaleFactor)
- }
- }
- }
- MonitorContextMenuButton
- {
- id: contextMenuButton
- anchors
- {
- right: parent.right
- rightMargin: Math.round(8 * screenScaleFactor)
- top: parent.top
- topMargin: Math.round(8 * screenScaleFactor)
- }
- width: Math.round(32 * screenScaleFactor)
- height: Math.round(32 * screenScaleFactor)
- enabled: OutputDevice.supportsPrintJobActions
- onClicked: enabled ? contextMenu.switchPopupState() : {}
- visible:
- {
- if(!printJob)
- {
- return false;
- }
- if(!contextMenu.hasItems)
- {
- return false;
- }
- var states = ["queued", "error", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"];
- return states.indexOf(printJob.state) !== -1;
- }
- }
- MonitorContextMenu
- {
- id: contextMenu
- printJob: base.printJob ? base.printJob : 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
- }
- }
|