Add the buttons to add printer and manage printers in the bottom of the

print selector panel.

Contributes to CURA-5942.
This commit is contained in:
Diego Prado Gesto 2018-11-21 11:43:20 +01:00
parent 8e47d04756
commit de650300e2
2 changed files with 52 additions and 6 deletions

View File

@ -52,7 +52,6 @@ Item
function togglePopup() function togglePopup()
{ {
// print(popupAlignment, popupAlignment == PopupAlignment.AlignRight)
if(popup.visible) if(popup.visible)
{ {
popup.close() popup.close()
@ -149,8 +148,8 @@ Item
// Ensure that the popup is located directly below the headerItem // Ensure that the popup is located directly below the headerItem
y: headerItemLoader.height + 2 * background.padding y: headerItemLoader.height + 2 * background.padding
// Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between // Make the popup aligned with the rest, using the property popupAlignment to decide whether is right or left.
// the button & text. // In case of right alignment, the 3x padding is due to left, right and padding between the button & text.
x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0
padding: UM.Theme.getSize("default_margin").width padding: UM.Theme.getSize("default_margin").width
closePolicy: Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnPressOutsideParent
@ -160,6 +159,7 @@ Item
color: popupBackgroundColor color: popupBackgroundColor
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")
radius: UM.Theme.getSize("default_radius").width
} }
} }
} }

View File

@ -1,7 +1,7 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.7
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
@ -46,7 +46,9 @@ Cura.ExpandableComponent
ScrollView ScrollView
{ {
anchors.fill: parent width: parent.width
anchors.top: parent.top
anchors.bottom: separator.top
clip: true clip: true
Column Column
@ -80,7 +82,7 @@ Cura.ExpandableComponent
text: name text: name
width: parent.width width: parent.width
checkable: true checkable: true
onClicked: onClicked:
{ {
togglePopup() togglePopup()
@ -132,5 +134,49 @@ Cura.ExpandableComponent
} }
} }
} }
Rectangle
{
id: separator
anchors.bottom: buttonRow.top
width: parent.width
height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining")
}
Row
{
id: buttonRow
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
padding: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
Cura.ActionButton
{
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Add printer")
color: UM.Theme.getColor("secondary")
hoverColor: UM.Theme.getColor("secondary")
textColor: UM.Theme.getColor("primary")
textHoverColor: UM.Theme.getColor("text")
onClicked: Cura.Actions.addMachine.trigger()
}
Cura.ActionButton
{
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Manage printers")
color: UM.Theme.getColor("secondary")
hoverColor: UM.Theme.getColor("secondary")
textColor: UM.Theme.getColor("primary")
textHoverColor: UM.Theme.getColor("text")
onClicked: Cura.Actions.configureMachines.trigger()
}
}
} }
} }