Просмотр исходного кода

Cleaned up the QML

This moves all the "default" margins of the welcome pages into a single point (the WizardPanel)
in order to prevent having to re-define it every time.
I've also fixed some incorrect margins that we had

CURA-6057
Jaime van Kessel 6 лет назад
Родитель
Сommit
74903fe3e5

+ 0 - 2
resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml

@@ -19,7 +19,6 @@ Item
     {
         id: titleLabel
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "Add a printer")
@@ -110,7 +109,6 @@ Item
         id: nextButton
         anchors.right: parent.right
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         enabled:
         {
             // If the network printer dropdown is expanded, make sure that there is a selected item

+ 10 - 9
resources/qml/WelcomePages/CloudContent.qml

@@ -31,7 +31,6 @@ Item
     {
         id: titleLabel
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "Ultimaker Cloud")
@@ -44,11 +43,15 @@ Item
     Item
     {
         id: cloudContentsArea
-        anchors.top: titleLabel.bottom
-        anchors.bottom: finishButton.top
-        anchors.left: parent.left
-        anchors.right: parent.right
-        anchors.margins: UM.Theme.getSize("default_margin").width
+        anchors
+        {
+            top: titleLabel.bottom
+            bottom: finishButton.top
+            left: parent.left
+            right: parent.right
+            topMargin: UM.Theme.getSize("default_margin").height
+        }
+
 
         // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in
         // the cloud contents area.
@@ -113,7 +116,6 @@ Item
         id: finishButton
         anchors.right: parent.right
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Finish")
         onClicked: base.showNextPage()
     }
@@ -123,7 +125,6 @@ Item
         id: createAccountButton
         anchors.left: parent.left
         anchors.verticalCenter: finishButton.verticalCenter
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Create an account")
         onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
     }
@@ -133,7 +134,7 @@ Item
         id: signInButton
         anchors.left: createAccountButton.right
         anchors.verticalCenter: finishButton.verticalCenter
-        anchors.margins: UM.Theme.getSize("wide_margin").width
+        anchors.leftMargin: UM.Theme.getSize("default_margin").width
         text: catalog.i18nc("@button", "Sign in")
         color: UM.Theme.getColor("secondary_button_text")
         font: UM.Theme.getFont("medium")

+ 9 - 7
resources/qml/WelcomePages/DataCollectionsContent.qml

@@ -19,7 +19,6 @@ Item
     {
         id: titleLabel
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "Help us to improve Ultimaker Cura")
@@ -32,11 +31,15 @@ Item
     Item
     {
         id: contentsArea
-        anchors.top: titleLabel.bottom
-        anchors.bottom: getStartedButton.top
-        anchors.left: parent.left
-        anchors.right: parent.right
-        anchors.margins: UM.Theme.getSize("wide_margin").width
+
+        anchors
+        {
+            top: titleLabel.bottom
+            bottom: getStartedButton.top
+            left: parent.left
+            right: parent.right
+            topMargin: UM.Theme.getSize("default_margin").width
+        }
 
         Column
         {
@@ -87,7 +90,6 @@ Item
         id: getStartedButton
         anchors.right: parent.right
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Next")
         onClicked: base.showNextPage()
     }

+ 7 - 7
resources/qml/WelcomePages/FirstStartMachineActionsContent.qml

@@ -40,7 +40,6 @@ Item
     {
         id: titleLabel
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         text: machineActionsModel.currentItem.title == undefined ? "" : machineActionsModel.currentItem.title
@@ -51,11 +50,13 @@ Item
 
     Item
     {
-        anchors.top: titleLabel.bottom
-        anchors.bottom: nextButton.top
-        anchors.margins: UM.Theme.getSize("default_margin").width
-        anchors.left: parent.left
-        anchors.right: parent.right
+        anchors
+        {
+            top: titleLabel.bottom
+            bottom: nextButton.top
+            left: parent.left
+            right: parent.right
+        }
 
         data: machineActionsModel.currentItem.content == undefined ? emptyItem : machineActionsModel.currentItem.content
     }
@@ -71,7 +72,6 @@ Item
         id: nextButton
         anchors.right: parent.right
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Next")
         onClicked: machineActionsModel.goToNextAction()
     }

+ 16 - 25
resources/qml/WelcomePages/UserAgreementContent.qml

@@ -18,7 +18,6 @@ Item
     {
         id: titleLabel
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "User Agreement")
@@ -27,31 +26,25 @@ Item
         renderType: Text.NativeRendering
     }
 
