mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Clean up some QML warnings
Contributes to CL-1051
This commit is contained in:
parent
3ef6359930
commit
1fa7a8880b
9 changed files with 51 additions and 26 deletions
|
@ -136,6 +136,9 @@ Item {
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
font: UM.Theme.getFont("large_nonbold");
|
font: UM.Theme.getFont("large_nonbold");
|
||||||
text: {
|
text: {
|
||||||
|
if (root.job === null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
if (root.job.configurationChanges.length === 0) {
|
if (root.job.configurationChanges.length === 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -182,11 +185,13 @@ Item {
|
||||||
}
|
}
|
||||||
text: catalog.i18nc("@label", "Override");
|
text: catalog.i18nc("@label", "Override");
|
||||||
visible: {
|
visible: {
|
||||||
var length = root.job.configurationChanges.length;
|
if (root.job & root.job.configurationChanges) {
|
||||||
for (var i = 0; i < length; i++) {
|
var length = root.job.configurationChanges.length;
|
||||||
var typeOfChange = root.job.configurationChanges[i].typeOfChange;
|
for (var i = 0; i < length; i++) {
|
||||||
if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
|
var typeOfChange = root.job.configurationChanges[i].typeOfChange;
|
||||||
return false;
|
if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -203,6 +208,9 @@ Item {
|
||||||
onYes: OutputDevice.forceSendJob(root.job.key);
|
onYes: OutputDevice.forceSendJob(root.job.key);
|
||||||
standardButtons: StandardButton.Yes | StandardButton.No;
|
standardButtons: StandardButton.Yes | StandardButton.No;
|
||||||
text: {
|
text: {
|
||||||
|
if (!root.job) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
var printJobName = formatPrintJobName(root.job.name);
|
var printJobName = formatPrintJobName(root.job.name);
|
||||||
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
|
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
|
||||||
return confirmText;
|
return confirmText;
|
||||||
|
|
|
@ -73,7 +73,7 @@ Item {
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
font: UM.Theme.getFont("default");
|
font: UM.Theme.getFont("default");
|
||||||
text: {
|
text: {
|
||||||
if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) {
|
if (printCoreConfiguration && printCoreConfiguration.activeMaterial != undefined) {
|
||||||
return printCoreConfiguration.activeMaterial.name;
|
return printCoreConfiguration.activeMaterial.name;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -101,7 +101,14 @@ Item {
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
|
|
||||||
PrintJobContextMenuItem {
|
PrintJobContextMenuItem {
|
||||||
enabled: printJob && !running ? OutputDevice.queuedPrintJobs[0].key != printJob.key : false;
|
enabled: {
|
||||||
|
if (printJob && !running) {
|
||||||
|
if (OutputDevice && OutputDevice.queuedPrintJobs[0]) {
|
||||||
|
return OutputDevice.queuedPrintJobs[0].key != printJob.key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
sendToTopConfirmationDialog.visible = true;
|
sendToTopConfirmationDialog.visible = true;
|
||||||
popup.close();
|
popup.close();
|
||||||
|
@ -169,7 +176,7 @@ Item {
|
||||||
icon: StandardIcon.Warning;
|
icon: StandardIcon.Warning;
|
||||||
onYes: OutputDevice.sendJobToTop(printJob.key);
|
onYes: OutputDevice.sendJobToTop(printJob.key);
|
||||||
standardButtons: StandardButton.Yes | StandardButton.No;
|
standardButtons: StandardButton.Yes | StandardButton.No;
|
||||||
text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "";
|
text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) : "";
|
||||||
title: catalog.i18nc("@window:title", "Move print job to top");
|
title: catalog.i18nc("@window:title", "Move print job to top");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +186,7 @@ Item {
|
||||||
icon: StandardIcon.Warning;
|
icon: StandardIcon.Warning;
|
||||||
onYes: OutputDevice.deleteJobFromQueue(printJob.key);
|
onYes: OutputDevice.deleteJobFromQueue(printJob.key);
|
||||||
standardButtons: StandardButton.Yes | StandardButton.No;
|
standardButtons: StandardButton.Yes | StandardButton.No;
|
||||||
text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "";
|
text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "";
|
||||||
title: catalog.i18nc("@window:title", "Delete print job");
|
title: catalog.i18nc("@window:title", "Delete print job");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +196,7 @@ Item {
|
||||||
icon: StandardIcon.Warning;
|
icon: StandardIcon.Warning;
|
||||||
onYes: printJob.setState("abort");
|
onYes: printJob.setState("abort");
|
||||||
standardButtons: StandardButton.Yes | StandardButton.No;
|
standardButtons: StandardButton.Yes | StandardButton.No;
|
||||||
text: printJob ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "";
|
text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "";
|
||||||
title: catalog.i18nc("@window:title", "Abort print");
|
title: catalog.i18nc("@window:title", "Abort print");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ Item {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
font: UM.Theme.getFont("default_bold");
|
font: UM.Theme.getFont("default_bold");
|
||||||
text: printJob ? printJob.name : ""; // Supress QML warnings
|
text: printJob && printJob.name ? printJob.name : ""; // Supress QML warnings
|
||||||
visible: printJob;
|
visible: printJob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ Item {
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
font: UM.Theme.getFont("default_bold");
|
font: UM.Theme.getFont("default_bold");
|
||||||
text: {
|
text: {
|
||||||
if (printJob) {
|
if (printJob !== null) {
|
||||||
if (printJob.assignedPrinter == null) {
|
if (printJob.assignedPrinter == null) {
|
||||||
if (printJob.state == "error") {
|
if (printJob.state == "error") {
|
||||||
return catalog.i18nc("@label", "Waiting for: Unavailable printer");
|
return catalog.i18nc("@label", "Waiting for: Unavailable printer");
|
||||||
|
@ -222,7 +222,7 @@ Item {
|
||||||
|
|
||||||
PrinterInfoBlock {
|
PrinterInfoBlock {
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
printer: root.printJob.assignedPrinter;
|
printer: root.printJon && root.printJob.assignedPrinter;
|
||||||
printJob: root.printJob;
|
printJob: root.printJob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,11 +398,13 @@ Item {
|
||||||
}
|
}
|
||||||
text: catalog.i18nc("@label", "Override");
|
text: catalog.i18nc("@label", "Override");
|
||||||
visible: {
|
visible: {
|
||||||
var length = printJob.configurationChanges.length;
|
if (printJob && printJob.configurationChanges) {
|
||||||
for (var i = 0; i < length; i++) {
|
var length = printJob.configurationChanges.length;
|
||||||
var typeOfChange = printJob.configurationChanges[i].typeOfChange;
|
for (var i = 0; i < length; i++) {
|
||||||
if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
|
var typeOfChange = printJob.configurationChanges[i].typeOfChange;
|
||||||
return false;
|
if (typeOfChange === "material_insert" || typeOfChange === "buildplate_change") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -418,6 +420,9 @@ Item {
|
||||||
onYes: OutputDevice.forceSendJob(printJob.key);
|
onYes: OutputDevice.forceSendJob(printJob.key);
|
||||||
standardButtons: StandardButton.Yes | StandardButton.No;
|
standardButtons: StandardButton.Yes | StandardButton.No;
|
||||||
text: {
|
text: {
|
||||||
|
if (!root.job) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
var printJobName = formatPrintJobName(printJob.name);
|
var printJobName = formatPrintJobName(printJob.name);
|
||||||
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
|
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
|
||||||
return confirmText;
|
return confirmText;
|
||||||
|
|
|
@ -27,7 +27,7 @@ Column {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
font: UM.Theme.getFont("default_bold");
|
font: UM.Theme.getFont("default_bold");
|
||||||
text: job ? job.name : "";
|
text: job && job.name ? job.name : "";
|
||||||
visible: job;
|
visible: job;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,12 +161,15 @@ Item {
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
font: UM.Theme.getFont("default");
|
font: UM.Theme.getFont("default");
|
||||||
text: {
|
text: {
|
||||||
|
if (!printer) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
if (printer.state == "disabled") {
|
if (printer.state == "disabled") {
|
||||||
return catalog.i18nc("@label", "Not available");
|
return catalog.i18nc("@label", "Not available");
|
||||||
} else if (printer.state == "unreachable") {
|
} else if (printer.state == "unreachable") {
|
||||||
return catalog.i18nc("@label", "Unreachable");
|
return catalog.i18nc("@label", "Unreachable");
|
||||||
}
|
}
|
||||||
if (printer.activePrintJob != null) {
|
if (printer.activePrintJob != null && printer.activePrintJob.name) {
|
||||||
return printer.activePrintJob.name;
|
return printer.activePrintJob.name;
|
||||||
}
|
}
|
||||||
return catalog.i18nc("@label", "Available");
|
return catalog.i18nc("@label", "Available");
|
||||||
|
|
|
@ -60,7 +60,7 @@ Item {
|
||||||
|
|
||||||
|
|
||||||
PrintJobPreview {
|
PrintJobPreview {
|
||||||
job: root.printer.activePrintJob;
|
job: root.printer && root.printer.activePrintJob ? root.printer.activePrintJob : null;
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import UM 1.3 as UM
|
||||||
|
|
||||||
ProgressBar {
|
ProgressBar {
|
||||||
property var progress: {
|
property var progress: {
|
||||||
if (printer.activePrintJob == null) {
|
if (!printer || printer.activePrintJob == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
var result = printer.activePrintJob.timeElapsed / printer.activePrintJob.timeTotal;
|
var result = printer.activePrintJob.timeElapsed / printer.activePrintJob.timeTotal;
|
||||||
|
@ -25,11 +25,10 @@ ProgressBar {
|
||||||
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
|
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
|
||||||
time from ever being less than 0. Negative durations cause strange behavior such
|
time from ever being less than 0. Negative durations cause strange behavior such
|
||||||
as displaying "-1h -1m". */
|
as displaying "-1h -1m". */
|
||||||
var activeJob = printer.activePrintJob;
|
return Math.max(printer.activePrintJob.timeTotal - printer.activePrintJob.timeElapsed, 0);
|
||||||
return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
|
|
||||||
}
|
}
|
||||||
property var progressText: {
|
property var progressText: {
|
||||||
if (printer.activePrintJob == null) {
|
if (!printer.activePrintJob || !printer.activePrintJob.state ) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
switch (printer.activePrintJob.state) {
|
switch (printer.activePrintJob.state) {
|
||||||
|
@ -65,6 +64,9 @@ ProgressBar {
|
||||||
progress: Rectangle {
|
progress: Rectangle {
|
||||||
id: progressItem;
|
id: progressItem;
|
||||||
color: {
|
color: {
|
||||||
|
if (!printer.activePrintJob) {
|
||||||
|
return "black";
|
||||||
|
}
|
||||||
var state = printer.activePrintJob.state
|
var state = printer.activePrintJob.state
|
||||||
var inactiveStates = [
|
var inactiveStates = [
|
||||||
"pausing",
|
"pausing",
|
||||||
|
|
|
@ -41,7 +41,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
PrinterFamilyPill {
|
PrinterFamilyPill {
|
||||||
text: printer.type;
|
text: printer ? printer.type : "";
|
||||||
visible: !compatiblePills.visible && printer;
|
visible: !compatiblePills.visible && printer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue