Browse Source

Fix merge conflicts

Lipu Fei 6 years ago
parent
commit
af9f9fc857

+ 2 - 0
cura/UI/WelcomePagesModel.py

@@ -76,6 +76,7 @@ class WelcomePagesModel(ListModel):
         if next_page_index == len(self._items):
             self.allFinished.emit()
             self.resetState()
+            return
 
         # Move to the next page
         self._setCurrentPageIndex(next_page_index)
@@ -152,6 +153,7 @@ class WelcomePagesModel(ListModel):
                             })
         self._pages.append({"id": "machine_actions",
                             "page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"),
+                            "next_page_id": "cloud",
                             })
         self._pages.append({"id": "cloud",
                             "page_url": self._getBuiltinWelcomePagePath("CloudContent.qml"),

+ 2 - 2
resources/qml/Cura.qml

@@ -76,11 +76,11 @@ UM.MainWindow
 
         if (CuraApplication.needToShowUserAgreement)
         {
-            welcomeDialog.visible = true;
+            welcomeDialog.show()
         }
         else
         {
-            welcomeDialog.visible = false;
+            welcomeDialog.close()
         }
         // TODO: While the new onboarding process contains the user-agreement,
         //       it should probably not entirely rely on 'needToShowUserAgreement' for show/hide.

+ 0 - 102
resources/qml/WelcomePages/StepPanel.qml

@@ -1,102 +0,0 @@
-// 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 UM 1.3 as UM
-import Cura 1.1 as Cura
-
-
-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 var currentItem: (model == null) ? null : model.getItem(model.currentPageIndex)
-    property var model: null
-
-    property var progressValue: model == null ? 0 : model.currentProgress
-    property string pageUrl: currentItem == null ? null : currentItem.page_url
-
-    signal showNextPage()
-    signal showPreviousPage()
-    signal goToPage(string page_id)  // Go to a specific page by the given page_id.
-
-    // Call the corresponding functions in the model
-    onShowNextPage: model.goToNextPage()
-    onShowPreviousPage: model.goToPreviousPage()
-    onGoToPage: model.goToPage(page_id)
-
-    onVisibleChanged:
-    {
-        if (visible)
-        {
-            model.resetState()
-        }
-    }
-
-    onModelChanged: model.resetState()
-
-    // Panel background
-    Rectangle
-    {
-        id: panelBackground
-        anchors.fill: parent
-        anchors.margins: 2
-        color: "white"  // TODO
-        radius: base.roundCornerRadius  // TODO
-    }
-
-    // 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
-    }
-
-    Cura.ProgressBar
-    {
-        id: progressBar
-
-        value: base.progressValue
-
-        anchors
-        {
-            left: panelBackground.left
-            right: panelBackground.right
-            top: panelBackground.top
-        }
-        height: base.stepBarHeight
-    }
-
-    Loader
-    {
-        id: contentLoader
-        anchors
-        {
-            margins: base.contentMargins
-            top: progressBar.bottom
-            bottom: parent.bottom
-            left: parent.left
-            right: parent.right
-        }
-        source: base.pageUrl
-    }
-}

+ 27 - 2
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
@@ -14,9 +15,9 @@ import Cura 1.1 as Cura
 //
 Window
 {
-    id: dialog
     UM.I18nCatalog { id: catalog; name: "cura" }
 
+    id: dialog
     title: catalog.i18nc("@title", "Welcome to Ultimaker Cura")
     modality: Qt.ApplicationModal
     flags: Qt.Window | Qt.FramelessWindowHint
@@ -25,14 +26,38 @@ Window
     height: 600  // TODO
     color: "transparent"
 
+    property int shadowOffset: 1 * screenScaleFactor
+
     property var model: CuraApplication.getWelcomePagesModel()
 
-    StepPanel
+    onVisibleChanged:
+    {
+        if (visible)
+        {
+            model.resetState()
+        }
+    }
+
+    WizardPanel
     {
         id: stepPanel
+        anchors.fill: parent
         model: dialog.model
     }
 
+    // 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
     {

+ 69 - 0
resources/qml/WelcomePages/WizardPanel.qml

@@ -0,0 +1,69 @@
+// 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 item is a wizard panel that contains a progress bar at the top and a content area that's beneath the progress
+// bar.
+//
+Item
+{
+    id: base
+
+    clip: true
+
+    property var currentItem: (model == null) ? null : model.getItem(model.currentPageIndex)
+    property var model: null
+
+    // Convenience properties
+    property var progressValue: model == null ? 0 : model.currentProgress
+    property string pageUrl: currentItem == null ? "" : currentItem.page_url
+
+    signal showNextPage()
+    signal showPreviousPage()
+    signal goToPage(string page_id)  // Go to a specific page by the given page_id.
+
+    // Call the corresponding functions in the model
+    onShowNextPage: model.goToNextPage()
+    onShowPreviousPage: model.goToPreviousPage()
+    onGoToPage: model.goToPage(page_id)
+
+    Rectangle  // Panel background
+    {
+        id: panelBackground
+        anchors.fill: parent
+        radius: UM.Theme.getSize("default_radius").width
+
+        Cura.ProgressBar
+        {
+            id: progressBar
+            anchors.top: parent.top
+            anchors.left: parent.left
+            anchors.right: parent.right
+
+            height: UM.Theme.getSize("progressbar").height
+
+            value: base.progressValue
+        }
+
+        Loader
+        {
+            id: contentLoader
+            anchors
+            {
+                margins: UM.Theme.getSize("default_margin").width
+                top: progressBar.bottom
+                bottom: parent.bottom
+                left: parent.left
+                right: parent.right
+            }
+            source: base.pageUrl
+        }
+    }
+}