mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 20:29:05 +08:00
Refactor StepPanel and WelcomeDialog
This commit is contained in:
parent
705cdedf0b
commit
60be55802e
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import QtQuick 2.10
|
import QtQuick 2.10
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtGraphicalEffects 1.0 // For the dropshadow
|
|
||||||
|
|
||||||
import UM 1.3 as UM
|
import UM 1.3 as UM
|
||||||
import Cura 1.1 as Cura
|
import Cura 1.1 as Cura
|
||||||
@ -15,14 +14,8 @@ Item
|
|||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
property int roundCornerRadius: 4
|
|
||||||
property int shadowOffset: 1
|
|
||||||
property int stepBarHeight: 12
|
|
||||||
property int contentMargins: 1
|
|
||||||
|
|
||||||
property int currentStep: 0
|
property int currentStep: 0
|
||||||
property int totalStepCount: (model == null) ? 0 : model.count
|
property int totalStepCount: (model == null) ? 0 : model.count
|
||||||
property real progressValue: (totalStepCount == 0) ? 0 : (currentStep / totalStepCount)
|
property real progressValue: (totalStepCount == 0) ? 0 : (currentStep / totalStepCount)
|
||||||
@ -88,57 +81,36 @@ Item
|
|||||||
base.currentStep = 0
|
base.currentStep = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Panel background
|
Rectangle // Panel background
|
||||||
Rectangle
|
|
||||||
{
|
{
|
||||||
id: panelBackground
|
id: panelBackground
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 2
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
color: "white" // TODO
|
|
||||||
radius: base.roundCornerRadius // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop shadow around the panel
|
CuraProgressBar
|
||||||
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
|
|
||||||
{
|
{
|
||||||
left: panelBackground.left
|
id: progressBar
|
||||||
right: panelBackground.right
|
anchors.top: parent.top
|
||||||
top: panelBackground.top
|
anchors.left: parent.left
|
||||||
}
|
anchors.right: parent.right
|
||||||
height: base.stepBarHeight
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader
|
height: UM.Theme.getSize("progressbar").height
|
||||||
{
|
|
||||||
id: contentLoader
|
value: base.progressValue
|
||||||
anchors
|
}
|
||||||
{
|
|
||||||
margins: base.contentMargins
|
Loader
|
||||||
top: progressBar.bottom
|
{
|
||||||
bottom: parent.bottom
|
id: contentLoader
|
||||||
left: parent.left
|
anchors
|
||||||
right: parent.right
|
{
|
||||||
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,6 @@ Item
|
|||||||
Cura.PrimaryButton
|
Cura.PrimaryButton
|
||||||
{
|
{
|
||||||
id: getStartedButton
|
id: getStartedButton
|
||||||
anchors.top: contentArea.bottom
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
|
anchors.margins: UM.Theme.getSize("welcome_pages_default_margin").width
|
||||||
text: catalog.i18nc("@button", "Get started")
|
text: catalog.i18nc("@button", "Get started")
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import QtQuick 2.10
|
import QtQuick 2.10
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
|
import QtGraphicalEffects 1.0 // For the DropShadow
|
||||||
|
|
||||||
import UM 1.3 as UM
|
import UM 1.3 as UM
|
||||||
import Cura 1.1 as Cura
|
import Cura 1.1 as Cura
|
||||||
@ -21,15 +22,31 @@ Window
|
|||||||
height: 600 // TODO
|
height: 600 // TODO
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
|
property int shadowOffset: 1 * screenScaleFactor
|
||||||
|
|
||||||
property alias currentStep: stepPanel.currentStep
|
property alias currentStep: stepPanel.currentStep
|
||||||
|
|
||||||
StepPanel
|
StepPanel
|
||||||
{
|
{
|
||||||
id: stepPanel
|
id: stepPanel
|
||||||
|
anchors.fill: parent
|
||||||
currentStep: 0
|
currentStep: 0
|
||||||
model: CuraApplication.getWelcomePagesModel()
|
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
|
// Close this dialog when there's no more page to show
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user