123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import QtQuick 2.3
- import QtQuick.Controls.Styles 1.3
- import QtQuick.Controls 1.4
- import UM 1.3 as UM
- Item
- {
- id: base
-
- property var printJob: null
- width: childrenRect.width
- height: UM.Theme.getSize("monitor_text_line").height
- UM.ProgressBar
- {
- id: progressBar
- anchors
- {
- verticalCenter: parent.verticalCenter
- left: parent.left
- }
- value: printJob ? printJob.progress : 0
- width: UM.Theme.getSize("monitor_progress_bar").width
- }
- Label
- {
- id: percentLabel
- anchors
- {
- left: progressBar.right
- leftMargin: UM.Theme.getSize("monitor_margin").width
- verticalCenter: parent.verticalCenter
- }
- text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%"
- color: printJob && printJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
- width: contentWidth
- font: UM.Theme.getFont("default")
-
- height: UM.Theme.getSize("monitor_text_line").height
- verticalAlignment: Text.AlignVCenter
- renderType: Text.NativeRendering
- }
- Label
- {
- id: statusLabel
- anchors
- {
- left: percentLabel.right
- leftMargin: UM.Theme.getSize("monitor_margin").width
- verticalCenter: parent.verticalCenter
- }
- color: UM.Theme.getColor("text")
- font: UM.Theme.getFont("default")
- text:
- {
- if (!printJob)
- {
- return "";
- }
- switch (printJob.state)
- {
- case "wait_cleanup":
- if (printJob.timeTotal > printJob.timeElapsed)
- {
- return catalog.i18nc("@label:status", "Aborted");
- }
- return catalog.i18nc("@label:status", "Finished");
- case "finished":
- return catalog.i18nc("@label:status", "Finished");
- case "sent_to_printer":
- return catalog.i18nc("@label:status", "Preparing...");
- case "pre_print":
- return catalog.i18nc("@label:status", "Preparing...");
- case "aborting":
- return catalog.i18nc("@label:status", "Aborting...");
- case "aborted":
- return catalog.i18nc("@label:status", "Aborted");
- case "pausing":
- return catalog.i18nc("@label:status", "Pausing...");
- case "paused":
- return catalog.i18nc("@label:status", "Paused");
- case "resuming":
- return catalog.i18nc("@label:status", "Resuming...");
- case "queued":
- return catalog.i18nc("@label:status", "Action required");
- default:
- return catalog.i18nc("@label:status", "Finishes %1 at %2".arg(OutputDevice.getDateCompleted(printJob.timeRemaining)).arg(OutputDevice.getTimeCompleted(printJob.timeRemaining)));
- }
- }
- width: contentWidth
-
- height: UM.Theme.getSize("monitor_text_line").height
- verticalAlignment: Text.AlignVCenter
- renderType: Text.NativeRendering
- }
- }
|