From 07161f5d5018f122d5b62fa8d9ca2b636fae032e Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Fri, 22 Sep 2017 13:40:55 +0200 Subject: [PATCH] CURA-4341 use existing signals instead to update topbar monitoring --- resources/qml/Cura.qml | 19 ++++--------------- resources/qml/Topbar.qml | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 702864f01b..5877656acc 100755 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -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 } diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 4cd684339f..5e208a40b4 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -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