Apply suggestions from code review

Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>
Co-authored-by: Jelle Spijker <j.spijker@ultimaker.com>
This commit is contained in:
Joey de l'Arago 2022-12-12 11:44:21 +01:00 committed by GitHub
parent e03b4e07f9
commit 1e6184448c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 25 deletions

View file

@ -43,7 +43,7 @@ Cura.ComboBox {
var value = propertyProvider.properties["options"][key]
comboboxModel.append({ text: value, code: key})
if (propertyProvider.properties.value == key)
if (propertyProvider.properties.value === key)
{
// The combobox is cleared after each value change so the currentIndex must be set each time.
currentIndex = i
@ -81,7 +81,7 @@ Cura.ComboBox {
function parseValueAndUpdateSetting()
{
if (comboboxModel.get(currentIndex) && comboboxModel.get(currentIndex).code != propertyProvider.properties.value)
if (comboboxModel.get(currentIndex) && comboboxModel.get(currentIndex).code !== propertyProvider.properties.value)
{
updateSetting(comboboxModel.get(currentIndex).code)
}

View file

@ -56,10 +56,10 @@ Row
Cura.ExtruderButton
{
anchors.margins : 0
anchors.margins: 0
padding: 0
extruder: model
checked: extruder.index == selectedIndex
checked: extruder.index === selectedIndex
iconScale: 0.8
font: UM.Theme.getFont("tiny_emphasis")
buttonSize: UM.Theme.getSize("small_button").width

View file

@ -87,13 +87,13 @@ UM.TextField
function parseValueUpdateSetting()
{
if (propertyProvider.properties.value == text || (parseFloat(propertyProvider.properties.value) == parseFloat(text) && !isNan(parseFloat(text))))
if (propertyProvider.properties.value === text || (parseFloat(propertyProvider.properties.value) === parseFloat(text)))
{
// Don't set the property value from the control. It already has the same value
return
}
if (propertyProvider && text != propertyProvider.properties.value)
if (propertyProvider && text !== propertyProvider.properties.value)
{
updateSetting(text);
}
@ -119,7 +119,7 @@ UM.TextField
State
{
name: "validationError"
when: propertyProvider.properties.validationState == "ValidatorState.Exception" || propertyProvider.properties.validationState == "ValidatorState.MinimumError" || propertyProvider.properties.validationState == "ValidatorState.MaximumError"
when: propertyProvider.properties.validationState === "ValidatorState.Exception" || propertyProvider.properties.validationState === "ValidatorState.MinimumError" || propertyProvider.properties.validationState === "ValidatorState.MaximumError"
PropertyChanges
{
target: background
@ -130,7 +130,7 @@ UM.TextField
State
{
name: "validationWarning"
when: propertyProvider.properties.validationState == "ValidatorState.MinimumWarning" || propertyProvider.properties.validationState == "ValidatorState.MaximumWarning"
when: propertyProvider.properties.validationState === "ValidatorState.MinimumWarning" || propertyProvider.properties.validationState === "ValidatorState.MaximumWarning"
PropertyChanges
{
target: background