From 6e5e5152beb2cd20bb63c512f92d013e477d4d2f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 10:14:47 +0100 Subject: [PATCH 01/21] Change machine actions buttons to secondaryButtons CURA-8949 --- resources/qml/Preferences/MachinesPage.qml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 48f53169f3..419c3abe0d 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -85,10 +85,14 @@ UM.ManagementPage { id: machineActions visible: currentItem && currentItem.id == Cura.MachineManager.activeMachine.id - anchors.left: parent.left - anchors.right: parent.right - anchors.top: machineName.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors + { + left: parent.left + right: parent.right + top: machineName.bottom + topMargin: UM.Theme.getSize("default_margin").height + } + spacing: UM.Theme.getSize("default_margin").height Repeater { @@ -99,7 +103,7 @@ UM.ManagementPage { width: Math.round(childrenRect.width + 2 * screenScaleFactor) height: childrenRect.height - Button + Cura.SecondaryButton { text: machineActionRepeater.model[index].label onClicked: From ee7bcc3f5f386704a0f0e6b44722c25084f031cf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 10:27:08 +0100 Subject: [PATCH 02/21] Use UM checkbox CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 42 +++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 243dc384b7..8b9f465dea 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -314,7 +314,7 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "Slice automatically when changing settings.") - Cura.CheckBox + UM.CheckBox { id: autoSliceCheckbox checked: boolCheck(UM.Preferences.getValue("general/auto_slice")) @@ -344,7 +344,7 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "Highlight unsupported areas of the model in red. Without support these areas will not print properly.") - Cura.CheckBox + UM.CheckBox { id: showOverhangCheckbox @@ -363,7 +363,7 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "Highlight missing or extraneous surfaces of the model using warning signs. The toolpaths will often be missing parts of the intended geometry.") - Cura.CheckBox + UM.CheckBox { id: showXrayErrorCheckbox @@ -380,7 +380,7 @@ UM.PreferencesPage height: childrenRect.height; text: catalog.i18nc("@info:tooltip", "Moves the camera so the model is in the center of the view when a model is selected") - Cura.CheckBox + UM.CheckBox { id: centerOnSelectCheckbox text: catalog.i18nc("@action:button","Center camera when item is selected"); @@ -395,7 +395,7 @@ UM.PreferencesPage height: childrenRect.height; text: catalog.i18nc("@info:tooltip", "Should the default zoom behavior of cura be inverted?") - Cura.CheckBox + UM.CheckBox { id: invertZoomCheckbox text: catalog.i18nc("@action:button", "Invert the direction of camera zoom."); @@ -416,7 +416,7 @@ UM.PreferencesPage height: childrenRect.height; text: zoomToMouseCheckbox.enabled ? catalog.i18nc("@info:tooltip", "Should zooming move in the direction of the mouse?") : catalog.i18nc("@info:tooltip", "Zooming towards the mouse is not supported in the orthographic perspective.") - Cura.CheckBox + UM.CheckBox { id: zoomToMouseCheckbox text: catalog.i18nc("@action:button", "Zoom toward mouse direction") @@ -447,7 +447,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip", "Should models on the platform be moved so that they no longer intersect?") - Cura.CheckBox + UM.CheckBox { id: pushFreeCheckbox text: catalog.i18nc("@option:check", "Ensure models are kept apart") @@ -461,7 +461,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip", "Should models on the platform be moved down to touch the build plate?") - Cura.CheckBox + UM.CheckBox { id: dropDownCheckbox text: catalog.i18nc("@option:check", "Automatically drop models to the build plate") @@ -478,7 +478,7 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip","Show caution message in g-code reader.") - Cura.CheckBox + UM.CheckBox { id: gcodeShowCautionCheckbox @@ -495,7 +495,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip", "Should layer be forced into compatibility mode?") - Cura.CheckBox + UM.CheckBox { id: forceLayerViewCompatibilityModeCheckbox text: catalog.i18nc("@option:check", "Force layer view compatibility mode (restart required)") @@ -510,7 +510,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip", "Should Cura open at the location it was closed?") - Cura.CheckBox + UM.CheckBox { id: restoreWindowPositionCheckbox text: catalog.i18nc("@option:check", "Restore window position on start") @@ -585,7 +585,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip","Should opening files from the desktop or external applications open in the same instance of Cura?") - Cura.CheckBox + UM.CheckBox { id: singleInstanceCheckbox text: catalog.i18nc("@option:check","Use a single instance of Cura") @@ -601,7 +601,7 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip","Should the build plate be cleared before loading a new model in the single instance of Cura?") enabled: singleInstanceCheckbox.checked - Cura.CheckBox + UM.CheckBox { id: singleInstanceClearBeforeLoadCheckbox text: catalog.i18nc("@option:check","Clear buildplate before loading model into the single instance") @@ -616,7 +616,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip","Should models be scaled to the build volume if they are too large?") - Cura.CheckBox + UM.CheckBox { id: scaleToFitCheckbox text: catalog.i18nc("@option:check","Scale large models") @@ -631,7 +631,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip","An model may appear extremely small if its unit is for example in meters rather than millimeters. Should these models be scaled up?") - Cura.CheckBox + UM.CheckBox { id: scaleTinyCheckbox text: catalog.i18nc("@option:check","Scale extremely small models") @@ -646,7 +646,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip","Should models be selected after they are loaded?") - Cura.CheckBox + UM.CheckBox { id: selectModelsOnLoadCheckbox text: catalog.i18nc("@option:check","Select models when loaded") @@ -661,7 +661,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip", "Should a prefix based on the printer name be added to the print job name automatically?") - Cura.CheckBox + UM.CheckBox { id: prefixJobNameCheckbox text: catalog.i18nc("@option:check", "Add machine prefix to job name") @@ -676,7 +676,7 @@ UM.PreferencesPage height: childrenRect.height text: catalog.i18nc("@info:tooltip", "Should a summary be shown when saving a project file?") - Cura.CheckBox + UM.CheckBox { text: catalog.i18nc("@option:check", "Show summary dialog when saving project") checked: boolCheck(UM.Preferences.getValue("cura/dialog_on_project_save")) @@ -821,7 +821,7 @@ UM.PreferencesPage height: visible ? childrenRect.height : 0 text: catalog.i18nc("@info:tooltip", "Should anonymous data about your print be sent to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.") - Cura.CheckBox + UM.CheckBox { id: sendDataCheckbox text: catalog.i18nc("@option:check","Send (anonymous) print information") @@ -860,7 +860,7 @@ UM.PreferencesPage height: visible ? childrenRect.height : 0 text: catalog.i18nc("@info:tooltip", "Should Cura check for updates when the program is started?") - Cura.CheckBox + UM.CheckBox { id: checkUpdatesCheckbox text: catalog.i18nc("@option:check","Check for updates on start") @@ -913,7 +913,7 @@ UM.PreferencesPage height: visible ? childrenRect.height : 0 text: catalog.i18nc("@info:tooltip", "Should an automatic check for new plugins be done every time Cura is started? It is highly recommended that you do not disable this!") - Cura.CheckBox + UM.CheckBox { id: pluginNotificationsUpdateCheckbox text: catalog.i18nc("@option:check", "Get notifications for plugin updates") From 3e5a51503e213854848940165b0cc99efb45c1db Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 10:59:23 +0100 Subject: [PATCH 03/21] Change font of the headings in general page CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 8b9f465dea..677fa2ca55 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -150,7 +150,7 @@ UM.PreferencesPage UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Interface") } @@ -333,7 +333,7 @@ UM.PreferencesPage UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Viewport behavior") } @@ -575,7 +575,7 @@ UM.PreferencesPage UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label","Opening and saving files") } @@ -757,7 +757,7 @@ UM.PreferencesPage UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Profiles") } @@ -812,7 +812,7 @@ UM.PreferencesPage UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Privacy") } UM.TooltipArea @@ -850,7 +850,7 @@ UM.PreferencesPage UM.Label { - font.bold: true + font: UM.Theme.getFont("medium_bold") text: catalog.i18nc("@label", "Updates") } From 2b220c627f5c8b017d2191de5fa2c848016459fd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 11:06:33 +0100 Subject: [PATCH 04/21] Disable wordwrap in combobox CURA-8949 --- resources/qml/Widgets/ComboBox.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/Widgets/ComboBox.qml b/resources/qml/Widgets/ComboBox.qml index b92daad9c4..6420f41823 100644 --- a/resources/qml/Widgets/ComboBox.qml +++ b/resources/qml/Widgets/ComboBox.qml @@ -72,7 +72,7 @@ ComboBox anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.verticalCenter: parent.verticalCenter anchors.right: downArrow.left - + wrapMode: Text.NoWrap text: { if (control.delegateModel.count == 0) @@ -149,6 +149,7 @@ ComboBox textFormat: Text.PlainText color: UM.Theme.getColor("setting_control_text") elide: Text.ElideRight + wrapMode: Text.NoWrap } background: UM.TooltipArea From 46e7217646a086a19b24707241fe8b72cae13431 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 11:22:19 +0100 Subject: [PATCH 05/21] Layout tweaks for general page CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 37 +++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 677fa2ca55..4fe96d180b 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -157,7 +157,7 @@ UM.PreferencesPage GridLayout { id: interfaceGrid - columns: 4 + columns: 2 width: parent.width UM.Label @@ -208,7 +208,8 @@ UM.PreferencesPage textRole: "text" model: languageList - Layout.fillWidth: true + implicitWidth: UM.Theme.getSize("setting_control").width + implicitHeight: currencyField.height function setCurrentIndex() { var code = UM.Preferences.getValue("general/language"); @@ -223,7 +224,9 @@ UM.PreferencesPage currentIndex: setCurrentIndex() - onActivated: if (model.get(index).code != "") + onActivated: + { + if (model.get(index).code != "") { UM.Preferences.setValue("general/language", model.get(index).code); } @@ -231,6 +234,7 @@ UM.PreferencesPage { currentIndex = setCurrentIndex(); } + } } UM.Label @@ -244,6 +248,7 @@ UM.PreferencesPage id: currencyField selectByMouse: true text: UM.Preferences.getValue("cura/currency") + implicitWidth: UM.Theme.getSize("setting_control").width onTextChanged: UM.Preferences.setValue("cura/currency", text) } @@ -272,7 +277,8 @@ UM.PreferencesPage model: themeList textRole: "text" - Layout.fillWidth: true + implicitWidth: UM.Theme.getSize("setting_control").width + implicitHeight: currencyField.height currentIndex: { @@ -526,11 +532,12 @@ UM.PreferencesPage text: catalog.i18nc("@info:tooltip", "What type of camera rendering should be used?") Column { - spacing: 4 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").height UM.Label { text: catalog.i18nc("@window:text", "Camera rendering:") + font: UM.Theme.getFont("medium_bold") } ListModel { @@ -548,6 +555,8 @@ UM.PreferencesPage model: comboBoxList textRole: "text" + width: UM.Theme.getSize("setting_control").width + height: UM.Theme.getSize("setting_control").height currentIndex: { @@ -589,6 +598,7 @@ UM.PreferencesPage { id: singleInstanceCheckbox text: catalog.i18nc("@option:check","Use a single instance of Cura") + checked: boolCheck(UM.Preferences.getValue("cura/single_instance")) onCheckedChanged: UM.Preferences.setValue("cura/single_instance", checked) } @@ -692,7 +702,7 @@ UM.PreferencesPage Column { - spacing: 4 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").height UM.Label { @@ -702,7 +712,8 @@ UM.PreferencesPage Cura.ComboBox { id: choiceOnOpenProjectDropDownButton - width: Math.round(250 * screenScaleFactor) + width: UM.Theme.getSize("setting_control").width + height: UM.Theme.getSize("setting_control").height model: ListModel { @@ -746,14 +757,14 @@ UM.PreferencesPage UM.TooltipArea { - width: childrenRect.width; - height: childrenRect.height; + width: childrenRect.width + height: childrenRect.height text: catalog.i18nc("@info:tooltip", "When you have made changes to a profile and switched to a different one, a dialog will be shown asking whether you want to keep your modifications or not, or you can choose a default behaviour and never show that dialog again.") Column { - spacing: 4 * screenScaleFactor + spacing: UM.Theme.getSize("narrow_margin").height UM.Label { @@ -769,8 +780,8 @@ UM.PreferencesPage Cura.ComboBox { id: choiceOnProfileOverrideDropDownButton - width: Math.round(250 * screenScaleFactor) - popup.width: Math.round(350 * screenScaleFactor) + width: UM.Theme.getSize("setting_control").width + height: UM.Theme.getSize("setting_control").height model: ListModel { id: discardOrKeepProfileListModel @@ -829,7 +840,7 @@ UM.PreferencesPage onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked) } - Button + Cura.SecondaryButton { id: showMoreInfo anchors.top: sendDataCheckbox.bottom From 8feaa327696002a6c8a2ec443330b7d47d4b40f9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 11:28:40 +0100 Subject: [PATCH 06/21] Codestyle cleanups Mostly just removing ;'s from QML CURA-8949 --- resources/qml/Preferences/MachinesPage.qml | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 419c3abe0d..d32ba603e7 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -11,9 +11,9 @@ import Cura 1.0 as Cura UM.ManagementPage { - id: base; + id: base - title: catalog.i18nc("@title:tab", "Printers"); + title: catalog.i18nc("@title:tab", "Printers") model: Cura.GlobalStacksModel { } sectionRole: "discoverySource" @@ -37,7 +37,7 @@ UM.ManagementPage Button { id: activateMenuButton - text: catalog.i18nc("@action:button", "Activate"); + text: catalog.i18nc("@action:button", "Activate") icon.name: "list-activate" enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id) @@ -45,25 +45,25 @@ UM.ManagementPage Button { id: addMenuButton - text: catalog.i18nc("@action:button", "Add"); + text: catalog.i18nc("@action:button", "Add") icon.name: "list-add" onClicked: Cura.Actions.addMachine.trigger() }, Button { id: removeMenuButton - text: catalog.i18nc("@action:button", "Remove"); + text: catalog.i18nc("@action:button", "Remove") icon.name: "list-remove" enabled: base.currentItem != null && model.count > 1 - onClicked: confirmDialog.open(); + onClicked: confirmDialog.open() }, Button { id: renameMenuButton - text: catalog.i18nc("@action:button", "Rename"); + text: catalog.i18nc("@action:button", "Rename") icon.name: "edit-rename" enabled: base.currentItem != null && base.currentItem.metadata.group_name == null - onClicked: renameDialog.open(); + onClicked: renameDialog.open() } ] @@ -156,13 +156,13 @@ UM.ManagementPage UM.RenameDialog { - id: renameDialog; - object: base.currentItem && base.currentItem.name ? base.currentItem.name : ""; + id: renameDialog + object: base.currentItem && base.currentItem.name ? base.currentItem.name : "" property var machine_name_validator: Cura.MachineNameValidator { } - validName: renameDialog.newName.match(renameDialog.machine_name_validator.machineNameRegex) != null; + validName: renameDialog.newName.match(renameDialog.machine_name_validator.machineNameRegex) != null onAccepted: { - Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim()); + Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim()) //Force updating currentItem and the details panel objectList.onCurrentIndexChanged() } @@ -177,6 +177,5 @@ UM.ManagementPage objectList.onCurrentIndexChanged() } } - } } From 2d0ce01ff50fde8cb7e802f8c861fcd98a2258d7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 12:28:03 +0100 Subject: [PATCH 07/21] Add menu to react on the hamburger menu CURA-8949 --- resources/qml/Preferences/MachinesPage.qml | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index d32ba603e7..53bf187fba 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -20,6 +20,7 @@ UM.ManagementPage activeId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: "" activeIndex: activeMachineIndex() + onHamburgeButtonClicked: menu.popup(content_item, content_item.width - menu.width, hamburger_button.height) function activeMachineIndex() { @@ -34,44 +35,21 @@ UM.ManagementPage } buttons: [ - Button - { - id: activateMenuButton - text: catalog.i18nc("@action:button", "Activate") - icon.name: "list-activate" - enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id - onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id) - }, - Button + Cura.SecondaryButton { id: addMenuButton - text: catalog.i18nc("@action:button", "Add") - icon.name: "list-add" + text: catalog.i18nc("@action:button", "Add New") onClicked: Cura.Actions.addMachine.trigger() - }, - Button - { - id: removeMenuButton - text: catalog.i18nc("@action:button", "Remove") - icon.name: "list-remove" - enabled: base.currentItem != null && model.count > 1 - onClicked: confirmDialog.open() - }, - Button - { - id: renameMenuButton - text: catalog.i18nc("@action:button", "Rename") - icon.name: "edit-rename" - enabled: base.currentItem != null && base.currentItem.metadata.group_name == null - onClicked: renameDialog.open() } ] Item { + id: content_item visible: base.currentItem != null anchors.fill: parent + UM.Label { id: machineName @@ -167,6 +145,28 @@ UM.ManagementPage objectList.onCurrentIndexChanged() } } + Cura.Menu + { + id: menu + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Activate") + enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachine.id + onTriggered: Cura.MachineManager.setActiveMachine(base.currentItem.id) + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Remove") + enabled: base.currentItem != null && model.count > 1 + onTriggered: confirmDialog.open() + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Rename") + enabled: base.currentItem != null && base.currentItem.metadata.group_name == null + onTriggered: renameDialog.open() + } + } Connections { From 5aed6bb3c8ece355d5c405ec22db8d5e03bedff4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 12:33:07 +0100 Subject: [PATCH 08/21] Move reset to defaults button for general page CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 4fe96d180b..67d1468be3 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -100,14 +100,14 @@ UM.PreferencesPage invertZoomCheckbox.checked = boolCheck(UM.Preferences.getValue("view/invert_zoom")) UM.Preferences.resetPreference("view/zoom_to_mouse"); zoomToMouseCheckbox.checked = boolCheck(UM.Preferences.getValue("view/zoom_to_mouse")) - UM.Preferences.resetPreference("view/top_layer_count"); - topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) + //UM.Preferences.resetPreference("view/top_layer_count"); + //topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) UM.Preferences.resetPreference("general/restore_window_geometry") restoreWindowPositionCheckbox.checked = boolCheck(UM.Preferences.getValue("general/restore_window_geometry")) UM.Preferences.resetPreference("general/camera_perspective_mode") - var defaultCameraMode = UM.Preferences.getValue("general/camera_perspective_mode") - setDefaultCameraMode(defaultCameraMode) + //var defaultCameraMode = UM.Preferences.getValue("general/camera_perspective_mode") +// /setDefaultCameraMode(defaultCameraMode) UM.Preferences.resetPreference("cura/choice_on_profile_override") setDefaultDiscardOrKeepProfile(UM.Preferences.getValue("cura/choice_on_profile_override")) @@ -125,6 +125,14 @@ UM.PreferencesPage pluginNotificationsUpdateCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_plugin_update_check")) } + buttons: [ + Cura.SecondaryButton + { + id: addMenuButton + text: catalog.i18nc("@action:button", "Defaults") + onClicked: reset() + } + ] ScrollView { id: preferencesScrollView From 742f0b7dbb17b76137c97185826557735ffe448c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 12:49:59 +0100 Subject: [PATCH 09/21] Add defaults button to setting visibility page CURA-8949 --- resources/qml/Preferences/SettingVisibilityPage.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index 2d433056db..0c8e5798c0 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -17,6 +17,15 @@ UM.PreferencesPage property int scrollToIndex: 0 + buttons: [ + Cura.SecondaryButton + { + id: addMenuButton + text: catalog.i18nc("@action:button", "Defaults") + onClicked: reset() + } + ] + signal scrollToSection( string key ) onScrollToSection: { From 9df7ccd5cc10ee08f2cd01ec3cdc2aa61fafae6b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 14:20:16 +0100 Subject: [PATCH 10/21] Let profiles page use ManagementPage No idea why it didn't in the first place. This caused a lot of code duplication. CURA-8949 --- resources/qml/Preferences/ProfilesPage.qml | 788 ++++++++------------- 1 file changed, 280 insertions(+), 508 deletions(-) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index a1a88a4c0b..0d2b811f8b 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -10,35 +10,24 @@ import UM 1.5 as UM import Cura 1.6 as Cura -Item +UM.ManagementPage { id: base - property var resetEnabled: false // Keep PreferencesDialog happy property var extrudersModel: CuraApplication.getExtrudersModel() property var qualityManagementModel: CuraApplication.getQualityManagementModel() - UM.I18nCatalog { id: catalog; name: "cura"; } + scrollviewCaption: catalog.i18nc("@label", "Profiles compatible with active printer:") + "" + Cura.MachineManager.activeMachine.name + "" + + onHamburgeButtonClicked: menu.popup(content_item, content_item.width - menu.width, hamburger_button.height) - Label - { - id: titleLabel - anchors - { - top: parent.top - left: parent.left - right: parent.right - margins: 5 * screenScaleFactor - } - font.pointSize: 18 - text: catalog.i18nc("@title:tab", "Profiles") - } property var hasCurrentItem: base.currentItem != null + sectionRole: "section_name" property var currentItem: { - var current_index = qualityListView.currentIndex; + var current_index = objectList.currentIndex; return (current_index == -1) ? null : base.qualityManagementModel.getItem(current_index); } @@ -66,125 +55,29 @@ Item return isCurrentItemActivated && Cura.MachineManager.hasUserSettings; } - Row // Button Row - { - id: buttonRow - anchors + model: qualityManagementModel + buttons: [ + Cura.SecondaryButton { - left: parent.left - right: parent.right - top: titleLabel.bottom - } - height: childrenRect.height - - // Activate button - Button - { - id: activateMenuButton - text: catalog.i18nc("@action:button", "Activate") - icon.name: "list-activate" - enabled: !isCurrentItemActivated && base.currentItem - onClicked: - { - if(base.currentItem.is_read_only) - { - Cura.IntentManager.selectIntent(base.currentItem.intent_category, base.currentItem.quality_type); - } - else - { - Cura.MachineManager.setQualityChangesGroup(base.currentItem.quality_changes_group); - } - } - } - - // Create button - Button + text: catalog.i18nc("@action:button", "Import") + onClicked:importDialog.open() + }, + Cura.SecondaryButton { id: createMenuButton - text: catalog.i18nc("@label", "Create") - icon.name: "list-add" - enabled: base.canCreateProfile && !Cura.MachineManager.stacksHaveErrors + text: catalog.i18nc("@action:button", "Create new") + + enabled: !Cura.MachineManager.stacksHaveErrors visible: base.canCreateProfile onClicked: { - createQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name); - createQualityDialog.open(); - createQualityDialog.selectText(); + createQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name) + createQualityDialog.open() + createQualityDialog.selectText() } } - - // Duplicate button - Button - { - id: duplicateMenuButton - text: catalog.i18nc("@label", "Duplicate") - icon.name: "list-add" - enabled: !base.canCreateProfile - visible: !base.canCreateProfile - - onClicked: - { - duplicateQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name); - duplicateQualityDialog.open(); - duplicateQualityDialog.selectText(); - } - } - - // Remove button - Button - { - id: removeMenuButton - text: catalog.i18nc("@action:button", "Remove") - icon.name: "list-remove" - enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated - onClicked: - { - forceActiveFocus(); - confirmRemoveQualityDialog.open(); - } - } - - // Rename button - Button - { - id: renameMenuButton - text: catalog.i18nc("@action:button", "Rename") - icon.name: "edit-rename" - enabled: base.hasCurrentItem && !base.currentItem.is_read_only - onClicked: - { - renameQualityDialog.object = base.currentItem.name; - renameQualityDialog.open(); - renameQualityDialog.selectText(); - } - } - - // Import button - Button - { - id: importMenuButton - text: catalog.i18nc("@action:button", "Import") - icon.name: "document-import" - onClicked: - { - importDialog.open(); - } - } - - // Export button - Button - { - id: exportMenuButton - text: catalog.i18nc("@action:button", "Export") - icon.name: "document-export" - enabled: base.hasCurrentItem && !base.currentItem.is_read_only - onClicked: - { - exportDialog.open(); - } - } - } + ] // Click create profile from ... in Profile context menu signal createProfile() @@ -195,186 +88,209 @@ Item createQualityDialog.selectText(); } - // Dialog to request a name when creating a new profile - UM.RenameDialog - { - id: createQualityDialog - title: catalog.i18nc("@title:window", "Create Profile") - object: "" - explanation: catalog.i18nc("@info", "Please provide a name for this profile.") - onAccepted: - { - base.newQualityNameToSelect = newName; // We want to switch to the new profile once it's created - base.toActivateNewQuality = true; - base.qualityManagementModel.createQualityChanges(newName); - } - } - property string newQualityNameToSelect: "" property bool toActivateNewQuality: false - // This connection makes sure that we will switch to the correct quality after the model gets updated - Connections + Item { - target: base.qualityManagementModel - function onItemsChanged() + id: content_item + anchors.fill: parent + // This connection makes sure that we will switch to the correct quality after the model gets updated + Connections { - var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name; - if (newQualityNameToSelect != "") + target: base.qualityManagementModel + function onItemsChanged() { - toSelectItemName = newQualityNameToSelect; - } - - var newIdx = -1; // Default to nothing if nothing can be found - if (toSelectItemName != "") - { - // Select the required quality name if given - for (var idx = 0; idx < base.qualityManagementModel.count; ++idx) + var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name; + if (newQualityNameToSelect != "") { - var item = base.qualityManagementModel.getItem(idx); - if (item && item.name == toSelectItemName) + toSelectItemName = newQualityNameToSelect; + } + + var newIdx = -1; // Default to nothing if nothing can be found + if (toSelectItemName != "") + { + // Select the required quality name if given + for (var idx = 0; idx < base.qualityManagementModel.count; ++idx) { - // Switch to the newly created profile if needed - newIdx = idx; - if (base.toActivateNewQuality) + var item = base.qualityManagementModel.getItem(idx); + if (item && item.name == toSelectItemName) { - // Activate this custom quality if required - if(item.quality_changes_group) + // Switch to the newly created profile if needed + newIdx = idx; + if (base.toActivateNewQuality) { - Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group); + // Activate this custom quality if required + if(item.quality_changes_group) + { + Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group); + } } + break; } - break; + } + } + objectList.currentIndex = newIdx; + + // Reset states + base.newQualityNameToSelect = ""; + base.toActivateNewQuality = false; + } + } + UM.MessageDialog + { + id: messageDialog + standardButtons: Dialog.Ok + } + + // Dialog to request a name when creating a new profile + UM.RenameDialog + { + id: createQualityDialog + title: catalog.i18nc("@title:window", "Create Profile") + object: "" + explanation: catalog.i18nc("@info", "Please provide a name for this profile.") + onAccepted: + { + base.newQualityNameToSelect = newName; // We want to switch to the new profile once it's created + base.toActivateNewQuality = true; + base.qualityManagementModel.createQualityChanges(newName); + } + } + + Cura.Menu + { + id: menu + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Activate") + + enabled: !isCurrentItemActivated && base.currentItem + onTriggered: + { + if(base.currentItem.is_read_only) + { + Cura.IntentManager.selectIntent(base.currentItem.intent_category, base.currentItem.quality_type) + } + else + { + Cura.MachineManager.setQualityChangesGroup(base.currentItem.quality_changes_group) } } } - qualityListView.currentIndex = newIdx; - - // Reset states - base.newQualityNameToSelect = ""; - base.toActivateNewQuality = false; - } - } - - // Dialog to request a name when duplicating a new profile - UM.RenameDialog - { - id: duplicateQualityDialog - title: catalog.i18nc("@title:window", "Duplicate Profile") - object: "" - onAccepted: - { - base.qualityManagementModel.duplicateQualityChanges(newName, base.currentItem); - } - } - - // Confirmation dialog for removing a profile - UM.MessageDialog - { - id: confirmRemoveQualityDialog - - title: catalog.i18nc("@title:window", "Confirm Remove") - text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItemName) - standardButtons: StandardButton.Yes | StandardButton.No - modal: true - - onAccepted: - { - base.qualityManagementModel.removeQualityChangesGroup(base.currentItem.quality_changes_group); - // reset current item to the first if available - qualityListView.currentIndex = -1; // Reset selection. - } - } - - // Dialog to rename a quality profile - UM.RenameDialog - { - id: renameQualityDialog - title: catalog.i18nc("@title:window", "Rename Profile") - object: "" - onAccepted: - { - var actualNewName = base.qualityManagementModel.renameQualityChangesGroup(base.currentItem.quality_changes_group, newName); - base.newQualityNameToSelect = actualNewName; // Select the new name after the model gets updated - } - } - - // Dialog for importing a quality profile - FileDialog - { - id: importDialog - title: catalog.i18nc("@title:window", "Import Profile") - selectExisting: true - nameFilters: base.qualityManagementModel.getFileNameFilters("profile_reader") - folder: CuraApplication.getDefaultPath("dialog_profile_path") - onAccepted: - { - var result = Cura.ContainerManager.importProfile(fileUrl); - messageDialog.title = catalog.i18nc("@title:window", "Import Profile") - messageDialog.text = result.message; - messageDialog.open(); - CuraApplication.setDefaultPath("dialog_profile_path", folder); - } - } - - // Dialog for exporting a quality profile - FileDialog - { - id: exportDialog - title: catalog.i18nc("@title:window", "Export Profile") - selectExisting: false - nameFilters: base.qualityManagementModel.getFileNameFilters("profile_writer") - folder: CuraApplication.getDefaultPath("dialog_profile_path") - onAccepted: - { - var result = Cura.ContainerManager.exportQualityChangesGroup(base.currentItem.quality_changes_group, - fileUrl, selectedNameFilter); - - if (result && result.status == "error") + Cura.MenuItem { - messageDialog.title = catalog.i18nc("@title:window", "Export Profile") + text: catalog.i18nc("@action:button", "Remove") + enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated + onTriggered: + { + forceActiveFocus() + confirmRemoveQualityDialog.open() + } + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Rename") + enabled: base.hasCurrentItem && !base.currentItem.is_read_only + onTriggered: + { + renameQualityDialog.object = base.currentItem.name + renameQualityDialog.open() + renameQualityDialog.selectText() + } + } + Cura.MenuItem + { + text: catalog.i18nc("@action:button", "Export") + enabled: base.hasCurrentItem && !base.currentItem.is_read_only + onTriggered: exportDialog.open() + } + } + + // Dialog for exporting a quality profile + FileDialog + { + id: exportDialog + title: catalog.i18nc("@title:window", "Export Profile") + selectExisting: false + nameFilters: base.qualityManagementModel.getFileNameFilters("profile_writer") + folder: CuraApplication.getDefaultPath("dialog_profile_path") + onAccepted: + { + var result = Cura.ContainerManager.exportQualityChangesGroup(base.currentItem.quality_changes_group, + fileUrl, selectedNameFilter); + + if (result && result.status == "error") + { + messageDialog.title = catalog.i18nc("@title:window", "Export Profile") + messageDialog.text = result.message; + messageDialog.open(); + } + + // else pop-up Message thing from python code + CuraApplication.setDefaultPath("dialog_profile_path", folder); + } + } + + // Dialog to request a name when duplicating a new profile + UM.RenameDialog + { + id: duplicateQualityDialog + title: catalog.i18nc("@title:window", "Duplicate Profile") + object: "" + onAccepted: + { + base.qualityManagementModel.duplicateQualityChanges(newName, base.currentItem); + } + } + + // Confirmation dialog for removing a profile + UM.MessageDialog + { + id: confirmRemoveQualityDialog + + title: catalog.i18nc("@title:window", "Confirm Remove") + text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItemName) + standardButtons: StandardButton.Yes | StandardButton.No + modal: true + + onAccepted: + { + base.qualityManagementModel.removeQualityChangesGroup(base.currentItem.quality_changes_group); + // reset current item to the first if available + qualityListView.currentIndex = -1; // Reset selection. + } + } + + // Dialog to rename a quality profile + UM.RenameDialog + { + id: renameQualityDialog + title: catalog.i18nc("@title:window", "Rename Profile") + object: "" + onAccepted: + { + var actualNewName = base.qualityManagementModel.renameQualityChangesGroup(base.currentItem.quality_changes_group, newName); + base.newQualityNameToSelect = actualNewName; // Select the new name after the model gets updated + } + } + + // Dialog for importing a quality profile + FileDialog + { + id: importDialog + title: catalog.i18nc("@title:window", "Import Profile") + selectExisting: true + nameFilters: base.qualityManagementModel.getFileNameFilters("profile_reader") + folder: CuraApplication.getDefaultPath("dialog_profile_path") + onAccepted: + { + var result = Cura.ContainerManager.importProfile(fileUrl); + messageDialog.title = catalog.i18nc("@title:window", "Import Profile") messageDialog.text = result.message; messageDialog.open(); + CuraApplication.setDefaultPath("dialog_profile_path", folder); } - - // else pop-up Message thing from python code - CuraApplication.setDefaultPath("dialog_profile_path", folder); - } - } - - //Dialogue box for showing the result of importing or exporting profiles. - UM.MessageDialog - { - id: messageDialog - standardButtons: Dialog.Ok - } - - Item - { - id: contentsItem - - anchors - { - top: titleLabel.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - margins: 5 * screenScaleFactor - bottomMargin: 0 - } - - clip: true - } - - Item - { - anchors - { - top: buttonRow.bottom - topMargin: UM.Theme.getSize("default_margin").height - left: parent.left - right: parent.right - bottom: parent.bottom } SystemPalette @@ -382,241 +298,97 @@ Item id: palette } - Label + Column { - id: captionLabel + id: detailsPanelHeaderColumn anchors { - top: parent.top left: parent.left - } - visible: text != "" - text: catalog.i18nc("@label %1 is printer name", "Printer: %1").arg(Cura.MachineManager.activeMachine.name) - width: profileBackground.width - elide: Text.ElideRight - } - - Rectangle - { - id: profileBackground - anchors - { - top: captionLabel.visible ? captionLabel.bottom : parent.top - topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0 - bottom: parent.bottom - left: parent.left - } - width: (parent.width * 0.4) | 0 - - color: palette.light - - ListView - { - id: qualityListView - anchors.fill: parent - - ScrollBar.vertical: UM.ScrollBar - { - id: profileScrollBar - } - clip: true - model: base.qualityManagementModel - - Component.onCompleted: - { - var selectedItemName = Cura.MachineManager.activeQualityOrQualityChangesName; - - // Select the required quality name if given - for (var idx = 0; idx < base.qualityManagementModel.count; idx++) - { - var item = base.qualityManagementModel.getItem(idx); - if (item.name == selectedItemName) - { - currentIndex = idx; - break; - } - } - } - - section.property: "section_name" - section.delegate: Rectangle - { - height: childrenRect.height - - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_lining").width - text: section - font.bold: true - } - } - - delegate: Rectangle - { - width: profileBackground.width - profileScrollBar.width - height: childrenRect.height - - // Added this property to identify custom profiles in automated system tests (Squish) - property bool isReadOnly: model.is_read_only - - property bool isCurrentItem: ListView.isCurrentItem - color: isCurrentItem ? palette.highlight : (model.index % 2) ? palette.base : palette.alternateBase - - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - width: Math.floor((parent.width * 0.8)) - text: model.name - elide: Text.ElideRight - font.italic: - { - if (model.is_read_only) - { - // For built-in qualities, it needs to match both the intent category and the quality name - return model.name == Cura.MachineManager.activeQualityOrQualityChangesName && model.intent_category == Cura.MachineManager.activeIntentCategory - } - else - { - // For custom qualities, it only needs to match the name - return model.name == Cura.MachineManager.activeQualityOrQualityChangesName - } - } - color: parent.isCurrentItem ? palette.highlightedText : palette.text - } - - MouseArea - { - anchors.fill: parent - onClicked: - { - parent.ListView.view.currentIndex = model.index; - } - } - } - } - } - - // details panel on the right - Item - { - id: detailsPanel - - anchors - { - left: profileBackground.right - leftMargin: UM.Theme.getSize("default_margin").width - top: parent.top - bottom: parent.bottom right: parent.right + top: parent.top } - Column + spacing: UM.Theme.getSize("default_margin").height + visible: base.currentItem != null + UM.Label { - id: detailsPanelHeaderColumn - anchors - { - left: parent.left - right: parent.right - top: parent.top - } - - spacing: UM.Theme.getSize("default_margin").height - visible: base.currentItem != null - - Item // Profile title Label - { - id: profileName - - width: parent.width - height: childrenRect.height - - Label - { - anchors.left: parent.left - anchors.right: parent.right - text: base.currentItemDisplayName - font: UM.Theme.getFont("large_bold") - elide: Text.ElideRight - renderType: Text.NativeRendering - } - } - - Flow - { - id: currentSettingsActions - width: parent.width - - visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory - - Button - { - text: catalog.i18nc("@action:button", "Update profile with current settings/overrides") - enabled: Cura.MachineManager.hasUserSettings && qualityListView.currentItem && !qualityListView.currentItem.is_read_only - onClicked: Cura.ContainerManager.updateQualityChanges() - } - - Button - { - text: catalog.i18nc("@action:button", "Discard current changes"); - enabled: Cura.MachineManager.hasUserSettings - onClicked: Cura.ContainerManager.clearUserContainers(); - } - } - - Label - { - id: defaultsMessage - visible: false - text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.") - wrapMode: Text.WordWrap - width: parent.width - } - Label - { - id: noCurrentSettingsMessage - visible: base.isCurrentItemActivated && !Cura.MachineManager.hasUserSettings - text: catalog.i18nc("@action:label", "Your current settings match the selected profile.") - wrapMode: Text.WordWrap - width: parent.width - } - - UM.TabRow - { - id: profileExtruderTabs - UM.TabRowButton //One extra tab for the global settings. - { - text: catalog.i18nc("@title:tab", "Global Settings") - } - - Repeater - { - model: base.extrudersModel - - UM.TabRowButton - { - text: model.name - } - } - } + anchors.left: parent.left + anchors.right: parent.right + text: base.currentItemDisplayName + font: UM.Theme.getFont("large_bold") + elide: Text.ElideRight } - Cura.ProfileOverview + Flow { - anchors + id: currentSettingsActions + width: parent.width + + visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory + + Cura.SecondaryButton { - top: detailsPanelHeaderColumn.bottom - left: parent.left - right: parent.right - bottom: parent.bottom + text: catalog.i18nc("@action:button", "Update profile with current settings/overrides") + enabled: Cura.MachineManager.hasUserSettings && objectList.currentIndex && !objectList.currentIndex.is_read_only + onClicked: Cura.ContainerManager.updateQualityChanges() } - visible: detailsPanelHeaderColumn.visible - qualityItem: base.currentItem - extruderPosition: profileExtruderTabs.currentIndex - 1 + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Discard current changes"); + enabled: Cura.MachineManager.hasUserSettings + onClicked: Cura.ContainerManager.clearUserContainers(); + } } + + UM.Label + { + id: defaultsMessage + visible: false + text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.") + width: parent.width + } + UM.Label + { + id: noCurrentSettingsMessage + visible: base.isCurrentItemActivated && !Cura.MachineManager.hasUserSettings + text: catalog.i18nc("@action:label", "Your current settings match the selected profile.") + width: parent.width + } + + UM.TabRow + { + id: profileExtruderTabs + UM.TabRowButton //One extra tab for the global settings. + { + text: catalog.i18nc("@title:tab", "Global Settings") + } + + Repeater + { + model: base.extrudersModel + + UM.TabRowButton + { + text: model.name + } + } + } + } + + Cura.ProfileOverview + { + anchors + { + top: detailsPanelHeaderColumn.bottom + left: parent.left + right: parent.right + bottom: parent.bottom + } + + visible: detailsPanelHeaderColumn.visible + qualityItem: base.currentItem + extruderPosition: profileExtruderTabs.currentIndex - 1 } } } From a458155258d52c02e35a422ed6cfcee6dc7186ec Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 15:09:57 +0100 Subject: [PATCH 11/21] Update look of the profilesPage CURA-8949 --- resources/qml/Preferences/ProfilesPage.qml | 1 + resources/qml/TableView.qml | 52 ++++++++++++++-------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 0d2b811f8b..2aa44c827b 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -381,6 +381,7 @@ UM.ManagementPage anchors { top: detailsPanelHeaderColumn.bottom + margins: UM.Theme.getSize("default_margin").height left: parent.left right: parent.right bottom: parent.bottom diff --git a/resources/qml/TableView.qml b/resources/qml/TableView.qml index 1075ce1f8a..87f9fbdc05 100644 --- a/resources/qml/TableView.qml +++ b/resources/qml/TableView.qml @@ -39,22 +39,23 @@ Item width: Math.max(1, Math.round(tableBase.width / headerRepeater.count)) height: UM.Theme.getSize("section").height - color: UM.Theme.getColor("secondary") + color: UM.Theme.getColor("main_background") + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("thick_lining") - Label + UM.Label { id: contentText anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("narrow_margin").width + anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("narrow_margin").width - + wrapMode: Text.NoWrap text: modelData font: UM.Theme.getFont("medium_bold") - color: UM.Theme.getColor("text") elide: Text.ElideRight } - Rectangle //Resize handle. + Item //Resize handle. { anchors { @@ -62,9 +63,7 @@ Item top: parent.top bottom: parent.bottom } - width: UM.Theme.getSize("thick_lining").width - - color: UM.Theme.getColor("thick_lining") + width: UM.Theme.getSize("default_lining").width MouseArea { @@ -97,13 +96,24 @@ Item } } - onWidthChanged: - { - tableView.forceLayout(); //Rescale table cells underneath as well. - } + onWidthChanged: tableView.forceLayout(); //Rescale table cells underneath as well. } } } + Rectangle + { + color: UM.Theme.getColor("main_background") + anchors + { + top: headerBar.bottom + topMargin: -UM.Theme.getSize("default_lining").width + left: parent.left + right: parent.right + bottom: parent.bottom + } + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("thick_lining") + } TableView { @@ -114,6 +124,7 @@ Item left: parent.left right: parent.right bottom: parent.bottom + margins: UM.Theme.getSize("default_lining").width } flickableDirection: Flickable.AutoFlickIfNeeded @@ -128,18 +139,21 @@ Item { implicitHeight: Math.max(1, cellContent.height) - color: UM.Theme.getColor((tableBase.currentRow == row) ? "primary" : ((row % 2 == 0) ? "main_background" : "viewport_background")) + color: UM.Theme.getColor((tableBase.currentRow == row) ? "text_selection" : "main_background") - Label + UM.Label { id: cellContent - width: parent.width - + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + } + wrapMode: Text.NoWrap text: display verticalAlignment: Text.AlignVCenter elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") } TextMetrics { From 3a1d5a29fa06de6faebf9cfce97648343ad1f26d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 16:12:23 +0100 Subject: [PATCH 12/21] Add background to profiles page CURA-8949 --- resources/qml/Preferences/ProfilesPage.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 2aa44c827b..67cf84de63 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -376,6 +376,21 @@ UM.ManagementPage } } + Rectangle + { + color: UM.Theme.getColor("main_background") + anchors + { + top: detailsPanelHeaderColumn.bottom + topMargin: -UM.Theme.getSize("default_lining").width + left: parent.left + right: parent.right + bottom: parent.bottom + } + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("thick_lining") + } + Cura.ProfileOverview { anchors From d6b2b951f294f77efb13ed5190f8399ccd928597 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 16:15:43 +0100 Subject: [PATCH 13/21] Hide background if no item is selected CURA-8949 --- resources/qml/Preferences/ProfilesPage.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 67cf84de63..f9d5d9c4b3 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -389,6 +389,7 @@ UM.ManagementPage } border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("thick_lining") + visible: base.hasCurrentItem } Cura.ProfileOverview From af99b87bef0772dd5e1c7f58aea37738a3d9cb62 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 18 Feb 2022 16:28:10 +0100 Subject: [PATCH 14/21] Remove close button No idea why it was there in the first place. The dialog itself can be closed... CURA-8949 --- resources/qml/Preferences/MachinesPage.qml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 53bf187fba..d4b2581b33 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -104,12 +104,6 @@ UM.ManagementPage minimumHeight: UM.Theme.getSize("modal_window_minimum").height maximumWidth: minimumWidth * 3 maximumHeight: minimumHeight * 3 - rightButtons: Button - { - text: catalog.i18nc("@action:button", "Close") - icon.name: "dialog-close" - onClicked: actionDialog.reject() - } } UM.I18nCatalog { id: catalog; name: "cura"; } From 8e55dda3cca087a0d76011a58f11968b6a5806cf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 21 Feb 2022 10:03:44 +0100 Subject: [PATCH 15/21] Switch old checkbox over to styled variant CURA-8949 --- resources/qml/Preferences/SettingVisibilityPage.qml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index 0c8e5798c0..48580da1ac 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -3,7 +3,6 @@ import QtQuick 2.1 import QtQuick.Controls 2.15 -import QtQuick.Controls 1.1 as OldControls import UM 1.5 as UM @@ -43,7 +42,7 @@ UM.PreferencesPage id: base anchors.fill: parent - OldControls.CheckBox + UM.CheckBox { id: toggleVisibleSettings anchors @@ -53,7 +52,7 @@ UM.PreferencesPage leftMargin: UM.Theme.getSize("default_margin").width } text: catalog.i18nc("@label:textbox", "Check all") - checkedState: + checkState: { if(definitionsModel.visibleCount == definitionsModel.categoryCount) { @@ -68,8 +67,7 @@ UM.PreferencesPage return Qt.PartiallyChecked } } - partiallyCheckedEnabled: true - + tristate: true MouseArea { anchors.fill: parent; From 8b987d9537b29a5ca25ff946ddebae5a40fa12ce Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 21 Feb 2022 10:05:09 +0100 Subject: [PATCH 16/21] Remove id left over from copy paste CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 1 - resources/qml/Preferences/MachinesPage.qml | 1 - resources/qml/Preferences/SettingVisibilityPage.qml | 1 - 3 files changed, 3 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 67d1468be3..a204c53ad3 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -128,7 +128,6 @@ UM.PreferencesPage buttons: [ Cura.SecondaryButton { - id: addMenuButton text: catalog.i18nc("@action:button", "Defaults") onClicked: reset() } diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index d4b2581b33..e51fce09f0 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -37,7 +37,6 @@ UM.ManagementPage buttons: [ Cura.SecondaryButton { - id: addMenuButton text: catalog.i18nc("@action:button", "Add New") onClicked: Cura.Actions.addMachine.trigger() } diff --git a/resources/qml/Preferences/SettingVisibilityPage.qml b/resources/qml/Preferences/SettingVisibilityPage.qml index 48580da1ac..0cc10be0f9 100644 --- a/resources/qml/Preferences/SettingVisibilityPage.qml +++ b/resources/qml/Preferences/SettingVisibilityPage.qml @@ -19,7 +19,6 @@ UM.PreferencesPage buttons: [ Cura.SecondaryButton { - id: addMenuButton text: catalog.i18nc("@action:button", "Defaults") onClicked: reset() } From ec407a81d37709578ce9184ff641b1a20e49eaca Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 21 Feb 2022 10:19:02 +0100 Subject: [PATCH 17/21] Change ordering of some items in general page As per design CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 31 +++++++++-------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index a204c53ad3..1dd988706c 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -170,7 +170,7 @@ UM.PreferencesPage UM.Label { id: languageLabel - text: "Language:" //Don't translate this, to make it easier to find the language drop-down if you can't read the current language. + text: "Language*:" //Don't translate this, to make it easier to find the language drop-down if you can't read the current language. } ListModel @@ -262,7 +262,7 @@ UM.PreferencesPage UM.Label { id: themeLabel - text: catalog.i18nc("@label","Theme:") + text: catalog.i18nc("@label: Please keep the asterix, it's to indicate that a restart is needed.", "Theme*:") } ListModel @@ -303,23 +303,6 @@ UM.PreferencesPage } } - UM.Label - { - id: languageCaption - - //: Language change warning - text: catalog.i18nc("@label", "You will need to restart the application for these changes to have effect.") - wrapMode: Text.WordWrap - font.italic: true - } - - Item - { - //: Spacer - height: UM.Theme.getSize("default_margin").height - width: UM.Theme.getSize("default_margin").width - } - UM.TooltipArea { width: childrenRect.width; @@ -337,6 +320,16 @@ UM.PreferencesPage } } + UM.Label + { + id: languageCaption + + //: Language change warning + text: catalog.i18nc("@label", "*You will need to restart the application for these changes to have effect.") + wrapMode: Text.WordWrap + font.italic: true + } + Item { //: Spacer From b2494f4d2e01c1cc5ad9923e82eb2a1a21708e49 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 21 Feb 2022 11:07:47 +0100 Subject: [PATCH 18/21] Change the moreInfo button for slice statistics CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 1dd988706c..fb76adb683 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -840,15 +840,17 @@ UM.PreferencesPage onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked) } - Cura.SecondaryButton + + UM.SimpleButton { - id: showMoreInfo - anchors.top: sendDataCheckbox.bottom - text: catalog.i18nc("@action:button", "More information") - onClicked: - { - CuraApplication.showMoreInformationDialogForAnonymousDataCollection(); - } + onClicked: CuraApplication.showMoreInformationDialogForAnonymousDataCollection() + iconSource: UM.Theme.getIcon("Information") + anchors.left: sendDataCheckbox.right + anchors.verticalCenter: sendDataCheckbox.verticalCenter + hoverBackgroundColor: UM.Theme.getColor("secondary_button_hover") + backgroundRadius: width / 2 + height: UM.Theme.getSize("small_button_icon").height + width: height } } From 1343d7bdf919790fa9ea62aec6cb7d18971c5676 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 21 Feb 2022 11:15:30 +0100 Subject: [PATCH 19/21] Change font of camera rendering label CURA-8949 --- resources/qml/Preferences/GeneralPage.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index fb76adb683..d6c1861dde 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -537,7 +537,6 @@ UM.PreferencesPage UM.Label { text: catalog.i18nc("@window:text", "Camera rendering:") - font: UM.Theme.getFont("medium_bold") } ListModel { From ba6c0438a1aed332a6c48d28f815840a005d670e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 21 Feb 2022 15:27:27 +0100 Subject: [PATCH 20/21] Fix size of signed out account screen CURA-8940 --- resources/qml/Account/GeneralOperations.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/Account/GeneralOperations.qml b/resources/qml/Account/GeneralOperations.qml index 5844864332..da62124f3f 100644 --- a/resources/qml/Account/GeneralOperations.qml +++ b/resources/qml/Account/GeneralOperations.qml @@ -16,7 +16,7 @@ Column { id: title anchors.horizontalCenter: parent.horizontalCenter - text: catalog.i18nc("@label", "Sign in to the Ultimaker platform") + text: catalog.i18nc("@label", "Sign in to the Ultimaker platform") font: UM.Theme.getFont("large_bold") } @@ -38,6 +38,7 @@ Column horizontalAlignment: Text.AlignLeft text: catalog.i18nc("@text", "- Add material profiles and plug-ins from the Marketplace\n- Back-up and sync your material profiles and plug-ins\n- Share ideas and get help from 48,000+ users in the Ultimaker community") lineHeight: 1.4 + wrapMode: Text.NoWrap } Cura.PrimaryButton From 163252765101323552a78f2e3b38d979b5f270bf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 21 Feb 2022 15:40:08 +0100 Subject: [PATCH 21/21] Prevent crash when switching extruder in profiles page --- cura/Machines/Models/QualitySettingsModel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Machines/Models/QualitySettingsModel.py b/cura/Machines/Models/QualitySettingsModel.py index bdae032f36..2051f1748d 100644 --- a/cura/Machines/Models/QualitySettingsModel.py +++ b/cura/Machines/Models/QualitySettingsModel.py @@ -178,7 +178,10 @@ class QualitySettingsModel(ListModel): label = f"{label}" # Make setting name italic if it's derived from the quality-changes profile. if isinstance(profile_value, SettingFunction): - profile_value_display = self._i18n_catalog.i18nc("@info:status", "Calculated") + if self._i18n_catalog: + profile_value_display = self._i18n_catalog.i18nc("@info:status", "Calculated") + else: + profile_value_display = "Calculated" else: profile_value_display = "" if profile_value is None else str(profile_value)