Merge branch '3.2'

Lots of conflicts due to rounding vs. flooring of text element positions for weirdness with the font aliasing.
This commit is contained in:
Ghostkeeper 2018-02-14 10:53:51 +01:00
commit ee9de1f11b
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
48 changed files with 999 additions and 875 deletions

View file

@ -484,7 +484,7 @@ UM.MainWindow
anchors
{
horizontalCenter: parent.horizontalCenter
horizontalCenterOffset: -(Math.floor(UM.Theme.getSize("sidebar").width / 2))
horizontalCenterOffset: -(Math.round(UM.Theme.getSize("sidebar").width / 2))
top: parent.verticalCenter;
bottom: parent.bottom;
}

View file

@ -65,7 +65,7 @@ Button
width: UM.Theme.getSize("extruder_button_material").width
height: UM.Theme.getSize("extruder_button_material").height
radius: Math.floor(width / 2)
radius: Math.round(width / 2)
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("extruder_button_material_border")

View file

@ -94,7 +94,7 @@ Item {
{
id: printJobTextfield
anchors.right: printJobPencilIcon.left
anchors.rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2)
anchors.rightMargin: Math.round(UM.Theme.getSize("default_margin").width / 2)
height: UM.Theme.getSize("jobspecs_line").height
width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
maximumLength: 120

View file

@ -225,7 +225,7 @@ Item
width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width;
height: UM.Theme.getSize("progressbar").height;
anchors.top: statusLabel.bottom;
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 4);
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 4);
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width;
}

View file

