mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Replace NetworkCamera with NetworkMJPGImage
This commit is contained in:
parent
890ddc015e
commit
c187b6a25c
5 changed files with 30 additions and 47 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue