Clean the recommended mode print setup

Contributes to CURA-5941
This commit is contained in:
Diego Prado Gesto 2018-11-29 08:54:04 +01:00
parent 990c653af4
commit 7639983925
2 changed files with 580 additions and 656 deletions

View File

@ -94,40 +94,10 @@ Item
anchors anchors
{ {
top: header.bottom top: header.bottom
leftMargin: UM.Theme.getSize("default_margin").width
rightMargin: UM.Theme.getSize("default_margin").width
} }
sourceComponent: currentModeIndex == 0 ? recommendedPrintSetup : customPrintSetup sourceComponent: currentModeIndex == 0 ? recommendedPrintSetup : customPrintSetup
} }
// Item
// {
// id: content
// width: parent.width
// height: 100
////// height: tabBar.height + sidebarContents.height
////
// anchors
// {
// top: header.bottom
// leftMargin: UM.Theme.getSize("default_margin").width
// rightMargin: UM.Theme.getSize("default_margin").width
// }
////
//// Rectangle
//// {
//// id: sidebarContents
//// anchors.top: tabBar.bottom
//// anchors.bottom: parent.bottom
//// anchors.left: parent.left
//// anchors.right: parent.right
//// height: UM.Theme.getSize("print_setup_widget").height
////
//// border.width: UM.Theme.getSize("default_lining").width * 2
//// border.color: UM.Theme.getColor("action_button_border")
//// }
// }
Rectangle Rectangle
{ {
id: buttonsSeparator id: buttonsSeparator
@ -195,7 +165,6 @@ Item
Component.onCompleted: Component.onCompleted:
{ {
print(height, "!!!!!!!!!!!!!!!!!!!!!!!")
var index = Math.round(UM.Preferences.getValue("cura/active_mode")) var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
if(index != null && !isNaN(index)) if(index != null && !isNaN(index))

View File

@ -8,17 +8,22 @@ import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Item Column
{ {
id: base id: base
signal showTooltip(Item item, point location, string text) signal showTooltip(Item item, point location, string text)
signal hideTooltip() signal hideTooltip()
height: childrenRect.height height: childrenRect.height + 2 * padding
padding: UM.Theme.getSize("thick_margin").width
spacing: UM.Theme.getSize("default_margin").height
property Action configureSettings property Action configureSettings
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1
property real labelColumnWidth: Math.round(width / 3)
property real settingsColumnWidth: width - labelColumnWidth
UM.I18nCatalog UM.I18nCatalog
{ {
@ -33,10 +38,9 @@ Item
{ {
id: qualityRow id: qualityRow
height: UM.Theme.getSize("thick_margin").height
anchors.topMargin: UM.Theme.getSize("thick_margin").height
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: childrenRect.height
Timer Timer
{ {
@ -145,14 +149,14 @@ Item
function calculateSliderStepWidth (totalTicks) function calculateSliderStepWidth (totalTicks)
{ {
qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((base.width * 0.55) / (totalTicks)) : 0 qualityModel.qualitySliderStepWidth = totalTicks != 0 ? Math.round((settingsColumnWidth) / (totalTicks)) : 0
} }
function calculateSliderMargins (availableMin, availableMax, totalTicks) function calculateSliderMargins (availableMin, availableMax, totalTicks)
{ {
if (availableMin == -1 || (availableMin == 0 && availableMax == 0)) if (availableMin == -1 || (availableMin == 0 && availableMax == 0))
{ {
qualityModel.qualitySliderMarginRight = Math.round(base.width * 0.55) qualityModel.qualitySliderMarginRight = Math.round(settingsColumnWidth)
} }
else if (availableMin == availableMax) else if (availableMin == availableMax)
{ {
@ -180,6 +184,7 @@ Item
source: UM.Theme.getIcon("category_layer_height") source: UM.Theme.getIcon("category_layer_height")
text: catalog.i18nc("@label", "Layer Height") text: catalog.i18nc("@label", "Layer Height")
anchors.bottom: speedSlider.bottom anchors.bottom: speedSlider.bottom
width: labelColumnWidth
} }
// Show titles for the each quality slider ticks // Show titles for the each quality slider ticks
@ -187,6 +192,7 @@ Item
{ {
anchors.left: speedSlider.left anchors.left: speedSlider.left
anchors.top: speedSlider.bottom anchors.top: speedSlider.bottom
Repeater Repeater
{ {
model: qualityModel model: qualityModel
@ -194,7 +200,7 @@ Item
Label Label
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.bottom anchors.top: parent.top
color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: (Cura.MachineManager.activeMachine != null && Cura.QualityProfilesDropDownMenuModel.getItem(index).available) ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
text: text:
{ {
@ -225,19 +231,19 @@ Item
if (qualityModel.totalTicks == 0) if (qualityModel.totalTicks == 0)
{ {
// If there is only one tick, align it centrally // If there is only one tick, align it centrally
return Math.round(((base.width * 0.55) - width) / 2) return Math.round(((settingsColumnWidth) - width) / 2)
} }
else if (index == 0) else if (index == 0)
{ {
return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index
} }
else if (index == qualityModel.totalTicks) else if (index == qualityModel.totalTicks)
{ {
return Math.round(base.width * 0.55 / qualityModel.totalTicks) * index - width return Math.round(settingsColumnWidth / qualityModel.totalTicks) * index - width
} }
else else
{ {
return Math.round((base.width * 0.55 / qualityModel.totalTicks) * index - (width / 2)) return Math.round((settingsColumnWidth / qualityModel.totalTicks) * index - (width / 2))
} }
} }
} }
@ -248,103 +254,102 @@ Item
Rectangle Rectangle
{ {
id: speedSlider id: speedSlider
width: Math.round(base.width * 0.55)
height: UM.Theme.getSize("thick_margin").height anchors
anchors.right: parent.right {
anchors.top: parent.top left: qualityRowTitle.right
anchors.topMargin: UM.Theme.getSize("thick_margin").height right: parent.right
}
// This Item is used only for tooltip, for slider area which is unavailable // This Item is used only for tooltip, for slider area which is unavailable
Item // Item
{ // {
function showTooltip (showTooltip) // function showTooltip (showTooltip)
{ // {
if (showTooltip) // if (showTooltip)
{ // {
var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile") // var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile")
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) // base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content)
} // }
else // else
{ // {
base.hideTooltip() // base.hideTooltip()
} // }
} // }
//
id: unavailableLineToolTip // id: unavailableLineToolTip
height: 20 * screenScaleFactor // hovered area height // height: 20 * screenScaleFactor // hovered area height
z: parent.z + 1 // should be higher, otherwise the area can be hovered // z: parent.z + 1 // should be higher, otherwise the area can be hovered
x: 0 // x: 0
anchors.verticalCenter: qualitySlider.verticalCenter // anchors.verticalCenter: qualitySlider.verticalCenter
//
Rectangle // Rectangle
{ // {
id: leftArea // id: leftArea
width: // width:
{ // {
if (qualityModel.availableTotalTicks == 0) // if (qualityModel.availableTotalTicks == 0)
{ // {
return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks // return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks
} // }
return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10 // return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10
} // }
height: parent.height // height: parent.height
color: "transparent" // color: "transparent"
//
MouseArea // MouseArea
{ // {
anchors.fill: parent // anchors.fill: parent
hoverEnabled: true // hoverEnabled: true
enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false // enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false
onEntered: unavailableLineToolTip.showTooltip(true) // onEntered: unavailableLineToolTip.showTooltip(true)
onExited: unavailableLineToolTip.showTooltip(false) // onExited: unavailableLineToolTip.showTooltip(false)
} // }
} // }
//
Item // Item
{ // {
id: rightArea // id: rightArea
width: // width:
{ // {
if(qualityModel.availableTotalTicks == 0) // if(qualityModel.availableTotalTicks == 0)
return 0 // return 0
//
return qualityModel.qualitySliderMarginRight - 10 // return qualityModel.qualitySliderMarginRight - 10
} // }
height: parent.height // height: parent.height
x: // x:
{ // {
if (qualityModel.availableTotalTicks == 0) // if (qualityModel.availableTotalTicks == 0)
{ // {
return 0 // return 0
} // }
//
var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin // var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin
var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10 // var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10
//
return totalGap // return totalGap
} // }
//
MouseArea // MouseArea
{ // {
anchors.fill: parent // anchors.fill: parent
hoverEnabled: true // hoverEnabled: true
enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false // enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false
onEntered: unavailableLineToolTip.showTooltip(true) // onEntered: unavailableLineToolTip.showTooltip(true)
onExited: unavailableLineToolTip.showTooltip(false) // onExited: unavailableLineToolTip.showTooltip(false)
} // }
} // }
} // }
// Draw Unavailable line // Draw Unavailable line
Rectangle Rectangle
{ {
id: groovechildrect id: groovechildrect
width: Math.round(base.width * 0.55) width: parent.width
height: 2 * screenScaleFactor height: 2 * screenScaleFactor
color: UM.Theme.getColor("quality_slider_unavailable") color: UM.Theme.getColor("quality_slider_unavailable")
anchors.verticalCenter: qualitySlider.verticalCenter anchors.verticalCenter: qualitySlider.verticalCenter
x: 0
}
// Draw ticks // Draw ticks
Repeater Repeater
@ -355,19 +360,21 @@ Item
Rectangle Rectangle
{ {
color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") color: Cura.QualityProfilesDropDownMenuModel.getItem(index).available ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
implicitWidth: 5 * screenScaleFactor implicitWidth: 4 * screenScaleFactor
implicitHeight: implicitWidth implicitHeight: implicitWidth
anchors.verticalCenter: qualitySlider.verticalCenter anchors.verticalCenter: parent.verticalCenter
x: Math.round(qualityModel.qualitySliderStepWidth * index) x: Math.round(qualityModel.qualitySliderStepWidth * index)
radius: Math.round(implicitWidth / 2) radius: Math.round(implicitWidth / 2)
} }
} }
}
// Draw available slider
Slider Slider
{ {
id: qualitySlider id: qualitySlider
height: UM.Theme.getSize("thick_margin").height height: UM.Theme.getSize("thick_margin").height
anchors.bottom: speedSlider.bottom anchors.bottom: parent.bottom
enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized enabled: qualityModel.totalTicks > 0 && !Cura.SimpleModeSettingsManager.isProfileCustomized
visible: qualityModel.availableTotalTicks > 0 visible: qualityModel.availableTotalTicks > 0
updateValueWhileDragging : false updateValueWhileDragging : false
@ -394,20 +401,17 @@ Item
color: UM.Theme.getColor("quality_slider_available") color: UM.Theme.getColor("quality_slider_available")
radius: Math.round(height / 2) radius: Math.round(height / 2)
} }
handle: Item
{ handle: Rectangle
Rectangle
{ {
id: qualityhandleButton id: qualityhandleButton
anchors.centerIn: parent
color: UM.Theme.getColor("quality_slider_available") color: UM.Theme.getColor("quality_slider_available")
implicitWidth: 10 * screenScaleFactor implicitWidth: 12 * screenScaleFactor
implicitHeight: implicitWidth implicitHeight: implicitWidth
radius: Math.round(implicitWidth / 2) radius: Math.round(implicitWidth / 2)
visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile visible: !Cura.SimpleModeSettingsManager.isProfileCustomized && !Cura.SimpleModeSettingsManager.isProfileUserCreated && qualityModel.existingQualityProfile
} }
} }
}
onValueChanged: onValueChanged:
{ {
@ -433,7 +437,7 @@ Item
onEntered: onEntered:
{ {
var content = catalog.i18nc("@tooltip","A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab") var content = catalog.i18nc("@tooltip", "A custom profile is currently active. To enable the quality slider, choose a default quality profile in Custom tab")
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content) base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, customisedSettings.height), content)
} }
onExited: base.hideTooltip() onExited: base.hideTooltip()
@ -474,27 +478,17 @@ Item
// //
Item Item
{ {
id: infillCellLeft
anchors.top: qualityRow.bottom
anchors.topMargin: UM.Theme.getSize("thick_margin").height * 2
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right
width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width height: childrenRect.height
Cura.IconWithText Cura.IconWithText
{ {
id: infillLabel id: infillRowTitle
source: UM.Theme.getIcon("category_infill") source: UM.Theme.getIcon("category_infill")
text: catalog.i18nc("@label", "Infill") + " (%)" text: catalog.i18nc("@label", "Infill") + " (%)"
anchors.bottom: parent.bottom
anchors width: labelColumnWidth
{
top: parent.top
topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.7)
left: parent.left
}
}
} }
Item Item
@ -502,13 +496,12 @@ Item
id: infillCellRight id: infillCellRight
height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height) height: infillSlider.height + UM.Theme.getSize("thick_margin").height + enableGradualInfillCheckBox.visible * (enableGradualInfillCheckBox.height + UM.Theme.getSize("thick_margin").height)
width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55)
anchors.left: infillCellLeft.right anchors.left: infillRowTitle.right
anchors.top: infillCellLeft.top anchors.right: parent.right
anchors.topMargin: UM.Theme.getSize("thick_margin").height
Label { Label
{
id: selectedInfillRateText id: selectedInfillRateText
anchors.left: infillSlider.left anchors.left: infillSlider.left
@ -800,26 +793,24 @@ Item
} }
} }
} }
}
// //
// Enable support // Enable support
// //
Row
{
anchors.left: parent.left
anchors.right: parent.right
height: childrenRect.height
Cura.IconWithText Cura.IconWithText
{ {
id: enableSupportLabel id: enableSupportLabel
visible: enableSupportCheckBox.visible visible: enableSupportCheckBox.visible
source: UM.Theme.getIcon("category_support") source: UM.Theme.getIcon("category_support")
text: catalog.i18nc("@label", "Support") text: catalog.i18nc("@label", "Support")
width: labelColumnWidth
anchors
{
top: infillCellRight.bottom
topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 1.5)
left: parent.left
right: infillCellLeft.right
rightMargin: UM.Theme.getSize("thick_margin").width
verticalCenter: enableSupportCheckBox.verticalCenter
}
} }
CheckBox CheckBox
@ -827,9 +818,6 @@ Item
id: enableSupportCheckBox id: enableSupportCheckBox
property alias _hovered: enableSupportMouseArea.containsMouse property alias _hovered: enableSupportMouseArea.containsMouse
anchors.top: enableSupportLabel.top
anchors.left: infillCellRight.left
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
enabled: base.settingsEnabled enabled: base.settingsEnabled
@ -868,11 +856,6 @@ Item
textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started
anchors.top: enableSupportCheckBox.top
anchors.left: enableSupportCheckBox.right
anchors.leftMargin: Math.round(UM.Theme.getSize("thick_margin").width / 2)
width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width width: Math.round(UM.Theme.getSize("print_setup_widget").width * .55) - Math.round(UM.Theme.getSize("thick_margin").width / 2) - enableSupportCheckBox.width
height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0 height: ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) ? UM.Theme.getSize("setting_control").height : 0
@ -927,6 +910,14 @@ Item
} }
} }
}
// Adhesion
Row
{
anchors.left: parent.left
anchors.right: parent.right
height: childrenRect.height
Cura.IconWithText Cura.IconWithText
{ {
@ -934,14 +925,7 @@ Item
visible: adhesionCheckBox.visible visible: adhesionCheckBox.visible
source: UM.Theme.getIcon("category_adhesion") source: UM.Theme.getIcon("category_adhesion")
text: catalog.i18nc("@label", "Adhesion") text: catalog.i18nc("@label", "Adhesion")
width: labelColumnWidth
anchors
{
left: parent.left
right: infillCellLeft.right
rightMargin: UM.Theme.getSize("thick_margin").width
verticalCenter: adhesionCheckBox.verticalCenter
}
} }
CheckBox CheckBox
@ -949,10 +933,6 @@ Item
id: adhesionCheckBox id: adhesionCheckBox
property alias _hovered: adhesionMouseArea.containsMouse property alias _hovered: adhesionMouseArea.containsMouse
anchors.top: enableSupportCheckBox.bottom
anchors.topMargin: UM.Theme.getSize("thick_margin").height
anchors.left: infillCellRight.left
//: Setting enable printing build-plate adhesion helper checkbox //: Setting enable printing build-plate adhesion helper checkbox
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
enabled: base.settingsEnabled enabled: base.settingsEnabled
@ -988,7 +968,7 @@ Item
catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards."));
} }
onExited: base.hideTooltip() onExited: base.hideTooltip()
}
} }
} }
@ -1005,31 +985,6 @@ Item
onModelChanged: populateExtruderModel() onModelChanged: populateExtruderModel()
} }
Item
{
id: tipsCell
anchors.top: adhesionCheckBox.visible ? adhesionCheckBox.bottom : (enableSupportCheckBox.visible ? supportExtruderCombobox.bottom : infillCellRight.bottom)
anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height * 2)
anchors.left: parent.left
width: parent.width
height: tipsText.contentHeight * tipsText.lineCount
Label
{
id: tipsText
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
anchors.top: parent.top
wrapMode: Text.WordWrap
text: catalog.i18nc("@label", "Need help improving your prints?<br>Read the <a href='%1'>Ultimaker Troubleshooting Guides</a>").arg("https://ultimaker.com/en/troubleshooting")
font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text");
linkColor: UM.Theme.getColor("text_link")
onLinkActivated: Qt.openUrlExternally(link)
}
}
UM.SettingPropertyProvider UM.SettingPropertyProvider
{ {
id: infillExtruderNumber id: infillExtruderNumber
@ -1096,8 +1051,8 @@ Item
function populateExtruderModel() function populateExtruderModel()
{ {
extruderModel.clear(); extruderModel.clear()
for(var extruderNumber = 0; extruderNumber < extruders.rowCount() ; extruderNumber++) for (var extruderNumber = 0; extruderNumber < extruders.rowCount(); extruderNumber++)
{ {
extruderModel.append({ extruderModel.append({
text: extruders.getItem(extruderNumber).name, text: extruders.getItem(extruderNumber).name,