@ -38,7 +38,7 @@ Rectangle
Button {
id: collapseButton
anchors.top: parent.top
anchors.topMargin: Math.floor(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2)
anchors.topMargin: Math.round(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2)
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width

View file

@ -163,7 +163,7 @@ UM.PreferencesPage
append({ text: "Русский", code: "ru_RU" })
append({ text: "Türkçe", code: "tr_TR" })
append({ text: "简体中文", code: "zh_CN" })
append({ text: "正體字", code: "zh_TW" })
//Traditional Chinese is disabled for being incomplete: append({ text: "", code: "zh_TW" })
var date_object = new Date();
if (date_object.getUTCMonth() == 8 && date_object.getUTCDate() == 19) //Only add Pirate on the 19th of September.

View file

@ -98,15 +98,15 @@ TabView
Row {
width: scrollView.columnWidth
height: parent.rowHeight
spacing: Math.floor(UM.Theme.getSize("default_margin").width / 2)
spacing: Math.round(UM.Theme.getSize("default_margin").width / 2)
// color indicator square
Rectangle {
id: colorSelector
color: properties.color_code
width: Math.floor(colorLabel.height * 0.75)
height: Math.floor(colorLabel.height * 0.75)
width: Math.round(colorLabel.height * 0.75)
height: Math.round(colorLabel.height * 0.75)
border.width: UM.Theme.getSize("default_lining").height
anchors.verticalCenter: parent.verticalCenter

View file

@ -59,15 +59,15 @@ UM.ManagementPage
anchors.right: parent.right
Rectangle
{
width: Math.floor(parent.height * 0.8)
height: Math.floor(parent.height * 0.8)
width: Math.round(parent.height * 0.8)
height: Math.round(parent.height * 0.8)
color: model.metadata.color_code
border.color: isCurrentItem ? palette.highlightedText : palette.text;
anchors.verticalCenter: parent.verticalCenter
}
Label
{
width: Math.floor((parent.width * 0.3))
width: Math.round((parent.width * 0.3))
text: model.metadata.material
elide: Text.ElideRight
font.italic: model.id == activeId

View file

@ -1,7 +1,7 @@
// Copyright (c) 2017 Ultimaker B.V.
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick 2.8
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
@ -50,7 +50,7 @@ Column
ExtruderBox
{
color: UM.Theme.getColor("sidebar")
width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.floor(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.round(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
extruderModel: modelData
}
}

View file

@ -1,7 +1,7 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick 2.8
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
@ -76,7 +76,7 @@ Item {
width: parent.width - 2 * UM.Theme.getSize("sidebar_margin").width
height: UM.Theme.getSize("progressbar").height
anchors.top: statusLabel.bottom
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 4)
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 4)
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
radius: UM.Theme.getSize("progressbar_radius").width
@ -354,7 +354,7 @@ Item {
}
Behavior on color { ColorAnimation { duration: 50; } }
anchors.left: parent.left
anchors.leftMargin: Math.floor(UM.Theme.getSize("save_button_text_margin").width / 2);
anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2);
width: parent.height
height: parent.height

View file

@ -187,13 +187,13 @@ Button
id: settingsButton
visible: base.hovered || settingsButton.hovered
height: Math.floor(base.height * 0.6)
width: Math.floor(base.height * 0.6)
height: Math.round(base.height * 0.6)
width: Math.round(base.height * 0.6)
anchors {
right: inheritButton.visible ? inheritButton.left : parent.right
// use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
rightMargin: inheritButton.visible ? Math.floor(UM.Theme.getSize("default_margin").width / 2) : category_arrow.width + Math.floor(UM.Theme.getSize("default_margin").width * 1.9)
rightMargin: inheritButton.visible ? Math.round(UM.Theme.getSize("default_margin").width / 2) : category_arrow.width + Math.round(UM.Theme.getSize("default_margin").width * 1.9)
verticalCenter: parent.verticalCenter
}
@ -231,7 +231,7 @@ Button
return false
}
height: Math.floor(parent.height / 2)
height: Math.round(parent.height / 2)
width: height
onClicked:

View file

@ -1,9 +1,9 @@
// Copyright (c) 2015 Ultimaker B.V.
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import QtQuick 2.8
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.1
import UM 1.2 as UM
@ -118,8 +118,8 @@ SettingItem
UM.RecolorImage {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: Math.floor(parent.width / 2.5)
height: Math.floor(parent.height / 2.5)
width: Math.round(parent.width / 2.5)
height: Math.round(parent.height / 2.5)
sourceSize.width: width
sourceSize.height: width
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");

View file

@ -61,7 +61,7 @@ SettingItem
{
id: downArrow
x: control.width - width - control.rightPadding
y: control.topPadding + Math.floor((control.availableHeight - height) / 2)
y: control.topPadding + Math.round((control.availableHeight - height) / 2)
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width

View file

@ -68,7 +68,7 @@ SettingItem
{
id: downArrow
x: control.width - width - control.rightPadding
y: control.topPadding + Math.floor((control.availableHeight - height) / 2)
y: control.topPadding + Math.round((control.availableHeight - height) / 2)
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
@ -126,16 +126,16 @@ SettingItem
background: Rectangle
{
id: swatch
height: Math.floor(UM.Theme.getSize("setting_control").height / 2)
height: Math.round(UM.Theme.getSize("setting_control").height / 2)
width: height
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Math.floor(UM.Theme.getSize("default_margin").width / 4)
anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4)
border.width: UM.Theme.getSize("default_lining").width
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: Math.floor(width / 2)
radius: Math.round(width / 2)
color: control.color
}
@ -180,16 +180,16 @@ SettingItem
background: Rectangle
{
id: swatch
height: Math.floor(UM.Theme.getSize("setting_control").height / 2)
height: Math.round(UM.Theme.getSize("setting_control").height / 2)
width: height
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Math.floor(UM.Theme.getSize("default_margin").width / 4)
anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4)
border.width: UM.Theme.getSize("default_lining").width
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: Math.floor(width / 2)
radius: Math.round(width / 2)
color: control.model.getItem(index).color
}

View file

@ -1,9 +1,9 @@
// Copyright (c) 2017 Ultimaker B.V.
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import QtQuick 2.8
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.1
import UM 1.1 as UM
import Cura 1.0 as Cura
@ -108,7 +108,7 @@ Item {
id: label;
anchors.left: parent.left;
anchors.leftMargin: doDepthIndentation ? Math.floor((UM.Theme.getSize("section_icon_column").width + 5) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0
anchors.leftMargin: doDepthIndentation ? Math.round((UM.Theme.getSize("section_icon_column").width + 5) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0
anchors.right: settingControls.left;
anchors.verticalCenter: parent.verticalCenter
@ -128,12 +128,12 @@ Item {
{
id: settingControls
height: Math.floor(parent.height / 2)
spacing: Math.floor(UM.Theme.getSize("sidebar_margin").height / 2)
height: Math.round(parent.height / 2)
spacing: Math.round(UM.Theme.getSize("sidebar_margin").height / 2)
anchors {
right: controlContainer.left
rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width / 2)
rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width / 2)
verticalCenter: parent.verticalCenter
}

View file

@ -87,7 +87,7 @@ SettingItem
{
id: downArrow
x: control.width - width - control.rightPadding
y: control.topPadding + Math.floor((control.availableHeight - height) / 2)
y: control.topPadding + Math.round((control.availableHeight - height) / 2)
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
@ -145,16 +145,16 @@ SettingItem
background: Rectangle
{
id: swatch
height: Math.floor(UM.Theme.getSize("setting_control").height / 2)
height: Math.round(UM.Theme.getSize("setting_control").height / 2)
width: height
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Math.floor(UM.Theme.getSize("default_margin").width / 4)
anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4)
border.width: UM.Theme.getSize("default_lining").width
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: Math.floor(width / 2)
radius: Math.round(width / 2)
color: control.color
}
@ -199,16 +199,16 @@ SettingItem
background: Rectangle
{
id: swatch
height: Math.floor(UM.Theme.getSize("setting_control").height / 2)
height: Math.round(UM.Theme.getSize("setting_control").height / 2)
width: height
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Math.floor(UM.Theme.getSize("default_margin").width / 4)
anchors.margins: Math.round(UM.Theme.getSize("default_margin").width / 4)
border.width: UM.Theme.getSize("default_lining").width
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
radius: Math.floor(width / 2)
radius: Math.round(width / 2)
color: control.model.getItem(index).color
}

View file

@ -26,7 +26,7 @@ SettingItem
anchors.fill: parent
border.width: Math.floor(UM.Theme.getSize("default_lining").width)
border.width: Math.round(UM.Theme.getSize("default_lining").width)
border.color:
{
if(!enabled)
@ -76,7 +76,7 @@ SettingItem
Rectangle
{
anchors.fill: parent;
anchors.margins: Math.floor(UM.Theme.getSize("default_lining").width);
anchors.margins: Math.round(UM.Theme.getSize("default_lining").width);
color: UM.Theme.getColor("setting_control_highlight")
opacity: !control.hovered ? 0 : propertyProvider.properties.validationState == "ValidatorState.Valid" ? 1.0 : 0.35;
}
@ -84,7 +84,7 @@ SettingItem
Label
{
anchors.right: parent.right;
anchors.rightMargin: Math.floor(UM.Theme.getSize("setting_unit_margin").width)
anchors.rightMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width)
anchors.verticalCenter: parent.verticalCenter;
text: definition.unit;
@ -107,9 +107,9 @@ SettingItem
anchors
{
left: parent.left
leftMargin: Math.floor(UM.Theme.getSize("setting_unit_margin").width)
leftMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width)
right: parent.right
rightMargin: Math.floor(UM.Theme.getSize("setting_unit_margin").width)
rightMargin: Math.round(UM.Theme.getSize("setting_unit_margin").width)
verticalCenter: parent.verticalCenter
}
renderType: Text.NativeRendering

View file

@ -4,7 +4,7 @@
import QtQuick 2.7
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import QtQuick.Layouts 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
@ -30,16 +30,16 @@ Item
{
top: parent.top
left: parent.left
leftMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width)
right: parent.right
rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width)
}
Label
{
id: globalProfileLabel
text: catalog.i18nc("@label","Profile:");
width: Math.floor(parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width - 2)
width: Math.round(parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width - 2)
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text");
verticalAlignment: Text.AlignVCenter
@ -53,7 +53,7 @@ Item
text: generateActiveQualityText()
enabled: !header.currentExtruderVisible || header.currentExtruderIndex > -1
width: Math.floor(parent.width * 0.55)
width: Math.round(parent.width * 0.55)
height: UM.Theme.getSize("setting_control").height
anchors.left: globalProfileLabel.right
anchors.right: parent.right
@ -82,12 +82,12 @@ Item
id: customisedSettings
visible: Cura.MachineManager.hasUserSettings
height: Math.floor(parent.height * 0.6)
width: Math.floor(parent.height * 0.6)
height: Math.round(parent.height * 0.6)
width: Math.round(parent.height * 0.6)
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Math.floor(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("sidebar_margin").width)
anchors.rightMargin: Math.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("sidebar_margin").width)
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
iconSource: UM.Theme.getIcon("star");
@ -112,7 +112,7 @@ Item
id: filterContainer
visible: true
border.width: Math.floor(UM.Theme.getSize("default_lining").width)
border.width: Math.round(UM.Theme.getSize("default_lining").width)
border.color:
{
if(hoverMouseArea.containsMouse || clearFilterButton.containsMouse)
@ -132,9 +132,9 @@ Item
top: globalProfileRow.bottom
topMargin: UM.Theme.getSize("sidebar_margin").height
left: parent.left
leftMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width)
right: parent.right
rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width)
}
height: visible ? UM.Theme.getSize("setting_control").height : 0
Behavior on height { NumberAnimation { duration: 100 } }
@ -145,7 +145,7 @@ Item
anchors.left: parent.left
anchors.right: clearFilterButton.left
anchors.rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
anchors.rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width)
placeholderText: catalog.i18nc("@label:textbox", "Search...")
@ -204,12 +204,12 @@ Item
iconSource: UM.Theme.getIcon("cross1")
visible: findingSettings
height: Math.floor(parent.height * 0.4)
height: Math.round(parent.height * 0.4)
width: visible ? height : 0
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width)
anchors.rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width)
color: UM.Theme.getColor("setting_control_button")
hoverColor: UM.Theme.getColor("setting_control_button_hover")
@ -238,7 +238,7 @@ Item
ListView
{
id: contents
spacing: Math.floor(UM.Theme.getSize("default_lining").height);
spacing: Math.round(UM.Theme.getSize("default_lining").height);
cacheBuffer: 1000000; // Set a large cache to effectively just cache every list item.
model: UM.SettingDefinitionsModel
@ -266,7 +266,7 @@ Item
{
id: delegate
width: Math.floor(UM.Theme.getSize("sidebar").width);
width: Math.round(UM.Theme.getSize("sidebar").width);
height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : - contents.spacing
Behavior on height { NumberAnimation { duration: 100 } }
opacity: provider.properties.enabled == "True" ? 1 : 0
@ -388,7 +388,7 @@ Item
contextMenu.provider = provider
contextMenu.popup();
}
onShowTooltip: base.showTooltip(delegate, { x: -UM.Theme.getSize("default_arrow").width, y: Math.floor(delegate.height / 2) }, text)
onShowTooltip: base.showTooltip(delegate, { x: -UM.Theme.getSize("default_arrow").width, y: Math.round(delegate.height / 2) }, text)
onHideTooltip: base.hideTooltip()
onShowAllHiddenInheritedSettings:
{

View file

@ -64,11 +64,11 @@ Rectangle
function getPrettyTime(time)
{
var hours = Math.floor(time / 3600)
var hours = Math.round(time / 3600)
time -= hours * 3600
var minutes = Math.floor(time / 60);
var minutes = Math.round(time / 60);
time -= minutes * 60
var seconds = Math.floor(time);
var seconds = Math.round(time);
var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2);
return finalTime;
@ -130,7 +130,7 @@ Rectangle
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.top: hideSettings ? machineSelection.bottom : headerSeparator.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
width: Math.floor(parent.width * 0.45)
width: Math.round(parent.width * 0.45)
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
visible: !monitoringPrint && !hideView
@ -142,7 +142,7 @@ Rectangle
id: settingsModeSelection
color: "transparent"
width: Math.floor(parent.width * 0.55)
width: Math.round(parent.width * 0.55)
height: UM.Theme.getSize("sidebar_header_mode_toggle").height
anchors.right: parent.right
@ -171,10 +171,10 @@ Rectangle
id: control
height: settingsModeSelection.height
width: Math.floor(parent.width / 2)
width: Math.round(parent.width / 2)
anchors.left: parent.left
anchors.leftMargin: model.index * Math.floor(settingsModeSelection.width / 2)
anchors.leftMargin: model.index * Math.round(settingsModeSelection.width / 2)
anchors.verticalCenter: parent.verticalCenter
ButtonGroup.group: modeMenuGroup
@ -329,7 +329,7 @@ Rectangle
height: UM.Theme.getSize("sidebar_lining").height
color: UM.Theme.getColor("sidebar_lining")
anchors.bottom: printSpecs.top
anchors.bottomMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 2 + UM.Theme.getSize("progressbar").height + UM.Theme.getFont("default_bold").pixelSize)
anchors.bottomMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 2 + UM.Theme.getSize("progressbar").height + UM.Theme.getFont("default_bold").pixelSize)
}
Item
@ -429,7 +429,7 @@ Rectangle
{
names.push(base.printMaterialNames[index]);
lengths.push(base.printMaterialLengths[index].toFixed(2));
weights.push(String(Math.floor(base.printMaterialWeights[index])));
weights.push(String(Math.round(base.printMaterialWeights[index])));
var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2);
costs.push(cost);
if(cost > 0)
@ -495,7 +495,7 @@ Rectangle
if(base.printMaterialLengths[index] > 0)
{
lengths.push(base.printMaterialLengths[index].toFixed(2));
weights.push(String(Math.floor(base.printMaterialWeights[index])));
weights.push(String(Math.round(base.printMaterialWeights[index])));
var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2);
costs.push(cost);
if(cost > 0)
@ -610,7 +610,7 @@ Rectangle
})
sidebarContents.replace(modesListModel.get(base.currentModeIndex).item, { "immediate": true })
var index = Math.floor(UM.Preferences.getValue("cura/active_mode"))
var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
if(index)
{
currentModeIndex = index;

View file

@ -1,7 +1,7 @@
// Copyright (c) 2016 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick 2.8
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1

View file

@ -1,7 +1,7 @@
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick 2.8
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
@ -17,7 +17,7 @@ Column
property int currentExtruderIndex: Cura.ExtruderManager.activeExtruderIndex;
property bool currentExtruderVisible: extrudersList.visible;
spacing: Math.floor(UM.Theme.getSize("sidebar_margin").width * 0.9)
spacing: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.9)
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
@ -39,15 +39,15 @@ Column
{
id: extruderSelectionRow
width: parent.width
height: Math.floor(UM.Theme.getSize("sidebar_tabs").height * 2 / 3)
height: Math.round(UM.Theme.getSize("sidebar_tabs").height * 2 / 3)
visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint
anchors
{
left: parent.left
leftMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width * 0.7)
leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.7)
right: parent.right
rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width * 0.7)
rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.7)
topMargin: UM.Theme.getSize("sidebar_margin").height
}
@ -57,15 +57,15 @@ Column
property var index: 0
height: UM.Theme.getSize("sidebar_header_mode_tabs").height
width: Math.floor(parent.width)
width: Math.round(parent.width)
boundsBehavior: Flickable.StopAtBounds
anchors
{
left: parent.left
leftMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2)
leftMargin: Math.round(UM.Theme.getSize("default_margin").width / 2)
right: parent.right
rightMargin: Math.floor(UM.Theme.getSize("default_margin").width / 2)
rightMargin: Math.round(UM.Theme.getSize("default_margin").width / 2)
verticalCenter: parent.verticalCenter
}
@ -84,7 +84,7 @@ Column
delegate: Button
{
height: ListView.view.height
width: Math.floor(ListView.view.width / extrudersModel.rowCount())
width: Math.round(ListView.view.width / extrudersModel.rowCount())
text: model.name
tooltip: model.name
@ -121,7 +121,7 @@ Column
width: {
var extruderTextWidth = extruderStaticText.visible ? extruderStaticText.width : 0;
var iconWidth = extruderIconItem.width;
return Math.floor(extruderTextWidth + iconWidth + UM.Theme.getSize("default_margin").width / 2);
return Math.round(extruderTextWidth + iconWidth + UM.Theme.getSize("default_margin").width / 2);
}
// Static text "Extruder"
@ -153,7 +153,7 @@ Column
var minimumWidth = control.width < UM.Theme.getSize("button").width ? control.width : UM.Theme.getSize("button").width;
var minimumHeight = control.height < UM.Theme.getSize("button").height ? control.height : UM.Theme.getSize("button").height;
var minimumSize = minimumWidth < minimumHeight ? minimumWidth : minimumHeight;
minimumSize -= Math.floor(UM.Theme.getSize("default_margin").width / 2);
minimumSize -= Math.round(UM.Theme.getSize("default_margin").width / 2);
return minimumSize;
}
@ -192,15 +192,15 @@ Column
{
right: parent.right
top: parent.top
rightMargin: Math.floor(parent.sizeToUse * 0.01)
topMargin: Math.floor(parent.sizeToUse * 0.05)
rightMargin: Math.round(parent.sizeToUse * 0.01)
topMargin: Math.round(parent.sizeToUse * 0.05)
}
color: model.color
width: Math.floor(parent.width * 0.35)
height: Math.floor(parent.height * 0.35)
radius: Math.floor(width / 2)
width: Math.round(parent.width * 0.35)
height: Math.round(parent.height * 0.35)
radius: Math.round(width / 2)
border.width: 1
border.color: UM.Theme.getColor("extruder_button_material_border")
@ -219,7 +219,7 @@ Column
Item
{
id: variantRowSpacer
height: Math.floor(UM.Theme.getSize("sidebar_margin").height / 4)
height: Math.round(UM.Theme.getSize("sidebar_margin").height / 4)
width: height
visible: !extruderSelectionRow.visible
}
@ -243,7 +243,7 @@ Column
{
id: materialLabel
text: catalog.i18nc("@label", "Material");
width: Math.floor(parent.width * 0.45 - UM.Theme.getSize("default_margin").width)
width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width)
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text");
}
@ -257,7 +257,7 @@ Column
visible: Cura.MachineManager.hasMaterials
enabled: !extrudersList.visible || base.currentExtruderIndex > -1
height: UM.Theme.getSize("setting_control").height
width: Math.floor(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width
anchors.right: parent.right
style: UM.Theme.styles.sidebar_header_button
activeFocusOnPress: true;
@ -293,7 +293,7 @@ Column
{
id: variantLabel
text: Cura.MachineManager.activeDefinitionVariantsName;
width: Math.floor(parent.width * 0.45 - UM.Theme.getSize("default_margin").width)
width: Math.round(parent.width * 0.45 - UM.Theme.getSize("default_margin").width)
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text");
}
@ -305,7 +305,7 @@ Column
visible: Cura.MachineManager.hasVariants
height: UM.Theme.getSize("setting_control").height
width: Math.floor(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width)
width: Math.round(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width)
anchors.right: parent.right
style: UM.Theme.styles.sidebar_header_button
activeFocusOnPress: true;
@ -374,7 +374,7 @@ Column
Item
{
id: materialInfoRow
height: Math.floor(UM.Theme.getSize("sidebar_setup").height / 2)
height: Math.round(UM.Theme.getSize("sidebar_setup").height / 2)
visible: (Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials) && !sidebar.monitoringPrint && !sidebar.hideSettings
anchors
@ -388,7 +388,7 @@ Column
Item {
height: UM.Theme.getSize("sidebar_setup").height
anchors.right: parent.right
width: Math.floor(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width)
width: Math.round(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width)
UM.RecolorImage {
id: warningImage

View file

@ -146,16 +146,16 @@ Item
}
function calculateSliderStepWidth (totalTicks) {
qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.floor((base.width * 0.55) / (totalTicks)) : 0
qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((base.width * 0.55) / (totalTicks)) : 0
}
function calculateSliderMargins (availableMin, availableMax, totalTicks) {
if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) {
qualityModel.qualitySliderMarginRight = Math.floor(base.width * 0.55)
qualityModel.qualitySliderMarginRight = Math.round(base.width * 0.55)
} else if (availableMin == availableMax) {
qualityModel.qualitySliderMarginRight = Math.floor((totalTicks - availableMin) * qualitySliderStepWidth)
qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMin) * qualitySliderStepWidth)
} else {
qualityModel.qualitySliderMarginRight = Math.floor((totalTicks - availableMax) * qualitySliderStepWidth)
qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMax) * qualitySliderStepWidth)
}
}
@ -190,7 +190,7 @@ Item
{
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 2)
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 2)
color: (Cura.MachineManager.activeMachine != null && Cura.ProfilesModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
text:
{
@ -219,13 +219,13 @@ Item
// Make sure the text aligns correctly with each tick
if (qualityModel.totalTicks == 0) {
// If there is only one tick, align it centrally
return Math.floor(((base.width * 0.55) - width) / 2)
return Math.round(((base.width * 0.55) - width) / 2)
} else if (index == 0) {
return Math.floor(base.width * 0.55 / qualityModel.totalTicks) * index
return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index
} else if (index == qualityModel.totalTicks) {
return Math.floor(base.width * 0.55 / qualityModel.totalTicks) * index - width
return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index - width
} else {
return Math.floor((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2))
return Math.round((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2))
}
}
}
@ -236,7 +236,7 @@ Item
Item
{
id: speedSlider
width: Math.floor(base.width * 0.55)
width: Math.round(base.width * 0.55)
height: UM.Theme.getSize("sidebar_margin").height
anchors.right: parent.right
anchors.top: parent.top
@ -246,7 +246,7 @@ Item
Rectangle
{
id: groovechildrect
width: Math.floor(base.width * 0.55)
width: Math.round(base.width * 0.55)
height: 2 * screenScaleFactor
color: UM.Theme.getColor("quality_slider_unavailable")
anchors.verticalCenter: qualitySlider.verticalCenter
@ -266,7 +266,7 @@ Item
width: 1 * screenScaleFactor
height: 6 * screenScaleFactor
y: 0
x: Math.floor(qualityModel.qualitySliderStepWidth * index)
x: Math.round(qualityModel.qualitySliderStepWidth * index)
}
}
@ -277,7 +277,7 @@ Item
color: UM.Theme.getColor("quality_slider_unavailable")
implicitWidth: 10 * screenScaleFactor
implicitHeight: implicitWidth
radius: Math.floor(width / 2)
radius: Math.round(width / 2)
}
Slider
@ -306,7 +306,7 @@ Item
groove: Rectangle {
implicitHeight: 2 * screenScaleFactor
color: UM.Theme.getColor("quality_slider_available")
radius: Math.floor(height / 2)
radius: Math.round(height / 2)
}
handle: Item {
Rectangle {
@ -315,7 +315,7 @@ Item
color: UM.Theme.getColor("quality_slider_available")
implicitWidth: 10 * screenScaleFactor
implicitHeight: implicitWidth
radius: Math.floor(implicitWidth / 2)
radius: Math.round(implicitWidth / 2)
visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile
}
}
@ -362,7 +362,7 @@ Item
text: catalog.i18nc("@label", "Print Speed")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
width: Math.floor(UM.Theme.getSize("sidebar").width * 0.35)
width: Math.round(UM.Theme.getSize("sidebar").width * 0.35)
elide: Text.ElideRight
}
@ -393,12 +393,12 @@ Item
id: customisedSettings
visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.SimpleModeSettingsManager.isProfileUserCreated
height: Math.floor(speedSlider.height * 0.8)
width: Math.floor(speedSlider.height * 0.8)
height: Math.round(speedSlider.height * 0.8)
width: Math.round(speedSlider.height * 0.8)
anchors.verticalCenter: speedSlider.verticalCenter
anchors.right: speedSlider.left
anchors.rightMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width / 2)
anchors.rightMargin: Math.round(UM.Theme.getSize("sidebar_margin").width / 2)
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
iconSource: UM.Theme.getIcon("reset");
@ -438,7 +438,7 @@ Item
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: parent.left
width: Math.floor(UM.Theme.getSize("sidebar").width * .45) - UM.Theme.getSize("sidebar_margin").width
width: Math.round(UM.Theme.getSize("sidebar").width * .45) - UM.Theme.getSize("sidebar_margin").width
Label
{
@ -448,7 +448,7 @@ Item
color: UM.Theme.getColor("text")
anchors.top: parent.top
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 1.7)
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 1.7)
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
}
@ -459,7 +459,7 @@ Item
id: infillCellRight
height: infillSlider.height + UM.Theme.getSize("sidebar_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("sidebar_margin").height)
width: Math.floor(UM.Theme.getSize("sidebar").width * .55)
width: Math.round(UM.Theme.getSize("sidebar").width * .55)
anchors.left: infillCellLeft.right
anchors.top: infillCellLeft.top
@ -470,7 +470,7 @@ Item
//anchors.top: parent.top
anchors.left: infillSlider.left
anchors.leftMargin: Math.floor((infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor)
anchors.leftMargin: Math.round((infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor)
anchors.right: parent.right
text: parseInt(infillDensity.properties.value) + "%"
@ -576,12 +576,12 @@ Item
{
id: infillIcon
width: Math.floor((parent.width / 5) - (UM.Theme.getSize("sidebar_margin").width))
width: Math.round((parent.width / 5) - (UM.Theme.getSize("sidebar_margin").width))
height: width
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 2)
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 2)
// we loop over all density icons and only show the one that has the current density and steps
Repeater
@ -592,8 +592,8 @@ Item
function activeIndex () {
for (var i = 0; i < infillModel.count; i++) {
var density = Math.floor(infillDensity.properties.value)
var steps = Math.floor(infillSteps.properties.value)
var density = Math.round(infillDensity.properties.value)
var steps = Math.round(infillSteps.properties.value)
var infillModelItem = infillModel.get(i)
if (infillModelItem != "undefined"
@ -634,7 +634,7 @@ Item
property alias _hovered: enableGradualInfillMouseArea.containsMouse
anchors.top: infillSlider.bottom
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height / 2) // closer to slider since it belongs to the same category
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height / 2) // closer to slider since it belongs to the same category
anchors.left: infillCellRight.left
style: UM.Theme.styles.checkbox
@ -676,7 +676,7 @@ Item
Label {
id: gradualInfillLabel
anchors.left: enableGradualInfillCheckBox.right
anchors.leftMargin: Math.floor(UM.Theme.getSize("sidebar_margin").width / 2)
anchors.leftMargin: Math.round(UM.Theme.getSize("sidebar_margin").width / 2)
text: catalog.i18nc("@label", "Enable gradual")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
@ -737,7 +737,7 @@ Item
visible: enableSupportCheckBox.visible
anchors.top: infillCellRight.bottom
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 1.5)
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 1.5)
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.right: infillCellLeft.right
@ -823,7 +823,7 @@ Item
anchors.topMargin: ((supportEnabled.properties.value === "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("sidebar_margin").height : 0
anchors.left: infillCellRight.left
width: Math.floor(UM.Theme.getSize("sidebar").width * .55)
width: Math.round(UM.Theme.getSize("sidebar").width * .55)
height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0
Behavior on height { NumberAnimation { duration: 100 } }
@ -952,7 +952,7 @@ Item
{
id: tipsCell
anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom)
anchors.topMargin: Math.floor(UM.Theme.getSize("sidebar_margin").height * 2)
anchors.topMargin: Math.round(UM.Theme.getSize("sidebar_margin").height * 2)
anchors.left: parent.left
width: parent.width
height: tipsText.contentHeight * tipsText.lineCount

View file

@ -1,7 +1,7 @@
// Copyright (c) 2015 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick 2.8
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
@ -36,7 +36,7 @@ UM.PointingRectangle {
}
}
base.opacity = 1;
target = Qt.point(40 , position.y + Math.floor(UM.Theme.getSize("tooltip_arrow_margins").height / 2))
target = Qt.point(40 , position.y + Math.round(UM.Theme.getSize("tooltip_arrow_margins").height / 2))
}
function hide() {

View file

@ -91,7 +91,7 @@ Item
anchors.topMargin: base.activeY
z: buttons.z -1
target: Qt.point(parent.right, base.activeY + Math.floor(UM.Theme.getSize("button").height/2))
target: Qt.point(parent.right, base.activeY + Math.round(UM.Theme.getSize("button").height/2))
arrowSize: UM.Theme.getSize("default_arrow").width
width:

View file

@ -220,7 +220,7 @@ Rectangle
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.right: viewModeButton.right
property var buttonTarget: Qt.point(viewModeButton.x + Math.floor(viewModeButton.width / 2), viewModeButton.y + Math.floor(viewModeButton.height / 2))
property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2))
height: childrenRect.height
width: childrenRect.width