Organize the components in a Column. Separate the TopHeader and place it

below the application menu, using all the width.

Contributes to CURA-5784.
This commit is contained in:
Diego Prado Gesto 2018-10-08 11:31:53 +02:00
parent 8bdd27183f
commit 3acfdadd12
2 changed files with 53 additions and 51 deletions

View File

@ -63,7 +63,7 @@ UM.MainWindow
CuraApplication.purgeWindows() CuraApplication.purgeWindows()
} }
Item Column
{ {
id: backgroundItem id: backgroundItem
anchors.fill: parent anchors.fill: parent
@ -92,19 +92,25 @@ UM.MainWindow
window: base window: base
} }
TopHeader
{
id: topHeader
anchors.left: parent.left
anchors.right: parent.right
}
Item Item
{ {
id: contentItem; id: contentItem
y: menu.height width: parent.width
width: parent.width; height: parent.height - menu.height - topHeader.height
height: parent.height - menu.height;
Keys.forwardTo: menu Keys.forwardTo: menu
DropArea DropArea
{ {
anchors.fill: parent; anchors.fill: parent
onDropped: onDropped:
{ {
if (drop.urls.length > 0) if (drop.urls.length > 0)
@ -137,69 +143,61 @@ UM.MainWindow
id: jobSpecs id: jobSpecs
anchors anchors
{ {
bottom: parent.bottom; bottom: parent.bottom
right: sidebar.left; right: sidebar.left
bottomMargin: UM.Theme.getSize("default_margin").height; bottomMargin: UM.Theme.getSize("default_margin").height
rightMargin: UM.Theme.getSize("default_margin").width; rightMargin: UM.Theme.getSize("default_margin").width
} }
} }
Button Button
{ {
id: openFileButton; id: openFileButton
text: catalog.i18nc("@action:button","Open File"); text: catalog.i18nc("@action:button","Open File")
iconSource: UM.Theme.getIcon("load") iconSource: UM.Theme.getIcon("load")
style: UM.Theme.styles.tool_button style: UM.Theme.styles.tool_button
tooltip: "" tooltip: ""
anchors anchors
{ {
top: topbar.bottom; top: parent.top
topMargin: UM.Theme.getSize("default_margin").height; topMargin: UM.Theme.getSize("default_margin").height
left: parent.left; left: parent.left
} }
action: Cura.Actions.open; action: Cura.Actions.open
} }
Toolbar Toolbar
{ {
id: toolbar; id: toolbar
property int mouseX: base.mouseX property int mouseX: base.mouseX
property int mouseY: base.mouseY property int mouseY: base.mouseY
anchors { anchors {
top: openFileButton.bottom; top: openFileButton.bottom
topMargin: UM.Theme.getSize("window_margin").height; topMargin: UM.Theme.getSize("window_margin").height
left: parent.left; left: parent.left
} }
} }
ObjectsList ObjectsList
{ {
id: objectsList; id: objectsList
visible: UM.Preferences.getValue("cura/use_multi_build_plate"); visible: UM.Preferences.getValue("cura/use_multi_build_plate")
anchors anchors
{ {
bottom: parent.bottom; bottom: parent.bottom
left: parent.left; left: parent.left
} }
} }
Topbar
{
id: topbar
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
}
Loader Loader
{ {
id: main id: main
anchors anchors
{ {
top: topbar.bottom top: parent.top
bottom: parent.bottom bottom: parent.bottom
left: parent.left left: parent.left
right: sidebar.left right: sidebar.left
@ -220,26 +218,30 @@ UM.MainWindow
{ {
id: sidebar id: sidebar
property bool collapsed: false; property bool collapsed: false
property var initialWidth: UM.Theme.getSize("sidebar").width; property var initialWidth: UM.Theme.getSize("sidebar").width
function callExpandOrCollapse() { function callExpandOrCollapse()
if (collapsed) { {
sidebar.visible = true; if (collapsed)
sidebar.initialWidth = UM.Theme.getSize("sidebar").width; {
viewportRect = Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0); sidebar.visible = true
sidebar.initialWidth = UM.Theme.getSize("sidebar").width
viewportRect = Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0)
expandSidebarAnimation.start(); expandSidebarAnimation.start();
} else {
viewportRect = Qt.rect(0, 0, 1, 1.0);
collapseSidebarAnimation.start();
} }
collapsed = !collapsed; else
UM.Preferences.setValue("cura/sidebar_collapsed", collapsed); {
viewportRect = Qt.rect(0, 0, 1, 1.0)
collapseSidebarAnimation.start()
}
collapsed = !collapsed
UM.Preferences.setValue("cura/sidebar_collapsed", collapsed)
} }
anchors anchors
{ {
top: topbar.top top: parent.top
bottom: parent.bottom bottom: parent.bottom
} }
@ -265,13 +267,13 @@ UM.MainWindow
Component.onCompleted: Component.onCompleted:
{ {
var sidebar_collapsed = UM.Preferences.getValue("cura/sidebar_collapsed"); var sidebar_collapsed = UM.Preferences.getValue("cura/sidebar_collapsed")
if (sidebar_collapsed) if (sidebar_collapsed)
{ {
sidebar.collapsed = true; sidebar.collapsed = true
viewportRect = Qt.rect(0, 0, 1, 1.0) viewportRect = Qt.rect(0, 0, 1, 1.0)
collapseSidebarAnimation.start(); collapseSidebarAnimation.start()
} }
} }
@ -290,8 +292,8 @@ UM.MainWindow
{ {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
horizontalCenterOffset: -(Math.round(UM.Theme.getSize("sidebar").width / 2)) horizontalCenterOffset: -(Math.round(UM.Theme.getSize("sidebar").width / 2))
top: parent.verticalCenter; top: parent.verticalCenter
bottom: parent.bottom; bottom: parent.bottom
bottomMargin: UM.Theme.getSize("default_margin").height bottomMargin: UM.Theme.getSize("default_margin").height
} }
} }