Fix merge conflicts with master

This commit is contained in:
Lipu Fei 2019-09-24 14:26:43 +02:00
commit 94e89ad4ac
89 changed files with 1283 additions and 928 deletions

View file

@ -447,7 +447,6 @@ UM.MainWindow
target: Cura.Actions.addProfile
onTriggered:
{
preferences.show();
preferences.setPage(4);
// Create a new profile after a very short delay so the preference page has time to initiate

View file

@ -35,6 +35,7 @@ UM.TooltipArea
property alias labelWidth: fieldLabel.width
property alias unitText: unitLabel.text
property alias textField: textFieldWithUnit
property alias valueText: textFieldWithUnit.text
property alias valueValidator: textFieldWithUnit.validator
property alias editingFinishedFunction: textFieldWithUnit.editingFinishedFunction
@ -43,6 +44,8 @@ UM.TooltipArea
// whether negative value is allowed. This affects the validation of the input field.
property bool allowNegativeValue: false
// whether positive value is allowed. This affects the validation of the input field.
property bool allowPositiveValue: true
// callback functions
property var afterOnEditingFinishedFunction: dummy_func
@ -65,7 +68,7 @@ UM.TooltipArea
anchors.left: parent.left
anchors.verticalCenter: textFieldWithUnit.verticalCenter
visible: text != ""
font: UM.Theme.getFont("medium")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
}
@ -153,7 +156,13 @@ UM.TooltipArea
const value = propertyProvider.properties.value
return value ? value : ""
}
validator: RegExpValidator { regExp: allowNegativeValue ? /-?[0-9\.,]{0,6}/ : /[0-9\.,]{0,6}/ }
validator: DoubleValidator
{
bottom: allowNegativeValue ? Number.NEGATIVE_INFINITY : 0
top: allowPositiveValue ? Number.POSITIVE_INFINITY : 0
decimals: 6
notation: DoubleValidator.StandardNotation
}
onEditingFinished: editingFinishedFunction()

View file

@ -43,31 +43,48 @@ NumericTextFieldWithUnit
{
result = func(result, polygon[i][item])
}
result = Math.abs(result)
return result
}
valueValidator: RegExpValidator { regExp: /[0-9\.,]{0,6}/ }
valueValidator: DoubleValidator {
bottom: allowNegativeValue ? Number.NEGATIVE_INFINITY : 0
top: allowPositiveValue ? Number.POSITIVE_INFINITY : 0
decimals: 6
notation: DoubleValidator.StandardNotation
}
valueText: axisValue
Connections
{
target: textField
onActiveFocusChanged:
{
// When this text field loses focus and the entered text is not valid, make sure to recreate the binding to
// show the correct value.
if (!textField.activeFocus && !textField.acceptableInput)
{
valueText = axisValue
}
}
}
editingFinishedFunction: function()
{
var polygon = JSON.parse(propertyProvider.properties.value)
var newValue = parseFloat(valueText.replace(',', '.'))
if (axisName == "x") // x min/x max
{
var start_i1 = (axisMinOrMax == "min") ? 0 : 2
var factor = (axisMinOrMax == "min") ? -1 : 1
polygon[start_i1][0] = newValue * factor
polygon[start_i1 + 1][0] = newValue * factor
polygon[start_i1][0] = newValue
polygon[start_i1 + 1][0] = newValue
}
else // y min/y max
{
var start_i1 = (axisMinOrMax == "min") ? 1 : 0
var factor = (axisMinOrMax == "min") ? -1 : 1
polygon[start_i1][1] = newValue * factor
polygon[start_i1 + 2][1] = newValue * factor
polygon[start_i1][1] = newValue
polygon[start_i1 + 2][1] = newValue
}
var polygon_string = JSON.stringify(polygon)
if (polygon_string != propertyProvider.properties.value)
@ -75,5 +92,8 @@ NumericTextFieldWithUnit
propertyProvider.setPropertyValue("value", polygon_string)
forceUpdateOnChangeFunction()
}
// Recreate the binding to show the correct value.
valueText = axisValue
}
}

