Move additional component loader into ActionPanelWidget

This commit is contained in:
Jaime van Kessel 2019-01-31 17:13:32 +01:00
parent 1a037bdb82
commit e6f722b29c
2 changed files with 69 additions and 62 deletions

View file

@ -12,13 +12,19 @@ import Cura 1.0 as Cura
// This element hold all the elements needed for the user to trigger the slicing process, and later // This element hold all the elements needed for the user to trigger the slicing process, and later
// to get information about the printing times, material consumption and the output process (such as // to get information about the printing times, material consumption and the output process (such as
// saving to a file, printing over network, ... // saving to a file, printing over network, ...
Item
{
id: base
width: childrenRect.width
height: childrenRect.height
Rectangle Rectangle
{ {
id: actionPanelWidget id: actionPanelWidget
width: UM.Theme.getSize("action_panel_widget").width width: UM.Theme.getSize("action_panel_widget").width
height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height
anchors. right: parent.right
color: UM.Theme.getColor("main_background") color: UM.Theme.getColor("main_background")
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining") border.color: UM.Theme.getColor("lining")
@ -39,7 +45,7 @@ Rectangle
right: parent.right right: parent.right
rightMargin: UM.Theme.getSize("thick_margin").width rightMargin: UM.Theme.getSize("thick_margin").width
} }
sourceComponent: outputAvailable ? outputProcessWidget : sliceProcessWidget sourceComponent: actionPanelWidget.outputAvailable ? outputProcessWidget : sliceProcessWidget
} }
Component Component
@ -54,3 +60,37 @@ Rectangle
OutputProcessWidget { } OutputProcessWidget { }
} }
} }
Item
{
id: additionalComponents
width: childrenRect.width
anchors.right: actionPanelWidget.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.bottom: actionPanelWidget.bottom
anchors.bottomMargin: UM.Theme.getSize("thick_margin").height * 2
visible: actionPanelWidget.visible
Row
{
id: additionalComponentsRow
anchors.verticalCenter: parent.verticalCenter
spacing: UM.Theme.getSize("default_margin").width
}
}
Component.onCompleted: base.addAdditionalComponents()
Connections
{
target: CuraApplication
onAdditionalComponentsChanged: base.addAdditionalComponents()
}
function addAdditionalComponents()
{
for (var component in CuraApplication.additionalComponents["saveButton"])
{
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
}
}

View file

@ -270,39 +270,6 @@ UM.MainWindow
visible: CuraApplication.platformActivity && (main.item == null || !qmlTypeOf(main.item, "QQuickRectangle")) visible: CuraApplication.platformActivity && (main.item == null || !qmlTypeOf(main.item, "QQuickRectangle"))
} }
Item
{
id: additionalComponents
width: childrenRect.width
anchors.right: actionPanelWidget.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.bottom: actionPanelWidget.bottom
anchors.bottomMargin: UM.Theme.getSize("thick_margin").height * 2
visible: actionPanelWidget.visible
Row
{
id: additionalComponentsRow
anchors.verticalCenter: parent.verticalCenter
spacing: UM.Theme.getSize("default_margin").width
}
}
Component.onCompleted: contentItem.addAdditionalComponents()
Connections
{
target: CuraApplication
onAdditionalComponentsChanged: contentItem.addAdditionalComponents("saveButton")
}
function addAdditionalComponents()
{
for (var component in CuraApplication.additionalComponents["saveButton"])
{
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
}
Loader Loader
{ {
// A stage can control this area. If nothing is set, it will therefore show the 3D view. // A stage can control this area. If nothing is set, it will therefore show the 3D view.