From 2ffcf03f43e7c68a57471123a2a221be13d964d1 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 8 Oct 2018 17:35:24 +0200 Subject: [PATCH] Create an AvatarImage component that will show the profile image of the user. Still WIP. Create an AccountWidget (WIP) that shows the avatar image and the dropdown menu to manage accounts. Contributes to CURA-5784. --- resources/qml/Skeleton/ApplicationViews.qml | 2 + resources/qml/Skeleton/TopHeader.qml | 17 ++++- .../qml/Skeleton/components/AccountWidget.qml | 71 ++++++++++++++++++ .../qml/Skeleton/components/AvatarImage.qml | 42 +++++++++++ .../{ => components}/OrientationViews.qml | 0 .../themes/cura-light/icons/circle_mask.svg | 64 ++++++++++++++++ .../cura-light/images/avatar_default.png | Bin 0 -> 3115 bytes 7 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 resources/qml/Skeleton/components/AccountWidget.qml create mode 100644 resources/qml/Skeleton/components/AvatarImage.qml rename resources/qml/Skeleton/{ => components}/OrientationViews.qml (100%) create mode 100644 resources/themes/cura-light/icons/circle_mask.svg create mode 100644 resources/themes/cura-light/images/avatar_default.png diff --git a/resources/qml/Skeleton/ApplicationViews.qml b/resources/qml/Skeleton/ApplicationViews.qml index 8e0b6efc0b..25c2ff9983 100644 --- a/resources/qml/Skeleton/ApplicationViews.qml +++ b/resources/qml/Skeleton/ApplicationViews.qml @@ -9,6 +9,8 @@ import QtQuick.Layouts 1.1 import UM 1.4 as UM import Cura 1.0 as Cura +import "components" + // This item contains the views selector, a combobox that is dinamically created from // the list of available Views (packages that create different visualizactions of the // scene. Aside the selector, there is a row of buttons that change the orientation of the view. diff --git a/resources/qml/Skeleton/TopHeader.qml b/resources/qml/Skeleton/TopHeader.qml index bf92fbb41d..c2e03aa04b 100644 --- a/resources/qml/Skeleton/TopHeader.qml +++ b/resources/qml/Skeleton/TopHeader.qml @@ -4,11 +4,12 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 import UM 1.4 as UM import Cura 1.0 as Cura +import "components" + Rectangle { id: base @@ -75,10 +76,20 @@ Rectangle text: catalog.i18nc("@action:button", "Toolbox") anchors { - right: parent.right - leftMargin: UM.Theme.getSize("default_margin").width + right: accountWidget.left + rightMargin: UM.Theme.getSize("default_margin").width } style: UM.Theme.styles.topheader_tab action: Cura.Actions.browsePackages } + + AccountWidget + { + id: accountWidget + anchors + { + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } + } } diff --git a/resources/qml/Skeleton/components/AccountWidget.qml b/resources/qml/Skeleton/components/AccountWidget.qml new file mode 100644 index 0000000000..3d33aeaf27 --- /dev/null +++ b/resources/qml/Skeleton/components/AccountWidget.qml @@ -0,0 +1,71 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 + +import UM 1.4 as UM + +Item +{ + id: base + height: UM.Theme.getSize("topheader").height + width: UM.Theme.getSize("topheader").height + + AvatarImage + { + id: avatar + width: Math.round(0.8 * parent.width) + height: Math.round(0.8 * parent.height) + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + + MouseArea + { + anchors.fill: avatar + onClicked: + { + // Collapse/Expand the dropdown panel + accountManagementPanel.visible = !accountManagementPanel.visible + } + } + + UM.PointingRectangle + { + id: accountManagementPanel + + width: 250 + height: 250 + + anchors + { + top: parent.bottom + topMargin: UM.Theme.getSize("default_margin").height + right: parent.right + } + + target: Qt.point(parent.width / 2, parent.bottom) + arrowSize: UM.Theme.getSize("default_arrow").width + + visible: false + opacity: visible ? 1 : 0 + Behavior on opacity { NumberAnimation { duration: 100 } } + + color: UM.Theme.getColor("tool_panel_background") + borderColor: UM.Theme.getColor("lining") + borderWidth: UM.Theme.getSize("default_lining").width + + Loader + { + id: panel + sourceComponent: login + } + } + + Component + { + id: login + Label {text: "HOLA"} + } +} \ No newline at end of file diff --git a/resources/qml/Skeleton/components/AvatarImage.qml b/resources/qml/Skeleton/components/AvatarImage.qml new file mode 100644 index 0000000000..52e2757cbf --- /dev/null +++ b/resources/qml/Skeleton/components/AvatarImage.qml @@ -0,0 +1,42 @@ +// Copyright (c) 2018 Ultimaker B.V. +import QtQuick 2.7 +import QtQuick.Controls 2.1 +import QtGraphicalEffects 1.0 + +import UM 1.4 as UM + +Item +{ + id: avatar + + Image + { + id: profileImage + source: UM.Theme.getImage("avatar_default") + sourceSize: Qt.size(parent.width, parent.height) + width: parent.width + height: parent.height + fillMode: Image.PreserveAspectCrop + visible: false + } + + UM.RecolorImage + { + id: profileImageMask + source: UM.Theme.getIcon("circle_mask") + sourceSize: Qt.size(parent.width, parent.height) + width: parent.width + height: parent.height + color: UM.Theme.getColor("topheader_background") + visible: false + } + + OpacityMask + { + anchors.fill: profileImage + source: profileImage + maskSource: profileImageMask + cached: true + invert: false + } +} \ No newline at end of file diff --git a/resources/qml/Skeleton/OrientationViews.qml b/resources/qml/Skeleton/components/OrientationViews.qml similarity index 100% rename from resources/qml/Skeleton/OrientationViews.qml rename to resources/qml/Skeleton/components/OrientationViews.qml diff --git a/resources/themes/cura-light/icons/circle_mask.svg b/resources/themes/cura-light/icons/circle_mask.svg new file mode 100644 index 0000000000..d5bfe53a97 --- /dev/null +++ b/resources/themes/cura-light/icons/circle_mask.svg @@ -0,0 +1,64 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/cura-light/images/avatar_default.png b/resources/themes/cura-light/images/avatar_default.png new file mode 100644 index 0000000000000000000000000000000000000000..0c306680f721dba0de73fb7be90fe5c548608692 GIT binary patch literal 3115 zcmbVOX*iS%8y@?FGN>;UW^hD^kmA@)wk*+Nt%xutWD5~v3CY&j$IjT-F&O*4hwKUE z94T3j?C-quPWgQQzF+4%*LPp{bv?_E`&q8%$MgEOiQZ{;0d^P+cG^H6Z4QGmp16!K zIMa#gEfyO(2~=(y-Mu-mK<{6mcg{kT38-cisu+e!2WiFqw8CCm*DTcYfleBQa=K}W z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