-    Item  // Area for pictures and texts
+    Label
     {
-        anchors.top: titleLabel.bottom
-        anchors.bottom: agreeButton.top
-        anchors.left: parent.left
-        anchors.right: parent.right
-        anchors.margins: UM.Theme.getSize("wide_margin").width
-
-        Label
+        id: disclaimerLineLabel
+        anchors
         {
-            id: disclaimerLineLabel
-            anchors.centerIn: parent
-            anchors.margins: UM.Theme.getSize("wide_margin").width
-
-            width: (parent.width * 2 / 3) | 0
-
-            text: "<p><b>Disclaimer by Ultimaker</b></p>"
-                + "<p>Please read this disclaimer carefully.</p>"
-                + "<p>Except when otherwise stated in writing, Ultimaker provides any Ultimaker software or third party software \"As is\" without warranty of any kind. The entire risk as to the quality and perfoemance of Ultimaker software is with you.</p>"
-                + "<p>Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.</p>"
-            textFormat: Text.RichText
-            wrapMode: Text.WordWrap
-            font: UM.Theme.getFont("default")
-            renderType: Text.NativeRendering
+            top: titleLabel.bottom
+            topMargin: UM.Theme.getSize("wide_margin").height
+            left: parent.left
+            right: parent.right
         }
+
+        text: "<p><b>Disclaimer by Ultimaker</b></p>"
+            + "<p>Please read this disclaimer carefully.</p>"
+            + "<p>Except when otherwise stated in writing, Ultimaker provides any Ultimaker software or third party software \"As is\" without warranty of any kind. The entire risk as to the quality and perfoemance of Ultimaker software is with you.</p>"
+            + "<p>Unless required by applicable law or agreed to in writing, in no event will Ultimaker be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use any Ultimaker software or third party software.</p>"
+        textFormat: Text.RichText
+        wrapMode: Text.WordWrap
+        font: UM.Theme.getFont("default")
+        renderType: Text.NativeRendering
     }
 
     Cura.PrimaryButton
@@ -59,7 +52,6 @@ Item
         id: agreeButton
         anchors.right: parent.right
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Agree")
         onClicked:
         {
@@ -74,7 +66,6 @@ Item
         id: declineButton
         anchors.left: parent.left
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Decline and close")
         onClicked:
         {

+ 0 - 2
resources/qml/WelcomePages/WelcomeContent.qml

@@ -15,8 +15,6 @@ Item
 {
     UM.I18nCatalog { id: catalog; name: "cura" }
 
-    anchors.margins: UM.Theme.getSize("wide_margin").width
-
     Column  // Arrange the items vertically and put everything in the center
     {
         anchors.centerIn: parent

+ 2 - 4
resources/qml/WelcomePages/WhatsNewContent.qml

@@ -19,7 +19,6 @@ Item
     {
         id: titleLabel
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "What's new in Ultimaker Cura")
@@ -34,8 +33,8 @@ Item
         anchors.bottom: getStartedButton.top
         anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.bottomMargin: UM.Theme.getSize("wide_margin").height
-        anchors.horizontalCenter: parent.horizontalCenter
-        width: (parent.width * 3 / 4) | 0
+        anchors.left: parent.left
+        anchors.right: parent.right
 
         border.color: "#dfdfdf"
         border.width: UM.Theme.getSize("default_lining").width
@@ -65,7 +64,6 @@ Item
         id: getStartedButton
         anchors.right: parent.right
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Next")
         onClicked: base.showNextPage()
     }

+ 2 - 1
resources/qml/WelcomePages/WizardPanel.qml

@@ -61,7 +61,8 @@ Item
             id: contentLoader
             anchors
             {
-                margins: UM.Theme.getSize("default_margin").width
+                margins: UM.Theme.getSize("wide_margin").width
+                bottomMargin: UM.Theme.getSize("default_margin").width
                 top: progressBar.bottom
                 bottom: parent.bottom
                 left: parent.left