mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-18 06:55:55 +08:00
Rework printer cards (cont)
Contributes to CL-1051
This commit is contained in:
parent
b5c893c08e
commit
7c01e632df
21
plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
Normal file
21
plugins/UM3NetworkPrinting/resources/qml/HorizontalLine.qml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import QtQuick 2.3
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import UM 1.3 as UM
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root;
|
||||||
|
property var enabled: true;
|
||||||
|
width: parent.width;
|
||||||
|
height: childrenRect.height;
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors {
|
||||||
|
left: parent.left;
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
right: parent.right;
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
}
|
||||||
|
color: root.enabled ? UM.Theme.getColor("monitor_lining_inactive") : UM.Theme.getColor("monitor_lining_active");
|
||||||
|
height: UM.Theme.getSize("default_lining").height;
|
||||||
|
}
|
||||||
|
}
|
@ -218,49 +218,10 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Printer family pills
|
PrinterInfoBlock {
|
||||||
Row {
|
printer: root.printJob.assignedPrinter;
|
||||||
id: printerFamilyPills;
|
printJob: root.printJob;
|
||||||
visible: printJob;
|
anchors.bottom: parent.bottom;
|
||||||
spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
|
|
||||||
anchors {
|
|
||||||
left: parent.left;
|
|
||||||
right: parent.right;
|
|
||||||
bottom: extrudersInfo.top;
|
|
||||||
bottomMargin: UM.Theme.getSize("default_margin").height;
|
|
||||||
}
|
|
||||||
height: childrenRect.height;
|
|
||||||
Repeater {
|
|
||||||
model: printJob ? printJob.compatibleMachineFamilies : [];
|
|
||||||
delegate: PrinterFamilyPill {
|
|
||||||
text: modelData;
|
|
||||||
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
|
|
||||||
padding: 3 * screenScaleFactor; // TODO: Theme!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print core & material config
|
|
||||||
Row {
|
|
||||||
id: extrudersInfo;
|
|
||||||
anchors {
|
|
||||||
bottom: parent.bottom;
|
|
||||||
left: parent.left;
|
|
||||||
right: parent.right;
|
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width;
|
|
||||||
}
|
|
||||||
height: childrenRect.height;
|
|
||||||
spacing: UM.Theme.getSize("default_margin").width;
|
|
||||||
PrintCoreConfiguration {
|
|
||||||
id: leftExtruderInfo;
|
|
||||||
width: Math.round(parent.width / 2) * screenScaleFactor;
|
|
||||||
printCoreConfiguration: printJob !== null ? printJob.configuration.extruderConfigurations[0] : null;
|
|
||||||
}
|
|
||||||
PrintCoreConfiguration {
|
|
||||||
id: rightExtruderInfo;
|
|
||||||
width: Math.round(parent.width / 2) * screenScaleFactor;
|
|
||||||
printCoreConfiguration: printJob !== null ? printJob.configuration.extruderConfigurations[1] : null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,14 @@ Item {
|
|||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
width: parent.width - 2 * shadowRadius;
|
width: parent.width - 2 * shadowRadius;
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width;
|
||||||
|
height: childrenRect.height;
|
||||||
|
|
||||||
// Main card
|
// Main card
|
||||||
Rectangle {
|
Item {
|
||||||
id: mainCard;
|
id: mainCard;
|
||||||
anchors.top: parent.top;
|
// color: "pink";
|
||||||
color: "pink";
|
|
||||||
height: childrenRect.height;
|
height: childrenRect.height;
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
|
|
||||||
@ -198,7 +201,7 @@ Item {
|
|||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
enabled: printer;
|
enabled: printer;
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log(printerInfo.height)
|
console.log(model.index)
|
||||||
if (root.collapsed && model) {
|
if (root.collapsed && model) {
|
||||||
printerList.currentIndex = model.index;
|
printerList.currentIndex = model.index;
|
||||||
} else {
|
} else {
|
||||||
@ -216,437 +219,16 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Detailed card
|
// Detailed card
|
||||||
Rectangle {
|
PrinterCardDetails {
|
||||||
width: parent.width;
|
collapsed: root.collapsed;
|
||||||
height: 0;
|
printer: printer;
|
||||||
anchors.top: mainCard.bottom;
|
visible: printer;
|
||||||
anchors.bottom: progressBar.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Progress bar
|
// Progress bar
|
||||||
PrinterCardProgressBar {
|
PrinterCardProgressBar {
|
||||||
id: progressBar;
|
|
||||||
anchors {
|
|
||||||
bottom: parent.bottom;
|
|
||||||
}
|
|
||||||
visible: printer && printer.activePrintJob != null && printer.activePrintJob != undefined;
|
visible: printer && printer.activePrintJob != null && printer.activePrintJob != undefined;
|
||||||
width: parent.width;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Item
|
|
||||||
// {
|
|
||||||
// id: detailedInfo
|
|
||||||
// property var printJob: printer.activePrintJob
|
|
||||||
// visible: height == childrenRect.height
|
|
||||||
// anchors.top: printerInfo.bottom
|
|
||||||
// width: parent.width
|
|
||||||
// height: !root.collapsed ? childrenRect.height : 0
|
|
||||||
// opacity: visible ? 1 : 0
|
|
||||||
// Behavior on height { NumberAnimation { duration: 100 } }
|
|
||||||
// Behavior on opacity { NumberAnimation { duration: 100 } }
|
|
||||||
// Rectangle
|
|
||||||
// {
|
|
||||||
// id: topSpacer
|
|
||||||
// color:
|
|
||||||
// {
|
|
||||||
// if(printer.state == "disabled")
|
|
||||||
// {
|
|
||||||
// return UM.Theme.getColor("monitor_lining_inactive")
|
|
||||||
// }
|
|
||||||
// return UM.Theme.getColor("viewport_background")
|
|
||||||
// }
|
|
||||||
// // UM.Theme.getColor("viewport_background")
|
|
||||||
// height: 1
|
|
||||||
// anchors
|
|
||||||
// {
|
|
||||||
// left: parent.left
|
|
||||||
// right: parent.right
|
|
||||||
// margins: UM.Theme.getSize("default_margin").width
|
|
||||||
// top: parent.top
|
|
||||||
// topMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// PrinterFamilyPill
|
|
||||||
// {
|
|
||||||
// id: printerFamilyPill
|
|
||||||
// color:
|
|
||||||
// {
|
|
||||||
// if(printer.state == "disabled")
|
|
||||||
// {
|
|
||||||
// return "transparent"
|
|
||||||
// }
|
|
||||||
// return UM.Theme.getColor("viewport_background")
|
|
||||||
// }
|
|
||||||
// anchors.top: topSpacer.bottom
|
|
||||||
// anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
|
|
||||||
// text: printer.type
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
// padding: 3
|
|
||||||
// }
|
|
||||||
// Row
|
|
||||||
// {
|
|
||||||
// id: extrudersInfo
|
|
||||||
// anchors.top: printerFamilyPill.bottom
|
|
||||||
// anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
|
|
||||||
// anchors.right: parent.right
|
|
||||||
// anchors.rightMargin: 2 * UM.Theme.getSize("default_margin").width
|
|
||||||
// height: childrenRect.height
|
|
||||||
// spacing: UM.Theme.getSize("default_margin").width
|
|
||||||
|
|
||||||
// PrintCoreConfiguration
|
|
||||||
// {
|
|
||||||
// id: leftExtruderInfo
|
|
||||||
// width: Math.round(parent.width / 2)
|
|
||||||
// printCoreConfiguration: printer.printerConfiguration.extruderConfigurations[0]
|
|
||||||
// }
|
|
||||||
|
|
||||||
// PrintCoreConfiguration
|
|
||||||
// {
|
|
||||||
// id: rightExtruderInfo
|
|
||||||
// width: Math.round(parent.width / 2)
|
|
||||||
// printCoreConfiguration: printer.printerConfiguration.extruderConfigurations[1]
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Rectangle
|
|
||||||
// {
|
|
||||||
// id: jobSpacer
|
|
||||||
// color: UM.Theme.getColor("viewport_background")
|
|
||||||
// height: 2
|
|
||||||
// anchors
|
|
||||||
// {
|
|
||||||
// left: parent.left
|
|
||||||
// right: parent.right
|
|
||||||
// margins: UM.Theme.getSize("default_margin").width
|
|
||||||
// top: extrudersInfo.bottom
|
|
||||||
// topMargin: 2 * UM.Theme.getSize("default_margin").height
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Item
|
|
||||||
// {
|
|
||||||
// id: jobInfo
|
|
||||||
// property var showJobInfo: printer.activePrintJob != null && printer.activePrintJob.state != "queued"
|
|
||||||
|
|
||||||
// anchors.top: jobSpacer.bottom
|
|
||||||
// anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.right: parent.right
|
|
||||||
// anchors.margins: UM.Theme.getSize("default_margin").width
|
|
||||||
// anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
|
|
||||||
// height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height: 0
|
|
||||||
// visible: showJobInfo
|
|
||||||
// Label
|
|
||||||
// {
|
|
||||||
// id: printJobName
|
|
||||||
// text: printer.activePrintJob != null ? printer.activePrintJob.name : ""
|
|
||||||
// font: UM.Theme.getFont("default_bold")
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.right: contextButton.left
|
|
||||||
// anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
// elide: Text.ElideRight
|
|
||||||
// }
|
|
||||||
// Label
|
|
||||||
// {
|
|
||||||
// id: ownerName
|
|
||||||
// anchors.top: printJobName.bottom
|
|
||||||
// text: printer.activePrintJob != null ? printer.activePrintJob.owner : ""
|
|
||||||
// font: UM.Theme.getFont("default")
|
|
||||||
// opacity: 0.6
|
|
||||||
// width: parent.width
|
|
||||||
// elide: Text.ElideRight
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function switchPopupState()
|
|
||||||
// {
|
|
||||||
// popup.visible ? popup.close() : popup.open()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Button
|
|
||||||
// {
|
|
||||||
// id: contextButton
|
|
||||||
// text: "\u22EE" //Unicode; Three stacked points.
|
|
||||||
// width: 35
|
|
||||||
// height: width
|
|
||||||
// anchors
|
|
||||||
// {
|
|
||||||
// right: parent.right
|
|
||||||
// top: parent.top
|
|
||||||
// }
|
|
||||||
// hoverEnabled: true
|
|
||||||
|
|
||||||
// background: Rectangle
|
|
||||||
// {
|
|
||||||
// opacity: contextButton.down || contextButton.hovered ? 1 : 0
|
|
||||||
// width: contextButton.width
|
|
||||||
// height: contextButton.height
|
|
||||||
// radius: 0.5 * width
|
|
||||||
// color: UM.Theme.getColor("viewport_background")
|
|
||||||
// }
|
|
||||||
// contentItem: Label
|
|
||||||
// {
|
|
||||||
// text: contextButton.text
|
|
||||||
// color: UM.Theme.getColor("monitor_tab_text_inactive")
|
|
||||||
// font.pixelSize: 25
|
|
||||||
// verticalAlignment: Text.AlignVCenter
|
|
||||||
// horizontalAlignment: Text.AlignHCenter
|
|
||||||
// }
|
|
||||||
|
|
||||||
// onClicked: parent.switchPopupState()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Popup
|
|
||||||
// {
|
|
||||||
// // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
|
|
||||||
// id: popup
|
|
||||||
// clip: true
|
|
||||||
// closePolicy: Popup.CloseOnPressOutside
|
|
||||||
// x: (parent.width - width) + 26 * screenScaleFactor
|
|
||||||
// y: contextButton.height - 5 * screenScaleFactor // Because shadow
|
|
||||||
// width: 182 * screenScaleFactor
|
|
||||||
// height: contentItem.height + 2 * padding
|
|
||||||
// visible: false
|
|
||||||
// padding: 5 * screenScaleFactor // Because shadow
|
|
||||||
|
|
||||||
// transformOrigin: Popup.Top
|
|
||||||
// contentItem: Item
|
|
||||||
// {
|
|
||||||
// width: popup.width
|
|
||||||
// height: childrenRect.height + 36 * screenScaleFactor
|
|
||||||
// anchors.topMargin: 10 * screenScaleFactor
|
|
||||||
// anchors.bottomMargin: 10 * screenScaleFactor
|
|
||||||
// Button
|
|
||||||
// {
|
|
||||||
// id: pauseButton
|
|
||||||
// text: printer.activePrintJob != null && printer.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
|
|
||||||
// onClicked:
|
|
||||||
// {
|
|
||||||
// if(printer.activePrintJob.state == "paused")
|
|
||||||
// {
|
|
||||||
// printer.activePrintJob.setState("print")
|
|
||||||
// }
|
|
||||||
// else if(printer.activePrintJob.state == "printing")
|
|
||||||
// {
|
|
||||||
// printer.activePrintJob.setState("pause")
|
|
||||||
// }
|
|
||||||
// popup.close()
|
|
||||||
// }
|
|
||||||
// width: parent.width
|
|
||||||
// enabled: printer.activePrintJob != null && ["paused", "printing"].indexOf(printer.activePrintJob.state) >= 0
|
|
||||||
// visible: enabled
|
|
||||||
// anchors.top: parent.top
|
|
||||||
// anchors.topMargin: 18 * screenScaleFactor
|
|
||||||
// height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
|
|
||||||
// hoverEnabled: true
|
|
||||||
// background: Rectangle
|
|
||||||
// {
|
|
||||||
// opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
|
|
||||||
// color: UM.Theme.getColor("viewport_background")
|
|
||||||
// }
|
|
||||||
// contentItem: Label
|
|
||||||
// {
|
|
||||||
// text: pauseButton.text
|
|
||||||
// horizontalAlignment: Text.AlignLeft
|
|
||||||
// verticalAlignment: Text.AlignVCenter
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Button
|
|
||||||
// {
|
|
||||||
// id: abortButton
|
|
||||||
// text: catalog.i18nc("@label", "Abort")
|
|
||||||
// onClicked:
|
|
||||||
// {
|
|
||||||
// abortConfirmationDialog.visible = true;
|
|
||||||
// popup.close();
|
|
||||||
// }
|
|
||||||
// width: parent.width
|
|
||||||
// height: 39 * screenScaleFactor
|
|
||||||
// anchors.top: pauseButton.bottom
|
|
||||||
// hoverEnabled: true
|
|
||||||
// enabled: printer.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(printer.activePrintJob.state) >= 0
|
|
||||||
// background: Rectangle
|
|
||||||
// {
|
|
||||||
// opacity: abortButton.down || abortButton.hovered ? 1 : 0
|
|
||||||
// color: UM.Theme.getColor("viewport_background")
|
|
||||||
// }
|
|
||||||
// contentItem: Label
|
|
||||||
// {
|
|
||||||
// text: abortButton.text
|
|
||||||
// horizontalAlignment: Text.AlignLeft
|
|
||||||
// verticalAlignment: Text.AlignVCenter
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MessageDialog
|
|
||||||
// {
|
|
||||||
// id: abortConfirmationDialog
|
|
||||||
// title: catalog.i18nc("@window:title", "Abort print")
|
|
||||||
// icon: StandardIcon.Warning
|
|
||||||
// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printer.activePrintJob.name)
|
|
||||||
// standardButtons: StandardButton.Yes | StandardButton.No
|
|
||||||
// Component.onCompleted: visible = false
|
|
||||||
// onYes: printer.activePrintJob.setState("abort")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// background: Item
|
|
||||||
// {
|
|
||||||
// width: popup.width
|
|
||||||
// height: popup.height
|
|
||||||
|
|
||||||
// DropShadow
|
|
||||||
// {
|
|
||||||
// anchors.fill: pointedRectangle
|
|
||||||
// radius: 5
|
|
||||||
// color: "#3F000000" // 25% shadow
|
|
||||||
// source: pointedRectangle
|
|
||||||
// transparentBorder: true
|
|
||||||
// verticalOffset: 2
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Item
|
|
||||||
// {
|
|
||||||
// id: pointedRectangle
|
|
||||||
// width: parent.width - 10 * screenScaleFactor // Because of the shadow
|
|
||||||
// height: parent.height - 10 * screenScaleFactor // Because of the shadow
|
|
||||||
// anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
// anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
// Rectangle
|
|
||||||
// {
|
|
||||||
// id: point
|
|
||||||
// height: 14 * screenScaleFactor
|
|
||||||
// width: 14 * screenScaleFactor
|
|
||||||
// color: UM.Theme.getColor("setting_control")
|
|
||||||
// transform: Rotation { angle: 45}
|
|
||||||
// anchors.right: bloop.right
|
|
||||||
// anchors.rightMargin: 24
|
|
||||||
// y: 1
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Rectangle
|
|
||||||
// {
|
|
||||||
// id: bloop
|
|
||||||
// color: UM.Theme.getColor("setting_control")
|
|
||||||
// width: parent.width
|
|
||||||
// anchors.top: parent.top
|
|
||||||
// anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
|
|
||||||
// anchors.bottom: parent.bottom
|
|
||||||
// anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// exit: Transition
|
|
||||||
// {
|
|
||||||
// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
|
||||||
// NumberAnimation { property: "visible"; duration: 75; }
|
|
||||||
// }
|
|
||||||
// enter: Transition
|
|
||||||
// {
|
|
||||||
// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
|
||||||
// NumberAnimation { property: "visible"; duration: 75; }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// onClosed: visible = false
|
|
||||||
// onOpened: visible = true
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Image
|
|
||||||
// {
|
|
||||||
// id: printJobPreview
|
|
||||||
// source: printer.activePrintJob != null ? printer.activePrintJob.previewImageUrl : ""
|
|
||||||
// anchors.top: ownerName.bottom
|
|
||||||
// anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
// width: parent.width / 2
|
|
||||||
// height: width
|
|
||||||
// opacity:
|
|
||||||
// {
|
|
||||||
// if(printer.activePrintJob == null)
|
|
||||||
// {
|
|
||||||
// return 1.0
|
|
||||||
// }
|
|
||||||
|
|
||||||
// switch(printer.activePrintJob.state)
|
|
||||||
// {
|
|
||||||
// case "wait_cleanup":
|
|
||||||
// case "wait_user_action":
|
|
||||||
// case "paused":
|
|
||||||
// return 0.5
|
|
||||||
// default:
|
|
||||||
// return 1.0
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// UM.RecolorImage
|
|
||||||
// {
|
|
||||||
// id: statusImage
|
|
||||||
// anchors.centerIn: printJobPreview
|
|
||||||
// source:
|
|
||||||
// {
|
|
||||||
// if(printer.activePrintJob == null)
|
|
||||||
// {
|
|
||||||
// return ""
|
|
||||||
// }
|
|
||||||
// switch(printer.activePrintJob.state)
|
|
||||||
// {
|
|
||||||
// case "paused":
|
|
||||||
// return "../svg/paused-icon.svg"
|
|
||||||
// case "wait_cleanup":
|
|
||||||
// if(printer.activePrintJob.timeElapsed < printer.activePrintJob.timeTotal)
|
|
||||||
// {
|
|
||||||
// return "../svg/aborted-icon.svg"
|
|
||||||
// }
|
|
||||||
// return "../svg/approved-icon.svg"
|
|
||||||
// case "wait_user_action":
|
|
||||||
// return "../svg/aborted-icon.svg"
|
|
||||||
// default:
|
|
||||||
// return ""
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// visible: source != ""
|
|
||||||
// width: 0.5 * printJobPreview.width
|
|
||||||
// height: 0.5 * printJobPreview.height
|
|
||||||
// sourceSize.width: width
|
|
||||||
// sourceSize.height: height
|
|
||||||
// color: "black"
|
|
||||||
// }
|
|
||||||
|
|
||||||
// CameraButton
|
|
||||||
// {
|
|
||||||
// id: showCameraButton
|
|
||||||
// iconSource: "../svg/camera-icon.svg"
|
|
||||||
// anchors
|
|
||||||
// {
|
|
||||||
// left: parent.left
|
|
||||||
// bottom: printJobPreview.bottom
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
370
plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
Normal file
370
plugins/UM3NetworkPrinting/resources/qml/PrinterCardDetails.qml
Normal file
@ -0,0 +1,370 @@
|
|||||||
|
import QtQuick 2.3
|
||||||
|
import QtQuick.Dialogs 1.1
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import QtQuick.Controls.Styles 1.3
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
import QtQuick.Controls 1.4 as LegacyControls
|
||||||
|
import UM 1.3 as UM
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root;
|
||||||
|
|
||||||
|
property var printer: null;
|
||||||
|
property var printJob: printer.activePrintJob;
|
||||||
|
property var collapsed: true;
|
||||||
|
|
||||||
|
Behavior on height { NumberAnimation { duration: 100 } }
|
||||||
|
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||||
|
|
||||||
|
width: parent.width;
|
||||||
|
height: collapsed ? 0 : childrenRect.height;
|
||||||
|
opacity: collapsed ? 0 : 1;
|
||||||
|
|
||||||
|
Column {
|
||||||
|
height: childrenRect.height;
|
||||||
|
width: parent.width;
|
||||||
|
|
||||||
|
spacing: UM.Theme.getSize("default_margin").height;
|
||||||
|
|
||||||
|
HorizontalLine { enabled: printer.state !== "disabled" }
|
||||||
|
|
||||||
|
PrinterInfoBlock {
|
||||||
|
printer: root.printer;
|
||||||
|
printJob: root.printer.activePrintJob;
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalLine { enabled: printer.state !== "disabled" }
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
color: "orange";
|
||||||
|
width: parent.width;
|
||||||
|
height: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: jobInfoSection;
|
||||||
|
|
||||||
|
property var job: root.printer ? root.printer.activePrintJob : null;
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log(job)
|
||||||
|
}
|
||||||
|
height: visible ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height : 0;
|
||||||
|
width: parent.width;
|
||||||
|
visible: job && job.state != "queued";
|
||||||
|
|
||||||
|
anchors.left: parent.left;
|
||||||
|
// anchors.right: contextButton.left;
|
||||||
|
// anchors.rightMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: printJobName;
|
||||||
|
elide: Text.ElideRight;
|
||||||
|
font: UM.Theme.getFont("default_bold");
|
||||||
|
text: job ? job.name : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: ownerName;
|
||||||
|
anchors.top: job.bottom;
|
||||||
|
elide: Text.ElideRight;
|
||||||
|
font: UM.Theme.getFont("default");
|
||||||
|
opacity: 0.6;
|
||||||
|
text: job ? job.owner : "";
|
||||||
|
width: parent.width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Item {
|
||||||
|
// id: jobInfo;
|
||||||
|
// property var showJobInfo: {
|
||||||
|
// return printer.activePrintJob != null && printer.activePrintJob.state != "queued"
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // anchors {
|
||||||
|
// // top: jobSpacer.bottom
|
||||||
|
// // topMargin: 2 * UM.Theme.getSize("default_margin").height
|
||||||
|
// // left: parent.left
|
||||||
|
// // right: parent.right
|
||||||
|
// // margins: UM.Theme.getSize("default_margin").width
|
||||||
|
// // leftMargin: 2 * UM.Theme.getSize("default_margin").width
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height : 0;
|
||||||
|
// visible: showJobInfo;
|
||||||
|
|
||||||
|
|
||||||
|
// function switchPopupState()
|
||||||
|
// {
|
||||||
|
// popup.visible ? popup.close() : popup.open()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Button
|
||||||
|
// {
|
||||||
|
// id: contextButton
|
||||||
|
// text: "\u22EE" //Unicode; Three stacked points.
|
||||||
|
// width: 35
|
||||||
|
// height: width
|
||||||
|
// anchors
|
||||||
|
// {
|
||||||
|
// right: parent.right
|
||||||
|
// top: parent.top
|
||||||
|
// }
|
||||||
|
// hoverEnabled: true
|
||||||
|
|
||||||
|
// background: Rectangle
|
||||||
|
// {
|
||||||
|
// opacity: contextButton.down || contextButton.hovered ? 1 : 0
|
||||||
|
// width: contextButton.width
|
||||||
|
// height: contextButton.height
|
||||||
|
// radius: 0.5 * width
|
||||||
|
// color: UM.Theme.getColor("viewport_background")
|
||||||
|
// }
|
||||||
|
// contentItem: Label
|
||||||
|
// {
|
||||||
|
// text: contextButton.text
|
||||||
|
// color: UM.Theme.getColor("monitor_tab_text_inactive")
|
||||||
|
// font.pixelSize: 25
|
||||||
|
// verticalAlignment: Text.AlignVCenter
|
||||||
|
// horizontalAlignment: Text.AlignHCenter
|
||||||
|
// }
|
||||||
|
|
||||||
|
// onClicked: parent.switchPopupState()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Popup
|
||||||
|
// {
|
||||||
|
// // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
|
||||||
|
// id: popup
|
||||||
|
// clip: true
|
||||||
|
// closePolicy: Popup.CloseOnPressOutside
|
||||||
|
// x: (parent.width - width) + 26 * screenScaleFactor
|
||||||
|
// y: contextButton.height - 5 * screenScaleFactor // Because shadow
|
||||||
|
// width: 182 * screenScaleFactor
|
||||||
|
// height: contentItem.height + 2 * padding
|
||||||
|
// visible: false
|
||||||
|
// padding: 5 * screenScaleFactor // Because shadow
|
||||||
|
|
||||||
|
// transformOrigin: Popup.Top
|
||||||
|
// contentItem: Item
|
||||||
|
// {
|
||||||
|
// width: popup.width
|
||||||
|
// height: childrenRect.height + 36 * screenScaleFactor
|
||||||
|
// anchors.topMargin: 10 * screenScaleFactor
|
||||||
|
// anchors.bottomMargin: 10 * screenScaleFactor
|
||||||
|
// Button
|
||||||
|
// {
|
||||||
|
// id: pauseButton
|
||||||
|
// text: printer.activePrintJob != null && printer.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
|
||||||
|
// onClicked:
|
||||||
|
// {
|
||||||
|
// if(printer.activePrintJob.state == "paused")
|
||||||
|
// {
|
||||||
|
// printer.activePrintJob.setState("print")
|
||||||
|
// }
|
||||||
|
// else if(printer.activePrintJob.state == "printing")
|
||||||
|
// {
|
||||||
|
// printer.activePrintJob.setState("pause")
|
||||||
|
// }
|
||||||
|
// popup.close()
|
||||||
|
// }
|
||||||
|
// width: parent.width
|
||||||
|
// enabled: printer.activePrintJob != null && ["paused", "printing"].indexOf(printer.activePrintJob.state) >= 0
|
||||||
|
// visible: enabled
|
||||||
|
// anchors.top: parent.top
|
||||||
|
// anchors.topMargin: 18 * screenScaleFactor
|
||||||
|
// height: visible ? 39 * screenScaleFactor : 0 * screenScaleFactor
|
||||||
|
// hoverEnabled: true
|
||||||
|
// background: Rectangle
|
||||||
|
// {
|
||||||
|
// opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
|
||||||
|
// color: UM.Theme.getColor("viewport_background")
|
||||||
|
// }
|
||||||
|
// contentItem: Label
|
||||||
|
// {
|
||||||
|
// text: pauseButton.text
|
||||||
|
// horizontalAlignment: Text.AlignLeft
|
||||||
|
// verticalAlignment: Text.AlignVCenter
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Button
|
||||||
|
// {
|
||||||
|
// id: abortButton
|
||||||
|
// text: catalog.i18nc("@label", "Abort")
|
||||||
|
// onClicked:
|
||||||
|
// {
|
||||||
|
// abortConfirmationDialog.visible = true;
|
||||||
|
// popup.close();
|
||||||
|
// }
|
||||||
|
// width: parent.width
|
||||||
|
// height: 39 * screenScaleFactor
|
||||||
|
// anchors.top: pauseButton.bottom
|
||||||
|
// hoverEnabled: true
|
||||||
|
// enabled: printer.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(printer.activePrintJob.state) >= 0
|
||||||
|
// background: Rectangle
|
||||||
|
// {
|
||||||
|
// opacity: abortButton.down || abortButton.hovered ? 1 : 0
|
||||||
|
// color: UM.Theme.getColor("viewport_background")
|
||||||
|
// }
|
||||||
|
// contentItem: Label
|
||||||
|
// {
|
||||||
|
// text: abortButton.text
|
||||||
|
// horizontalAlignment: Text.AlignLeft
|
||||||
|
// verticalAlignment: Text.AlignVCenter
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// MessageDialog
|
||||||
|
// {
|
||||||
|
// id: abortConfirmationDialog
|
||||||
|
// title: catalog.i18nc("@window:title", "Abort print")
|
||||||
|
// icon: StandardIcon.Warning
|
||||||
|
// text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printer.activePrintJob.name)
|
||||||
|
// standardButtons: StandardButton.Yes | StandardButton.No
|
||||||
|
// Component.onCompleted: visible = false
|
||||||
|
// onYes: printer.activePrintJob.setState("abort")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// background: Item
|
||||||
|
// {
|
||||||
|
// width: popup.width
|
||||||
|
// height: popup.height
|
||||||
|
|
||||||
|
// DropShadow
|
||||||
|
// {
|
||||||
|
// anchors.fill: pointedRectangle
|
||||||
|
// radius: 5
|
||||||
|
// color: "#3F000000" // 25% shadow
|
||||||
|
// source: pointedRectangle
|
||||||
|
// transparentBorder: true
|
||||||
|
// verticalOffset: 2
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Item
|
||||||
|
// {
|
||||||
|
// id: pointedRectangle
|
||||||
|
// width: parent.width - 10 * screenScaleFactor // Because of the shadow
|
||||||
|
// height: parent.height - 10 * screenScaleFactor // Because of the shadow
|
||||||
|
// anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
// anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
// Rectangle
|
||||||
|
// {
|
||||||
|
// id: point
|
||||||
|
// height: 14 * screenScaleFactor
|
||||||
|
// width: 14 * screenScaleFactor
|
||||||
|
// color: UM.Theme.getColor("setting_control")
|
||||||
|
// transform: Rotation { angle: 45}
|
||||||
|
// anchors.right: bloop.right
|
||||||
|
// anchors.rightMargin: 24
|
||||||
|
// y: 1
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Rectangle
|
||||||
|
// {
|
||||||
|
// id: bloop
|
||||||
|
// color: UM.Theme.getColor("setting_control")
|
||||||
|
// width: parent.width
|
||||||
|
// anchors.top: parent.top
|
||||||
|
// anchors.topMargin: 8 * screenScaleFactor // Because of the shadow + point
|
||||||
|
// anchors.bottom: parent.bottom
|
||||||
|
// anchors.bottomMargin: 8 * screenScaleFactor // Because of the shadow
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// exit: Transition
|
||||||
|
// {
|
||||||
|
// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
||||||
|
// NumberAnimation { property: "visible"; duration: 75; }
|
||||||
|
// }
|
||||||
|
// enter: Transition
|
||||||
|
// {
|
||||||
|
// // This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
||||||
|
// NumberAnimation { property: "visible"; duration: 75; }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// onClosed: visible = false
|
||||||
|
// onOpened: visible = true
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Image
|
||||||
|
// {
|
||||||
|
// id: printJobPreview
|
||||||
|
// source: printer.activePrintJob != null ? printer.activePrintJob.previewImageUrl : ""
|
||||||
|
// anchors.top: ownerName.bottom
|
||||||
|
// anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
// width: parent.width / 2
|
||||||
|
// height: width
|
||||||
|
// opacity:
|
||||||
|
// {
|
||||||
|
// if(printer.activePrintJob == null)
|
||||||
|
// {
|
||||||
|
// return 1.0
|
||||||
|
// }
|
||||||
|
|
||||||
|
// switch(printer.activePrintJob.state)
|
||||||
|
// {
|
||||||
|
// case "wait_cleanup":
|
||||||
|
// case "wait_user_action":
|
||||||
|
// case "paused":
|
||||||
|
// return 0.5
|
||||||
|
// default:
|
||||||
|
// return 1.0
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// UM.RecolorImage
|
||||||
|
// {
|
||||||
|
// id: statusImage
|
||||||
|
// anchors.centerIn: printJobPreview
|
||||||
|
// source:
|
||||||
|
// {
|
||||||
|
// if(printer.activePrintJob == null)
|
||||||
|
// {
|
||||||
|
// return ""
|
||||||
|
// }
|
||||||
|
// switch(printer.activePrintJob.state)
|
||||||
|
// {
|
||||||
|
// case "paused":
|
||||||
|
// return "../svg/paused-icon.svg"
|
||||||
|
// case "wait_cleanup":
|
||||||
|
// if(printer.activePrintJob.timeElapsed < printer.activePrintJob.timeTotal)
|
||||||
|
// {
|
||||||
|
// return "../svg/aborted-icon.svg"
|
||||||
|
// }
|
||||||
|
// return "../svg/approved-icon.svg"
|
||||||
|
// case "wait_user_action":
|
||||||
|
// return "../svg/aborted-icon.svg"
|
||||||
|
// default:
|
||||||
|
// return ""
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// visible: source != ""
|
||||||
|
// width: 0.5 * printJobPreview.width
|
||||||
|
// height: 0.5 * printJobPreview.height
|
||||||
|
// sourceSize.width: width
|
||||||
|
// sourceSize.height: height
|
||||||
|
// color: "black"
|
||||||
|
// }
|
||||||
|
|
||||||
|
// CameraButton
|
||||||
|
// {
|
||||||
|
// id: showCameraButton
|
||||||
|
// iconSource: "../svg/camera-icon.svg"
|
||||||
|
// anchors
|
||||||
|
// {
|
||||||
|
// left: parent.left
|
||||||
|
// bottom: printJobPreview.bottom
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
@ -15,6 +15,7 @@ ProgressBar {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
value: progress;
|
value: progress;
|
||||||
|
width: parent.width;
|
||||||
|
|
||||||
style: ProgressBarStyle {
|
style: ProgressBarStyle {
|
||||||
property var remainingTime:
|
property var remainingTime:
|
||||||
|
@ -4,9 +4,8 @@ import UM 1.2 as UM
|
|||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
property alias color: background.color
|
|
||||||
property alias text: familyNameLabel.text
|
property alias text: familyNameLabel.text
|
||||||
property var padding: 0
|
property var padding: 3 * screenScaleFactor; // TODO: Theme!
|
||||||
implicitHeight: familyNameLabel.contentHeight + 2 * padding // Apply the padding to top and bottom.
|
implicitHeight: familyNameLabel.contentHeight + 2 * padding // Apply the padding to top and bottom.
|
||||||
implicitWidth: familyNameLabel.contentWidth + implicitHeight // The extra height is added to ensure the radius doesn't cut something off.
|
implicitWidth: familyNameLabel.contentWidth + implicitHeight // The extra height is added to ensure the radius doesn't cut something off.
|
||||||
Rectangle
|
Rectangle
|
||||||
@ -14,7 +13,7 @@ Item
|
|||||||
id: background
|
id: background
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
color: parent.color
|
color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
radius: 0.5 * height
|
radius: 0.5 * height
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
import QtQuick 2.3
|
||||||
|
import QtQuick.Dialogs 1.1
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import QtQuick.Controls.Styles 1.3
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
import QtQuick.Controls 1.4 as LegacyControls
|
||||||
|
import UM 1.3 as UM
|
||||||
|
|
||||||
|
// Includes printer type pill and extuder configurations
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root;
|
||||||
|
|
||||||
|
property var printer: null;
|
||||||
|
property var printJob: null;
|
||||||
|
|
||||||
|
width: parent.width;
|
||||||
|
height: childrenRect.height;
|
||||||
|
|
||||||
|
// Printer family pills
|
||||||
|
Row {
|
||||||
|
id: printerFamilyPills;
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left;
|
||||||
|
right: parent.right;
|
||||||
|
bottom: extrudersInfo.top;
|
||||||
|
bottomMargin: UM.Theme.getSize("default_margin").height;
|
||||||
|
}
|
||||||
|
height: childrenRect.height;
|
||||||
|
spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
|
||||||
|
width: parent.width;
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: compatiblePills;
|
||||||
|
visible: printJob;
|
||||||
|
model: printJob ? printJob.compatibleMachineFamilies : [];
|
||||||
|
delegate: PrinterFamilyPill { text: modelData; }
|
||||||
|
}
|
||||||
|
|
||||||
|
PrinterFamilyPill {
|
||||||
|
visible: !compatiblePills.visible && printer;
|
||||||
|
text: printer.type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extruder info
|
||||||
|
Row {
|
||||||
|
id: extrudersInfo;
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
left: parent.left;
|
||||||
|
right: parent.right;
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
}
|
||||||
|
height: childrenRect.height;
|
||||||
|
spacing: UM.Theme.getSize("default_margin").width;
|
||||||
|
width: parent.width;
|
||||||
|
|
||||||
|
PrintCoreConfiguration {
|
||||||
|
width: Math.round(parent.width / 2) * screenScaleFactor;
|
||||||
|
printCoreConfiguration: getExtruderConfig(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintCoreConfiguration {
|
||||||
|
width: Math.round(parent.width / 2) * screenScaleFactor;
|
||||||
|
printCoreConfiguration: getExtruderConfig(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getExtruderConfig( i ) {
|
||||||
|
if (root.printJob) {
|
||||||
|
// Use more-specific print job if possible
|
||||||
|
return root.printJob.configuration.extruderConfigurations[i];
|
||||||
|
} else {
|
||||||
|
if (root.printer) {
|
||||||
|
return root.printer.printerConfiguration.extruderConfigurations[i];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user