WIP: Add base QMLs for WelcomeDialog

This commit is contained in:
Lipu Fei 2019-02-27 11:50:14 +01:00
parent 889bc8a529
commit 3b63f92d55
9 changed files with 380 additions and 2 deletions

View file

@ -0,0 +1,34 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
Item
{
id: base
property int totalSteps: 10
property int currentStep: 6
property int radius: 2
Rectangle
{
id: background
anchors.fill: parent
color: "#f0f0f0"
radius: base.radius
}
Rectangle
{
id: progress
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: (currentStep * 1.0 / totalSteps) * background.width
color: "#3282ff"
radius: base.radius
}
}

View file

@ -0,0 +1,105 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0 // For the dropshadow
import Cura 1.1 as Cura
Item
{
id: base
anchors.fill: parent
clip: true
property int roundCornerRadius: 4
property int shadowOffset: 2
property int stepBarHeight: 12
property int contentMargins: 4
property int totalSteps: 0
property int currentStep: -1
property var currentItem: null
property var model: null
onVisibleChanged:
{
if (visible)
{
base.currentStep = 0
base.currentItem = base.model.getItem(base.currentStep)
}
}
onCurrentStepChanged:
{
base.currentItem = base.model.getItem(base.currentStep)
}
onModelChanged:
{
base.totalSteps = base.model.count
base.currentStep = 0
base.currentItem = base.model.getItem(base.currentStep)
}
// Panel background
Rectangle
{
id: panelBackground
anchors.fill: parent
anchors.margins: 10
color: "white" // TODO
radius: base.roundCornerRadius // TODO
}
// Drop shadow around the panel
DropShadow
{
id: shadow
// Don't blur the shadow
radius: base.roundCornerRadius + 2
anchors.fill: parent
source: parent
horizontalOffset: base.shadowOffset
verticalOffset: base.shadowOffset
visible: true
color: UM.Theme.getColor("action_button_shadow")
// Should always be drawn behind the background.
z: panelBackground.z - 1
}
StepIndicatorBar
{
id: stepIndicatorBar
//anchors.margins: 10
totalSteps: base.totalSteps
currentStep: base.currentStep
radius: base.roundCornerRadius
anchors
{
left: panelBackground.left
right: panelBackground.right
top: panelBackground.top
}
height: base.stepBarHeight
}
Loader
{
id: contentLoader
anchors
{
margins: base.contentMargins
top: stepIndicatorBar.bottom
bottom: parent.bottom
left: parent.left
right: parent.right
}
source: base.currentItem.page_url
}
}

View file

@ -0,0 +1,41 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
Component
{
Column
{
spacing: 20
Label
{
id: titleLabel
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: "User Agreement" // TODO
color: "blue" // TODO
//font:
renderType: NativeRendering
}
Image {
id: curaImage
anchors.horizontalCenter: parent.horizontalCenter
source: "TODO"
}
Label
{
id: textLabel
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: "Please fllow these steps to set up\nUltimaker Cura. This will only take a few moments."
//font:
renderType: NativeRendering
}
}
}

View file

@ -0,0 +1,65 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.3 as UM
import Cura 1.1 as Cura
//
// This component contains the content for the first page of the welcome on-boarding process.
//
Column
{
UM.I18nCatalog { id: catalog; name: "cura" }
spacing: 60
// Placeholder
Label { text: " " }
Label
{
id: titleLabel
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@label", "Welcome to Ultimaker Cura")
color: UM.Theme.getColor("primary_button")
font: UM.Theme.getFont("large_bold")
renderType: Text.NativeRendering
}
Column
{
anchors.horizontalCenter: parent.horizontalCenter
spacing: 40
Image
{
id: curaImage
anchors.horizontalCenter: parent.horizontalCenter
source: UM.Theme.getImage("first_run_welcome_cura")
}
Label
{
id: textLabel
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@text", "Please follow these steps to set up\nUltimaker Cura. This will only take a few moments.")
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
}
}
Cura.PrimaryButton
{
id: getStartedButton
anchors.horizontalCenter: parent.horizontalCenter
text: catalog.i18nc("@button", "Get started")
width: 140
fixedWidthMode: true
}
}

View file

@ -0,0 +1,30 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Window 2.2
import UM 1.3 as UM
import Cura 1.1 as Cura
Window
{
UM.I18nCatalog { id: catalog; name: "cura" }
title: catalog.i18nc("@title", "Welcome to Ultimaker Cura")
modality: Qt.ApplicationModal
flags: Qt.Window | Qt.FramelessWindowHint
width: 580 // TODO
height: 600 // TODO
color: "transparent"
StepPanel
{
id: stepPanel
currentStep: 0
model: CuraApplication.getWelcomePagesModel()
}
}