From aeccfe3509b37c184a24a88864c3550beebb45b1 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 12 Jun 2016 15:25:39 +0200 Subject: [PATCH] Rearrange preferences Merges general & view into a single page Introduces sections on general page Cleans up code --- resources/qml/Cura.qml | 19 +-- .../qml/{ => Preferences}/GeneralPage.qml | 150 +++++++++++++++--- .../qml/{ => Preferences}/MachinesPage.qml | 0 resources/qml/ViewPage.qml | 96 ----------- 4 files changed, 138 insertions(+), 127 deletions(-) rename resources/qml/{ => Preferences}/GeneralPage.qml (66%) rename resources/qml/{ => Preferences}/MachinesPage.qml (100%) delete mode 100644 resources/qml/ViewPage.qml diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index c3dc95b454..6dd57e17c8 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -545,16 +545,13 @@ UM.MainWindow { //; Remove & re-add the general page as we want to use our own instead of uranium standard. removePage(0); - insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("GeneralPage.qml")); + insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("Preferences/GeneralPage.qml")); - //: View preferences page title - insertPage(1, catalog.i18nc("@title:tab","View"), Qt.resolvedUrl("ViewPage.qml")); + insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml")); - insertPage(3, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("MachinesPage.qml")); + insertPage(3, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/MaterialsPage.qml")); - insertPage(4, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/MaterialsPage.qml")); - - insertPage(5, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml")); + insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml")); //Force refresh setPage(0); @@ -583,7 +580,7 @@ UM.MainWindow onTriggered: { Cura.MachineManager.newQualityContainerFromQualityAndUser(); - preferences.setPage(5); + preferences.setPage(4); preferences.show(); // Show the renameDialog after a very short delay so the preference page has time to initiate @@ -597,7 +594,7 @@ UM.MainWindow onTriggered: { preferences.visible = true; - preferences.setPage(3); + preferences.setPage(2); } } @@ -607,7 +604,7 @@ UM.MainWindow onTriggered: { preferences.visible = true; - preferences.setPage(5); + preferences.setPage(4); } } @@ -617,7 +614,7 @@ UM.MainWindow onTriggered: { preferences.visible = true; - preferences.setPage(2); + preferences.setPage(1); preferences.getCurrentItem().scrollToSection(source.key); } } diff --git a/resources/qml/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml similarity index 66% rename from resources/qml/GeneralPage.qml rename to resources/qml/Preferences/GeneralPage.qml index 0ae783916b..2886f94d92 100644 --- a/resources/qml/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -39,6 +39,12 @@ UM.PreferencesPage scaleTinyCheckbox.checked = boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes")) UM.Preferences.resetPreference("cura/jobname_prefix") prefixJobNameCheckbox.checked = boolCheck(UM.Preferences.getValue("cura/jobname_prefix")) + UM.Preferences.resetPreference("view/show_overhang"); + showOverhangCheckbox.checked = boolCheck(UM.Preferences.getValue("view/show_overhang")) + UM.Preferences.resetPreference("view/center_on_select"); + centerOnSelectCheckbox.checked = boolCheck(UM.Preferences.getValue("view/center_on_select")) + UM.Preferences.resetPreference("view/top_layer_count"); + topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) if (plugins.model.find("id", "SliceInfoPlugin") > -1) { UM.Preferences.resetPreference("info/send_slice_info") @@ -50,17 +56,24 @@ UM.PreferencesPage } } - ColumnLayout + Column { //: Language selection label UM.I18nCatalog{id: catalog; name:"cura"} - RowLayout + Label + { + font.bold: true + text: catalog.i18nc("@label","Interface") + } + + Row { Label { id: languageLabel text: catalog.i18nc("@label","Language:") + anchors.verticalCenter: languageComboBox.verticalCenter } ComboBox @@ -120,6 +133,51 @@ UM.PreferencesPage font.italic: true } + Item + { + //: Spacer + height: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("default_margin").width + } + + Label + { + font.bold: true + text: catalog.i18nc("@label","Viewport behavior") + } + + UM.TooltipArea + { + width: childrenRect.width; + height: childrenRect.height; + + text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.") + + CheckBox + { + id: showOverhangCheckbox + + checked: boolCheck(UM.Preferences.getValue("view/show_overhang")) + onClicked: UM.Preferences.setValue("view/show_overhang", checked) + + text: catalog.i18nc("@option:check","Display overhang"); + } + } + + UM.TooltipArea { + width: childrenRect.width; + height: childrenRect.height; + text: catalog.i18nc("@info:tooltip","Moves the camera so the object is in the center of the view when an object is selected") + + CheckBox + { + id: centerOnSelectCheckbox + text: catalog.i18nc("@action:button","Center camera when item is selected"); + checked: boolCheck(UM.Preferences.getValue("view/center_on_select")) + onClicked: UM.Preferences.setValue("view/center_on_select", checked) + } + } + UM.TooltipArea { width: childrenRect.width height: childrenRect.height @@ -134,15 +192,52 @@ UM.PreferencesPage } } + UM.TooltipArea { + width: childrenRect.width; + height: childrenRect.height; + text: catalog.i18nc("@info:tooltip","Display 5 top layers in layer view or only the top-most layer. Rendering 5 layers takes longer, but may show more information.") + + CheckBox + { + id: topLayerCountCheckbox + text: catalog.i18nc("@action:button","Display five top layers in layer view"); + checked: UM.Preferences.getValue("view/top_layer_count") == 5 + onClicked: + { + if(UM.Preferences.getValue("view/top_layer_count") == 5) + { + UM.Preferences.setValue("view/top_layer_count", 1) + } + else + { + UM.Preferences.setValue("view/top_layer_count", 5) + } + } + } + } + + Item + { + //: Spacer + height: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("default_margin").height + } + + Label + { + font.bold: true + text: catalog.i18nc("@label","Opening files") + } + UM.TooltipArea { width: childrenRect.width height: childrenRect.height - text: catalog.i18nc("@info:tooltip","Should opened files be scaled to the build volume if they are too large?") + text: catalog.i18nc("@info:tooltip","Should objects be scaled to the build volume if they are too large?") CheckBox { id: scaleToFitCheckbox - text: catalog.i18nc("@option:check","Scale large files") + text: catalog.i18nc("@option:check","Scale large objects") checked: boolCheck(UM.Preferences.getValue("mesh/scale_to_fit")) onCheckedChanged: UM.Preferences.setValue("mesh/scale_to_fit", checked) } @@ -151,17 +246,45 @@ UM.PreferencesPage UM.TooltipArea { width: childrenRect.width height: childrenRect.height - text: catalog.i18nc("@info:tooltip","Should opened files be scaled up if they are extremely small?") + text: catalog.i18nc("@info:tooltip","Should objects be scaled up if they are extremely small?") CheckBox { id: scaleTinyCheckbox - text: catalog.i18nc("@option:check","Scale extremely small files") + text: catalog.i18nc("@option:check","Scale extremely small objects") checked: boolCheck(UM.Preferences.getValue("mesh/scale_tiny_meshes")) onCheckedChanged: UM.Preferences.setValue("mesh/scale_tiny_meshes", checked) } } + UM.TooltipArea { + width: childrenRect.width + height: childrenRect.height + text: catalog.i18nc("@info:tooltip", "Should a prefix based on the printer name be added to the print job name automatically?") + + CheckBox + { + id: prefixJobNameCheckbox + text: catalog.i18nc("@option:check", "Add machine prefix to job name") + checked: boolCheck(UM.Preferences.getValue("cura/jobname_prefix")) + onCheckedChanged: UM.Preferences.setValue("cura/jobname_prefix", checked) + } + } + + Item + { + //: Spacer + height: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("default_margin").height + } + + Label + { + font.bold: true + visible: checkUpdatesCheckbox.visible || sendDataCheckbox.visible + text: catalog.i18nc("@label","Privacy") + } + UM.TooltipArea { visible: plugins.model.find("id", "UpdateChecker") > -1 width: childrenRect.width @@ -192,20 +315,7 @@ UM.PreferencesPage } } - UM.TooltipArea { - width: childrenRect.width - height: childrenRect.height - text: catalog.i18nc("@info:tooltip", "Should a prefix based on the printer name be added to the print job name automatically?") - - CheckBox - { - id: prefixJobNameCheckbox - text: catalog.i18nc("@option:check", "Add machine prefix to job name") - checked: boolCheck(UM.Preferences.getValue("cura/jobname_prefix")) - onCheckedChanged: UM.Preferences.setValue("cura/jobname_prefix", checked) - } - } - + //: Invisible list used to check if a plugin exists ListView { id: plugins diff --git a/resources/qml/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml similarity index 100% rename from resources/qml/MachinesPage.qml rename to resources/qml/Preferences/MachinesPage.qml diff --git a/resources/qml/ViewPage.qml b/resources/qml/ViewPage.qml deleted file mode 100644 index baf56db116..0000000000 --- a/resources/qml/ViewPage.qml +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2015 Ultimaker B.V. -// Cura is released under the terms of the AGPLv3 or higher. - -import QtQuick 2.1 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Controls.Styles 1.1 - -import UM 1.1 as UM - -UM.PreferencesPage -{ - id: preferencesPage - - //: View configuration page title - title: catalog.i18nc("@title:window","View"); - - function reset() - { - UM.Preferences.resetPreference("view/show_overhang"); - UM.Preferences.resetPreference("view/center_on_select"); - UM.Preferences.resetPreference("view/top_layer_count"); - } - - Column - { - UM.I18nCatalog { id: catalog; name:"cura"} - - UM.TooltipArea - { - width: childrenRect.width; - height: childrenRect.height; - - text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.") - - CheckBox - { - id: overhangCheckbox - - checked: boolCheck(UM.Preferences.getValue("view/show_overhang")) - onClicked: UM.Preferences.setValue("view/show_overhang", checked) - - text: catalog.i18nc("@option:check","Display overhang"); - } - } - - UM.TooltipArea { - width: childrenRect.width; - height: childrenRect.height; - text: catalog.i18nc("@info:tooltip","Moves the camera so the object is in the center of the view when an object is selected") - - CheckBox - { - id: centerCheckbox - text: catalog.i18nc("@action:button","Center camera when item is selected"); - checked: boolCheck(UM.Preferences.getValue("view/center_on_select")) - onClicked: UM.Preferences.setValue("view/center_on_select", checked) - } - } - - UM.TooltipArea { - width: childrenRect.width; - height: childrenRect.height; - text: catalog.i18nc("@info:tooltip","Display 5 top layers in layer view or only the top-most layer. Rendering 5 layers takes longer, but may show more information.") - - CheckBox - { - id: topLayerCheckbox - text: catalog.i18nc("@action:button","Display five top layers in layer view."); - checked: UM.Preferences.getValue("view/top_layer_count") == 5 - onClicked: - { - if(UM.Preferences.getValue("view/top_layer_count") == 5) - { - UM.Preferences.setValue("view/top_layer_count", 1) - } - else - { - UM.Preferences.setValue("view/top_layer_count", 5) - } - } - } - } - - Connections { - target: UM.Preferences - onPreferenceChanged: - { - overhangCheckbox.checked = boolCheck(UM.Preferences.getValue("view/show_overhang")) - centerCheckbox.checked = boolCheck(UM.Preferences.getValue("view/center_on_select")) - topLayerCheckbox = UM.Preferences.getValue("view/top_layer_count") == 5 - - } - } - } -}