Changed parseInt to Math.floor

This commit is contained in:
Mark 2017-10-11 16:47:40 +02:00
parent d9c7a211c1
commit eaa7b75f0e
7 changed files with 64 additions and 64 deletions

View file

@ -24,7 +24,7 @@ Column
{
id: connectedPrinterHeader
width: parent.width
height: parseInt(childrenRect.height + UM.Theme.getSize("default_margin").height * 2)
height: Math.floor(childrenRect.height + UM.Theme.getSize("default_margin").height * 2)
color: UM.Theme.getColor("setting_category")
Label
@ -82,7 +82,7 @@ Column
{
id: extruderRectangle
color: UM.Theme.getColor("sidebar")
width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : parseInt(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.floor(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
height: UM.Theme.getSize("sidebar_extruder_box").height
Label //Extruder name.
@ -162,8 +162,8 @@ Column
Rectangle //Material colour indication.
{
id: materialColor
width: parseInt(materialName.height * 0.75)
height: parseInt(materialName.height * 0.75)
width: Math.floor(materialName.height * 0.75)
height: Math.floor(materialName.height * 0.75)
radius: width / 2
color: (connectedPrinter != null && connectedPrinter.materialColors[index] != null && connectedPrinter.materialIds[index] != "") ? connectedPrinter.materialColors[index] : "#00000000"
border.width: UM.Theme.getSize("default_lining").width
@ -357,7 +357,7 @@ Column
color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok")
property var showError:
{
if(bedTemperature.properties.maximum_value != "None" && bedTemperature.properties.maximum_value < parseInt(preheatTemperatureInput.text))
if(bedTemperature.properties.maximum_value != "None" && bedTemperature.properties.maximum_value < Math.floor(preheatTemperatureInput.text))
{
return true;
} else
@ -475,7 +475,7 @@ Column
visible: preheatCountdown.visible
source: UM.Theme.getIcon("print_time")
anchors.right: preheatCountdown.left
anchors.rightMargin: parseInt(UM.Theme.getSize("default_margin").width / 2)
anchors.rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2)
anchors.verticalCenter: preheatCountdown.verticalCenter
}
@ -527,15 +527,15 @@ Column
{
return true; //Can always cancel if the timer is running.
}
if (bedTemperature.properties.minimum_value != "None" && parseInt(preheatTemperatureInput.text) < parseInt(bedTemperature.properties.minimum_value))
if (bedTemperature.properties.minimum_value != "None" && Math.floor(preheatTemperatureInput.text) < Math.floor(bedTemperature.properties.minimum_value))
{
return false; //Target temperature too low.
}
if (bedTemperature.properties.maximum_value != "None" && parseInt(preheatTemperatureInput.text) > parseInt(bedTemperature.properties.maximum_value))
if (bedTemperature.properties.maximum_value != "None" && Math.floor(preheatTemperatureInput.text) > Math.floor(bedTemperature.properties.maximum_value))
{
return false; //Target temperature too high.
}
if (parseInt(preheatTemperatureInput.text) == 0)
if (Math.floor(preheatTemperatureInput.text) == 0)
{
return false; //Setting the temperature to 0 is not allowed (since that cancels the pre-heating).
}
@ -708,13 +708,13 @@ Column
Row
{
height: UM.Theme.getSize("setting_control").height
width: parseInt(base.width - 2 * UM.Theme.getSize("default_margin").width)
width: Math.floor(base.width - 2 * UM.Theme.getSize("default_margin").width)
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
Label
{
width: parseInt(parent.width * 0.4)
width: Math.floor(parent.width * 0.4)
anchors.verticalCenter: parent.verticalCenter
text: label
color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
@ -723,7 +723,7 @@ Column
}
Label
{
width: parseInt(parent.width * 0.6)
width: Math.floor(parent.width * 0.6)
anchors.verticalCenter: parent.verticalCenter
text: value
color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")