From 4cde6c05ae1f5e948075956f224c902b0fa409fb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 7 Sep 2018 15:23:09 +0200 Subject: [PATCH] Switch most usages of containerStackId to containerStack for settingPropertyProvider This mostly makes the code a bit more logic and also decreases the number of searches in the registry --- .../MachineSettingsAction.qml | 14 ++++++++------ .../PerObjectSettingsPanel.qml | 7 +++---- .../PostProcessingPlugin/PostProcessingPlugin.qml | 2 +- resources/qml/Cura.qml | 4 ++-- resources/qml/Menus/ContextMenu.qml | 2 +- resources/qml/MonitorSidebar.qml | 4 ++-- resources/qml/PrepareSidebar.qml | 4 ++-- resources/qml/PrintMonitor.qml | 6 +++--- resources/qml/PrinterOutput/ExtruderBox.qml | 2 +- resources/qml/Settings/SettingItem.qml | 2 +- resources/qml/SidebarHeader.qml | 2 +- resources/qml/SidebarSimple.qml | 9 ++++----- 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.qml b/plugins/MachineSettingsAction/MachineSettingsAction.qml index b12f8f8696..8c2262b5b7 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.qml +++ b/plugins/MachineSettingsAction/MachineSettingsAction.qml @@ -16,6 +16,8 @@ Cura.MachineAction property var extrudersModel: Cura.ExtrudersModel{} property int extruderTabsCount: 0 + property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : "" + Connections { target: base.extrudersModel @@ -511,7 +513,7 @@ Cura.MachineAction } return ""; } - return Cura.MachineManager.activeMachineId; + return base.activeMachineId } key: settingKey watchedProperties: [ "value", "description" ] @@ -564,7 +566,7 @@ Cura.MachineAction } return ""; } - return Cura.MachineManager.activeMachineId; + return base.activeMachineId } key: settingKey watchedProperties: [ "value", "description" ] @@ -655,7 +657,7 @@ Cura.MachineAction } return ""; } - return Cura.MachineManager.activeMachineId; + return base.activeMachineId } key: settingKey watchedProperties: [ "value", "options", "description" ] @@ -754,7 +756,7 @@ Cura.MachineAction } return ""; } - return Cura.MachineManager.activeMachineId; + return base.activeMachineId } key: settingKey watchedProperties: [ "value", "description" ] @@ -879,7 +881,7 @@ Cura.MachineAction { id: machineExtruderCountProvider - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: base.activeMachineId key: "machine_extruder_count" watchedProperties: [ "value", "description" ] storeIndex: manager.containerIndex @@ -889,7 +891,7 @@ Cura.MachineAction { id: machineHeadPolygonProvider - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: base.acthiveMachineId key: "machine_head_with_fans_polygon" watchedProperties: [ "value" ] storeIndex: manager.containerIndex diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index a2790dcf08..596fbd2e99 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -17,7 +17,6 @@ Item { width: childrenRect.width; height: childrenRect.height; - property var all_categories_except_support: [ "machine_settings", "resolution", "shell", "infill", "material", "speed", "travel", "cooling", "platform_adhesion", "dual", "meshfix", "blackmagic", "experimental"] @@ -45,7 +44,7 @@ Item { UM.SettingPropertyProvider { id: meshTypePropertyProvider - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine watchedProperties: [ "enabled" ] } @@ -518,7 +517,7 @@ Item { { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_extruder_count" watchedProperties: [ "value" ] storeIndex: 0 @@ -528,7 +527,7 @@ Item { { id: printSequencePropertyProvider - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "print_sequence" watchedProperties: [ "value" ] storeIndex: 0 diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index b8d7258ef2..e91fc73cf4 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -384,7 +384,7 @@ UM.Dialog UM.SettingPropertyProvider { id: inheritStackProvider - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: model.key ? model.key : "None" watchedProperties: [ "limit_to_extruder" ] } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index c22fea38b4..b9febdeb32 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -306,7 +306,7 @@ UM.MainWindow { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_extruder_count" watchedProperties: [ "value" ] storeIndex: 0 @@ -1054,7 +1054,7 @@ UM.MainWindow { restart(); } - else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "") + else if(Cura.MachineManager.activeMachine == null) { addMachineDialog.open(); } diff --git a/resources/qml/Menus/ContextMenu.qml b/resources/qml/Menus/ContextMenu.qml index e35aef5f20..1ea402d815 100644 --- a/resources/qml/Menus/ContextMenu.qml +++ b/resources/qml/Menus/ContextMenu.qml @@ -103,7 +103,7 @@ Menu { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_extruder_count" watchedProperties: [ "value" ] } diff --git a/resources/qml/MonitorSidebar.qml b/resources/qml/MonitorSidebar.qml index b761b05380..80bd5c1a2e 100644 --- a/resources/qml/MonitorSidebar.qml +++ b/resources/qml/MonitorSidebar.qml @@ -181,7 +181,7 @@ Rectangle { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_extruder_count" watchedProperties: [ "value" ] storeIndex: 0 @@ -191,7 +191,7 @@ Rectangle { id: machineHeatedBed - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_heated_bed" watchedProperties: [ "value" ] storeIndex: 0 diff --git a/resources/qml/PrepareSidebar.qml b/resources/qml/PrepareSidebar.qml index 703cbb8844..78b6a22ef9 100644 --- a/resources/qml/PrepareSidebar.qml +++ b/resources/qml/PrepareSidebar.qml @@ -595,7 +595,7 @@ Rectangle { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_extruder_count" watchedProperties: [ "value" ] storeIndex: 0 @@ -605,7 +605,7 @@ Rectangle { id: machineHeatedBed - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_heated_bed" watchedProperties: [ "value" ] storeIndex: 0 diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 7727f9cb52..3bfcea7025 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -78,18 +78,18 @@ Column UM.SettingPropertyProvider { id: bedTemperature - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "material_bed_temperature" watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"] storeIndex: 0 - property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None" + property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None" } UM.SettingPropertyProvider { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_extruder_count" watchedProperties: ["value"] } diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index 56c86f1034..f0abd4cd6c 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -23,7 +23,7 @@ Item watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"] storeIndex: 0 - property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None" + property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None" } Rectangle diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 48b3cd306d..34bf9df921 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -139,7 +139,7 @@ Item { { id: linkedSettingIcon; - visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon + visible: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon height: parent.height; width: height; diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 6ee33dd2f2..02bcfde29a 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -607,7 +607,7 @@ Column { id: machineExtruderCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "machine_extruder_count" watchedProperties: [ "value" ] storeIndex: 0 diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 4b229d9807..e962d7fc8f 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -20,7 +20,6 @@ Item property variant minimumPrintTime: PrintInformation.minimumPrintTime; property variant maximumPrintTime: PrintInformation.maximumPrintTime; property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 - Component.onCompleted: PrintInformation.enabled = true Component.onDestruction: PrintInformation.enabled = false UM.I18nCatalog { id: catalog; name: "cura" } @@ -1116,7 +1115,7 @@ Item UM.SettingPropertyProvider { id: platformAdhesionType - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "adhesion_type" watchedProperties: [ "value", "enabled" ] storeIndex: 0 @@ -1125,7 +1124,7 @@ Item UM.SettingPropertyProvider { id: supportEnabled - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "support_enable" watchedProperties: [ "value", "enabled", "description" ] storeIndex: 0 @@ -1134,7 +1133,7 @@ Item UM.SettingPropertyProvider { id: extrudersEnabledCount - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "extruders_enabled_count" watchedProperties: [ "value" ] storeIndex: 0 @@ -1143,7 +1142,7 @@ Item UM.SettingPropertyProvider { id: supportExtruderNr - containerStackId: Cura.MachineManager.activeMachineId + containerStack: Cura.MachineManager.activeMachine key: "support_extruder_nr" watchedProperties: [ "value" ] storeIndex: 0