mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-24 03:11:03 -07:00
Merge branch 'ui_rework_4_0' into cura4.0_header
This commit is contained in:
commit
ef0ba81564
132 changed files with 14801 additions and 11456 deletions
|
|
@ -31,10 +31,10 @@ Rectangle {
|
|||
anchors.fill: parent;
|
||||
hoverEnabled: true;
|
||||
onClicked: {
|
||||
if (OutputDevice.activeCamera !== null) {
|
||||
OutputDevice.setActiveCamera(null)
|
||||
if (OutputDevice.activeCameraUrl != "") {
|
||||
OutputDevice.setActiveCameraUrl("");
|
||||
} else {
|
||||
OutputDevice.setActiveCamera(modelData.camera);
|
||||
OutputDevice.setActiveCameraUrl(modelData.cameraUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Component {
|
|||
height: maximumHeight;
|
||||
onVisibleChanged: {
|
||||
if (monitorFrame != null && !monitorFrame.visible) {
|
||||
OutputDevice.setActiveCamera(null);
|
||||
OutputDevice.setActiveCameraUrl("");
|
||||
}
|
||||
}
|
||||
width: maximumWidth;
|
||||
|
|
@ -125,8 +125,8 @@ Component {
|
|||
|
||||
PrinterVideoStream {
|
||||
anchors.fill: parent;
|
||||
camera: OutputDevice.activeCamera;
|
||||
visible: OutputDevice.activeCamera != null;
|
||||
cameraUrl: OutputDevice.activeCameraUrl;
|
||||
visible: OutputDevice.activeCameraUrl != "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,43 +10,36 @@ Component {
|
|||
height: maximumHeight;
|
||||
width: maximumWidth;
|
||||
|
||||
Cura.CameraView {
|
||||
Cura.NetworkMJPGImage {
|
||||
id: cameraImage;
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter;
|
||||
verticalCenter: parent.verticalCenter;
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
|
||||
OutputDevice.activePrinter.camera.start();
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.cameraUrl != null) {
|
||||
cameraImage.start();
|
||||
}
|
||||
}
|
||||
height: Math.floor((imageHeight === 0 ? 600 * screenScaleFactor : imageHeight) * width / imageWidth);
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
|
||||
OutputDevice.activePrinter.camera.start();
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.cameraUrl != null) {
|
||||
cameraImage.start();
|
||||
}
|
||||
} else {
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
|
||||
OutputDevice.activePrinter.camera.stop();
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.cameraUrl != null) {
|
||||
cameraImage.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
source: {
|
||||
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.cameraUrl != null) {
|
||||
return OutputDevice.activePrinter.cameraUrl;
|
||||
}
|
||||
}
|
||||
width: Math.min(imageWidth === 0 ? 800 * screenScaleFactor : imageWidth, maximumWidth);
|
||||
z: 1;
|
||||
|
||||
Connections
|
||||
{
|
||||
target: OutputDevice.activePrinter.camera;
|
||||
onNewImage:
|
||||
{
|
||||
if (cameraImage.visible) {
|
||||
cameraImage.image = OutputDevice.activePrinter.camera.latestImage;
|
||||
cameraImage.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ Item {
|
|||
id: root;
|
||||
property var printJob: null;
|
||||
property var running: isRunning(printJob);
|
||||
property var assigned: isAssigned(printJob);
|
||||
|
||||
Button {
|
||||
id: button;
|
||||
|
|
@ -33,6 +34,7 @@ Item {
|
|||
hoverEnabled: true;
|
||||
onClicked: parent.switchPopupState();
|
||||
text: "\u22EE"; //Unicode; Three stacked points.
|
||||
visible: printJob.state == "queued" || running ? true : false;
|
||||
width: 35 * screenScaleFactor; // TODO: Theme!
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +103,7 @@ Item {
|
|||
|
||||
PrintJobContextMenuItem {
|
||||
enabled: {
|
||||
if (printJob && !running) {
|
||||
if (printJob && printJob.state == "queued" && !assigned) {
|
||||
if (OutputDevice && OutputDevice.queuedPrintJobs[0]) {
|
||||
return OutputDevice.queuedPrintJobs[0].key != printJob.key;
|
||||
}
|
||||
|
|
@ -209,4 +211,10 @@ Item {
|
|||
}
|
||||
return ["paused", "printing", "pre_print"].indexOf(job.state) !== -1;
|
||||
}
|
||||
function isAssigned(job) {
|
||||
if (!job) {
|
||||
return false;
|
||||
}
|
||||
return job.assignedPrinter ? true : false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,24 +46,26 @@ Item {
|
|||
width: parent.width - 2 * shadowRadius;
|
||||
|
||||
Column {
|
||||
id: cardContents;
|
||||
height: childrenRect.height;
|
||||
width: parent.width;
|
||||
|
||||
// Main card
|
||||
Item {
|
||||
id: mainCard;
|
||||
height: 60 * screenScaleFactor + 2 * UM.Theme.getSize("default_margin").width;
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: UM.Theme.getSize("default_margin").width;
|
||||
right: parent.right;
|
||||
rightMargin: UM.Theme.getSize("default_margin").width;
|
||||
}
|
||||
height: 60 * screenScaleFactor + 2 * UM.Theme.getSize("default_margin").height;
|
||||
width: parent.width;
|
||||
|
||||
// Machine icon
|
||||
Item {
|
||||
id: machineIcon;
|
||||
anchors {
|
||||
leftMargin: UM.Theme.getSize("wide_margin").width;
|
||||
top: parent.top;
|
||||
left: parent.left;
|
||||
margins: UM.Theme.getSize("default_margin").width;
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
height: parent.height - 2 * UM.Theme.getSize("default_margin").width;
|
||||
width: height;
|
||||
|
||||
|
|
@ -108,7 +110,7 @@ Item {
|
|||
id: printerInfo;
|
||||
anchors {
|
||||
left: machineIcon.right;
|
||||
leftMargin: UM.Theme.getSize("default_margin").width;
|
||||
leftMargin: UM.Theme.getSize("wide_margin").width;
|
||||
right: collapseIcon.left;
|
||||
verticalCenter: machineIcon.verticalCenter;
|
||||
}
|
||||
|
|
@ -222,7 +224,6 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Detailed card
|
||||
PrinterCardDetails {
|
||||
collapsed: root.collapsed;
|
||||
|
|
@ -233,6 +234,7 @@ Item {
|
|||
// Progress bar
|
||||
PrinterCardProgressBar {
|
||||
visible: printer && printer.activePrintJob != null;
|
||||
width: parent.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Item {
|
|||
right: parent.right;
|
||||
rightMargin: UM.Theme.getSize("default_margin").width;
|
||||
}
|
||||
height: childrenRect.height + UM.Theme.getSize("wide_margin").height;
|
||||
height: childrenRect.height + UM.Theme.getSize("default_margin").height;
|
||||
spacing: UM.Theme.getSize("default_margin").height;
|
||||
width: parent.width;
|
||||
|
||||
|
|
@ -39,9 +39,7 @@ Item {
|
|||
printJob: root.printer ? root.printer.activePrintJob : null;
|
||||
}
|
||||
|
||||
HorizontalLine {
|
||||
visible: root.printJob;
|
||||
}
|
||||
HorizontalLine {}
|
||||
|
||||
Row {
|
||||
height: childrenRect.height;
|
||||
|
|
@ -61,24 +59,17 @@ Item {
|
|||
visible: printJob;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PrintJobPreview {
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
job: root.printer && root.printer.activePrintJob ? root.printer.activePrintJob : null;
|
||||
visible: root.printJob;
|
||||
}
|
||||
}
|
||||
|
||||
CameraButton {
|
||||
id: showCameraButton;
|
||||
anchors {
|
||||
bottom: contentColumn.bottom;
|
||||
bottomMargin: Math.round(1.5 * UM.Theme.getSize("default_margin").height);
|
||||
left: contentColumn.left;
|
||||
leftMargin: Math.round(0.5 * UM.Theme.getSize("default_margin").width);
|
||||
CameraButton {
|
||||
id: showCameraButton;
|
||||
iconSource: "../svg/camera-icon.svg";
|
||||
visible: root.printer;
|
||||
}
|
||||
iconSource: "../svg/camera-icon.svg";
|
||||
visible: root.printJob;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import UM 1.3 as UM
|
|||
import Cura 1.0 as Cura
|
||||
|
||||
Item {
|
||||
property var camera: null;
|
||||
property var cameraUrl: "";
|
||||
|
||||
Rectangle {
|
||||
anchors.fill:parent;
|
||||
|
|
@ -18,7 +18,7 @@ Item {
|
|||
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
onClicked: OutputDevice.setActiveCamera(null);
|
||||
onClicked: OutputDevice.setActiveCameraUrl("");
|
||||
z: 0;
|
||||
}
|
||||
|
||||
|
|
@ -34,33 +34,23 @@ Item {
|
|||
z: 999;
|
||||
}
|
||||
|
||||
Cura.CameraView {
|
||||
Cura.NetworkMJPGImage {
|
||||
id: cameraImage
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
height: Math.round((imageHeight === 0 ? 600 * screenScaleFactor : imageHeight) * width / imageWidth);
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
if (camera != null) {
|
||||
camera.start();
|
||||
if (cameraUrl != "") {
|
||||
start();
|
||||
}
|
||||
} else {
|
||||
if (camera != null) {
|
||||
camera.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: camera
|
||||
onNewImage: {
|
||||
if (cameraImage.visible) {
|
||||
cameraImage.image = camera.latestImage;
|
||||
cameraImage.update();
|
||||
if (cameraUrl != "") {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
source: cameraUrl
|
||||
width: Math.min(imageWidth === 0 ? 800 * screenScaleFactor : imageWidth, maximumWidth);
|
||||
z: 1
|
||||
}
|
||||
|
|
@ -68,7 +58,7 @@ Item {
|
|||
MouseArea {
|
||||
anchors.fill: cameraImage;
|
||||
onClicked: {
|
||||
OutputDevice.setActiveCamera(null);
|
||||
OutputDevice.setActiveCameraUrl("");
|
||||
}
|
||||
z: 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue