CURA-5402 hopefully solved merge conflicts

This commit is contained in:
Jack Ha 2018-06-06 14:39:53 +02:00
commit 96f2e6e1ed
96 changed files with 1612 additions and 838 deletions

View file

@ -323,10 +323,11 @@ UM.MainWindow
{
if (drop.urls.length > 0)
{
// As the drop area also supports plugins, first check if it's a plugin that was dropped.
if (drop.urls.length == 1)
var nonPackages = [];
for (var i = 0; i < drop.urls.length; i++)
{
var filename = drop.urls[0];
var filename = drop.urls[i];
if (filename.endsWith(".curapackage"))
{
// Try to install plugin & close.
@ -334,11 +335,13 @@ UM.MainWindow
packageInstallDialog.text = catalog.i18nc("@label", "This package will be installed after restarting.");
packageInstallDialog.icon = StandardIcon.Information;
packageInstallDialog.open();
return;
}
else
{
nonPackages.push(filename);
}
}
openDialog.handleOpenFileUrls(drop.urls);
openDialog.handleOpenFileUrls(nonPackages);
}
}
}

View file

@ -80,13 +80,10 @@ Item {
property int unremovableSpacing: 5
text: PrintInformation.jobName
horizontalAlignment: TextInput.AlignRight
onTextChanged: {
PrintInformation.setJobName(text);
}
onEditingFinished: {
if (printJobTextfield.text != ''){
printJobTextfield.focus = false;
}
var new_name = text == "" ? "unnamed" : text;
PrintInformation.setJobName(new_name, true);
printJobTextfield.focus = false;
}
validator: RegExpValidator {
regExp: /^[^\\ \/ \*\?\|\[\]]*$/

View file

@ -92,6 +92,7 @@ Rectangle
anchors.verticalCenter: buildplateIcon.verticalCenter
anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2)
text: configuration.buildplateConfiguration
renderType: Text.NativeRendering
color: textColor
}
}

View file

