mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 02:45:55 +08:00
Move profile dropdown to another file
CURA-5941
This commit is contained in:
parent
0fdaebaaf8
commit
b9d9a35868
89
resources/qml/GlobalProfileButton.qml
Normal file
89
resources/qml/GlobalProfileButton.qml
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
|
|
||||||
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
import "Menus"
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: globalProfileRow
|
||||||
|
height: UM.Theme.getSize("print_setup_item").height
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: globalProfileLabel
|
||||||
|
text: catalog.i18nc("@label","Profile:")
|
||||||
|
textFormat: Text.PlainText
|
||||||
|
width: Math.round(parent.width * 0.45 - UM.Theme.getSize("thick_margin").width - 2)
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolButton
|
||||||
|
{
|
||||||
|
id: globalProfileSelection
|
||||||
|
|
||||||
|
text: generateActiveQualityText()
|
||||||
|
width: Math.round(parent.width * 0.55)
|
||||||
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
anchors.left: globalProfileLabel.right
|
||||||
|
anchors.right: parent.right
|
||||||
|
tooltip: Cura.MachineManager.activeQualityOrQualityChangesName
|
||||||
|
style: UM.Theme.styles.sidebar_header_button
|
||||||
|
activeFocusOnPress: true
|
||||||
|
menu: ProfileMenu { }
|
||||||
|
|
||||||
|
function generateActiveQualityText () {
|
||||||
|
var result = Cura.MachineManager.activeQualityOrQualityChangesName;
|
||||||
|
|
||||||
|
if (Cura.MachineManager.isActiveQualitySupported) {
|
||||||
|
if (Cura.MachineManager.activeQualityLayerHeight > 0) {
|
||||||
|
result += " <font color=\"" + UM.Theme.getColor("text_detail") + "\">"
|
||||||
|
result += " - "
|
||||||
|
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
|
||||||
|
result += "</font>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.SimpleButton
|
||||||
|
{
|
||||||
|
id: customisedSettings
|
||||||
|
|
||||||
|
visible: Cura.MachineManager.hasUserSettings
|
||||||
|
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.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("thick_margin").width)
|
||||||
|
|
||||||
|
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
|
||||||
|
iconSource: UM.Theme.getIcon("star");
|
||||||
|
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
forceActiveFocus();
|
||||||
|
Cura.Actions.manageProfiles.trigger()
|
||||||
|
}
|
||||||
|
onEntered:
|
||||||
|
{
|
||||||
|
var content = catalog.i18nc("@tooltip","Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.")
|
||||||
|
base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), content)
|
||||||
|
}
|
||||||
|
onExited: base.hideTooltip()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -126,7 +126,9 @@ Cura.ExpandableComponent
|
|||||||
|
|
||||||
popupItem: Rectangle
|
popupItem: Rectangle
|
||||||
{
|
{
|
||||||
property var total_height: popupItemHeader.height + popupItemContent.height + footerControll.height + UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
|
property var totalMargins: UM.Theme.getSize("narrow_margin").height * 11
|
||||||
|
property var total_height: popupItemHeader.height + popupItemContent.height + totalMargins
|
||||||
id: popupItemWrapper
|
id: popupItemWrapper
|
||||||
height: total_height
|
height: total_height
|
||||||
|
|
||||||
@ -157,9 +159,9 @@ Cura.ExpandableComponent
|
|||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
topMargin: UM.Theme.getSize("sidebar_margin").height
|
//topMargin: UM.Theme.getSize("sidebar_margin").height
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: UM.Theme.getSize("narrow_margin").height
|
leftMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,8 +171,6 @@ Cura.ExpandableComponent
|
|||||||
height: UM.Theme.getSize("default_lining").height
|
height: UM.Theme.getSize("default_lining").height
|
||||||
anchors.top: popupItemHeaderText.bottom
|
anchors.top: popupItemHeaderText.bottom
|
||||||
color: UM.Theme.getColor("action_button_border")
|
color: UM.Theme.getColor("action_button_border")
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
Button
|
||||||
@ -209,21 +209,33 @@ Cura.ExpandableComponent
|
|||||||
{
|
{
|
||||||
id: popupItemContent
|
id: popupItemContent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: tabBar.height + sidebarContents.height
|
height: globalProfileRow.height + tabBar.height + UM.Theme.getSize("print_setup_widget").height - UM.Theme.getSize("print_setup_item").height
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: popupItemHeader.bottom
|
top: popupItemHeader.bottom
|
||||||
topMargin: UM.Theme.getSize("narrow_margin").height
|
topMargin: UM.Theme.getSize("default_margin").height * 1.5
|
||||||
right: parent.right
|
right: parent.right
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GlobalProfileButton
|
||||||
|
{
|
||||||
|
id: globalProfileRow
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UM.TabRow
|
UM.TabRow
|
||||||
{
|
{
|
||||||
id: tabBar
|
id: tabBar
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
anchors.top: globalProfileRow.bottom
|
||||||
|
anchors.topMargin: UM.Theme.getSize("default_margin").height * 1.5
|
||||||
onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex)
|
onCurrentIndexChanged: Cura.ExtruderManager.setActiveExtruderIndex(currentIndex)
|
||||||
z: 1
|
z: 1
|
||||||
Repeater
|
Repeater
|
||||||
@ -280,8 +292,6 @@ Cura.ExpandableComponent
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: UM.Theme.getSize("print_setup_widget").height
|
|
||||||
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width * 2
|
border.width: UM.Theme.getSize("default_lining").width * 2
|
||||||
border.color: UM.Theme.getColor("action_button_border")
|
border.color: UM.Theme.getColor("action_button_border")
|
||||||
|
|
||||||
@ -296,8 +306,8 @@ Cura.ExpandableComponent
|
|||||||
|
|
||||||
SidebarAdvanced
|
SidebarAdvanced
|
||||||
{
|
{
|
||||||
anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height
|
anchors.topMargin: Math.round(UM.Theme.getSize("wide_margin").height / 1.7)
|
||||||
anchors.bottomMargin: 2 //don't overlap bottom border
|
anchors.bottomMargin: 2 //prevent bottom line overlapping
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: currentModeIndex == 1
|
visible: currentModeIndex == 1
|
||||||
onShowTooltip: base.showTooltip(item, location, text)
|
onShowTooltip: base.showTooltip(item, location, text)
|
||||||
@ -312,7 +322,6 @@ Cura.ExpandableComponent
|
|||||||
anchors.top: popupItemContent.bottom
|
anchors.top: popupItemContent.bottom
|
||||||
anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
anchors.topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: settingControlButton.height + UM.Theme.getSize("default_lining").height * 4
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -330,9 +339,8 @@ Cura.ExpandableComponent
|
|||||||
{
|
{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: UM.Theme.getSize("narrow_margin").height
|
rightMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
color: UM.Theme.getColor("secondary")
|
color: UM.Theme.getColor("secondary")
|
||||||
@ -349,14 +357,11 @@ Cura.ExpandableComponent
|
|||||||
{
|
{
|
||||||
height: UM.Theme.getSize("action_panel_button").height
|
height: UM.Theme.getSize("action_panel_button").height
|
||||||
text: catalog.i18nc("@button", "Recommended")
|
text: catalog.i18nc("@button", "Recommended")
|
||||||
|
|
||||||
color: UM.Theme.getColor("secondary")
|
color: UM.Theme.getColor("secondary")
|
||||||
hoverColor: UM.Theme.getColor("secondary")
|
hoverColor: UM.Theme.getColor("secondary")
|
||||||
textColor: UM.Theme.getColor("primary")
|
textColor: UM.Theme.getColor("primary")
|
||||||
textHoverColor: UM.Theme.getColor("text")
|
textHoverColor: UM.Theme.getColor("text")
|
||||||
|
|
||||||
iconSource: UM.Theme.getIcon("arrow_left")
|
iconSource: UM.Theme.getIcon("arrow_left")
|
||||||
|
|
||||||
width: UM.Theme.getSize("print_setup_action_button").width
|
width: UM.Theme.getSize("print_setup_action_button").width
|
||||||
fixedWidthMode: true
|
fixedWidthMode: true
|
||||||
|
|
||||||
@ -365,9 +370,8 @@ Cura.ExpandableComponent
|
|||||||
{
|
{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
topMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
bottomMargin: UM.Theme.getSize("narrow_margin").height * 2
|
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: UM.Theme.getSize("narrow_margin").height
|
leftMargin: UM.Theme.getSize("narrow_margin").height * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@ -376,7 +380,7 @@ Cura.ExpandableComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
|
var index = Math.round(UM.Preferences.getValue("cura/active_mode"))
|
||||||
|
@ -21,92 +21,6 @@ Item
|
|||||||
signal showTooltip(Item item, point location, string text)
|
signal showTooltip(Item item, point location, string text)
|
||||||
signal hideTooltip()
|
signal hideTooltip()
|
||||||
|
|
||||||
Item
|
|
||||||
{
|
|
||||||
id: globalProfileRow
|
|
||||||
height: UM.Theme.getSize("print_setup_item").height
|
|
||||||
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: Math.round(UM.Theme.getSize("thick_margin").width)
|
|
||||||
right: parent.right
|
|
||||||
rightMargin: Math.round(UM.Theme.getSize("thick_margin").width)
|
|
||||||
}
|
|
||||||
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
id: globalProfileLabel
|
|
||||||
text: catalog.i18nc("@label","Profile:")
|
|
||||||
textFormat: Text.PlainText
|
|
||||||
width: Math.round(parent.width * 0.45 - UM.Theme.getSize("thick_margin").width - 2)
|
|
||||||
font: UM.Theme.getFont("default")
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolButton
|
|
||||||
{
|
|
||||||
id: globalProfileSelection
|
|
||||||
|
|
||||||
text: generateActiveQualityText()
|
|
||||||
width: Math.round(parent.width * 0.55)
|
|
||||||
height: UM.Theme.getSize("setting_control").height
|
|
||||||
anchors.left: globalProfileLabel.right
|
|
||||||
anchors.right: parent.right
|
|
||||||
tooltip: Cura.MachineManager.activeQualityOrQualityChangesName
|
|
||||||
style: UM.Theme.styles.sidebar_header_button
|
|
||||||
activeFocusOnPress: true
|
|
||||||
menu: ProfileMenu { }
|
|
||||||
|
|
||||||
function generateActiveQualityText () {
|
|
||||||
var result = Cura.MachineManager.activeQualityOrQualityChangesName;
|
|
||||||
|
|
||||||
if (Cura.MachineManager.isActiveQualitySupported) {
|
|
||||||
if (Cura.MachineManager.activeQualityLayerHeight > 0) {
|
|
||||||
result += " <font color=\"" + UM.Theme.getColor("text_detail") + "\">"
|
|
||||||
result += " - "
|
|
||||||
result += Cura.MachineManager.activeQualityLayerHeight + "mm"
|
|
||||||
result += "</font>"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.SimpleButton
|
|
||||||
{
|
|
||||||
id: customisedSettings
|
|
||||||
|
|
||||||
visible: Cura.MachineManager.hasUserSettings
|
|
||||||
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.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("thick_margin").width)
|
|
||||||
|
|
||||||
color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
|
|
||||||
iconSource: UM.Theme.getIcon("star");
|
|
||||||
|
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
forceActiveFocus();
|
|
||||||
Cura.Actions.manageProfiles.trigger()
|
|
||||||
}
|
|
||||||
onEntered:
|
|
||||||
{
|
|
||||||
var content = catalog.i18nc("@tooltip","Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.")
|
|
||||||
base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), content)
|
|
||||||
}
|
|
||||||
onExited: base.hideTooltip()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolButton
|
ToolButton
|
||||||
{
|
{
|
||||||
id: settingVisibilityMenu
|
id: settingVisibilityMenu
|
||||||
@ -115,7 +29,6 @@ Item
|
|||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: globalProfileRow.bottom
|
|
||||||
topMargin: UM.Theme.getSize("thick_margin").height
|
topMargin: UM.Theme.getSize("thick_margin").height
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: UM.Theme.getSize("thick_margin").width
|
rightMargin: UM.Theme.getSize("thick_margin").width
|
||||||
@ -168,7 +81,7 @@ Item
|
|||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: globalProfileRow.bottom
|
//top: globalProfileRow.bottom
|
||||||
topMargin: UM.Theme.getSize("thick_margin").height
|
topMargin: UM.Theme.getSize("thick_margin").height
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: UM.Theme.getSize("thick_margin").width
|
leftMargin: UM.Theme.getSize("thick_margin").width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user