mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 04:54:04 -06:00
CURA-4341 use existing signals instead to update topbar monitoring
This commit is contained in:
parent
ce390b50e7
commit
07161f5d50
2 changed files with 15 additions and 23 deletions
|
@ -23,17 +23,10 @@ UM.MainWindow
|
|||
Connections
|
||||
{
|
||||
target: Printer
|
||||
onShowPrintMonitor:
|
||||
{
|
||||
topbar.monitoringChanged(show)
|
||||
|
||||
if (show)
|
||||
{
|
||||
|
||||
onShowPrintMonitor: {
|
||||
if (show) {
|
||||
topbar.startMonitoringPrint()
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
topbar.stopMonitoringPrint()
|
||||
}
|
||||
}
|
||||
|
@ -352,17 +345,13 @@ UM.MainWindow
|
|||
}
|
||||
}
|
||||
|
||||
function isMonitoringPrint () {
|
||||
return base.showPrintMonitor
|
||||
}
|
||||
|
||||
Topbar
|
||||
{
|
||||
id: topbar
|
||||
anchors.left:parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
monitoringPrint: isMonitoringPrint()
|
||||
monitoringPrint: base.showPrintMonitor
|
||||
onStartMonitoringPrint: base.showPrintMonitor = true
|
||||
onStopMonitoringPrint: base.showPrintMonitor = false
|
||||
}
|
||||
|
|
|
@ -22,19 +22,22 @@ Rectangle
|
|||
|
||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||
|
||||
// monitoring status
|
||||
property bool monitoringPrint
|
||||
|
||||
// incoming signal
|
||||
function monitoringChanged (isNowMonitoring) {
|
||||
monitoringPrint = isNowMonitoring
|
||||
}
|
||||
property bool monitoringPrint: false
|
||||
|
||||
// outgoing signal
|
||||
signal startMonitoringPrint()
|
||||
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
|
||||
{
|
||||
id: catalog
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue