Added DropShadow to the printer & printjob tiles

CL-893 && CL-894
This commit is contained in:
Jaime van Kessel 2018-08-23 15:53:32 +02:00
parent 5176ead0e2
commit b0d9dc6fdd
2 changed files with 43 additions and 11 deletions

View file

@ -1,12 +1,13 @@
import QtQuick 2.2 import QtQuick 2.3
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.3 import QtQuick.Controls.Styles 1.3
import QtGraphicalEffects 1.0
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Component Component
{ {
Rectangle Rectangle
@ -57,15 +58,25 @@ Component
{ {
anchors.fill: parent anchors.fill: parent
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
displayMarginBeginning: 2
model: OutputDevice.printers model: OutputDevice.printers
delegate: Rectangle delegate: Rectangle
{ {
width: parent.width width: parent.width - 2 * shadowRadius
height: childrenRect.height + UM.Theme.getSize("default_margin").height height: childrenRect.height + UM.Theme.getSize("default_margin").height
anchors.horizontalCenter: parent.horizontalCenter
id: base id: base
property var shadowRadius: 5
property var collapsed: true property var collapsed: true
layer.enabled: true
layer.effect: DropShadow
{
radius: base.shadowRadius
verticalOffset: 2
color: "#3F000000" // 25% shadow
}
Item Item
{ {
id: printerInfo id: printerInfo
@ -136,11 +147,13 @@ Component
{ {
id: detailedInfo id: detailedInfo
property var printJob: modelData.activePrintJob property var printJob: modelData.activePrintJob
visible: !base.collapsed visible: height == childrenRect.height
anchors.top: printerInfo.bottom anchors.top: printerInfo.bottom
width: parent.width width: parent.width
height: visible ? childrenRect.height : 0 height: !base.collapsed ? childrenRect.height : 0
opacity: visible ? 1 : 0
Behavior on height { NumberAnimation { duration: 100 } }
Behavior on opacity { NumberAnimation { duration: 50 } }
Rectangle Rectangle
{ {
id: topSpacer id: topSpacer

View file

@ -1,15 +1,16 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import UM 1.3 as UM import UM 1.3 as UM
Item Item
{ {
id: base
property var printJob: null property var printJob: null
property var shadowRadius: 5
function getPrettyTime(time) function getPrettyTime(time)
{ {
return OutputDevice.formatDuration(time) return OutputDevice.formatDuration(time)
@ -24,7 +25,25 @@ Item
Rectangle Rectangle
{ {
id: background id: background
anchors.fill: parent anchors
{
top: parent.top
topMargin: 3
left: parent.left
leftMargin: base.shadowRadius
rightMargin: base.shadowRadius
right: parent.right
bottom: parent.bottom
bottomMargin: base.shadowRadius
}
layer.enabled: true
layer.effect: DropShadow
{
radius: base.shadowRadius
verticalOffset: 2
color: "#3F000000" // 25% shadow
}
Item Item
{ {