mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 15:33:16 +08:00
CURA-4341 use existing signals instead to update topbar monitoring
This commit is contained in:
parent
ce390b50e7
commit
07161f5d50
@ -23,17 +23,10 @@ UM.MainWindow
|
|||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: Printer
|
target: Printer
|
||||||
onShowPrintMonitor:
|
onShowPrintMonitor: {
|
||||||
{
|
if (show) {
|
||||||
topbar.monitoringChanged(show)
|
|
||||||
|
|
||||||
if (show)
|
|
||||||
{
|
|
||||||
|
|
||||||
topbar.startMonitoringPrint()
|
topbar.startMonitoringPrint()
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
topbar.stopMonitoringPrint()
|
topbar.stopMonitoringPrint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,17 +345,13 @@ UM.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMonitoringPrint () {
|
|
||||||
return base.showPrintMonitor
|
|
||||||
}
|
|
||||||
|
|
||||||
Topbar
|
Topbar
|
||||||
{
|
{
|
||||||
id: topbar
|
id: topbar
|
||||||
anchors.left:parent.left
|
anchors.left:parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
monitoringPrint: isMonitoringPrint()
|
monitoringPrint: base.showPrintMonitor
|
||||||
onStartMonitoringPrint: base.showPrintMonitor = true
|
onStartMonitoringPrint: base.showPrintMonitor = true
|
||||||
onStopMonitoringPrint: base.showPrintMonitor = false
|
onStopMonitoringPrint: base.showPrintMonitor = false
|
||||||
}
|
}
|
||||||
|
@ -22,19 +22,22 @@ Rectangle
|
|||||||
|
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||||
|
property bool monitoringPrint: false
|
||||||
// monitoring status
|
|
||||||
property bool monitoringPrint
|
|
||||||
|
|
||||||
// incoming signal
|
|
||||||
function monitoringChanged (isNowMonitoring) {
|
|
||||||
monitoringPrint = isNowMonitoring
|
|
||||||
}
|
|
||||||
|
|
||||||
// outgoing signal
|
// outgoing signal
|
||||||
signal startMonitoringPrint()
|
signal startMonitoringPrint()
|
||||||
signal stopMonitoringPrint()
|
signal stopMonitoringPrint()
|
||||||
|
|
||||||
|
// update monitoring status when event was triggered outside topbar
|
||||||
|
Component.onCompleted: {
|
||||||
|
startMonitoringPrint.connect(function () {
|
||||||
|
base.monitoringPrint = true
|
||||||
|
})
|
||||||
|
stopMonitoringPrint.connect(function () {
|
||||||
|
base.monitoringPrint = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
UM.I18nCatalog
|
UM.I18nCatalog
|
||||||
{
|
{
|
||||||
id: catalog
|
id: catalog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user