Browse Source

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 years ago
parent
commit
74903fe3e5

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

@@ -19,7 +19,6 @@ Item
     {
     {
         id: titleLabel
         id: titleLabel
         anchors.top: parent.top
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "Add a printer")
         text: catalog.i18nc("@label", "Add a printer")
@@ -110,7 +109,6 @@ Item
         id: nextButton
         id: nextButton
         anchors.right: parent.right
         anchors.right: parent.right
         anchors.bottom: parent.bottom
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         enabled:
         enabled:
         {
         {
             // If the network printer dropdown is expanded, make sure that there is a selected item
             // 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
         id: titleLabel
         anchors.top: parent.top
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "Ultimaker Cloud")
         text: catalog.i18nc("@label", "Ultimaker Cloud")
@@ -44,11 +43,15 @@ Item
     Item
     Item
     {
     {
         id: cloudContentsArea
         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
         // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in
         // the cloud contents area.
         // the cloud contents area.
@@ -113,7 +116,6 @@ Item
         id: finishButton
         id: finishButton
         anchors.right: parent.right
         anchors.right: parent.right
         anchors.bottom: parent.bottom
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Finish")
         text: catalog.i18nc("@button", "Finish")
         onClicked: base.showNextPage()
         onClicked: base.showNextPage()
     }
     }
@@ -123,7 +125,6 @@ Item
         id: createAccountButton
         id: createAccountButton
         anchors.left: parent.left
         anchors.left: parent.left
         anchors.verticalCenter: finishButton.verticalCenter
         anchors.verticalCenter: finishButton.verticalCenter
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Create an account")
         text: catalog.i18nc("@button", "Create an account")
         onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
         onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
     }
     }
@@ -133,7 +134,7 @@ Item
         id: signInButton
         id: signInButton
         anchors.left: createAccountButton.right
         anchors.left: createAccountButton.right
         anchors.verticalCenter: finishButton.verticalCenter
         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")
         text: catalog.i18nc("@button", "Sign in")
         color: UM.Theme.getColor("secondary_button_text")
         color: UM.Theme.getColor("secondary_button_text")
         font: UM.Theme.getFont("medium")
         font: UM.Theme.getFont("medium")

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

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

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

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

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

@@ -18,7 +18,6 @@ Item
     {
     {
         id: titleLabel
         id: titleLabel
         anchors.top: parent.top
         anchors.top: parent.top
-        anchors.topMargin: UM.Theme.getSize("wide_margin").height
         anchors.horizontalCenter: parent.horizontalCenter
         anchors.horizontalCenter: parent.horizontalCenter
         horizontalAlignment: Text.AlignHCenter
         horizontalAlignment: Text.AlignHCenter
         text: catalog.i18nc("@label", "User Agreement")
         text: catalog.i18nc("@label", "User Agreement")
@@ -27,31 +26,25 @@ Item
         renderType: Text.NativeRendering
         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
     Cura.PrimaryButton
@@ -59,7 +52,6 @@ Item
         id: agreeButton
         id: agreeButton
         anchors.right: parent.right
         anchors.right: parent.right
         anchors.bottom: parent.bottom
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Agree")
         text: catalog.i18nc("@button", "Agree")
         onClicked:
         onClicked:
         {
         {
@@ -74,7 +66,6 @@ Item
         id: declineButton
         id: declineButton
         anchors.left: parent.left
         anchors.left: parent.left
         anchors.bottom: parent.bottom
         anchors.bottom: parent.bottom
-        anchors.margins: UM.Theme.getSize("wide_margin").width
         text: catalog.i18nc("@button", "Decline and close")
         text: catalog.i18nc("@button", "Decline and close")
         onClicked:
         onClicked:
         {
         {

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

@@ -15,8 +15,6 @@ Item
 {
 {
     UM.I18nCatalog { id: catalog; name: "cura" }
     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
     Column  // Arrange the items vertically and put everything in the center
     {
     {
         anchors.centerIn: parent
         anchors.centerIn: parent

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

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

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

@@ -61,7 +61,8 @@ Item
             id: contentLoader
             id: contentLoader
             anchors
             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
                 top: progressBar.bottom
                 bottom: parent.bottom
                 bottom: parent.bottom
                 left: parent.left
                 left: parent.left