mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Show "Pausing...", "Aborting...", and "Resuming..." texts
Contributes to CL-1126
This commit is contained in:
parent
90726ecbff
commit
1abd0b3499
2 changed files with 39 additions and 20 deletions
|
@ -11,7 +11,7 @@ import UM 1.3 as UM
|
|||
Item {
|
||||
id: root;
|
||||
property var printJob: null;
|
||||
property var running: isRunning(printJob);
|
||||
property var started: isStarted(printJob);
|
||||
property var assigned: isAssigned(printJob);
|
||||
|
||||
Button {
|
||||
|
@ -34,7 +34,7 @@ Item {
|
|||
hoverEnabled: true;
|
||||
onClicked: parent.switchPopupState();
|
||||
text: "\u22EE"; //Unicode; Three stacked points.
|
||||
visible: printJob.state == "queued" || running ? true : false;
|
||||
visible: printJob.state == "queued" || printJob.state == "aborted" || started ? true : false;
|
||||
width: 35 * screenScaleFactor; // TODO: Theme!
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,12 @@ Item {
|
|||
width: parent.width;
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: {
|
||||
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;
|
||||
|
@ -110,42 +115,57 @@ Item {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
onClicked: {
|
||||
sendToTopConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: catalog.i18nc("@label", "Move to top");
|
||||
}
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: printJob && !running;
|
||||
onClicked: {
|
||||
deleteConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: catalog.i18nc("@label", "Delete");
|
||||
visible: printJob && !started && printJob.state !== "aborted" && printJob.state !== "finished";
|
||||
}
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: printJob && running;
|
||||
enabled: !(printJob.state == "pausing" || printJob.state == "resuming");
|
||||
onClicked: {
|
||||
if (printJob.state == "paused") {
|
||||
printJob.setState("print");
|
||||
} else if(printJob.state == "printing") {
|
||||
printJob.setState("pause");
|
||||
}
|
||||
popup.close();
|
||||
return;
|
||||
}
|
||||
text: printJob && printJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause");
|
||||
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: printJob && started && printJob.state;
|
||||
}
|
||||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: printJob && running;
|
||||
enabled: printJob.state !== "aborting";
|
||||
onClicked: {
|
||||
abortConfirmationDialog.visible = true;
|
||||
popup.close();
|
||||
}
|
||||
text: catalog.i18nc("@label", "Abort");
|
||||
text: printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort");
|
||||
visible: printJob && started;
|
||||
}
|
||||
}
|
||||
enter: Transition {
|
||||
|
@ -205,11 +225,11 @@ Item {
|
|||
function switchPopupState() {
|
||||
popup.visible ? popup.close() : popup.open();
|
||||
}
|
||||
function isRunning(job) {
|
||||
function isStarted(job) {
|
||||
if (!job) {
|
||||
return false;
|
||||
}
|
||||
return ["paused", "printing", "pre_print"].indexOf(job.state) !== -1;
|
||||
return ["pre_print", "printing", "pausing", "paused", "resuming", "aborting"].indexOf(job.state) !== -1;
|
||||
}
|
||||
function isAssigned(job) {
|
||||
if (!job) {
|
||||
|
|
|
@ -12,13 +12,12 @@ Button {
|
|||
color: UM.Theme.getColor("monitor_context_menu_highlight");
|
||||
}
|
||||
contentItem: Label {
|
||||
color: UM.Theme.getColor("text");
|
||||
color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_inactive");
|
||||
text: parent.text
|
||||
horizontalAlignment: Text.AlignLeft;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
}
|
||||
height: 39 * screenScaleFactor; // TODO: Theme!
|
||||
hoverEnabled: true;
|
||||
visible: enabled;
|
||||
width: parent.width;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue