Code Style: camelCase for qnl properties, brackets, commas

CURA-6683
This commit is contained in:
Nino van Hooff 2019-09-18 09:45:26 +02:00
parent c3bbd884b5
commit be7bd59e30

View file

@ -15,14 +15,14 @@ Item
id: base id: base
width: childrenRect.width width: childrenRect.width
height: childrenRect.height height: childrenRect.height
property var all_categories_except_support: [ "machine_settings", "resolution", "shell", "infill", "material", "speed", property var allCategoriesExceptSupport: [ "machine_settings", "resolution", "shell", "infill", "material", "speed",
"travel", "cooling", "platform_adhesion", "dual", "meshfix", "blackmagic", "experimental"] "travel", "cooling", "platform_adhesion", "dual", "meshfix", "blackmagic", "experimental"]
readonly property string normal_mesh_type: "" readonly property string normalMeshType: ""
readonly property string support_mesh_type: "support_mesh" readonly property string supportMeshType: "support_mesh"
readonly property string cutting_mesh_type: "cutting_mesh" readonly property string cuttingMeshType: "cutting_mesh"
readonly property string infill_mesh_type: "infill_mesh" readonly property string infillMeshType: "infill_mesh"
readonly property string anti_overhang_mesh_type: "anti_overhang_mesh" readonly property string antiOverhangMeshType: "anti_overhang_mesh"
property var currentMeshType: UM.ActiveTool.properties.getValue("MeshType") property var currentMeshType: UM.ActiveTool.properties.getValue("MeshType")
@ -30,17 +30,16 @@ Item
onCurrentMeshTypeChanged: onCurrentMeshTypeChanged:
{ {
// set checked state of mesh type buttons // set checked state of mesh type buttons
normalButton.checked = currentMeshType === normal_mesh_type normalButton.checked = type === normalMeshType
supportMeshButton.checked = currentMeshType === support_mesh_type supportMeshButton.checked = type === supportMeshType
overhangMeshButton.checked = currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type overhangMeshButton.checked = type === infillMeshType || type === cuttingMeshType
antiOverhangMeshButton.checked = currentMeshType === anti_overhang_mesh_type antiOverhangMeshButton.checked = type === antiOverhangMeshType
// update active type label // update active type label
for (var button in meshTypeButtons.children) for (var button in meshTypeButtons.children)
{ {
if (meshTypeButtons.children[button].checked) if (meshTypeButtons.children[button].checked){
{ meshTypeLabel.text = catalog.i18nc("@label", "Mesh Type") + ": " + meshTypeButtons.children[button].text
meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text
break break
} }
} }
@ -50,11 +49,11 @@ Item
{ {
if (infillOnlyCheckbox.checked) if (infillOnlyCheckbox.checked)
{ {
setMeshType(infill_mesh_type) setMeshType(infillMeshType)
} }
else else
{ {
setMeshType(cutting_mesh_type) setMeshType(cuttingMeshType)
} }
} }
@ -63,6 +62,23 @@ Item
UM.ActiveTool.setProperty("MeshType", type) UM.ActiveTool.setProperty("MeshType", type)
} }
function updateView(type) {
// set checked state of mesh type buttons
normalButton.checked = type === normal_mesh_type
supportMeshButton.checked = type === support_mesh_type
overhangMeshButton.checked = type === infill_mesh_type || type === cutting_mesh_type
antiOverhangMeshButton.checked = type === anti_overhang_mesh_type
// update active type label
for (var button in meshTypeButtons.children)
{
if(meshTypeButtons.children[button].checked){
meshTypeLabel.text = catalog.i18nc("@label","Mesh Type") + ": " + meshTypeButtons.children[button].text
break
}
}
}
UM.I18nCatalog { id: catalog; name: "uranium"} UM.I18nCatalog { id: catalog; name: "uranium"}
Column Column
@ -85,7 +101,7 @@ Item
iconSource: UM.Theme.getIcon("pos_normal"); iconSource: UM.Theme.getIcon("pos_normal");
property bool needBorder: true property bool needBorder: true
checkable: true checkable: true
onClicked: setMeshType(normal_mesh_type); onClicked: setMeshType(normalMeshType);
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
z: 4 z: 4
} }
@ -97,7 +113,7 @@ Item
iconSource: UM.Theme.getIcon("pos_print_as_support"); iconSource: UM.Theme.getIcon("pos_print_as_support");
property bool needBorder: true property bool needBorder: true
checkable:true checkable:true
onClicked: setMeshType(support_mesh_type) onClicked: setMeshType(supportMeshType)
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
z: 3 z: 3
} }
@ -109,7 +125,7 @@ Item
iconSource: UM.Theme.getIcon("pos_modify_overlaps"); iconSource: UM.Theme.getIcon("pos_modify_overlaps");
property bool needBorder: true property bool needBorder: true
checkable:true checkable:true
onClicked: setMeshType(infill_mesh_type) onClicked: setMeshType(infillMeshType)
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
z: 2 z: 2
} }
@ -121,7 +137,7 @@ Item
iconSource: UM.Theme.getIcon("pos_modify_dont_support_overlap"); iconSource: UM.Theme.getIcon("pos_modify_dont_support_overlap");
property bool needBorder: true property bool needBorder: true
checkable: true checkable: true
onClicked: setMeshType(anti_overhang_mesh_type) onClicked: setMeshType(antiOverhangMeshType)
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
z: 1 z: 1
} }
@ -141,18 +157,18 @@ Item
{ {
id: infillOnlyCheckbox id: infillOnlyCheckbox
text: catalog.i18nc("@action:checkbox","Infill only"); text: catalog.i18nc("@action:checkbox", "Infill only");
style: UM.Theme.styles.checkbox; style: UM.Theme.styles.checkbox;
visible: currentMeshType === infill_mesh_type || currentMeshType === cutting_mesh_type visible: currentMeshType === infillMeshType || currentMeshType === cuttingMeshType
onClicked: setOverhangsMeshType() onClicked: setOverhangsMeshType()
Binding Binding
{ {
target: infillOnlyCheckbox target: infillOnlyCheckbox
property: "checked" property: "checked"
value: currentMeshType === infill_mesh_type value: currentMeshType === infillMeshType
} }
} }
@ -193,9 +209,9 @@ Item
{ {
var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ] var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]
if(currentMeshType == "support_mesh") if (currentMeshType == "support_mesh")
{ {
excluded_settings = excluded_settings.concat(base.all_categories_except_support) excluded_settings = excluded_settings.concat(base.allCategoriesExceptSupport)
} }
return excluded_settings return excluded_settings
} }
@ -371,7 +387,7 @@ Item
settingPickDialog.visible = true; settingPickDialog.visible = true;
if (currentMeshType == "support_mesh") if (currentMeshType == "support_mesh")
{ {
settingPickDialog.additional_excluded_settings = base.all_categories_except_support; settingPickDialog.additional_excluded_settings = base.allCategoriesExceptSupport;
} }
else else
{ {
@ -394,7 +410,7 @@ Item
onVisibilityChanged: onVisibilityChanged:
{ {
// force updating the model to sync it with addedSettingsModel // force updating the model to sync it with addedSettingsModel
if(visible) if (visible)
{ {
// Set skip setting, it will prevent from resetting selected mesh_type // Set skip setting, it will prevent from resetting selected mesh_type
contents.model.visibilityHandler.addSkipResetSetting(currentMeshType) contents.model.visibilityHandler.addSkipResetSetting(currentMeshType)
@ -411,7 +427,7 @@ Item
// Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value` // Don't filter on "settable_per_meshgroup" any more when `printSequencePropertyProvider.properties.value`
// is set to "one_at_a_time", because the current backend architecture isn't ready for that. // is set to "one_at_a_time", because the current backend architecture isn't ready for that.
if(filterInput.text != "") if (filterInput.text != "")
{ {
new_filter["i18n_label"] = "*" + filterInput.text new_filter["i18n_label"] = "*" + filterInput.text
} }