mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Move machine selector to own component & new location
This also simplifies & cleans up the actually used QML CURA-5772
This commit is contained in:
parent
1ed3558b9a
commit
85436c1469
3 changed files with 60 additions and 35 deletions
|
@ -169,6 +169,14 @@ UM.MainWindow
|
|||
action: Cura.Actions.open
|
||||
}
|
||||
|
||||
MachineAndConfigurationSelector
|
||||
{
|
||||
anchors.left: openFileButton.right
|
||||
//anchors.right: sidebar.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.top: openFileButton.top
|
||||
}
|
||||
|
||||
Toolbar
|
||||
{
|
||||
id: toolbar
|
||||
|
|
|
@ -9,6 +9,8 @@ import UM 1.2 as UM
|
|||
import Cura 1.0 as Cura
|
||||
import "Menus"
|
||||
import "Menus/ConfigurationMenu"
|
||||
import "components"
|
||||
|
||||
|
||||
Rectangle
|
||||
{
|
||||
|
@ -19,7 +21,6 @@ Rectangle
|
|||
property bool hideView: Cura.MachineManager.activeMachineName == ""
|
||||
|
||||
// Is there an output device for this printer?
|
||||
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
||||
property bool printerConnected: Cura.MachineManager.printerConnected
|
||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||
|
@ -85,41 +86,11 @@ Rectangle
|
|||
}
|
||||
}
|
||||
|
||||
MachineSelection
|
||||
{
|
||||
id: machineSelection
|
||||
width: base.width - configSelection.width - separator.width
|
||||
height: UM.Theme.getSize("sidebar_header").height
|
||||
anchors.top: base.top
|
||||
anchors.left: parent.left
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: separator
|
||||
visible: configSelection.visible
|
||||
width: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0
|
||||
height: UM.Theme.getSize("sidebar_header").height
|
||||
color: UM.Theme.getColor("sidebar_lining_thin")
|
||||
anchors.left: machineSelection.right
|
||||
}
|
||||
|
||||
ConfigurationSelection
|
||||
{
|
||||
id: configSelection
|
||||
visible: isNetworkPrinter && printerConnected
|
||||
width: visible ? Math.round(base.width * 0.15) : 0
|
||||
height: UM.Theme.getSize("sidebar_header").height
|
||||
anchors.top: base.top
|
||||
anchors.right: parent.right
|
||||
panelWidth: base.width
|
||||
}
|
||||
|
||||
SidebarHeader {
|
||||
id: header
|
||||
width: parent.width
|
||||
visible: !hideSettings && (machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants)
|
||||
anchors.top: machineSelection.bottom
|
||||
anchors.top: parent.top
|
||||
|
||||
onShowTooltip: base.showTooltip(item, location, text)
|
||||
onHideTooltip: base.hideTooltip()
|
||||
|
@ -160,10 +131,9 @@ Rectangle
|
|||
}
|
||||
|
||||
// Settings mode selection toggle
|
||||
Rectangle
|
||||
Item
|
||||
{
|
||||
id: settingsModeSelection
|
||||
color: "transparent"
|
||||
|
||||
width: Math.round(parent.width * 0.55)
|
||||
height: UM.Theme.getSize("sidebar_header_mode_toggle").height
|
||||
|
@ -328,7 +298,6 @@ Rectangle
|
|||
anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height
|
||||
height: timeDetails.height + costSpec.height
|
||||
width: base.width - (saveButton.buttonRowWidth + UM.Theme.getSize("sidebar_margin").width)
|
||||
clip: true
|
||||
|
||||
Label
|
||||
{
|
||||
|
|
48
resources/qml/components/MachineAndConfigurationSelector.qml
Normal file
48
resources/qml/components/MachineAndConfigurationSelector.qml
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) 2017 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.7
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
import "../Menus"
|
||||
import "../Menus/ConfigurationMenu"
|
||||
import ".."
|
||||
|
||||
Rectangle
|
||||
{
|
||||
color: UM.Theme.getColor("sidebar_lining_thin")
|
||||
|
||||
implicitHeight: UM.Theme.getSize("sidebar_header").height
|
||||
implicitWidth: UM.Theme.getSize("sidebar").width
|
||||
|
||||
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
||||
property bool printerConnected: Cura.MachineManager.printerConnected
|
||||
|
||||
MachineSelection
|
||||
{
|
||||
id: machineSelection
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: configSelection.left
|
||||
rightMargin: UM.Theme.getSize("sidebar_lining_thin").height / 2
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
ConfigurationSelection
|
||||
{
|
||||
id: configSelection
|
||||
visible: isNetworkPrinter && printerConnected
|
||||
width: visible ? Math.round(parent.width * 0.15) : 0
|
||||
panelWidth: parent.width
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue