mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 09:47:50 -06:00
Use new context menu
Contributes to CL-1165
This commit is contained in:
parent
cdc24081a5
commit
548882e398
1 changed files with 56 additions and 6 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue