mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-05 14:54:33 +08:00

Now with unified style as agreed upon by Simon & Ian. Rules: - ID before all other props. - All props before children. - All props after ID in alphabetical order. - Empty line between children. - Semi-colons. Note: I didn't touch the DiscoverUM3Action because that's it's whole own UI part.
46 lines
1.7 KiB
QML
46 lines
1.7 KiB
QML
// Copyright (c) 2018 Ultimaker B.V.
|
|
// Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.2
|
|
import UM 1.3 as UM
|
|
import Cura 1.0 as Cura
|
|
|
|
Component {
|
|
Item {
|
|
height: maximumHeight;
|
|
width: maximumWidth;
|
|
|
|
Image {
|
|
id: cameraImage;
|
|
anchors {
|
|
horizontalCenter: parent.horizontalCenter;
|
|
verticalCenter: parent.verticalCenter;
|
|
}
|
|
Component.onCompleted: {
|
|
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
|
|
OutputDevice.activePrinter.camera.start();
|
|
}
|
|
}
|
|
height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width);
|
|
onVisibleChanged: {
|
|
if (visible) {
|
|
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
|
|
OutputDevice.activePrinter.camera.start();
|
|
}
|
|
} else {
|
|
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
|
|
OutputDevice.activePrinter.camera.stop();
|
|
}
|
|
}
|
|
}
|
|
source: {
|
|
if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) {
|
|
return OutputDevice.activePrinter.camera.latestImage;
|
|
}
|
|
return "";
|
|
}
|
|
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth);
|
|
z: 1;
|
|
}
|
|
}
|
|
} |