mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Refactor the PrintSetupSelector
The file was splitted in several other files to improve readability. There is a new folder called PrintSetupSelector where all those files will be. Contributes to CURA-5941.
This commit is contained in:
parent
56f20648f5
commit
85b34d6005
7 changed files with 419 additions and 399 deletions
|
@ -45,7 +45,6 @@ Item
|
||||||
Cura.MachineSelector
|
Cura.MachineSelector
|
||||||
{
|
{
|
||||||
id: machineSelection
|
id: machineSelection
|
||||||
z: openFileButton.z - 1 //Ensure that the tooltip of the open file button stays above the item row.
|
|
||||||
headerCornerSide: Cura.RoundedRectangle.Direction.Left
|
headerCornerSide: Cura.RoundedRectangle.Direction.Left
|
||||||
Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width
|
Layout.minimumWidth: UM.Theme.getSize("machine_selector_widget").width
|
||||||
Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width
|
Layout.maximumWidth: UM.Theme.getSize("machine_selector_widget").width
|
||||||
|
|
|
@ -1,392 +0,0 @@
|
||||||
// Copyright (c) 2018 Ultimaker B.V.
|
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
|
||||||
|
|
||||||
import QtQuick 2.7
|
|
||||||
import QtQuick.Controls 2.0
|
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
|
|
||||||
import UM 1.3 as UM
|
|
||||||
import Cura 1.0 as Cura
|
|
||||||
import "Menus"
|
|
||||||
import "Menus/ConfigurationMenu"
|
|
||||||
|
|
||||||
Cura.ExpandableComponent
|
|
||||||
{
|
|
||||||
id: base
|
|
||||||
|
|
||||||
property int currentModeIndex: -1
|
|
||||||
property bool hideSettings: PrintInformation.preSliced
|
|
||||||
|
|
||||||
property string enabledText: catalog.i18nc("@label:Should be short", "On")
|
|
||||||
property string disabledText: catalog.i18nc("@label:Should be short", "Off")
|
|
||||||
|
|
||||||
// This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
|
|
||||||
signal showTooltip(Item item, point location, string text)
|
|
||||||
signal hideTooltip()
|
|
||||||
|
|
||||||
implicitWidth: 200 * screenScaleFactor
|
|
||||||
height: childrenRect.height
|
|
||||||
iconSource: UM.Theme.getIcon("pencil")
|
|
||||||
|
|
||||||
popupPadding : 0
|
|
||||||
popupSpacingY: UM.Theme.getSize("narrow_margin").width
|
|
||||||
|
|
||||||
popupClosePolicy: Popup.CloseOnEscape
|
|
||||||
|
|
||||||
onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex)
|
|
||||||
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
popupItemWrapper.width = base.width
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.I18nCatalog
|
|
||||||
{
|
|
||||||
id: catalog
|
|
||||||
name: "cura"
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer
|
|
||||||
{
|
|
||||||
id: tooltipDelayTimer
|
|
||||||
interval: 500
|
|
||||||
repeat: false
|
|
||||||
property var item
|
|
||||||
property string text
|
|
||||||
|
|
||||||
onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text)
|
|
||||||
}
|
|
||||||
|
|
||||||
headerItem: RowLayout
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
IconWithText
|
|
||||||
{
|
|
||||||
source: UM.Theme.getIcon("category_layer_height")
|
|
||||||
text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : ""
|
|
||||||
|
|
||||||
UM.SettingPropertyProvider
|
|
||||||
{
|
|
||||||
id: layerHeight
|
|
||||||
containerStack: Cura.MachineManager.activeStack
|
|
||||||
key: "layer_height"
|
|
||||||
watchedProperties: ["value"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IconWithText
|
|
||||||
{
|
|
||||||
source: UM.Theme.getIcon("category_infill")
|
|
||||||
text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%"
|
|
||||||
|
|
||||||
UM.SettingPropertyProvider
|
|
||||||
{
|
|
||||||
id: infillDensity
|
|
||||||
containerStack: Cura.MachineManager.activeStack
|
|
||||||
key: "infill_sparse_density"
|
|
||||||
watchedProperties: ["value"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IconWithText
|
|
||||||
{
|
|
||||||
source: UM.Theme.getIcon("category_support")
|
|
||||||
text: supportEnabled.properties.value == "True" ? enabledText : disabledText
|
|
||||||
|
|
||||||
|
|
||||||
UM.SettingPropertyProvider
|
|
||||||
{
|
|
||||||
id: supportEnabled
|
|
||||||
containerStack: Cura.MachineManager.activeMachine
|
|
||||||
key: "support_enable"
|
|
||||||
watchedProperties: ["value"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IconWithText
|
|
||||||
{
|
|
||||||
source: UM.Theme.getIcon("category_adhesion")
|
|
||||||
text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText
|
|
||||||
|
|
||||||
UM.SettingPropertyProvider
|
|
||||||
{
|
|
||||||
id: platformAdhesionType
|
|
||||||
containerStack: Cura.MachineManager.activeMachine
|
|
||||||
key: "adhesion_type"
|
|
||||||
watchedProperties: [ "value"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.ExtrudersModel
|
|
||||||
{
|
|
||||||
id: extrudersModel
|
|
||||||
}
|
|
||||||
|
|
||||||
popupItem: Rectangle
|
|
||||||
{
|
|
||||||
property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
id: popupItemWrapper
|
|
||||||
height: total_height
|
|
||||||
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
|
||||||
border.color: UM.Theme.getColor("lining")
|
|
||||||
|
|
||||||
Item
|
|
||||||
{
|
|
||||||
id: popupItemHeader
|
|
||||||
height: 36
|
|
||||||
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: parent.top
|
|
||||||
right: parent.right
|
|
||||||
left: parent.left
|
|
||||||
}
|
|
||||||
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
id: popupItemHeaderText
|
|
||||||
text: catalog.i18nc("@label", "Print settings");
|
|
||||||
font: UM.Theme.getFont("default")
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
height: parent.height
|
|
||||||
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
topMargin: UM.Theme.getSize("sidebar_margin").height
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: UM.Theme.getSize("narrow_margin").height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
width: parent.width
|
|
||||||
height: UM.Theme.getSize("default_lining").height
|
|
||||||
anchors.top: popupItemHeaderText.bottom
|
|
||||||
color: UM.Theme.getColor("action_button_border")
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
id: closeButton;
|
|
||||||
width: UM.Theme.getSize("message_close").width;
|
|
||||||
height: UM.Theme.getSize("message_close").height;
|
|
||||||
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
right: parent.right;
|
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width;
|
|
||||||
top: parent.top;
|
|
||||||
topMargin: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.RecolorImage
|
|
||||||
{
|
|
||||||
anchors.fill: parent;
|
|
||||||
sourceSize.width: width
|
|
||||||
sourceSize.height: width
|
|
||||||
color: UM.Theme.getColor("message_text")
|
|
||||||
source: UM.Theme.getIcon("cross1")
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: base.togglePopup() // Will hide the popup item
|
|
||||||
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
color: UM.Theme.getColor("message_background")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
id: popupItemContent
|
|
||||||
width: parent.width
|
|
||||||
height: tabBar.height + sidebarContents.height
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: popupItemHeader.bottom
|
|
||||||
topMargin: UM.Theme.getSize("narrow_margin").height
|
|
||||||
right: parent.right
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.TabRow
|
|
||||||
{
|
|
||||||
id: tabBar
|
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
||||||
onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex)
|
|
||||||
z: 1
|
|
||||||
Repeater
|
|
||||||
{
|
|
||||||
model: extrudersModel
|
|
||||||
delegate: UM.TabRowButton
|
|
||||||
{
|
|
||||||
contentItem: Rectangle
|
|
||||||
{
|
|
||||||
z: 2
|
|
||||||
Cura.ExtruderIcon
|
|
||||||
{
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
materialColor: model.color
|
|
||||||
extruderEnabled: model.enabled
|
|
||||||
width: parent.height
|
|
||||||
height: parent.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
z: 1
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width * 2
|
|
||||||
border.color: UM.Theme.getColor("action_button_border")
|
|
||||||
|
|
||||||
visible:
|
|
||||||
{
|
|
||||||
return index == tabBar.currentIndex
|
|
||||||
}
|
|
||||||
|
|
||||||
// overlap bottom border
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
width: parent.width - UM.Theme.getSize("default_lining").width * 4
|
|
||||||
height: UM.Theme.getSize("default_lining").width * 4
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: - (UM.Theme.getSize("default_lining").width * 2)
|
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2
|
|
||||||
anchors.left: parent.left
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
SidebarSimple
|
|
||||||
{
|
|
||||||
anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height
|
|
||||||
anchors.fill: parent
|
|
||||||
visible: currentModeIndex != 1
|
|
||||||
onShowTooltip: base.showTooltip(item, location, text)
|
|
||||||
onHideTooltip: base.hideTooltip()
|
|
||||||
}
|
|
||||||
|
|
||||||
SidebarAdvanced
|
|
||||||
{
|
|
||||||
anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height
|
|
||||||
anchors.bottomMargin: 2 //don't overlap bottom border
|
|
||||||
anchors.fill: parent
|
|
||||||
visible: currentModeIndex == 1
|
|
||||||
onShowTooltip: base.showTooltip(item, location, text)
|
|
||||||
onHideTooltip: base.hideTooltip()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item
|
|
||||||
{
|
|
||||||
id: footerControll
|
|
||||||
anchors.top: popupItemContent.bottom
|
|
||||||
anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
width: parent.width
|
|
||||||
height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
width: parent.width
|
|
||||||
height: UM.Theme.getSize("default_lining").height
|
|
||||||
color: UM.Theme.getColor("action_button_border")
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.ActionButton
|
|
||||||
{
|
|
||||||
id: settingControlButton
|
|
||||||
leftPadding: UM.Theme.getSize("default_margin").width
|
|
||||||
rightPadding: UM.Theme.getSize("default_margin").width
|
|
||||||
height: UM.Theme.getSize("action_panel_button").height
|
|
||||||
text: catalog.i18nc("@button", "Custom")
|
|
||||||
color: UM.Theme.getColor("secondary")
|
|
||||||
hoverColor: UM.Theme.getColor("secondary")
|
|
||||||
textColor: UM.Theme.getColor("primary")
|
|
||||||
textHoverColor: UM.Theme.getColor("text")
|
|
||||||
iconSourceRight: UM.Theme.getIcon("arrow_right")
|
|
||||||
width: UM.Theme.getSize("print_setup_action_button").width
|
|
||||||
fixedWidthMode: true
|
|
||||||
visible: currentModeIndex == 0
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: parent.top
|
|
||||||
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
right: parent.right
|
|
||||||
rightMargin: UM.Theme.getSize("narrow_margin").height
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: currentModeIndex = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.ActionButton
|
|
||||||
{
|
|
||||||
height: UM.Theme.getSize("action_panel_button").height
|
|
||||||
text: catalog.i18nc("@button", "Recommended")
|
|
||||||
color: UM.Theme.getColor("secondary")
|
|
||||||
hoverColor: UM.Theme.getColor("secondary")
|
|
||||||
textColor: UM.Theme.getColor("primary")
|
|
||||||
textHoverColor: UM.Theme.getColor("text")
|
|
||||||
iconSource: UM.Theme.getIcon("arrow_left")
|
|
||||||
width: UM.Theme.getSize("print_setup_action_button").width
|
|
||||||
fixedWidthMode: true
|
|
||||||
visible: currentModeIndex == 1
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: parent.top
|
|
||||||
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: UM.Theme.getSize("narrow_margin").height
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: currentModeIndex = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
|
|
||||||
|
|
||||||
if(index != null && !isNaN(index))
|
|
||||||
{
|
|
||||||
currentModeIndex = index
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentModeIndex = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright (c) 2015 Ultimaker B.V.
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
|
|
||||||
import "Settings"
|
import "../Settings"
|
||||||
|
|
||||||
SettingView {
|
SettingView {
|
||||||
}
|
}
|
68
resources/qml/PrintSetupSelector/PrintSetupSelector.qml
Normal file
68
resources/qml/PrintSetupSelector/PrintSetupSelector.qml
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
|
||||||
|
import UM 1.3 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
Cura.ExpandableComponent
|
||||||
|
{
|
||||||
|
id: base
|
||||||
|
|
||||||
|
property int currentModeIndex: -1
|
||||||
|
property bool hideSettings: PrintInformation.preSliced
|
||||||
|
|
||||||
|
property string enabledText: catalog.i18nc("@label:Should be short", "On")
|
||||||
|
property string disabledText: catalog.i18nc("@label:Should be short", "Off")
|
||||||
|
|
||||||
|
// This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
|
||||||
|
signal showTooltip(Item item, point location, string text)
|
||||||
|
signal hideTooltip()
|
||||||
|
|
||||||
|
iconSource: UM.Theme.getIcon("pencil")
|
||||||
|
popupPadding: UM.Theme.getSize("default_lining").width
|
||||||
|
popupSpacingY: UM.Theme.getSize("narrow_margin").width
|
||||||
|
|
||||||
|
popupClosePolicy: Popup.CloseOnEscape
|
||||||
|
|
||||||
|
onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex)
|
||||||
|
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
popupItemWrapper.width = base.width
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.I18nCatalog
|
||||||
|
{
|
||||||
|
id: catalog
|
||||||
|
name: "cura"
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer
|
||||||
|
{
|
||||||
|
id: tooltipDelayTimer
|
||||||
|
interval: 500
|
||||||
|
repeat: false
|
||||||
|
property var item
|
||||||
|
property string text
|
||||||
|
|
||||||
|
onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text)
|
||||||
|
}
|
||||||
|
|
||||||
|
headerItem: PrintSetupSelectorHeader
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.ExtrudersModel
|
||||||
|
{
|
||||||
|
id: extrudersModel
|
||||||
|
}
|
||||||
|
|
||||||
|
popupItem: PrintSetupSelectorContents
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
276
resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml
Normal file
276
resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml
Normal file
|
@ -0,0 +1,276 @@
|
||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
import UM 1.3 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2
|
||||||
|
id: popupItemWrapper
|
||||||
|
height: total_height
|
||||||
|
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color: UM.Theme.getColor("lining")
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: popupItemHeader
|
||||||
|
height: 36
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: parent.top
|
||||||
|
right: parent.right
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: popupItemHeaderText
|
||||||
|
text: catalog.i18nc("@label", "Print settings");
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
topMargin: UM.Theme.getSize("sidebar_margin").height
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("narrow_margin").height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
height: UM.Theme.getSize("default_lining").height
|
||||||
|
anchors.top: popupItemHeaderText.bottom
|
||||||
|
color: UM.Theme.getColor("action_button_border")
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: closeButton;
|
||||||
|
width: UM.Theme.getSize("message_close").width;
|
||||||
|
height: UM.Theme.getSize("message_close").height;
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
right: parent.right;
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width;
|
||||||
|
top: parent.top;
|
||||||
|
topMargin: 10
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
anchors.fill: parent;
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: width
|
||||||
|
color: UM.Theme.getColor("message_text")
|
||||||
|
source: UM.Theme.getIcon("cross1")
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: base.togglePopup() // Will hide the popup item
|
||||||
|
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
color: UM.Theme.getColor("message_background")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: popupItemContent
|
||||||
|
width: parent.width
|
||||||
|
height: tabBar.height + sidebarContents.height
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: popupItemHeader.bottom
|
||||||
|
topMargin: UM.Theme.getSize("narrow_margin").height
|
||||||
|
right: parent.right
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.TabRow
|
||||||
|
{
|
||||||
|
id: tabBar
|
||||||
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex)
|
||||||
|
z: 1
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: extrudersModel
|
||||||
|
delegate: UM.TabRowButton
|
||||||
|
{
|
||||||
|
contentItem: Rectangle
|
||||||
|
{
|
||||||
|
z: 2
|
||||||
|
Cura.ExtruderIcon
|
||||||
|
{
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
materialColor: model.color
|
||||||
|
extruderEnabled: model.enabled
|
||||||
|
width: parent.height
|
||||||
|
height: parent.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
z: 1
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width * 2
|
||||||
|
border.color: UM.Theme.getColor("action_button_border")
|
||||||
|
|
||||||
|
visible:
|
||||||
|
{
|
||||||
|
return index == tabBar.currentIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
// overlap bottom border
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
width: parent.width - UM.Theme.getSize("default_lining").width * 4
|
||||||
|
height: UM.Theme.getSize("default_lining").width * 4
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: - (UM.Theme.getSize("default_lining").width * 2)
|
||||||
|
anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
RecommendedPrintSetup
|
||||||
|
{
|
||||||
|
anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: currentModeIndex != 1
|
||||||
|
onShowTooltip: base.showTooltip(item, location, text)
|
||||||
|
onHideTooltip: base.hideTooltip()
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomPrintSetup
|
||||||
|
{
|
||||||
|
anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height
|
||||||
|
anchors.bottomMargin: 2 //don't overlap bottom border
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: currentModeIndex == 1
|
||||||
|
onShowTooltip: base.showTooltip(item, location, text)
|
||||||
|
onHideTooltip: base.hideTooltip()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: footerControll
|
||||||
|
anchors.top: popupItemContent.bottom
|
||||||
|
anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
|
width: parent.width
|
||||||
|
height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
height: UM.Theme.getSize("default_lining").height
|
||||||
|
color: UM.Theme.getColor("action_button_border")
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.ActionButton
|
||||||
|
{
|
||||||
|
id: settingControlButton
|
||||||
|
leftPadding: UM.Theme.getSize("default_margin").width
|
||||||
|
rightPadding: UM.Theme.getSize("default_margin").width
|
||||||
|
height: UM.Theme.getSize("action_panel_button").height
|
||||||
|
text: catalog.i18nc("@button", "Custom")
|
||||||
|
color: UM.Theme.getColor("secondary")
|
||||||
|
hoverColor: UM.Theme.getColor("secondary")
|
||||||
|
textColor: UM.Theme.getColor("primary")
|
||||||
|
textHoverColor: UM.Theme.getColor("text")
|
||||||
|
iconSourceRight: UM.Theme.getIcon("arrow_right")
|
||||||
|
width: UM.Theme.getSize("print_setup_action_button").width
|
||||||
|
fixedWidthMode: true
|
||||||
|
visible: currentModeIndex == 0
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: parent.top
|
||||||
|
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
|
bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("narrow_margin").height
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: currentModeIndex = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.ActionButton
|
||||||
|
{
|
||||||
|
height: UM.Theme.getSize("action_panel_button").height
|
||||||
|
text: catalog.i18nc("@button", "Recommended")
|
||||||
|
color: UM.Theme.getColor("secondary")
|
||||||
|
hoverColor: UM.Theme.getColor("secondary")
|
||||||
|
textColor: UM.Theme.getColor("primary")
|
||||||
|
textHoverColor: UM.Theme.getColor("text")
|
||||||
|
iconSource: UM.Theme.getIcon("arrow_left")
|
||||||
|
width: UM.Theme.getSize("print_setup_action_button").width
|
||||||
|
fixedWidthMode: true
|
||||||
|
visible: currentModeIndex == 1
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: parent.top
|
||||||
|
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
|
bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("narrow_margin").height
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: currentModeIndex = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
|
||||||
|
|
||||||
|
if(index != null && !isNaN(index))
|
||||||
|
{
|
||||||
|
currentModeIndex = index
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentModeIndex = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
import UM 1.3 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Cura.IconLabel
|
||||||
|
{
|
||||||
|
source: UM.Theme.getIcon("category_layer_height")
|
||||||
|
text: Cura.MachineManager.activeStack ? Cura.MachineManager.activeQualityOrQualityChangesName + " " + layerHeight.properties.value + "mm" : ""
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: layerHeight
|
||||||
|
containerStack: Cura.MachineManager.activeStack
|
||||||
|
key: "layer_height"
|
||||||
|
watchedProperties: ["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.IconLabel
|
||||||
|
{
|
||||||
|
source: UM.Theme.getIcon("category_infill")
|
||||||
|
text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%"
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: infillDensity
|
||||||
|
containerStack: Cura.MachineManager.activeStack
|
||||||
|
key: "infill_sparse_density"
|
||||||
|
watchedProperties: ["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.IconLabel
|
||||||
|
{
|
||||||
|
source: UM.Theme.getIcon("category_support")
|
||||||
|
text: supportEnabled.properties.value == "True" ? enabledText : disabledText
|
||||||
|
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: supportEnabled
|
||||||
|
containerStack: Cura.MachineManager.activeMachine
|
||||||
|
key: "support_enable"
|
||||||
|
watchedProperties: ["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.IconLabel
|
||||||
|
{
|
||||||
|
source: UM.Theme.getIcon("category_adhesion")
|
||||||
|
text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: platformAdhesionType
|
||||||
|
containerStack: Cura.MachineManager.activeMachine
|
||||||
|
key: "adhesion_type"
|
||||||
|
watchedProperties: [ "value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -188,7 +188,7 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IconWithText
|
Cura.IconLabel
|
||||||
{
|
{
|
||||||
id: qualityRowTitle
|
id: qualityRowTitle
|
||||||
source: UM.Theme.getIcon("category_layer_height")
|
source: UM.Theme.getIcon("category_layer_height")
|
||||||
|
@ -496,7 +496,7 @@ Item
|
||||||
|
|
||||||
width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width
|
width: Math.round(UM.Theme.getSize("print_setup_widget").width * .45) - UM.Theme.getSize("thick_margin").width
|
||||||
|
|
||||||
IconWithText
|
Cura.IconLabel
|
||||||
{
|
{
|
||||||
id: infillLabel
|
id: infillLabel
|
||||||
source: UM.Theme.getIcon("category_infill")
|
source: UM.Theme.getIcon("category_infill")
|
||||||
|
@ -818,7 +818,7 @@ Item
|
||||||
//
|
//
|
||||||
// Enable support
|
// Enable support
|
||||||
//
|
//
|
||||||
IconWithText
|
Cura.IconLabel
|
||||||
{
|
{
|
||||||
id: enableSupportLabel
|
id: enableSupportLabel
|
||||||
visible: enableSupportCheckBox.visible
|
visible: enableSupportCheckBox.visible
|
||||||
|
@ -942,7 +942,7 @@ Item
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IconWithText
|
Cura.IconLabel
|
||||||
{
|
{
|
||||||
id: adhesionHelperLabel
|
id: adhesionHelperLabel
|
||||||
visible: adhesionCheckBox.visible
|
visible: adhesionCheckBox.visible
|
Loading…
Add table
Add a link
Reference in a new issue