Disable printer cards which are not in focus

Contributes to CL-1151
This commit is contained in:
Ian Paschal 2018-12-14 16:55:48 +01:00
parent 2112681217
commit e877b47e22
4 changed files with 25 additions and 8 deletions

View file

@ -8,11 +8,13 @@ import UM 1.3 as UM
import Cura 1.0 as Cura
Rectangle {
id: base
property var iconSource: null;
color: "#0a0850" // TODO: Theme!
height: width;
radius: Math.round(0.5 * width);
width: 24 * screenScaleFactor;
property var enabled: true
UM.RecolorImage {
id: icon;
@ -29,12 +31,18 @@ Rectangle {
MouseArea {
id: clickArea;
anchors.fill: parent;
hoverEnabled: true;
hoverEnabled: base.enabled
onClicked: {
if (OutputDevice.activeCameraUrl != "") {
OutputDevice.setActiveCameraUrl("");
} else {
OutputDevice.setActiveCameraUrl(modelData.cameraUrl);
if (base.enabled)
{
if (OutputDevice.activeCameraUrl != "")
{
OutputDevice.setActiveCameraUrl("")
}
else
{
OutputDevice.setActiveCameraUrl(modelData.cameraUrl)
}
}
}
}

View file

@ -124,6 +124,7 @@ Item
MonitorPrinterCard
{
printer: modelData
enabled: model.index == currentIndex
}
}
}

View file

@ -25,6 +25,11 @@ Item
property var borderSize: 1 * screenScaleFactor // TODO: Theme, and remove from here
// If the printer card's controls are enabled. This is used by the carousel
// to prevent opening the context menu or camera while the printer card is not
// "in focus"
property var enabled: true
width: 834 * screenScaleFactor // TODO: Theme!
height: childrenRect.height
@ -124,6 +129,7 @@ Item
printJob: printer.activePrintJob
width: 36 * screenScaleFactor // TODO: Theme!
height: 36 * screenScaleFactor // TODO: Theme!
enabled: base.enabled
}
CameraButton
{
@ -136,6 +142,7 @@ Item
bottomMargin: 20 * screenScaleFactor // TODO: Theme!
}
iconSource: "../svg/icons/camera.svg"
enabled: base.enabled
}
}
@ -320,7 +327,7 @@ Item
implicitHeight: 32 * screenScaleFactor // TODO: Theme!
implicitWidth: 96 * screenScaleFactor // TODO: Theme!
visible: printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0
onClicked: overrideConfirmationDialog.open()
onClicked: base.enabled ? overrideConfirmationDialog.open() : {}
}
}

View file

@ -13,6 +13,7 @@ Item {
property var printJob: null;
property var started: isStarted(printJob);
property var assigned: isAssigned(printJob);
property var enabled: true
Button {
id: button;
@ -31,8 +32,8 @@ Item {
verticalAlignment: Text.AlignVCenter;
}
height: width;
hoverEnabled: true;
onClicked: parent.switchPopupState();
hoverEnabled: base.enabled
onClicked: base.enabled ? parent.switchPopupState() : {}
text: "\u22EE"; //Unicode; Three stacked points.
visible: {
if (!printJob) {