mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 01:09:00 +08:00
Use new context menu
Contributes to CL-1165
This commit is contained in:
parent
cdc24081a5
commit
548882e398
@ -156,10 +156,9 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MonitorContextMenuButton
|
||||||
PrintJobContextMenu
|
|
||||||
{
|
{
|
||||||
id: contextButton
|
id: contextMenuButton
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
right: parent.right
|
right: parent.right
|
||||||
@ -167,16 +166,49 @@ Item
|
|||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: 12 * screenScaleFactor // TODO: Theme!
|
topMargin: 12 * screenScaleFactor // TODO: Theme!
|
||||||
}
|
}
|
||||||
printJob: printer ? printer.activePrintJob : null
|
|
||||||
width: 36 * screenScaleFactor // TODO: Theme!
|
width: 36 * screenScaleFactor // TODO: Theme!
|
||||||
height: 36 * screenScaleFactor // TODO: Theme!
|
height: 36 * screenScaleFactor // TODO: Theme!
|
||||||
// enabled: base.enabled
|
// enabled: base.enabled
|
||||||
enabled: false
|
enabled: false
|
||||||
visible: printer
|
onClicked: enabled ? contextMenu.switchPopupState() : {}
|
||||||
|
visible:
|
||||||
|
{
|
||||||
|
if (!printer || !printer.activePrintJob) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
var states = ["queued", "sent_to_printer", "pre_print", "printing", "pausing", "paused", "resuming"]
|
||||||
|
return states.indexOf(printer.activePrintJob.state) !== -1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MonitorPrinterContextMenu
|
||||||
|
{
|
||||||
|
id: contextMenu
|
||||||
|
printJob: printer ? printer.activePrintJob : null
|
||||||
|
target: contextMenuButton
|
||||||
|
}
|
||||||
|
|
||||||
|
// For cloud printing, add this mouse area over the disabled contextButton to indicate that it's not available
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
id: contextMenuDisabledButtonArea
|
||||||
|
anchors.fill: contextMenuButton
|
||||||
|
hoverEnabled: contextMenuButton.visible && !contextMenuButton.enabled
|
||||||
|
onEntered: contextMenuDisabledInfo.open()
|
||||||
|
onExited: contextMenuDisabledInfo.close()
|
||||||
|
enabled: !contextMenuButton.enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
MonitorInfoBlurb
|
||||||
|
{
|
||||||
|
id: contextMenuDisabledInfo
|
||||||
|
text: catalog.i18nc("@info", "These options are not available because you are monitoring a cloud printer.")
|
||||||
|
target: contextMenuButton
|
||||||
|
}
|
||||||
|
|
||||||
CameraButton
|
CameraButton
|
||||||
{
|
{
|
||||||
id: cameraButton;
|
id: cameraButton
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
right: parent.right
|
right: parent.right
|
||||||
@ -189,6 +221,24 @@ Item
|
|||||||
enabled: false
|
enabled: false
|
||||||
visible: printer
|
visible: printer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For cloud printing, add this mouse area over the disabled cameraButton to indicate that it's not available
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
id: cameraDisabledButtonArea
|
||||||
|
anchors.fill: cameraButton
|
||||||
|
hoverEnabled: cameraButton.visible && !cameraButton.enabled
|
||||||
|
onEntered: cameraDisabledInfo.open()
|
||||||
|
onExited: cameraDisabledInfo.close()
|
||||||
|
enabled: !cameraButton.enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
MonitorInfoBlurb
|
||||||
|
{
|
||||||
|
id: cameraDisabledInfo
|
||||||
|
text: catalog.i18nc("@info", "The webcam is not available because you are monitoring a cloud printer.")
|
||||||
|
target: cameraButton
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user