Move profile dropdown to another file

CURA-5941
This commit is contained in:
Aleksei S 2018-11-29 00:00:22 +01:00
parent 0fdaebaaf8
commit b9d9a35868
3 changed files with 115 additions and 109 deletions

View 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()
}
}
}

View File

@ -126,7 +126,9 @@ Cura.ExpandableComponent
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
height: total_height
@ -157,9 +159,9 @@ Cura.ExpandableComponent
anchors
{
topMargin: UM.Theme.getSize("sidebar_margin").height
//topMargin: UM.Theme.getSize("sidebar_margin").height
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
anchors.top: popupItemHeaderText.bottom
color: UM.Theme.getColor("action_button_border")
}
Button
@ -209,21 +209,33 @@ Cura.ExpandableComponent
{
id: popupItemContent
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
{
top: popupItemHeader.bottom
topMargin: UM.Theme.getSize("narrow_margin").height
topMargin: UM.Theme.getSize("default_margin").height * 1.5
right: parent.right
left: parent.left
leftMargin: 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
{
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)
z: 1
Repeater
@ -280,8 +292,6 @@ Cura.ExpandableComponent
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")
@ -296,8 +306,8 @@ Cura.ExpandableComponent
SidebarAdvanced
{
anchors.topMargin: UM.Theme.getSize("print_setup_content_top_margin").height
anchors.bottomMargin: 2 //don't overlap bottom border
anchors.topMargin: Math.round(UM.Theme.getSize("wide_margin").height / 1.7)
anchors.bottomMargin: 2 //prevent bottom line overlapping
anchors.fill: parent
visible: currentModeIndex == 1
onShowTooltip: base.showTooltip(item, location, text)
@ -312,7 +322,6 @@ Cura.ExpandableComponent
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
@ -330,9 +339,8 @@ Cura.ExpandableComponent
{
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
rightMargin: UM.Theme.getSize("narrow_margin").height * 2
}
color: UM.Theme.getColor("secondary")
@ -349,14 +357,11 @@ Cura.ExpandableComponent
{
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
@ -365,9 +370,8 @@ Cura.ExpandableComponent
{
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
leftMargin: UM.Theme.getSize("narrow_margin").height * 2
}
MouseArea {

View File

@ -21,92 +21,6 @@ Item
signal showTooltip(Item item, point location, string text)
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
{
id: settingVisibilityMenu
@ -115,7 +29,6 @@ Item
height: UM.Theme.getSize("setting_control").height
anchors
{
top: globalProfileRow.bottom
topMargin: UM.Theme.getSize("thick_margin").height
right: parent.right
rightMargin: UM.Theme.getSize("thick_margin").width
@ -168,7 +81,7 @@ Item
anchors
{
top: globalProfileRow.bottom
//top: globalProfileRow.bottom
topMargin: UM.Theme.getSize("thick_margin").height
left: parent.left
leftMargin: UM.Theme.getSize("thick_margin").width