From 60be55802e6c78ced9d7ac5143753a329aee709b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 26 Mar 2019 11:04:17 +0100 Subject: [PATCH] Refactor StepPanel and WelcomeDialog --- resources/qml/WelcomePages/StepPanel.qml | 76 ++++++------------- resources/qml/WelcomePages/WelcomeContent.qml | 1 - resources/qml/WelcomePages/WelcomeDialog.qml | 17 +++++ 3 files changed, 41 insertions(+), 53 deletions(-) diff --git a/resources/qml/WelcomePages/StepPanel.qml b/resources/qml/WelcomePages/StepPanel.qml index 551a01687a..182e0e7972 100644 --- a/resources/qml/WelcomePages/StepPanel.qml +++ b/resources/qml/WelcomePages/StepPanel.qml @@ -3,7 +3,6 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 -import QtGraphicalEffects 1.0 // For the dropshadow import UM 1.3 as UM import Cura 1.1 as Cura @@ -15,14 +14,8 @@ Item { id: base - anchors.fill: parent clip: true - property int roundCornerRadius: 4 - property int shadowOffset: 1 - property int stepBarHeight: 12 - property int contentMargins: 1 - property int currentStep: 0 property int totalStepCount: (model == null) ? 0 : model.count property real progressValue: (totalStepCount == 0) ? 0 : (currentStep / totalStepCount) @@ -88,57 +81,36 @@ Item base.currentStep = 0 } - // Panel background - Rectangle + Rectangle // Panel background { id: panelBackground anchors.fill: parent - anchors.margins: 2 - color: "white" // TODO - radius: base.roundCornerRadius // TODO - } + radius: UM.Theme.getSize("default_radius").width - // Drop shadow around the panel - DropShadow - { - id: shadow - radius: UM.Theme.getSize("monitor_shadow_radius").width - anchors.fill: parent - source: parent - horizontalOffset: base.shadowOffset - verticalOffset: base.shadowOffset - color: UM.Theme.getColor("monitor_shadow") - transparentBorder: true - // Should always be drawn behind the background. - z: panelBackground.z - 1 - } - - CuraProgressBar - { - id: progressBar - - value: base.progressValue - - anchors + CuraProgressBar { - left: panelBackground.left - right: panelBackground.right - top: panelBackground.top - } - height: base.stepBarHeight - } + id: progressBar + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right - Loader - { - id: contentLoader - anchors - { - margins: base.contentMargins - top: progressBar.bottom - bottom: parent.bottom - left: parent.left - right: parent.right + height: UM.Theme.getSize("progressbar").height + + value: base.progressValue + } + + Loader + { + id: contentLoader + anchors + { + margins: base.contentMargins + top: progressBar.bottom + bottom: parent.bottom + left: parent.left + right: parent.right + } + source: base.currentItem.page_url } - source: base.currentItem.page_url } } diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index 2fde182c4c..770097d3a9 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -54,7 +54,6 @@ Item Cura.PrimaryButton { id: getStartedButton - anchors.top: contentArea.bottom anchors.horizontalCenter: parent.horizontalCenter anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width text: catalog.i18nc("@button", "Get started") diff --git a/resources/qml/WelcomePages/WelcomeDialog.qml b/resources/qml/WelcomePages/WelcomeDialog.qml index 626b6b6877..00849ca037 100644 --- a/resources/qml/WelcomePages/WelcomeDialog.qml +++ b/resources/qml/WelcomePages/WelcomeDialog.qml @@ -4,6 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Window 2.2 +import QtGraphicalEffects 1.0 // For the DropShadow import UM 1.3 as UM import Cura 1.1 as Cura @@ -21,15 +22,31 @@ Window height: 600 // TODO color: "transparent" + property int shadowOffset: 1 * screenScaleFactor + property alias currentStep: stepPanel.currentStep StepPanel { id: stepPanel + anchors.fill: parent currentStep: 0 model: CuraApplication.getWelcomePagesModel() } + // Drop shadow around the panel + DropShadow + { + id: shadow + radius: UM.Theme.getSize("monitor_shadow_radius").width + anchors.fill: stepPanel + source: stepPanel + horizontalOffset: shadowOffset + verticalOffset: shadowOffset + color: UM.Theme.getColor("monitor_shadow") + transparentBorder: true + } + // Close this dialog when there's no more page to show Connections {