@ -26,6 +26,7 @@ Column
{
id: extruderLabel
text: catalog.i18nc("@label:extruder label", "Extruder")
renderType: Text.NativeRendering
elide: Text.ElideRight
anchors.left: parent.left
font: UM.Theme.getFont("default")
@ -59,6 +60,7 @@ Column
id: extruderNumberText
anchors.centerIn: parent
text: printCoreConfiguration.position + 1
renderType: Text.NativeRendering
font: UM.Theme.getFont("default")
color: mainColor
}
@ -69,6 +71,7 @@ Column
{
id: materialLabel
text: printCoreConfiguration.material.name
renderType: Text.NativeRendering
elide: Text.ElideRight
width: parent.width
font: UM.Theme.getFont("default_bold")
@ -79,6 +82,7 @@ Column
{
id: printCoreTypeLabel
text: printCoreConfiguration.hotendID
renderType: Text.NativeRendering
elide: Text.ElideRight
width: parent.width
font: UM.Theme.getFont("default")

View file

@ -13,7 +13,7 @@ Button
id: base
property var outputDevice: null
property var matched: updateOnSync()
text: matched == true ? "Yes" : "No"
text: matched == true ? catalog.i18nc("@label:extruder label", "Yes") : catalog.i18nc("@label:extruder label", "No")
width: parent.width
height: parent.height

View file

@ -63,8 +63,7 @@ Menu
exclusiveGroup: group
onTriggered:
{
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
Cura.MachineManager.setMaterial(activeExtruderIndex, model.container_node);
Cura.MachineManager.setMaterial(extruderIndex, model.container_node);
}
}
onObjectAdded: brandMaterialsMenu.insertItem(index, object)

View file

@ -404,10 +404,17 @@ TabView
id: spinBox
anchors.left: label.right
value: {
// In case the setting is not in the material...
if (!isNaN(parseFloat(materialPropertyProvider.properties.value)))
{
return parseFloat(materialPropertyProvider.properties.value);
}
// ... we search in the variant, and if it is not there...
if (!isNaN(parseFloat(variantPropertyProvider.properties.value)))
{
return parseFloat(variantPropertyProvider.properties.value);
}
// ... then look in the definition container.
if (!isNaN(parseFloat(machinePropertyProvider.properties.value)))
{
return parseFloat(machinePropertyProvider.properties.value);
@ -431,6 +438,13 @@ TabView
key: model.key
}
UM.ContainerPropertyProvider
{
id: variantPropertyProvider
containerId: Cura.MachineManager.activeVariantId
watchedProperties: [ "value" ]
key: model.key
}
UM.ContainerPropertyProvider
{
id: machinePropertyProvider
containerId: Cura.MachineManager.activeDefinitionId

View file

@ -93,14 +93,7 @@ SettingItem
{
target: control
property: "currentIndex"
value:
{
if(propertyProvider.properties.value == -1)
{
return control.getIndexByPosition(Cura.MachineManager.defaultExtruderPosition);
}
return propertyProvider.properties.value
}
value: control.getIndexByPosition(propertyProvider.properties.value)
// Sometimes when the value is already changed, the model is still being built.
// The when clause ensures that the current index is not updated when this happens.
when: control.model.items.length > 0

View file

@ -57,7 +57,8 @@ Item
interval: 50
running: false
repeat: false
onTriggered: {
onTriggered:
{
var item = Cura.QualityProfilesDropDownMenuModel.getItem(qualitySlider.value);
Cura.MachineManager.activeQualityGroup = item.quality_group;
}
@ -77,7 +78,8 @@ Item
{
// update needs to be called when the widgets are visible, otherwise the step width calculation
// will fail because the width of an invisible item is 0.
if (visible) {
if (visible)
{
qualityModel.update();
}
}
@ -97,24 +99,30 @@ Item
property var qualitySliderAvailableMax: 0
property var qualitySliderMarginRight: 0
function update () {
function update ()
{
reset()
var availableMin = -1
var availableMax = -1
for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++) {
for (var i = 0; i < Cura.QualityProfilesDropDownMenuModel.rowCount(); i++)
{
var qualityItem = Cura.QualityProfilesDropDownMenuModel.getItem(i)
// Add each quality item to the UI quality model
qualityModel.append(qualityItem)
// Set selected value
if (Cura.MachineManager.activeQualityType == qualityItem.quality_type) {
if (Cura.MachineManager.activeQualityType == qualityItem.quality_type)
{
// set to -1 when switching to user created profile so all ticks are clickable
if (Cura.SimpleModeSettingsManager.isProfileUserCreated) {
if (Cura.SimpleModeSettingsManager.isProfileUserCreated)
{
qualityModel.qualitySliderActiveIndex = -1
} else {
}
else
{
qualityModel.qualitySliderActiveIndex = i
}
@ -122,18 +130,21 @@ Item
}
// Set min available
if (qualityItem.available && availableMin == -1) {
if (qualityItem.available && availableMin == -1)
{
availableMin = i
}
// Set max available
if (qualityItem.available) {
if (qualityItem.available)
{
availableMax = i
}
}
// Set total available ticks for active slider part
if (availableMin != -1) {
if (availableMin != -1)
{
qualityModel.availableTotalTicks = availableMax - availableMin + 1
}
@ -145,16 +156,23 @@ Item
qualityModel.qualitySliderAvailableMax = availableMax
}
function calculateSliderStepWidth (totalTicks) {
function calculateSliderStepWidth (totalTicks)
{
qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((base.width * 0.55) / (totalTicks)) : 0
}
function calculateSliderMargins (availableMin, availableMax, totalTicks) {
if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) {
function calculateSliderMargins (availableMin, availableMax, totalTicks)
{
if (availableMin == -1 || (availableMin == 0 && availableMax == 0))
{
qualityModel.qualitySliderMarginRight = Math.round(base.width * 0.55)
} else if (availableMin == availableMax) {
}
else if (availableMin == availableMax)
{
qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMin) * qualitySliderStepWidth)
} else {
}
else
{
qualityModel.qualitySliderMarginRight = Math.round((totalTicks - availableMax) * qualitySliderStepWidth)
}
}
@ -215,16 +233,24 @@ Item
return result
}
x: {
x:
{
// Make sure the text aligns correctly with each tick
if (qualityModel.totalTicks == 0) {
if (qualityModel.totalTicks == 0)
{
// If there is only one tick, align it centrally
return Math.round(((base.width * 0.55) - width) / 2)
} else if (index == 0) {
}
else if (index == 0)
{
return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index
} else if (index == qualityModel.totalTicks) {
}
else if (index == qualityModel.totalTicks)
{
return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index - width
} else {
}
else
{
return Math.round((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2))
}
}
@ -291,7 +317,8 @@ Item
Rectangle
{
id: rightArea
width: {
width:
{
if(qualityModel.availableTotalTicks == 0)
return 0
@ -299,8 +326,10 @@ Item
}
height: parent.height
color: "transparent"
x: {
if (qualityModel.availableTotalTicks == 0) {
x:
{
if (qualityModel.availableTotalTicks == 0)
{
return 0
}
@ -310,7 +339,8 @@ Item
return totalGap
}
MouseArea {
MouseArea
{
anchors.fill: parent
hoverEnabled: true
enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false
@ -373,13 +403,16 @@ Item
style: SliderStyle
{
//Draw Available line
groove: Rectangle {
groove: Rectangle
{
implicitHeight: 2 * screenScaleFactor
color: UM.Theme.getColor("quality_slider_available")
radius: Math.round(height / 2)
}
handle: Item {
Rectangle {
handle: Item
{
Rectangle
{
id: qualityhandleButton
anchors.centerIn: parent
color: UM.Theme.getColor("quality_slider_available")
@ -391,11 +424,14 @@ Item
}
}
onValueChanged: {
onValueChanged:
{
// only change if an active machine is set and the slider is visible at all.
if (Cura.MachineManager.activeMachine != null && visible) {
if (Cura.MachineManager.activeMachine != null && visible)
{
// prevent updating during view initializing. Trigger only if the value changed by user
if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1) {
if (qualitySlider.value != qualityModel.qualitySliderActiveIndex && qualityModel.qualitySliderActiveIndex != -1)
{
// start updating with short delay
qualitySliderChangeTimer.start()
}
@ -587,8 +623,10 @@ Item
// same operation
var active_mode = UM.Preferences.getValue("cura/active_mode")
if (active_mode == 0 || active_mode == "simple") {
if (active_mode == 0 || active_mode == "simple")
{
Cura.MachineManager.setSettingForAllExtruders("infill_sparse_density", "value", roundedSliderValue)
Cura.MachineManager.resetSettingForAllExtruders("infill_line_distance")
}
}

View file

@ -148,9 +148,22 @@ UM.Dialog
{
height: childrenRect.height
width: parent.width
Label
Label
{
text: catalog.i18nc("@action:label", "Extruder %1").arg(modelData)
text: {
var extruder = Number(modelData)
var extruder_id = ""
if(!isNaN(extruder))
{
extruder_id = extruder + 1 // The extruder counter start from One and not Zero
}
else
{
extruder_id = modelData
}
return catalog.i18nc("@action:label", "Extruder %1").arg(extruder_id)
}
font.bold: true
}
Row