Cura/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml
Ian Paschal 8a856f13d2 Re-add config changes in monitor tab
Contributes to CL-1152
2018-12-10 11:36:51 +01:00

92 lines
2.5 KiB
QML

// 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 UM 1.3 as UM
// TODO: Documentation!
Item
{
id: printJobPreview
property var printJob: null
property var size: 256
width: size
height: size
// Actual content
Image
{
id: previewImage
anchors.fill: parent
opacity:
{
if (printJob && (printJob.state == "error" || printJob.configurationChanges.length > 0 || !printJob.isActive))
{
return 0.5
}
return 1.0
}
source: printJob ? printJob.previewImageUrl : ""
visible: printJob
}
UM.RecolorImage
{
id: ultiBotImage
anchors.centerIn: printJobPreview
color: UM.Theme.getColor("monitor_placeholder_image")
height: printJobPreview.height
source: "../svg/ultibot.svg"
sourceSize
{
height: height
width: width
}
/* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
not in order to determine if we show the placeholder (ultibot) image instead. */
visible: printJob && previewImage.status == Image.Error
width: printJobPreview.width
}
UM.RecolorImage
{
id: overlayIcon
anchors.centerIn: printJobPreview
color: UM.Theme.getColor("monitor_image_overlay")
height: 0.5 * printJobPreview.height
source:
{
if (printJob.configurationChanges.length > 0)
{
return "../svg/warning-icon.svg"
}
switch(printJob.state)
{
case "error":
return "../svg/aborted-icon.svg"
case "wait_cleanup":
return printJob.timeTotal > printJob.timeElapsed ? "../svg/aborted-icon.svg" : ""
case "pausing":
return "../svg/paused-icon.svg"
case "paused":
return "../svg/paused-icon.svg"
case "resuming":
return "../svg/paused-icon.svg"
default:
return ""
}
return ""
}
sourceSize
{
height: height
width: width
}
visible: source != ""
width: 0.5 * printJobPreview.width
}
}