View file

@ -107,8 +107,9 @@ Item
Cura.PrinterTypeLabel
{
id: printerTypeLabel
text: Cura.MachineManager.getAbbreviatedMachineName(section)
text: section
anchors.verticalCenter: parent.verticalCenter //One default margin above and one below.
autoFit: true
}
}

View file

@ -51,5 +51,21 @@ Button
border.color: objectItemButton.checked ? UM.Theme.getColor("primary") : "transparent"
}
TextMetrics
{
id: buttonTextMetrics
text: buttonText.text
font: buttonText.font
elide: buttonText.elide
elideWidth: buttonText.width
}
Cura.ToolTip
{
id: tooltip
tooltipText: objectItemButton.text
visible: objectItemButton.hovered && buttonTextMetrics.elidedText != buttonText.text
}
onClicked: Cura.SceneController.changeSelection(index)
}

View file

@ -78,7 +78,7 @@ Item
id: contents
width: parent.width
visible: objectSelector.opened
height: visible ? scroll.height : 0
height: visible ? listView.height : 0
color: UM.Theme.getColor("main_background")
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
@ -87,50 +87,39 @@ Item
anchors.bottom: parent.bottom
ScrollView
ListView
{
id: scroll
width: parent.width
id: listView
clip: true
padding: UM.Theme.getSize("default_lining").width
contentItem: ListView
anchors
{
id: listView
left: parent.left
right: parent.right
margins: UM.Theme.getSize("default_lining").width
}
// Can't use parent.width since the parent is the flickable component and not the ScrollView
width: scroll.width - scroll.leftPadding - scroll.rightPadding
property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
ScrollBar.vertical: ScrollBar
{
hoverEnabled: true
}
// We use an extra property here, since we only want to to be informed about the content size changes.
onContentHeightChanged:
property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
height: Math.min(contentHeight, maximumHeight)
model: Cura.ObjectsModel {}
delegate: ObjectItemButton
{
id: modelButton
Binding
{
// It can sometimes happen that (due to animations / updates) the contentHeight is -1.
// This can cause a bunch of updates to trigger oneother, leading to a weird loop.
if(contentHeight >= 0)
{
scroll.height = Math.min(contentHeight, maximumHeight) + scroll.topPadding + scroll.bottomPadding
}
}
Component.onCompleted:
{
scroll.height = Math.min(contentHeight, maximumHeight) + scroll.topPadding + scroll.bottomPadding
}
model: Cura.ObjectsModel {}
delegate: ObjectItemButton
{
id: modelButton
Binding
{
target: modelButton
property: "checked"
value: model.selected
}
text: model.name
width: listView.width
target: modelButton
property: "checked"
value: model.selected
}
text: model.name
width: listView.width
}
}
}

View file

@ -469,7 +469,7 @@ UM.PreferencesPage
Label
{
text: catalog.i18nc("@window:text", "Camera rendering: ")
text: catalog.i18nc("@window:text", "Camera rendering:")
}
ComboBox
{

View file

@ -72,6 +72,7 @@ Button
verticalCenter: parent.verticalCenter
}
spacing: UM.Theme.getSize("narrow_margin").width
visible: (updatePrinterTypesOnlyWhenChecked && machineSelectorButton.checked) || !updatePrinterTypesOnlyWhenChecked
Repeater
{

View file

@ -65,7 +65,7 @@ Item
anchors.right: clearFilterButton.left
anchors.rightMargin: Math.round(UM.Theme.getSize("thick_margin").width)
placeholderText: "<img align='middle' src='"+ UM.Theme.getIcon("search") +"'>" + "<div vertical-align=bottom>" + catalog.i18nc("@label:textbox", "search settings")
placeholderText: "<img align='middle' src='"+ UM.Theme.getIcon("search") +"'>" + "<div vertical-align=bottom>" + catalog.i18nc("@label:textbox", "Search settings")
style: TextFieldStyle
{